Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
test: unflake browser._launchServer tests (#37063)
Simon Knottf15285fe5106
diff --git a/tests/library/debug-controller.spec.ts b/tests/library/debug-controller.spec.tsindex b635f80ddd..1554df72cf 100644--- a/tests/library/debug-controller.spec.ts+++ b/tests/library/debug-controller.spec.ts@@ -361,7 +361,8 @@ test('should report error in aria template', async ({ backend }) => {expect(error.message).toContain('Unterminated string:');});-test('should work with browser._launchServer', async ({ browser }) => {+test('should work with browser._launchServer', async ({ browserType }) => {+ const browser = await browserType.launch();const server = await (browser as any)._launchServer({ _debugController: true });const backend = new Backend();@@ -375,10 +376,15 @@ test('should work with browser._launchServer', async ({ browser }) => {const page = await browser.newPage();await page.close();- expect(pageCounts).toEqual([1, 0]);+ // this test shares an instance of Playwright with other tests, so we can't assert on the precise number of pages+ expect(pageCounts.length).toBeGreaterThanOrEqual(2);++ await server.close();+ await browser.close();});-test('should not work with browser._launchServer(_debugController: false)', async ({ browser }) => {+test('should not work with browser._launchServer(_debugController: false)', async ({ browserType }) => {+ const browser = await browserType.launch();const server = await (browser as any)._launchServer({ _debugController: false });const backend = new Backend();@@ -388,4 +394,7 @@ test('should not work with browser._launchServer(_debugController: false)', asynawait backend.connect(connectionString.toString());await backend.initialize();}).rejects.toThrow();++ await server.close();+ await browser.close();});