Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

test: enable showDirectoryPicker test (#11669)

Yury Semikhatsky81a7b2488fde
diff --git a/tests/capabilities.spec.ts b/tests/capabilities.spec.ts
index 4a743fdb26..db7ba53f85 100644
--- a/tests/capabilities.spec.ts
+++ b/tests/capabilities.spec.ts
@@ -124,13 +124,18 @@ it('should not crash on page with mp4 #smoke', async ({ page, server, platform,
await page.waitForTimeout(1000);
});
-it('should not crash on showDirectoryPicker', async ({ page, server, platform, browserName }) => {
+it('should not crash on showDirectoryPicker', async ({ page, server, browserName, browserMajorVersion }) => {
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/7339' });
- it.fixme(browserName === 'chromium', 'https://github.com/microsoft/playwright/issues/7339, crashes');
+ it.skip(browserName === 'chromium' && browserMajorVersion < 99, 'Fixed in Chromium r956769');
it.skip(browserName !== 'chromium', 'showDirectoryPicker is only available in Chromium');
await page.goto(server.EMPTY_PAGE);
- await page.evaluate(async () => {
- const dir = await (window as any).showDirectoryPicker();
- return dir.name;
- });
+ await Promise.race([
+ page.evaluate(async () => {
+ const dir = await (window as any).showDirectoryPicker();
+ return dir.name;
+ }).catch(e => expect(e.message).toContain('DOMException: The user aborted a request')),
+ // The dialog will not be accepted, so we just wait for some time to
+ // to give the browser a chance to crash.
+ new Promise(r => setTimeout(r, 1000))
+ ]);
});