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: navigator.storage.getDirectory() across browsers (#18305)
Yury Semikhatsky12fdd3336e62
diff --git a/tests/library/capabilities.spec.ts b/tests/library/capabilities.spec.tsindex 9e934cf460..a6c48d3dd2 100644--- a/tests/library/capabilities.spec.ts+++ b/tests/library/capabilities.spec.ts@@ -140,3 +140,21 @@ it('should not crash on showDirectoryPicker', async ({ page, server, browserNamenew Promise(r => setTimeout(r, 1000))]);});++it('should not crash on storage.getDirectory()', async ({ page, server, browserName, isMac }) => {+ it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/18235' });+ it.skip(browserName === 'firefox', 'navigator.storage.getDirectory is not a function');+ await page.goto(server.EMPTY_PAGE);+ const error = await page.evaluate(async () => {+ const dir = await navigator.storage.getDirectory();+ return dir.name;+ }).catch(e => e);+ if (browserName === 'webkit') {+ if (isMac)+ expect(error.message).toContain('UnknownError: The operation failed for an unknown transient reason');+ else+ expect(error.message).toContain('TypeError: undefined is not an object');+ } else {+ expect(error).toBeFalsy();+ }+});