microsoft / playwright

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
https://playwright.dev
Apache License 2.0
67.11k stars 3.69k forks source link

[Bug]: Protocol error (Browser.grantPermissions): Unknown permission type: accessibilityEvents #33678

Closed dgsayer1 closed 1 day ago

dgsayer1 commented 2 days ago

Version

1.49.0

Steps to reproduce

  1. Upgraded playwright to version 1.49.0 from 1.48.2
  2. Ran our set of tests (playwright test --workers=1 --project=smoke)

All tests failed with the error Error: browser.newContext: Protocol error (Browser.grantPermissions): Unknown permission type: accessibilityEvents

  1. Disabled the following by commenting out the code:
    /* contextOptions: {
      permissions: ['clipboard-read', 'clipboard-write', 'accessibility-events'],
    }, */
  2. Re-ran the tests

    All tests passed

  3. Downgraded playwright version to 1.48.2
  4. Rerun tests

    All tests passed

I've attached out playwright.config.ts code in the Additional Context section. Unfortunately I am unable to provide further test code.

Additionally, I've checked the Playwright readme document for granting permissions and it looks like the playwright.config.ts is correctly setup.

Expected behavior

All tests should run.

Actual behavior

All tests failed

Additional context

import { devices } from '@playwright/test';
import type { PlaywrightTestConfig } from '@playwright/test';
import '@support/custom-assertions';

const config: PlaywrightTestConfig = {
  testDir: './tests/ui',
  timeout: 60 * 1_000, 
  expect: { timeout: 10 * 1_000 }, 
  maxFailures: process.env.CI ? 20 : undefined, 
  fullyParallel: false, 
  forbidOnly: !!process.env.CI, 
  globalSetup: require.resolve('./global-setup'),
  retries: process.env.CI ? 2 : 0, 
  workers: process.env.CI ? 6 : undefined,
  reporter: process.env.CI ? [
    ['github'],
    ['playwright-tesults-reporter', {
      'tesults-target': process.env.TESULTS_TOKEN,
      'tesults-build-name': process.env.TESULTS_BUILD_NAME,
    }],
  ] : 'html',

  use: {
    locale: 'en-GB',
    actionTimeout: 0,
    trace: 'on-first-retry', 
    ignoreHTTPSErrors: true,
    screenshot: process.env.CI ? 'only-on-failure' : 'off',
    contextOptions: {
      permissions: ['clipboard-read', 'clipboard-write', 'accessibility-events'],
    },
  },
  projects: [
    {
      name: 'smoke',
      testDir: './tests/smoke-tests',
      timeout: 30 * 60 * 1_000,
      use: {
        ...devices['Desktop Chrome'],
        channel: 'chromium',
        baseURL: process.env.appBaseUrl,
        viewport: { width: 1280, height: 720 },
        trace: 'on-first-retry',
        video: 'retain-on-failure',
        screenshot: 'only-on-failure',
      },
      retries: 0,
    },
  ],
};

export default config;

Environment

System:
    OS: Windows 11 10.0.26100
    CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12700H
    Memory: 7.39 GB / 31.68 GB
  Binaries:
    Node: 20.1.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 9.6.4 - C:\Program Files\nodejs\npm.CMD
    pnpm: 8.15.6 - ~\AppData\Local\pnpm\pnpm.EXE
  IDEs:
    VSCode: 1.95.3 - C:\Users\DGS\AppData\Local\Programs\Microsoft VS Code\bin\code.CMD
  npmPackages:
    @playwright/test: ^1.49.0 => 1.49.0 
    playwright: ^1.49.0 => 1.49.0 
    playwright-lighthouse: ^2.2.2 => 2.2.2 
    playwright-tesults-reporter: ^1.1.0 => 1.1.0
dgozman commented 1 day ago

@dgsayer1 Thank you for the issue! Indeed, this permission has been removed from Chromium by this change.

Overall, permissions are not stable and change between browsers and versions. I've updated the docs to mention this in #33690. Let me know what you think.

dgsayer1 commented 1 day ago

Perfect @dgozman, thank you for investigating and resolving so quickly.