Skip to content

fix: update Playwright config to set working directory for the web server #1002

fix: update Playwright config to set working directory for the web server

fix: update Playwright config to set working directory for the web server #1002

Workflow file for this run

name: "Test"
on:
pull_request:
merge_group:
push:
branches:
- master
jobs:
test-controller:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-nix
with:
attic_token: ${{ secrets.ATTIC_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Configure poetry
run: |
nix develop .#ci --command poetry config virtualenvs.in-project true
- name: Cache the virtualenv
uses: actions/cache@v4
with:
path: ./controller/.venv
key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }}
- name: Cache dev env
uses: ./.github/actions/run-command-with-nix-cache-upload
with:
attic_token: ${{ secrets.ATTIC_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
script: |
nix develop .#ci --command echo "Cache dev env"
- name: Install dependencies
run: |
nix develop .#ci --command poetry install
working-directory: controller
- name: Run tests
run: |
nix develop .#ci --command poetry run python -m pytest -sxv
working-directory: controller
test-frontend-integration:
runs-on: ubuntu-22.04-arm
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-nix
with:
attic_token: ${{ secrets.ATTIC_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install dependencies
run: |
npm ci
working-directory: frontend
- name: Build application
uses: ./.github/actions/run-command-with-nix-cache-upload
with:
attic_token: ${{ secrets.ATTIC_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
script: |
nix build .#thymis-controller --print-build-logs
- name: Run tests
uses: ./.github/actions/run-command-with-nix-cache-upload
with:
attic_token: ${{ secrets.ATTIC_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
script: |
export THYMIS_FLAKE_ROOT='..'
nix develop .#onlyPlaywrightBrowsers --command npm run test 2>&1 | tee output.log
if grep -q -e "Error: A snapshot doesn't exist at" -e "Screenshot comparison failed" output.log; then
echo "Playwright tests failed due to a snapshot issue"
echo "SNAPSHOT_DIFFERENCES=true" >> $GITHUB_ENV
fi
if grep -q -E -e "[[:digit:]]+ failed" -e "was not able to start" output.log; then
echo "Playwright tests failed"
exit 1
fi
working-directory: frontend
- uses: actions/upload-artifact@v4
id: artifact-upload
if: always()
with:
name: playwright-report
path: frontend/playwright-report/
retention-days: 30
- name: Comment on PR with report link
uses: thollander/actions-comment-pull-request@v3
if: ${{ always() && github.event_name == 'pull_request' && env.SNAPSHOT_DIFFERENCES == 'true' }}
with:
message: |
### Playwright visual snapshot differences were detected.
View the [Playwright report](${{ steps.artifact-upload.outputs.artifact-url }}) to review the visual differences.
**To approve the snapshot changes and update the snapshots, please comment:** /approve-snapshots
comment-tag: playwright-snapshots
mode: recreate
test-frontend-integration-stable-input:
runs-on: ubuntu-22.04-arm
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-nix
with:
attic_token: ${{ secrets.ATTIC_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install dependencies
run: |
npm ci
working-directory: frontend
- name: Build application
uses: ./.github/actions/run-command-with-nix-cache-upload
with:
attic_token: ${{ secrets.ATTIC_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
script: |
nix build .#thymis-controller --print-build-logs
- name: Run tests
uses: ./.github/actions/run-command-with-nix-cache-upload
with:
attic_token: ${{ secrets.ATTIC_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
script: |
nix develop .#onlyPlaywrightBrowsers --command npm run test 2>&1 | tee output.log
if grep -q -e "Error: A snapshot doesn't exist at" -e "Screenshot comparison failed" output.log; then
echo "Playwright tests failed due to a snapshot issue"
echo "SNAPSHOT_DIFFERENCES=true" >> $GITHUB_ENV
fi
if grep -q -E -e "[[:digit:]]+ failed" -e "was not able to start" output.log; then
echo "Playwright tests failed"
exit 1
fi
working-directory: frontend
- uses: actions/upload-artifact@v4
id: artifact-upload
if: always()
with:
name: playwright-report-stable-input
path: frontend/playwright-report/
retention-days: 30
- name: Comment on PR with report link
uses: thollander/actions-comment-pull-request@v3
if: ${{ always() && github.event_name == 'pull_request' && env.SNAPSHOT_DIFFERENCES == 'true' }}
with:
message: |
### Playwright visual snapshot differences were detected.
View the [Playwright report](${{ steps.artifact-upload.outputs.artifact-url }}) to review the visual differences.
**To approve the snapshot changes and update the snapshots, please comment:** /approve-snapshots
comment-tag: playwright-snapshots
mode: recreate
test-pre-commit:
if: ${{ github.event_name != 'pull_request_target' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.13
- name: Install pre-commit
run: |
python -m pip install pre-commit
- name: Install node dependencies
run: |
npm ci
working-directory: frontend
- name: Run pre-commit
run: |
pre-commit run --all-files