fix: add 'window-management' to chromium browser (#31687)
This commit is contained in:
parent
de39d227f7
commit
0aa2f06f68
|
|
@ -980,6 +980,7 @@ A permission or an array of permissions to grant. Permissions can be one of the
|
||||||
* `'notifications'`
|
* `'notifications'`
|
||||||
* `'payment-handler'`
|
* `'payment-handler'`
|
||||||
* `'storage-access'`
|
* `'storage-access'`
|
||||||
|
* `'window-management'`
|
||||||
|
|
||||||
### option: BrowserContext.grantPermissions.origin
|
### option: BrowserContext.grantPermissions.origin
|
||||||
* since: v1.8
|
* since: v1.8
|
||||||
|
|
|
||||||
|
|
@ -434,6 +434,7 @@ export class CRBrowserContext extends BrowserContext {
|
||||||
// chrome-specific permissions we have.
|
// chrome-specific permissions we have.
|
||||||
['midi-sysex', 'midiSysex'],
|
['midi-sysex', 'midiSysex'],
|
||||||
['storage-access', 'storageAccess'],
|
['storage-access', 'storageAccess'],
|
||||||
|
['window-management', 'windowManagement']
|
||||||
]);
|
]);
|
||||||
const filtered = permissions.map(permission => {
|
const filtered = permissions.map(permission => {
|
||||||
const protocolPermission = webPermissionToProtocol.get(permission);
|
const protocolPermission = webPermissionToProtocol.get(permission);
|
||||||
|
|
|
||||||
1
packages/playwright-core/types/types.d.ts
vendored
1
packages/playwright-core/types/types.d.ts
vendored
|
|
@ -8472,6 +8472,7 @@ export interface BrowserContext {
|
||||||
* - `'notifications'`
|
* - `'notifications'`
|
||||||
* - `'payment-handler'`
|
* - `'payment-handler'`
|
||||||
* - `'storage-access'`
|
* - `'storage-access'`
|
||||||
|
* - `'window-management'`
|
||||||
* @param options
|
* @param options
|
||||||
*/
|
*/
|
||||||
grantPermissions(permissions: ReadonlyArray<string>, options?: {
|
grantPermissions(permissions: ReadonlyArray<string>, options?: {
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,14 @@ it.describe('permissions', () => {
|
||||||
expect(await getPermission(page, 'geolocation')).toBe('granted');
|
expect(await getPermission(page, 'geolocation')).toBe('granted');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should grant window-management permission when origin is listed', async ({ page, context, server, browserName }) => {
|
||||||
|
it.fail(browserName === 'firefox');
|
||||||
|
|
||||||
|
await page.goto(server.EMPTY_PAGE);
|
||||||
|
await context.grantPermissions(['window-management'], { origin: server.EMPTY_PAGE });
|
||||||
|
expect(await getPermission(page, 'window-management')).toBe('granted');
|
||||||
|
});
|
||||||
|
|
||||||
it('should prompt for geolocation permission when origin is not listed', async ({ page, context, server }) => {
|
it('should prompt for geolocation permission when origin is not listed', async ({ page, context, server }) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
await context.grantPermissions(['geolocation'], { origin: server.EMPTY_PAGE });
|
await context.grantPermissions(['geolocation'], { origin: server.EMPTY_PAGE });
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue