Skip to content

Commit

Permalink
test(permissions): add chromium test for clipboard permissions (micro…
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelfeldman committed Apr 28, 2020
1 parent d52bd92 commit 9641e01
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion test/permissions.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ describe.skip(WEBKIT)('Permissions', function() {
await context.clearPermissions();
expect(await page.evaluate(() => window['events'])).toEqual(['prompt', 'denied', 'granted', 'prompt']);
});
it('should isolate permissions between browser contexs', async({page, server, context, browser}) => {
it('should isolate permissions between browser contexts', async({page, server, context, browser}) => {
await page.goto(server.EMPTY_PAGE);
const otherContext = await browser.newContext();
const otherPage = await otherContext.newPage();
Expand All @@ -122,4 +122,15 @@ describe.skip(WEBKIT)('Permissions', function() {
expect(await getPermission(otherPage, 'geolocation')).toBe('granted');
await otherContext.close();
});
it.skip(FFOX)('should support clipboard read', async({page, server, context, browser}) => {
// No such permissions (requires flag) in Firefox
await page.goto(server.EMPTY_PAGE);
expect(await getPermission(page, 'clipboard-read')).toBe('prompt');
let error;
await page.evaluate(() => navigator.clipboard.readText()).catch(e => error = e);
expect(error.toString()).toContain('denied');
await context.grantPermissions(['clipboard-read']);
expect(await getPermission(page, 'clipboard-read')).toBe('granted');
await page.evaluate(() => navigator.clipboard.readText());
});
});

0 comments on commit 9641e01

Please sign in to comment.