my current workflow file, to run tests in Playwright using matrix to run 3 projects and pnpm, looks like this.
Somehow for webkit I get this error:
What am I doing wrong?
Also I would like to check for existing cache also in the first job. Anyone got experience with it?
The other 2 jobs of the matrix work fine...
name: Playwright Tests
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
types: [synchronize, ready_for_review]
workflow_dispatch:
env:
PLAYWRIGHT_CONTAINER_IMAGE: mcr.microsoft.com/playwright:v1.41.2-jammy
NODE_VERSION: 18
TEST_URL: ${{ vars.TEST_URL }}
TEST_ADMIN_USERNAME: ${{ vars.TEST_ADMIN_USERNAME }}
TEST_ADMIN_PASSWORD: ${{ secrets.TEST_ADMIN_PASSWORD }}
TEST_USERNAME: ${{ vars.TEST_USERNAME }}
TEST_PASSWORD: ${{ secrets.TEST_PASSWORD }}
ALLURE_ENDPOINT: ${{ vars.ALLURE_ENDPOINT }}
ALLURE_TOKEN: ${{ secrets.ALLURE_TOKEN }}
ALLURE_PROJECT_ID: ${{ vars.ALLURE_PROJECT_ID }}
jobs:
cache-and-install:
runs-on: ubuntu-latest
container:
image: ${{ github.env.PLAYWRIGHT_CONTAINER_IMAGE }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: 8
run_install: false
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'pnpm'
# Correctly setting the store path
- name: Determine pnpm store path
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_ENV
# Debugging: Echo the STORE_PATH to ensure it's correctly set
- name: Echo pnpm store path
run: echo "Store path is $STORE_PATH"
- name: Install dependencies
run: pnpm install --frozen-lockfile
# This step caches the pnpm store directly, which includes node_modules
- name: Cache pnpm store and node_modules
uses: actions/cache@v3
with:
path: |
${{ github.env.STORE_PATH }}
**/node_modules
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
- name: Store Playwright's Version
run: |
PLAYWRIGHT_VERSION=$(npx playwright --version | awk '{print $2}')
echo "Playwright's Version: $PLAYWRIGHT_VERSION"
echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV
- name: Setup Playwright
run: npx playwright install --with-deps
# Preparing cache for Playwright browsers. Actual caching happens at the end of the job.
- name: Cache Playwright Browsers
uses: actions/cache@v3
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ github.env.PLAYWRIGHT_VERSION }}
playwright-tests:
needs: cache-and-install
runs-on: ubuntu-latest
container:
image: ${{ github.env.PLAYWRIGHT_CONTAINER_IMAGE }}
strategy:
matrix:
include:
- name: 'Admin - Desktop Chrome'
project: 'Admin - Desktop Chrome'
- name: 'Driver - Mobile Android'
project: 'Driver - Mobile Android'
- name: 'Driver - Mobile iOS'
project: 'Driver - Mobile iOS'
steps:
- uses: actions/checkout@v3
# Restoring the pnpm store and node_modules cache
- name: Restore pnpm store and node_modules cache
uses: actions/cache@v3
with:
path: |
${{ github.env.STORE_PATH }}
**/node_modules
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Restore Playwright Browsers cache
uses: actions/cache@v3
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ github.env.PLAYWRIGHT_VERSION }}
- name: Run Playwright Test
run: npx playwright test --project="${{ matrix.project }}"
