Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/actions/setup-playwright/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions .github/workflows/run-checks-on-pr.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Run checks on PR

on:
pull_request:
branches: [ main ]
pull_request:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -21,4 +21,4 @@ jobs:
run-changed-or-added-tests:
uses: ./.github/workflows/run-new-tests-check.yaml
with:
base_ref: ${{ github.base_ref }}
base_ref: ${{ github.base_ref }}
44 changes: 22 additions & 22 deletions .github/workflows/run-new-tests-check.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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

Expand All @@ -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
Expand All @@ -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
Expand All @@ -90,4 +90,4 @@ jobs:
with:
name: new-tests-results-${{ matrix.project }}-${{ github.run_id }}
path: playwright-report/
retention-days: 7
retention-days: 7
6 changes: 6 additions & 0 deletions tests/example.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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/);
});
Loading