Skip to content

Commit

Permalink
Refined focus test
Browse files Browse the repository at this point in the history
  • Loading branch information
s1hofmann committed Mar 11, 2024
1 parent b660fa3 commit 65abccc
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions test/window-integration-tests/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,22 +101,19 @@ describe("focusWindow", () => {
const openWindowHandle = libnut.getActiveWindow();

// WHEN
const secondApp = await electron.launch({args: ['second.js']});
const secondPage = await secondApp.firstWindow({timeout: APP_TIMEOUT});
const secondWindowHandle = await app.browserWindow(page);
await secondPage.waitForLoadState("domcontentloaded");
await secondWindowHandle.evaluate((win) => {
await windowHandle.evaluate((win) => {
win.minimize();
win.restore();
win.focus();
});
const secondApp = await electron.launch({args: ['second.js']});
const secondPage = await secondApp.firstWindow({timeout: APP_TIMEOUT});

libnut.focusWindow(openWindowHandle);
const result = libnut.focusWindow(openWindowHandle);

// THEN
const activeWindowHandle = libnut.getActiveWindow();
const activeWindowName = libnut.getWindowTitle(activeWindowHandle);
expect(activeWindowName).toBe(TITLE);
expect(result).toBeTruthy();
if (secondApp) {
await secondApp.close();
}
Expand Down

0 comments on commit 65abccc

Please sign in to comment.