name: Playwright Tests on: push: branches: [ trunk ] pull_request: jobs: PlaywrightE2ETests: name: Playwright E2E tests timeout-minutes: 60 runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 with: ref: trunk - name: Cache node_modules id: cache-node-modules uses: actions/cache@v3 env: cache-name: cache-node-modules with: path: node_modules key: ${{ runner.os }}-build-${{ hashFiles('**/package-lock.json') }} restore-keys: | ${{ runner.os }}-build-${{ env.cache-name }}- ${{ runner.os }}-build- ${{ runner.os }}- - name: Setup node version and npm cache uses: actions/setup-node@v3 with: node-version-file: '.nvmrc' cache: 'npm' - name: Install Node dependencies if: steps.cache-node-modules.outputs.cache-hit != 'true' run: npm install --no-optional --no-audit - name: Load wp-env run: npm run env:start --update - name: Fix permissions # We need to figure this out https://github.com/WordPress/gutenberg/issues/22515#issuecomment-1308346256 run: | WP_ENV_DIR=$(npm run wp-env install-path --silent 2>&1 | head -1) cd $WP_ENV_DIR mkdir -p tests-WordPress/wp-content/languages tests-WordPress/wp-content/upgrade chmod -R 767 tests-WordPress/wp-content/languages tests-WordPress/wp-content/upgrade cd - - name: Install Playwright Browsers run: npx playwright install --with-deps - name: Run Playwright tests run: npx playwright test --config=tests/e2e-pw/playwright.config.ts - uses: actions/upload-artifact@v3 with: name: playwright-report path: playwright-report/ retention-days: 30