diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 10c3ab9..f32ba02 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,39 +1,39 @@ -name: Test - +name: Playwright Tests on: push: - branches: - - main + branches: [main, master] pull_request: - branches: - - main - + branches: [main, master] jobs: - test-logs: - timeout-minutes: 10 + test: + timeout-minutes: 60 runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Cache Node Modules - id: realgolfgames-logs-cache-node-modules - uses: actions/cache@v4 - env: - cache-name: cache-node-modules + - uses: actions/checkout@v3 + - uses: actions/setup-node@v2 with: - path: ~/.npm - key: ${{ runner.os }}-node-modules-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.json') }} - restore-keys: | - ${{ runner.os }}-node-modules-${{ env.cache-name }}- - ${{ runner.os }}-node-modules- - ${{ runner.os }}- + node-version: '16.x' - - name: Install dependencies - if: steps.realgolfgames-logs-cache-node-modules.outputs.cache-hit != 'true' - run: npm install - - - name: Install Playwright dependencies - run: npx playwright install --with-deps chromium + - name: Get installed Playwright version + id: playwright-version + run: echo "PLAYWRIGHT_VERSION=$(node -e "console.log(require('./package-lock.json').dependencies['@playwright/test'].version)")" >> $GITHUB_ENV + - name: Cache playwright binaries + uses: actions/cache@v3 + id: playwright-cache + with: + path: | + ~/.cache/ms-playwright + key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }} + - run: npm ci + - run: npx playwright install --with-deps + if: steps.playwright-cache.outputs.cache-hit != 'true' + - run: npx playwright install-deps + if: steps.playwright-cache.outputs.cache-hit != 'true' - - name: Run tests - run: npx playwright test --project="Google Chrome" + - name: Run Playwright tests + run: npx playwright test + - uses: actions/upload-artifact@v2 + if: always() + with: + name: playwright-test-results + path: test-results/