Skip to content

Commit

Permalink
[Test] Add test on window close (#696)
Browse files Browse the repository at this point in the history
* test playwright window close

* refactor

* remove describe

* verify if test fails prior to change

* verify if test fails prior to change

* revert debug change
  • Loading branch information
christian-byrne authored Jan 24, 2025
1 parent 5061d46 commit a05aaf0
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { type Locator, expect, test } from '@playwright/test';
import { chromium } from '@playwright/test';
import { type Locator, chromium, expect, test } from '@playwright/test';

test('has title', async () => {
const browser = await chromium.connectOverCDP('http://127.0.0.1:9000');
Expand Down Expand Up @@ -56,3 +55,14 @@ test('has title', async () => {
await button.click();
}
});

test('app quits when window is closed', async () => {
const browser = await chromium.connectOverCDP('http://127.0.0.1:9000');
const context = browser.contexts()[0];
const page = context.pages()[0];

await page.close();
await new Promise((resolve) => setTimeout(resolve, 3000));

expect(browser.isConnected()).toBeFalsy();
});

0 comments on commit a05aaf0

Please sign in to comment.