diff --git a/.github/actions/setup-playwright/action.yaml b/.github/actions/setup-playwright/action.yaml index df2f1bf..1aeec63 100644 --- a/.github/actions/setup-playwright/action.yaml +++ b/.github/actions/setup-playwright/action.yaml @@ -28,3 +28,8 @@ runs: if: steps.cache-playwright.outputs.cache-hit != 'true' run: yarn playwright install --with-deps shell: bash + + - name: Ensure system dependencies are installed + if: steps.cache-playwright.outputs.cache-hit == 'true' + run: yarn playwright install-deps + shell: bash diff --git a/.github/workflows/run-checks-on-pr.yaml b/.github/workflows/run-checks-on-pr.yaml index 5c0cf12..ebe16b6 100644 --- a/.github/workflows/run-checks-on-pr.yaml +++ b/.github/workflows/run-checks-on-pr.yaml @@ -1,8 +1,8 @@ name: Run checks on PR on: - pull_request: - branches: [ main ] + pull_request: + branches: [main] concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -21,4 +21,4 @@ jobs: run-changed-or-added-tests: uses: ./.github/workflows/run-new-tests-check.yaml with: - base_ref: ${{ github.base_ref }} \ No newline at end of file + base_ref: ${{ github.base_ref }} diff --git a/.github/workflows/run-new-tests-check.yaml b/.github/workflows/run-new-tests-check.yaml index dbe148b..b976dc3 100644 --- a/.github/workflows/run-new-tests-check.yaml +++ b/.github/workflows/run-new-tests-check.yaml @@ -1,20 +1,20 @@ name: Run changed or added tests on: - workflow_call: - inputs: - base_ref: - description: 'Base branch to compare against' - required: false - default: 'main' - type: string - workflow_dispatch: - inputs: - base_ref: - description: 'Base branch to compare against' - required: false - default: 'main' - type: string + workflow_call: + inputs: + base_ref: + description: 'Base branch to compare against' + required: false + default: 'main' + type: string + workflow_dispatch: + inputs: + base_ref: + description: 'Base branch to compare against' + required: false + default: 'main' + type: string jobs: run-changed-or-added-tests: @@ -29,7 +29,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - + - name: Set up Node.js and Playwright uses: ./.github/actions/setup-playwright @@ -38,8 +38,8 @@ jobs: run: | BASE_REF="${{ inputs.base_ref || 'main' }}" git fetch origin "$BASE_REF" - NEW_TESTS=$(git diff --name-only --diff-filter=ACMR "$BASE_REF"...HEAD -- tests/ || echo '') - + NEW_TESTS=$(git diff --name-only --diff-filter=ACMR origin/"$BASE_REF"...HEAD -- tests/ || echo '') + if [ -z "$NEW_TESTS" ]; then echo "No new or changed tests found" echo "has_new_tests=false" >> $GITHUB_OUTPUT @@ -59,16 +59,16 @@ jobs: if: ${{ steps.find-new-tests.outputs.has_new_tests == 'true' }} id: list-tests run: | - TEST_FILES=$(echo "${{ steps.find-new-tests.outputs.new_test_files }}" | tr '\n' ' ') - + TEST_FILES=$(echo "${{ steps.find-new-tests.outputs.new_test_files }}" | xargs) + if [ -z "$TEST_FILES" ]; then echo "No test files to process" echo "has_new_tests=false" >> $GITHUB_OUTPUT exit 0 fi - + TEST_LIST=$(yarn playwright test --project=${{ matrix.project }} "$TEST_FILES" --list || echo '') - + if [ -z "$TEST_LIST" ]; then echo "No tests found for project ${{ matrix.project }}" echo "has_new_tests=false" >> $GITHUB_OUTPUT @@ -90,4 +90,4 @@ jobs: with: name: new-tests-results-${{ matrix.project }}-${{ github.run_id }} path: playwright-report/ - retention-days: 7 \ No newline at end of file + retention-days: 7 diff --git a/tests/example.spec.ts b/tests/example.spec.ts index fefb4c9..35016c5 100644 --- a/tests/example.spec.ts +++ b/tests/example.spec.ts @@ -16,3 +16,9 @@ test('get started link', { tag: ['@smoke', '@regression', '@mobile'] }, async ({ // Expects page to have a heading with the name of Installation. await expect(page.getByRole('heading', { name: 'Installation' })).toBeVisible(); }); + +test('new test', { tag: ['@new'] }, async ({ page }) => { + await page.goto('https://playwright.dev/'); + + await expect(page).toHaveTitle(/Playwright/); +});