diff --git a/.github/screenshot-bot.config.toml b/.github/screenshot-bot.config.toml index 8b0465027d64..63258542591c 100644 --- a/.github/screenshot-bot.config.toml +++ b/.github/screenshot-bot.config.toml @@ -22,4 +22,4 @@ branchesIgnore = ["^release/.*", "^v[0-9].x$"] screenshotImageAttrs = [] # Text which is placed at the beginning of section "Failed tests" -failedTestsReportDescription = '### Before (main) <= Diff => After (local)' +failedTestsReportDescription = '

Before (main) ← Diff → After (local)

' diff --git a/.github/workflows/e2e-cypress.yml b/.github/workflows/e2e-cypress.yml deleted file mode 100644 index 71566025f4bb..000000000000 --- a/.github/workflows/e2e-cypress.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: ⚙️ Cypress component testing -on: - pull_request: - push: - branches: - - main - -jobs: - cypress: - if: ${{ !contains(github.head_ref, 'release/') }} - runs-on: ubuntu-latest - name: Component testing result - steps: - - uses: actions/checkout@v4.2.0 - - uses: taiga-family/ci/actions/setup/variables@v1.93.1 - - uses: taiga-family/ci/actions/setup/node@v1.93.1 - - run: npx tsc -p projects/demo-cypress/tsconfig.json - - run: npx nx component-test demo-cypress - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true diff --git a/.github/workflows/e2e-playwright.yml b/.github/workflows/e2e.yml similarity index 64% rename from .github/workflows/e2e-playwright.yml rename to .github/workflows/e2e.yml index 93ebc188b76b..3757b0d3b772 100644 --- a/.github/workflows/e2e-playwright.yml +++ b/.github/workflows/e2e.yml @@ -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/checkout@v4.2.0 + with: + ref: ${{ github.base_ref }} + - uses: taiga-family/ci/actions/setup/variables@v1.93.0 + - uses: taiga-family/ci/actions/setup/node@v1.93.0 + + - name: Run tests for baseline state + run: npx nx component-test demo-cypress + + - name: Save Cypress Baseline Snapshots + uses: actions/upload-artifact@v4.4.0 + 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/checkout@v4.2.0 + - uses: taiga-family/ci/actions/setup/variables@v1.93.0 + - uses: taiga-family/ci/actions/setup/node@v1.93.0 + + - name: Download Cypress Baseline Snapshots + uses: actions/download-artifact@v4.1.8 + 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/upload-artifact@v4.4.0 + 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/checkout@v4.2.0 - uses: taiga-family/ci/actions/setup/variables@v1.93.1 @@ -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/checkout@v4.2.0 - uses: taiga-family/ci/actions/setup/variables@v1.93.1 - - name: Download artifacts / ${{ env.PLAYWRIGHT_SNAPSHOTS_ARTIFACTS_KEY }} + - name: Download artifacts for Playwright continue-on-error: true uses: actions/download-artifact@v4.1.8 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/download-artifact@v4.1.8 + 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: | diff --git a/projects/demo-cypress/cypress-image-diff.config.js b/projects/demo-cypress/cypress-image-diff.config.js index d7f30e063186..a8a11bd2b4f9 100644 --- a/projects/demo-cypress/cypress-image-diff.config.js +++ b/projects/demo-cypress/cypress-image-diff.config.js @@ -6,4 +6,7 @@ module.exports = { FILENAME: 'report-summary', OVERWRITE: true, }, + RETRY_OPTIONS: { + doNotFail: process.env.CI || false, + }, }; diff --git a/projects/demo-cypress/src/tests/input-phone-international.cy.ts b/projects/demo-cypress/src/tests/input-phone-international.cy.ts index fe35c7b6701f..d30189390dc3 100644 --- a/projects/demo-cypress/src/tests/input-phone-international.cy.ts +++ b/projects/demo-cypress/src/tests/input-phone-international.cy.ts @@ -29,7 +29,7 @@ import {createOutputSpy} from 'cypress/angular'; [formControl]="control" [(countryIsoCode)]="countryIsoCode" > - + `, diff --git a/projects/demo/src/modules/components/chip/examples/4/index.html b/projects/demo/src/modules/components/chip/examples/4/index.html index 190f7ac64bcd..4cb4a07097b7 100644 --- a/projects/demo/src/modules/components/chip/examples/4/index.html +++ b/projects/demo/src/modules/components/chip/examples/4/index.html @@ -3,7 +3,7 @@ class="fade" >
Very long value in chip
-
{{ 123456 | tuiAmount: 'RUB' | async }}
+
{{ 123000 | tuiAmount: 'RUB' | async }}
{ - console.info('canvas:', version); - const images = await Promise.all(imagesPaths.map(loadImage)); const totalWidth = images.reduce((acc: number, {width}) => acc + width, 0); const maxHeight = Math.max(...images.map(({height}) => height));