ci: attach Cypress CT diff-snapshots to CI report #7182
Workflow file for this 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
name: ⚙️ Cypress component 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' | |
jobs: | |
cypress: | |
runs-on: ubuntu-latest | |
name: Component testing result | |
steps: | |
- uses: actions/[email protected] | |
- uses: actions/[email protected] | |
with: | |
ref: ${{ github.base_ref }} | |
path: ${{ env.CYPRESS_BASELINE_REPO }} | |
- uses: taiga-family/ci/actions/setup/[email protected] | |
- uses: taiga-family/ci/actions/setup/[email protected] | |
- name: Share node_modules between current and baseline repos | |
run: | | |
cp -r node_modules ${{ env.CYPRESS_BASELINE_REPO }}/node_modules | |
tree -d -L 1 | |
tree -d ${{ env.CYPRESS_BASELINE_REPO }} -L 1 | |
- name: Run tests for baseline state | |
run: | | |
cd ${{ env.CYPRESS_BASELINE_REPO }} | |
tree ${{env.CYPRESS_CACHE_FOLDER}} -L 4 | |
npx nx component-test demo-cypress | |
cd ../ | |
mkdir -p ${{ env.CYPRESS_BASELINE_SNAPSHOTS }} && cp -r ${{ env.CYPRESS_BASELINE_REPO }}/${{env.CYPRESS_BASELINE_SNAPSHOTS }}/. ${{ env.CYPRESS_BASELINE_SNAPSHOTS }} | |
rm -r ${{ env.CYPRESS_BASELINE_REPO }} | |
- 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 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true |