diff --git a/.github/workflows/tests_primary.yml b/.github/workflows/tests_primary.yml deleted file mode 100644 index ec575d808e798..0000000000000 --- a/.github/workflows/tests_primary.yml +++ /dev/null @@ -1,243 +0,0 @@ -name: "tests 1" - -on: - push: - branches: - - main - - release-* - pull_request: - paths-ignore: - - 'browser_patches/**' - - 'docs/**' - branches: - - main - - release-* - -concurrency: - # For pull requests, cancel all currently-running jobs for this workflow - # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -env: - # Force terminal colors. @see https://www.npmjs.com/package/colors - FORCE_COLOR: 1 - ELECTRON_SKIP_BINARY_DOWNLOAD: 1 - DEBUG_GIT_COMMIT_INFO: 1 - -jobs: - test_linux: - name: ${{ matrix.os }} (${{ matrix.browser }} - Node.js ${{ matrix.node-version }}) - environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }} - strategy: - fail-fast: false - matrix: - browser: [chromium, firefox, webkit] - os: [ubuntu-22.04] - node-version: [18] - include: - - os: ubuntu-22.04 - node-version: 20 - browser: chromium - - os: ubuntu-22.04 - node-version: 22 - browser: chromium - - os: ubuntu-22.04 - node-version: 24 - browser: chromium - runs-on: ${{ matrix.os }} - permissions: - id-token: write # This is required for OIDC login (azure/login) to succeed - contents: read # This is required for actions/checkout to succeed - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/run-test - with: - node-version: ${{ matrix.node-version }} - browsers-to-install: ${{ matrix.browser }} chromium - command: npm run test -- --project=${{ matrix.browser }}-* - bot-name: "${{ matrix.browser }}-${{ matrix.os }}-node${{ matrix.node-version }}" - flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }} - flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }} - flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }} - - test_linux_chromium_tot: - name: ${{ matrix.os }} (chromium tip-of-tree) - environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-22.04] - runs-on: ${{ matrix.os }} - permissions: - id-token: write # This is required for OIDC login (azure/login) to succeed - contents: read # This is required for actions/checkout to succeed - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/run-test - with: - browsers-to-install: chromium-tip-of-tree - command: npm run test -- --project=chromium-* - bot-name: "${{ matrix.os }}-chromium-tip-of-tree" - flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }} - flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }} - flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }} - env: - PWTEST_CHANNEL: chromium-tip-of-tree - - test_test_runner: - name: Test Runner - environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, windows-latest, macos-latest] - node-version: [18] - shardIndex: [1, 2] - shardTotal: [2] - include: - - os: ubuntu-latest - node-version: 20 - shardIndex: 1 - shardTotal: 2 - - os: ubuntu-latest - node-version: 20 - shardIndex: 2 - shardTotal: 2 - - os: ubuntu-latest - node-version: 22 - shardIndex: 1 - shardTotal: 2 - - os: ubuntu-latest - node-version: 22 - shardIndex: 2 - shardTotal: 2 - - os: ubuntu-latest - node-version: 24 - shardIndex: 1 - shardTotal: 2 - - os: ubuntu-latest - node-version: 24 - shardIndex: 2 - shardTotal: 2 - runs-on: ${{ matrix.os }} - permissions: - id-token: write # This is required for OIDC login (azure/login) to succeed - contents: read # This is required for actions/checkout to succeed - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/run-test - with: - node-version: ${{matrix.node-version}} - command: npm run ttest -- --shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }} - bot-name: "${{ matrix.os }}-node${{ matrix.node-version }}-${{ matrix.shardIndex }}" - flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }} - flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }} - flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }} - env: - PWTEST_CHANNEL: firefox-beta - - test_web_components: - name: Web Components - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 18 - - run: npm ci - - run: npm run build - - - run: npx playwright install --with-deps - - run: npm run test-html-reporter - env: - PWTEST_BOT_NAME: "web-components-html-reporter" - - name: Upload blob report - if: ${{ !cancelled() }} - uses: ./.github/actions/upload-blob-report - with: - report_dir: packages/html-reporter/blob-report - job_name: "web-components-html-reporter" - - - run: npm run test-web - if: ${{ !cancelled() }} - env: - PWTEST_BOT_NAME: "web-components-web" - - name: Upload blob report - if: ${{ !cancelled() }} - uses: ./.github/actions/upload-blob-report - with: - report_dir: packages/web/blob-report - job_name: "web-components-web" - - test_vscode_extension: - name: VSCode Extension - runs-on: ubuntu-latest - env: - PWTEST_BOT_NAME: "vscode-extension" - DEBUG_GIT_COMMIT_INFO: "" - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 18 - - run: npm ci - env: - DEBUG: pw:install - - run: npm run build - - run: npx playwright install chromium - - name: Checkout extension - run: git clone https://github.com/microsoft/playwright-vscode.git - - name: Print extension revision - run: git rev-parse HEAD - working-directory: ./playwright-vscode - - name: Remove @playwright/test from extension dependencies - run: node -e "const p = require('./package.json'); delete p.devDependencies['@playwright/test']; fs.writeFileSync('./package.json', JSON.stringify(p, null, 2));" - working-directory: ./playwright-vscode - - name: Build extension - run: npm ci && npm run build - working-directory: ./playwright-vscode - - name: Run extension tests - run: npm run test -- --workers=1 - working-directory: ./playwright-vscode - - name: Upload blob report - if: ${{ !cancelled() }} - uses: ./.github/actions/upload-blob-report - with: - report_dir: playwright-vscode/blob-report - job_name: ${{ env.PWTEST_BOT_NAME }} - - test_package_installations: - name: "Installation Test ${{ matrix.os }}" - environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }} - strategy: - fail-fast: false - matrix: - os: - - ubuntu-latest - - macos-latest - - windows-latest - runs-on: ${{ matrix.os }} - timeout-minutes: 30 - permissions: - id-token: write # This is required for OIDC login (azure/login) to succeed - contents: read # This is required for actions/checkout to succeed - steps: - - uses: actions/checkout@v4 - - run: npm install -g yarn@1 - - run: npm install -g pnpm@8 - - name: Setup Ubuntu Binary Installation # TODO: Remove when https://github.com/electron/electron/issues/42510 is fixed - if: ${{ runner.os == 'Linux' }} - run: | - if grep -q "Ubuntu 24" /etc/os-release; then - sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 - fi - shell: bash - - uses: ./.github/actions/run-test - with: - command: npm run itest - bot-name: "package-installations-${{ matrix.os }}" - shell: ${{ matrix.os == 'windows-latest' && 'pwsh' || 'bash' }} - flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }} - flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }} - flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }} diff --git a/.github/workflows/tests_secondary.yml b/.github/workflows/tests_secondary.yml index eafe68cd60f3e..0a6f635a042c3 100644 --- a/.github/workflows/tests_secondary.yml +++ b/.github/workflows/tests_secondary.yml @@ -9,7 +9,6 @@ on: paths-ignore: - 'browser_patches/**' - 'docs/**' - types: [ labeled ] branches: - main - release-* @@ -24,184 +23,6 @@ permissions: contents: read # This is required for actions/checkout to succeed jobs: - test_linux: - name: ${{ matrix.os }} (${{ matrix.browser }}) - environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }} - strategy: - fail-fast: false - matrix: - browser: [chromium, firefox, webkit] - os: [ubuntu-24.04] - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/run-test - with: - browsers-to-install: ${{ matrix.browser }} chromium - command: npm run test -- --project=${{ matrix.browser }}-* - bot-name: "${{ matrix.browser }}-${{ matrix.os }}" - flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }} - flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }} - flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }} - - test_mac: - name: ${{ matrix.os }} (${{ matrix.browser }}) - environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }} - strategy: - fail-fast: false - matrix: - # Intel: *-large - # Arm64: *-xlarge - os: [macos-13-large, macos-13-xlarge, macos-14-large, macos-14-xlarge] - browser: [chromium, firefox, webkit] - include: - - os: macos-15-large - browser: webkit - - os: macos-15-xlarge - browser: webkit - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/run-test - with: - browsers-to-install: ${{ matrix.browser }} chromium - command: npm run test -- --project=${{ matrix.browser }}-* - bot-name: "${{ matrix.browser }}-${{ matrix.os }}" - flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }} - flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }} - flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }} - - test_win: - name: "Windows" - environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }} - strategy: - fail-fast: false - matrix: - browser: [chromium, firefox, webkit] - runs-on: windows-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/run-test - with: - browsers-to-install: ${{ matrix.browser }} chromium - command: npm run test -- --project=${{ matrix.browser }}-* ${{ matrix.browser == 'firefox' && '--workers 1' || '' }} - bot-name: "${{ matrix.browser }}-windows-latest" - flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }} - flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }} - flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }} - - test-package-installations-other-node-versions: - name: "Installation Test ${{ matrix.os }} (${{ matrix.node_version }})" - environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - include: - - os: ubuntu-latest - node_version: 20 - - os: ubuntu-latest - node_version: 22 - - os: ubuntu-latest - node_version: 24 - timeout-minutes: 30 - steps: - - uses: actions/checkout@v4 - - run: npm install -g yarn@1 - - run: npm install -g pnpm@8 - - name: Setup Ubuntu Binary Installation # TODO: Remove when https://github.com/electron/electron/issues/42510 is fixed - if: ${{ runner.os == 'Linux' }} - run: | - if grep -q "Ubuntu 24" /etc/os-release; then - sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 - fi - shell: bash - - uses: ./.github/actions/run-test - with: - node-version: ${{ matrix.node_version }} - command: npm run itest - bot-name: "package-installations-${{ matrix.os }}-node${{ matrix.node_version }}" - flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }} - flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }} - flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }} - - headed_tests: - name: "headed ${{ matrix.browser }} (${{ matrix.os }})" - environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }} - strategy: - fail-fast: false - matrix: - browser: [chromium, firefox, webkit] - os: [ubuntu-24.04, macos-14-xlarge, windows-latest] - include: - # We have different binaries per Ubuntu version for WebKit. - - browser: webkit - os: ubuntu-22.04 - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/run-test - with: - browsers-to-install: ${{ matrix.browser }} chromium - command: npm run test -- --project=${{ matrix.browser }}-* --headed - bot-name: "${{ matrix.browser }}-headed-${{ matrix.os }}" - flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }} - flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }} - flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }} - - transport_linux: - name: "Transport" - environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }} - strategy: - fail-fast: false - matrix: - mode: [driver, service] - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/run-test - with: - browsers-to-install: chromium - command: npm run ctest - bot-name: "${{ matrix.mode }}" - flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }} - flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }} - flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }} - env: - PWTEST_MODE: ${{ matrix.mode }} - - tracing_linux: - name: Tracing ${{ matrix.browser }} ${{ matrix.channel }} - environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }} - strategy: - fail-fast: false - matrix: - include: - - browser: chromium - runs-on: ubuntu-22.04 - - browser: firefox - runs-on: ubuntu-22.04 - # See https://github.com/microsoft/playwright/issues/35586 - - browser: webkit - runs-on: ubuntu-24.04 - - browser: chromium - runs-on: ubuntu-22.04 - channel: chromium-tip-of-tree - runs-on: ${{ matrix.runs-on }} - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/run-test - with: - browsers-to-install: ${{ matrix.browser }} chromium ${{ matrix.channel }} - command: npm run test -- --project=${{ matrix.browser }}-* - bot-name: "tracing-${{ matrix.channel || matrix.browser }}" - flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }} - flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }} - flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }} - env: - PWTEST_TRACE: 1 - PWTEST_CHANNEL: ${{ matrix.channel }} - test_chromium_channels: name: Test ${{ matrix.channel }} on ${{ matrix.runs-on }} environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }} @@ -209,8 +30,8 @@ jobs: strategy: fail-fast: false matrix: - channel: [chrome, chrome-beta, msedge, msedge-beta, msedge-dev] - runs-on: [ubuntu-22.04, macos-latest, windows-latest] + channel: [chrome-canary] + runs-on: [macos-15-xlarge] steps: - uses: actions/checkout@v4 - uses: ./.github/actions/run-test @@ -223,106 +44,13 @@ jobs: flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }} env: PWTEST_CHANNEL: ${{ matrix.channel }} - - chromium_tot: - name: Chromium tip-of-tree ${{ matrix.os }}${{ matrix.headed }} - environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-22.04, macos-13, windows-latest] - headed: ['--headed', ''] - exclude: - # Tested in tests_primary.yml already - - os: ubuntu-22.04 - headed: '' - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/run-test + - uses: actions/upload-artifact@v4 + if: always() with: - browsers-to-install: chromium-tip-of-tree - command: npm run ctest -- ${{ matrix.headed }} - bot-name: "chromium-tip-of-tree-${{ matrix.os }}${{ matrix.headed }}" - flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }} - flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }} - flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }} - env: - PWTEST_CHANNEL: chromium-tip-of-tree - - chromium_tot_headless_shell: - name: Chromium tip-of-tree headless-shell-${{ matrix.os }} - environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-22.04] - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/run-test + name: profiles + path: profiles + - uses: actions/upload-artifact@v4 + if: always() with: - browsers-to-install: chromium-tip-of-tree-headless-shell - command: npm run ctest - bot-name: "chromium-tip-of-tree-headless-shell-${{ matrix.os }}" - flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }} - flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }} - flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }} - env: - PWTEST_CHANNEL: chromium-tip-of-tree-headless-shell - - firefox_beta: - name: Firefox Beta ${{ matrix.os }} - environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-22.04, windows-latest, macos-latest] - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/run-test - with: - browsers-to-install: firefox-beta chromium - command: npm run ftest - bot-name: "firefox-beta-${{ matrix.os }}" - flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }} - flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }} - flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }} - env: - PWTEST_CHANNEL: firefox-beta - - build-playwright-driver: - name: "build-playwright-driver" - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 18 - - run: npm ci - - run: npm run build - - run: utils/build/build-playwright-driver.sh - - test_channel_chromium: - name: Test channel=chromium - environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }} - strategy: - fail-fast: false - matrix: - runs-on: [ubuntu-latest, windows-latest, macos-latest] - runs-on: ${{ matrix.runs-on }} - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/run-test - with: - # TODO: this should pass --no-shell. - # However, codegen tests do not inherit the channel and try to launch headless shell. - browsers-to-install: chromium - command: npm run ctest - bot-name: "channel-chromium-${{ matrix.runs-on }}" - flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }} - flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }} - flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }} - env: - PWTEST_CHANNEL: chromium + name: crashes + path: crashes diff --git a/packages/playwright-core/bin/reinstall_chrome_canary_linux.sh b/packages/playwright-core/bin/reinstall_chrome_canary_linux.sh new file mode 100755 index 0000000000000..07eacd44411fb --- /dev/null +++ b/packages/playwright-core/bin/reinstall_chrome_canary_linux.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +set -e +set -x + +if [[ $(arch) == "aarch64" ]]; then + echo "ERROR: not supported on Linux Arm64" + exit 1 +fi + +if [ -z "$PLAYWRIGHT_HOST_PLATFORM_OVERRIDE" ]; then + if [[ ! -f "/etc/os-release" ]]; then + echo "ERROR: cannot install on unknown linux distribution (/etc/os-release is missing)" + exit 1 + fi + + ID=$(bash -c 'source /etc/os-release && echo $ID') + if [[ "${ID}" != "ubuntu" && "${ID}" != "debian" ]]; then + echo "ERROR: cannot install on $ID distribution - only Ubuntu and Debian are supported" + exit 1 + fi +fi + +# 1. make sure to remove old canary if any. +if dpkg --get-selections | grep -q "^google-chrome-unstable[[:space:]]*install$" >/dev/null; then + apt-get remove -y google-chrome-unstable +fi + +# 2. Update apt lists (needed to install curl and chrome dependencies) +apt-get update + +# 3. Install curl to download chrome +if ! command -v curl >/dev/null; then + apt-get install -y curl +fi + +# 4. download chrome canary from dl.google.com and install it. +cd /tmp +curl -O https://dl.google.com/linux/direct/google-chrome-unstable_current_amd64.deb +apt-get install -y ./google-chrome-unstable_current_amd64.deb +rm -rf ./google-chrome-unstable_current_amd64.deb +cd - +google-chrome-unstable --version diff --git a/packages/playwright-core/bin/reinstall_chrome_canary_mac.sh b/packages/playwright-core/bin/reinstall_chrome_canary_mac.sh new file mode 100755 index 0000000000000..9d0160aa6b8d9 --- /dev/null +++ b/packages/playwright-core/bin/reinstall_chrome_canary_mac.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +set -e +set -x + +rm -rf "/Applications/Google Chrome Canary.app" +cd /tmp +curl --retry 3 -o ./googlechromecanary.dmg -k https://dl.google.com/chrome/mac/universal/canary/googlechromecanary.dmg +hdiutil attach -nobrowse -quiet -noautofsck -noautoopen -mountpoint /Volumes/googlechromecanary.dmg ./googlechromecanary.dmg +cp -pR "/Volumes/googlechromecanary.dmg/Google Chrome Canary.app" /Applications +hdiutil detach /Volumes/googlechromecanary.dmg +rm -rf /tmp/googlechromecanary.dmg + +/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary --version diff --git a/packages/playwright-core/bin/reinstall_chrome_canary_win.ps1 b/packages/playwright-core/bin/reinstall_chrome_canary_win.ps1 new file mode 100644 index 0000000000000..6f8e560fdda1f --- /dev/null +++ b/packages/playwright-core/bin/reinstall_chrome_canary_win.ps1 @@ -0,0 +1,24 @@ +$ErrorActionPreference = 'Stop' + +$url = 'https://dl.google.com/tag/s/dl/chrome/install/dev/googlechromestandaloneenterprise64.msi' + +Write-Host "Downloading Google Chrome Canary" +$wc = New-Object net.webclient +$msiInstaller = "$env:temp\google-chrome-canary.msi" +$wc.Downloadfile($url, $msiInstaller) + +Write-Host "Installing Google Chrome Canary" +$arguments = "/i `"$msiInstaller`" /quiet" +Start-Process msiexec.exe -ArgumentList $arguments -Wait +Remove-Item $msiInstaller + +$suffix = "\\Google\\Chrome SxS\\Application\\chrome.exe" +if (Test-Path "${env:ProgramFiles(x86)}$suffix") { + (Get-Item "${env:ProgramFiles(x86)}$suffix").VersionInfo +} elseif (Test-Path "${env:ProgramFiles}$suffix") { + (Get-Item "${env:ProgramFiles}$suffix").VersionInfo +} else { + Write-Host "ERROR: Failed to install Google Chrome Canary." + Write-Host "ERROR: This could be due to insufficient privileges, in which case re-running as Administrator may help." + exit 1 +} diff --git a/packages/playwright-core/src/client/browserContext.ts b/packages/playwright-core/src/client/browserContext.ts index a87ceec2a3692..874232d1d754e 100644 --- a/packages/playwright-core/src/client/browserContext.ts +++ b/packages/playwright-core/src/client/browserContext.ts @@ -486,6 +486,7 @@ export class BrowserContext extends ChannelOwner } async close(options: { reason?: string } = {}): Promise { + console.trace('BrowserContext.close'); if (this._closingStatus !== 'none') return; this._closeReason = options.reason; diff --git a/packages/playwright-core/src/server/chromium/crBrowser.ts b/packages/playwright-core/src/server/chromium/crBrowser.ts index 626ee3d221942..b5faebc79e7c0 100644 --- a/packages/playwright-core/src/server/chromium/crBrowser.ts +++ b/packages/playwright-core/src/server/chromium/crBrowser.ts @@ -537,6 +537,7 @@ export class CRBrowserContext extends BrowserContext { } async doClose(reason: string | undefined) { + console.trace('CRBrowserContext.doClose'); // Headful chrome cannot dispose browser context with opened 'beforeunload' // dialogs, so we should close all that are currently opened. // We also won't get new ones since `Target.disposeBrowserContext` does not trigger diff --git a/packages/playwright-core/src/server/chromium/crNetworkManager.ts b/packages/playwright-core/src/server/chromium/crNetworkManager.ts index 27a4cba97fdc5..c1814b84046ea 100644 --- a/packages/playwright-core/src/server/chromium/crNetworkManager.ts +++ b/packages/playwright-core/src/server/chromium/crNetworkManager.ts @@ -238,6 +238,7 @@ export class CRNetworkManager { } _onRequestPaused(sessionInfo: SessionInfo, event: Protocol.Fetch.requestPausedPayload) { + console.log(new Date(), 'onRequestPaused', event.request.url); if (!event.networkId) { // Fetch without networkId means that request was not recognized by inspector, and // it will never receive Network.requestWillBeSent. Continue the request to not affect it. @@ -631,6 +632,7 @@ class RouteImpl implements network.RouteDelegate { } async fulfill(response: types.NormalizedFulfillResponse) { + console.log(new Date(), 'fulfill'); this._fulfilled = true; const body = response.isBase64 ? response.body : Buffer.from(response.body).toString('base64'); diff --git a/packages/playwright-core/src/server/recorder/recorderApp.ts b/packages/playwright-core/src/server/recorder/recorderApp.ts index c4f8c3b7b6a97..e03f26d748d12 100644 --- a/packages/playwright-core/src/server/recorder/recorderApp.ts +++ b/packages/playwright-core/src/server/recorder/recorderApp.ts @@ -87,7 +87,9 @@ export class RecorderApp { const uri = route.request().url().substring('https://playwright/'.length); const file = require.resolve('../../vite/recorder/' + uri); + console.log(new Date(), 'readFile:' + file); fs.promises.readFile(file).then(buffer => { + console.log(new Date(), 'fulfill:' + file); route.fulfill({ status: 200, headers: [ diff --git a/packages/playwright-core/src/server/registry/index.ts b/packages/playwright-core/src/server/registry/index.ts index 433a6f35f6ca9..d33d7322aad8c 100644 --- a/packages/playwright-core/src/server/registry/index.ts +++ b/packages/playwright-core/src/server/registry/index.ts @@ -653,7 +653,11 @@ export class Registry { 'linux': '', 'darwin': '/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary', 'win32': `\\Google\\Chrome SxS\\Application\\chrome.exe`, - })); + }, () => this._installChromiumChannel('chrome-canary', { + 'linux': 'reinstall_chrome_canary_linux.sh', + 'darwin': 'reinstall_chrome_canary_mac.sh', + 'win32': 'reinstall_chrome_canary_win.ps1', + }))); this._executables.push(this._createChromiumChannel('msedge', { 'linux': '/opt/microsoft/msedge/msedge', diff --git a/tests/library/inspector/cli-codegen-2.spec.ts b/tests/library/inspector/cli-codegen-2.spec.ts index 313acc6b18533..2e8381352ce78 100644 --- a/tests/library/inspector/cli-codegen-2.spec.ts +++ b/tests/library/inspector/cli-codegen-2.spec.ts @@ -90,14 +90,37 @@ var page1 = await context.NewPageAsync();`); await page.CloseAsync();`); }); + test.only('should repro', async ({ page }) => { + await (page.context() as any)._enableRecorder({ + language: 'javascript', + mode: 'recording', + }); + await page.context().newPage(); + await page.evaluate(() => { + console.log('evaluating'); + const body = document.querySelector('body'); + if (body) + console.log('there is a body'); + else + console.log('there is no body'); + return body!.remove(); + }); + }); + test('should not lead to an error if html gets clicked', async ({ openRecorder }) => { const { page, recorder } = await openRecorder(); - await recorder.setContentAndWait(''); - await page.context().newPage(); const errors: any[] = []; recorder.page.on('pageerror', e => errors.push(e)); - await recorder.page.evaluate(() => document.querySelector('body')!.remove()); + await recorder.page.evaluate(() => { + console.log('evaluating'); + const body = document.querySelector('body'); + if (body) + console.log('there is a body'); + else + console.log('there is no body'); + return body!.remove(); + }); await page.dispatchEvent('html', 'mousemove', { detail: 1 }); await recorder.page.close(); await recorder.waitForOutput('JavaScript', 'page.close();'); diff --git a/tests/library/inspector/inspectorTest.ts b/tests/library/inspector/inspectorTest.ts index e7ed9a952653f..79ebd679f9004 100644 --- a/tests/library/inspector/inspectorTest.ts +++ b/tests/library/inspector/inspectorTest.ts @@ -84,14 +84,15 @@ export const test = contextTest.extend({ }); }, - openRecorder: async ({ context, recorderPageGetter }, use) => { + openRecorder: async ({ recorderPageGetter, context }, use) => { + test.slow(); await use(async options => { + const page = context.pages()[0]; await (context as any)._enableRecorder({ language: 'javascript', mode: 'recording', ...options }); - const page = await context.newPage(); return { page, recorder: new Recorder(page, await recorderPageGetter()) }; }); }, diff --git a/tests/library/playwright.config.ts b/tests/library/playwright.config.ts index 76c82d0998419..28681cc04af18 100644 --- a/tests/library/playwright.config.ts +++ b/tests/library/playwright.config.ts @@ -79,19 +79,22 @@ if (mode === 'service2') { }; } +process.env.DEBUG = 'pw:browser,pw:protocol'; + const config: Config = { testDir, outputDir, expect: { timeout: 10000, }, - maxFailures: 200, + maxFailures: 1, timeout: video ? 60000 : 30000, globalTimeout: 5400000, workers: process.env.CI ? 2 : undefined, fullyParallel: !process.env.CI, - forbidOnly: !!process.env.CI, - retries: process.env.CI ? 3 : 0, + forbidOnly: false, + retries: 0, + repeatEach: 100, reporter: reporters(), projects: [], use: {