mirror of
https://github.com/suitenumerique/docs
synced 2026-04-21 13:37:20 +00:00
⚡️(e2e) replay only failed tests when rerunning the test suite
We improved the test suite to only replay failed tests when rerunning the test suite. This allows us to focus on fixing the failed tests without having to wait for the entire test suite to run again. We add the Browser in cache to speed up the test execution and reduce the time it takes to run the tests.
This commit is contained in:
parent
a01c5f97ca
commit
52c998ee5f
1 changed files with 136 additions and 11 deletions
147
.github/workflows/impress-frontend.yml
vendored
147
.github/workflows/impress-frontend.yml
vendored
|
|
@ -66,9 +66,54 @@ jobs:
|
|||
- name: Check linting
|
||||
run: cd src/frontend/ && yarn lint
|
||||
|
||||
test-e2e-chromium:
|
||||
prepare-e2e:
|
||||
runs-on: ubuntu-latest
|
||||
needs: install-dependencies
|
||||
timeout-minutes: 10
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: "22.x"
|
||||
|
||||
- name: Restore the frontend cache
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: "src/frontend/**/node_modules"
|
||||
key: front-node_modules-${{ hashFiles('src/frontend/**/yarn.lock') }}
|
||||
fail-on-cache-miss: true
|
||||
|
||||
- name: Restore Playwright browsers cache
|
||||
id: playwright-cache
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: ~/.cache/ms-playwright
|
||||
key: playwright-${{ runner.os }}-${{ hashFiles('src/frontend/yarn.lock', 'src/frontend/apps/e2e/yarn.lock') }}
|
||||
restore-keys: |
|
||||
playwright-${{ runner.os }}-
|
||||
|
||||
- name: Install Playwright browsers
|
||||
if: steps.playwright-cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
cd src/frontend/apps/e2e
|
||||
yarn install-playwright chromium firefox webkit
|
||||
|
||||
- name: Save Playwright browsers cache
|
||||
if: steps.playwright-cache.outputs.cache-hit != 'true'
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: ~/.cache/ms-playwright
|
||||
key: ${{ steps.playwright-cache.outputs.cache-primary-key }}
|
||||
|
||||
test-e2e-chromium:
|
||||
runs-on: ubuntu-latest
|
||||
needs: prepare-e2e
|
||||
timeout-minutes: 20
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
|
|
@ -89,8 +134,12 @@ jobs:
|
|||
- name: Set e2e env variables
|
||||
run: cat env.d/development/common.e2e >> env.d/development/common.local
|
||||
|
||||
- name: Install Playwright Browsers
|
||||
run: cd src/frontend/apps/e2e && yarn install --frozen-lockfile && yarn install-playwright chromium
|
||||
- name: Restore Playwright browsers cache
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: ~/.cache/ms-playwright
|
||||
key: playwright-${{ runner.os }}-${{ hashFiles('src/frontend/yarn.lock', 'src/frontend/apps/e2e/yarn.lock') }}
|
||||
fail-on-cache-miss: true
|
||||
|
||||
- name: Free disk space before Docker
|
||||
uses: ./.github/actions/free-disk-space
|
||||
|
|
@ -98,10 +147,46 @@ jobs:
|
|||
- name: Start Docker services
|
||||
run: make bootstrap-e2e FLUSH_ARGS='--no-input'
|
||||
|
||||
- name: Run e2e tests
|
||||
run: cd src/frontend/ && yarn e2e:test --project='chromium'
|
||||
- name: Restore last-run cache
|
||||
if: ${{ github.run_attempt > 1 }}
|
||||
id: restore-last-run
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: src/frontend/apps/e2e/test-results/.last-run.json
|
||||
key: playwright-last-run-${{ github.run_id }}-chromium
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
- name: Run e2e tests
|
||||
env:
|
||||
PLAYWRIGHT_LIST_PRINT_STEPS: true
|
||||
FORCE_COLOR: true
|
||||
run: |
|
||||
cd src/frontend/
|
||||
|
||||
LAST_FAILED_FLAG=""
|
||||
if [ "${{ github.run_attempt }}" != "1" ]; then
|
||||
LAST_FAILED_FLAG="--last-failed"
|
||||
fi
|
||||
|
||||
yarn e2e:test --project='chromium' $LAST_FAILED_FLAG
|
||||
|
||||
- name: Save last-run cache
|
||||
if: always()
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: src/frontend/apps/e2e/test-results/.last-run.json
|
||||
key: playwright-last-run-${{ github.run_id }}-chromium
|
||||
|
||||
- name: Upload last-run artifact
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: playwright-instance-last-run-chromium
|
||||
path: src/frontend/apps/e2e/test-results/.last-run.json
|
||||
include-hidden-files: true
|
||||
if-no-files-found: warn
|
||||
retention-days: 7
|
||||
|
||||
- uses: actions/upload-artifact@v6
|
||||
if: always()
|
||||
with:
|
||||
name: playwright-chromium-report
|
||||
|
|
@ -131,8 +216,12 @@ jobs:
|
|||
- name: Set e2e env variables
|
||||
run: cat env.d/development/common.e2e >> env.d/development/common.local
|
||||
|
||||
- name: Install Playwright Browsers
|
||||
run: cd src/frontend/apps/e2e && yarn install --frozen-lockfile && yarn install-playwright firefox webkit chromium
|
||||
- name: Restore Playwright browsers cache
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: ~/.cache/ms-playwright
|
||||
key: playwright-${{ runner.os }}-${{ hashFiles('src/frontend/yarn.lock', 'src/frontend/apps/e2e/yarn.lock') }}
|
||||
fail-on-cache-miss: true
|
||||
|
||||
- name: Free disk space before Docker
|
||||
uses: ./.github/actions/free-disk-space
|
||||
|
|
@ -140,10 +229,46 @@ jobs:
|
|||
- name: Start Docker services
|
||||
run: make bootstrap-e2e FLUSH_ARGS='--no-input'
|
||||
|
||||
- name: Run e2e tests
|
||||
run: cd src/frontend/ && yarn e2e:test --project=firefox --project=webkit
|
||||
- name: Restore last-run cache
|
||||
if: ${{ github.run_attempt > 1 }}
|
||||
id: restore-last-run
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: src/frontend/apps/e2e/test-results/.last-run.json
|
||||
key: playwright-last-run-${{ github.run_id }}-other-browser
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
- name: Run e2e tests
|
||||
env:
|
||||
PLAYWRIGHT_LIST_PRINT_STEPS: true
|
||||
FORCE_COLOR: true
|
||||
run: |
|
||||
cd src/frontend/
|
||||
|
||||
LAST_FAILED_FLAG=""
|
||||
if [ "${{ github.run_attempt }}" != "1" ]; then
|
||||
LAST_FAILED_FLAG="--last-failed"
|
||||
fi
|
||||
|
||||
yarn e2e:test --project=firefox --project=webkit $LAST_FAILED_FLAG
|
||||
|
||||
- name: Save last-run cache
|
||||
if: always()
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: src/frontend/apps/e2e/test-results/.last-run.json
|
||||
key: playwright-last-run-${{ github.run_id }}-other-browser
|
||||
|
||||
- name: Upload last-run artifact
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: playwright-instance-last-run-other-browser
|
||||
path: src/frontend/apps/e2e/test-results/.last-run.json
|
||||
include-hidden-files: true
|
||||
if-no-files-found: warn
|
||||
retention-days: 7
|
||||
|
||||
- uses: actions/upload-artifact@v6
|
||||
if: always()
|
||||
with:
|
||||
name: playwright-other-report
|
||||
|
|
|
|||
Loading…
Reference in a new issue