test: navigator.storage.getDirectory() across browsers (#18305)

This commit is contained in:
Yury Semikhatsky 2022-10-26 15:41:36 -07:00 committed by GitHub
parent eb1c92630e
commit 12fdd3336e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -140,3 +140,21 @@ it('should not crash on showDirectoryPicker', async ({ page, server, browserName
new 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();
}
});