Skip to content

Commit

Permalink
Really fix playwright fr finally
Browse files Browse the repository at this point in the history
  • Loading branch information
djahandarie committed Jan 1, 2025
1 parent c5fcaf7 commit a573ddb
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 16 deletions.
41 changes: 26 additions & 15 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ jobs:
ref: dictionaries
path: dictionaries

- name: Grab latest screenshots from master branch
### [PR] master-screenshots

- name: "[PR] Grab latest screenshots from master branch"
uses: dawidd6/action-download-artifact@80620a5d27ce0ae443b965134db88467fc607b43 # pin@v2
continue-on-error: true
id: master-screenshots
Expand All @@ -62,15 +64,28 @@ jobs:
workflow: playwright.yml
workflow_conclusion: success
path: test/playwright/__screenshots__/
if: github.event_name == 'pull_request'

- name: "[PR] Store steps.master-screenshots.outcome in a file"
run: echo ${{ steps.master-screenshots.outcome }} > ./master-screenshots-outcome
if: github.event_name == 'pull_request'

- name: "[PR] Upload master-screenshots-outcome"
uses: actions/upload-artifact@v4
with:
name: master-screenshots-outcome-${{ matrix.shardIndex }}
path: master-screenshots-outcome
if: github.event_name == 'pull_request'

- name: "[PR] Generate new screenshots & compare against master"
### actual tests
- name: "[PR] Run tests & compare against master"
id: playwright
run: |
npx playwright test --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} 2>&1 | tee ./playwright-output || true
continue-on-error: true
if: github.event_name == 'pull_request' && steps.master-screenshots.outcome != 'failure'

- name: "[Push] Generate new authoritative screenshots for master"
- name: "[Push] Run tests & save screenshots"
id: playwright-master
run: npx playwright test --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} -u 2>&1 | tee ./playwright-output
if: github.event_name == 'push'
Expand All @@ -89,14 +104,6 @@ jobs:
path: blob-report
retention-days: 1

- name: "[PR] Store steps.master-screenshots.outcome in a file"
run: echo ${{ steps.master-screenshots.outcome }} > ./master-screenshots-outcome

- uses: actions/upload-artifact@v4
with:
name: master-screenshots-outcome-${{ matrix.shardIndex }}
path: master-screenshots-outcome

- uses: actions/upload-artifact@v4
with:
name: playwright-output-${{ matrix.shardIndex }}
Expand Down Expand Up @@ -150,26 +157,30 @@ jobs:
name: playwright-screenshots
path: test/playwright/__screenshots__/

### master-screenshots-outcome
- name: Download master-screenshots-outcome files
### [PR] master-screenshots-outcome
- name: '[PR] Download master-screenshots-outcome files'
uses: actions/download-artifact@v4
with:
path: master-screenshots-outcomes
pattern: master-screenshots-outcome-*
merge-multiple: true
if: github.event_name == 'pull_request'

- name: Check if any shard failed to download master screenshots
- name: '[PR] Calculate if any shard failed to download master screenshots'
run: |
if grep -q "failure" master-screenshots-outcomes/*; then
echo "failure" > master-screenshots-outcome
else
echo "success" > master-screenshots-outcome
fi
if: github.event_name == 'pull_request'

- uses: actions/upload-artifact@v4
- name: '[PR] Upload master-screenshots-outcome'
uses: actions/upload-artifact@v4
with:
name: master-screenshots-outcome
path: master-screenshots-outcome
if: github.event_name == 'pull_request'

### playwright-output
- name: Download playwright-output files
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/playwright_comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
run_id: ${{ github.event.workflow_run.id }}
name: master-screenshots-outcome
if: github.event_name == 'pull_request'

- name: Grab playwright-results-json from PR run
uses: dawidd6/action-download-artifact@80620a5d27ce0ae443b965134db88467fc607b43 # v7
Expand Down Expand Up @@ -71,7 +72,7 @@ jobs:
cat ./playwright-output;
echo "$EOF";
echo "MASTER_SCREENSHOTS_OUTCOME<<$EOF";
cat ./master-screenshots-outcome;
[ -f ./master-screenshots-outcome ] && cat ./master-screenshots-outcome;
echo "$EOF";
echo "FAILED=$(jq -r '.stats.unexpected' playwright-results.json)";
echo "FLAKY=$(jq -r '.stats.flaky' playwright-results.json)";
Expand Down

0 comments on commit a573ddb

Please sign in to comment.