-
Notifications
You must be signed in to change notification settings - Fork 472
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: attach Cypress CT diff-snapshots to CI report (#9293)
- Loading branch information
1 parent
b22e9c2
commit 2c9a668
Showing
7 changed files
with
81 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
name: ⚙️ Playwright E2E testing | ||
name: ⚙️ E2E testing | ||
on: | ||
pull_request: | ||
|
||
env: | ||
CYPRESS_BASELINE_REPO: 'baseline' | ||
CYPRESS_RESULTS_FOLDER: 'projects/demo-cypress/tests-results' | ||
CYPRESS_BASELINE_SNAPSHOTS: 'projects/demo-cypress/tests-results/snapshots/baseline' | ||
CYPRESS_BASELINE_SNAPSHOTS_KEY: 'cy_baseline_${{ github.event.pull_request.head.sha }}' | ||
|
||
jobs: | ||
build-demo: | ||
if: ${{ !contains(github.head_ref , 'release/') }} | ||
|
@@ -25,6 +31,60 @@ jobs: | |
path: dist/demo | ||
key: ${{ env.CACHE_DIST_KEY }} | ||
|
||
cypress: | ||
runs-on: ubuntu-latest | ||
name: Cypress / Component Testing | ||
steps: | ||
- uses: actions/[email protected] | ||
with: | ||
ref: ${{ github.base_ref }} | ||
- uses: taiga-family/ci/actions/setup/[email protected] | ||
- uses: taiga-family/ci/actions/setup/[email protected] | ||
|
||
- name: Run tests for baseline state | ||
run: npx nx component-test demo-cypress | ||
|
||
- name: Save Cypress Baseline Snapshots | ||
uses: actions/[email protected] | ||
with: | ||
path: ${{env.CYPRESS_BASELINE_SNAPSHOTS}} | ||
name: ${{env.CYPRESS_BASELINE_SNAPSHOTS_KEY}} | ||
if-no-files-found: ignore | ||
compression-level: 0 | ||
retention-days: 1 | ||
|
||
- uses: actions/[email protected] | ||
- uses: taiga-family/ci/actions/setup/[email protected] | ||
- uses: taiga-family/ci/actions/setup/[email protected] | ||
|
||
- name: Download Cypress Baseline Snapshots | ||
uses: actions/[email protected] | ||
with: | ||
path: ${{env.CYPRESS_BASELINE_SNAPSHOTS}} | ||
pattern: ${{ env.CYPRESS_BASELINE_SNAPSHOTS_KEY }} | ||
merge-multiple: true | ||
|
||
- name: Run tests for current state | ||
run: npx nx component-test demo-cypress | ||
|
||
- name: Prepare diff screenshots | ||
run: | | ||
npm install canvas | ||
npx ts-node ./scripts/visual-testing/combine-cypress-failed-screenshots.ts | ||
- name: Debug output | ||
continue-on-error: true | ||
run: tree ${{ env.CYPRESS_RESULTS_FOLDER }} -L 1 | ||
|
||
- name: Upload artifacts | ||
uses: actions/[email protected] | ||
with: | ||
path: '${{ env.CYPRESS_RESULTS_FOLDER }}/**/*.diff.png' | ||
name: ${{ env.CYPRESS_SNAPSHOTS_ARTIFACTS_KEY }} | ||
if-no-files-found: ignore | ||
compression-level: 0 | ||
retention-days: 1 | ||
|
||
playwright: | ||
if: ${{ !contains(github.head_ref , 'release/') }} | ||
runs-on: ubuntu-latest | ||
|
@@ -34,7 +94,7 @@ jobs: | |
matrix: | ||
shardIndex: [1, 2, 3, 4, 5, 6, 7, 8, 9] | ||
shardTotal: [9] | ||
name: playwright / (${{ matrix.shardIndex }} of ${{ matrix.shardTotal }}) | ||
name: Playwright / (${{ matrix.shardIndex }} of ${{ matrix.shardTotal }}) | ||
steps: | ||
- uses: actions/[email protected] | ||
- uses: taiga-family/ci/actions/setup/[email protected] | ||
|
@@ -74,6 +134,7 @@ jobs: | |
- name: Combine images to get diff reports | ||
run: | | ||
npm install canvas | ||
npm view canvas version | ||
npx ts-node ./scripts/visual-testing/combine-playwright-failed-screenshots.ts | ||
- name: Debug output | ||
|
@@ -112,13 +173,13 @@ jobs: | |
result: | ||
if: ${{ !contains(github.head_ref , 'release/') }} | ||
name: E2E result | ||
needs: [playwright] | ||
needs: [playwright, cypress] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/[email protected] | ||
- uses: taiga-family/ci/actions/setup/[email protected] | ||
|
||
- name: Download artifacts / ${{ env.PLAYWRIGHT_SNAPSHOTS_ARTIFACTS_KEY }} | ||
- name: Download artifacts for Playwright | ||
continue-on-error: true | ||
uses: actions/[email protected] | ||
with: | ||
|
@@ -127,6 +188,15 @@ jobs: | |
merge-multiple: true | ||
- run: ls -R ./total/playwright || echo "not found" | ||
|
||
- name: Download artifacts for Cypress | ||
continue-on-error: true | ||
uses: actions/[email protected] | ||
with: | ||
path: ./total/cypress | ||
pattern: ${{ env.CYPRESS_SNAPSHOTS_ARTIFACTS_KEY }} | ||
merge-multiple: true | ||
- run: ls -R ./total/cypress || echo "not found" | ||
|
||
- name: Check if diff-output exists | ||
id: diff_checker | ||
run: | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters