Update Browser Tests Expectations #8
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
# Inspired by: https://github.com/Comfy-Org/ComfyUI_frontend/blob/57701f6145f622bf17237410c165966fb4aecc75/.github/workflows/test-browser-exp.yaml | |
name: Update Browser Tests Expectations | |
# Run on PR merged into master or manually triggered, can assume this always runs on master | |
# But since master is protected, updated images need to push to a dedicated branch and PR to master | |
on: | |
workflow_dispatch: | |
jobs: | |
update_browser_expectations: | |
if: github.event.pull_request.merged || github.event_name == 'workflow_dispatch' | |
runs-on: ubuntu-latest | |
steps: | |
# Ref: https://github.com/orgs/community/discussions/25199#discussioncomment-3246802 | |
- name: Get latest ComfyUI release with tag | |
id: latestrelease | |
run: | | |
echo "comfy_latest_release=$(curl -s https://api.github.com/repos/comfyanonymous/ComfyUI/releases/latest | jq '.tag_name' | sed 's/\"//g')" >> $GITHUB_OUTPUT | |
- name: Checkout ComfyUI | |
uses: actions/checkout@v4 | |
with: | |
repository: comfyanonymous/ComfyUI | |
ref: ${{ steps.latestrelease.outputs.comfy_latest_release }} | |
path: ComfyUI | |
- name: Checkout BizyAir | |
uses: actions/checkout@v4 | |
with: | |
repository: siliconflow/BizyAir | |
ref: master | |
path: ComfyUI/custom_nodes/BizyAir | |
- name: Checkout bizyair_frontend | |
uses: actions/checkout@v4 | |
with: | |
repository: siliconflow/bizyair_frontend | |
path: ComfyUI/custom_nodes/BizyAir/bizyair_frontend | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.12' | |
cache: 'pip' | |
cache-dependency-path: | | |
ComfyUI/requirements.txt | |
ComfyUI/custom_nodes/BizyAir/requirements.txt | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20.9.0' | |
cache: 'npm' | |
cache-dependency-path: | | |
ComfyUI/custom_nodes/BizyAir/bizyair_frontend/browser_tests/package-lock.json | |
ComfyUI/custom_nodes/BizyAir/bizyair_frontend/package-lock.json | |
- name: Install dependencies | |
run: | | |
pip install -r ComfyUI/requirements.txt | |
pip install -r ComfyUI/custom_nodes/BizyAir/requirements.txt | |
pip install wait-for-it | |
- name: Install playwright | |
run: | | |
npm install | |
npx playwright install chromium --with-deps | |
working-directory: ComfyUI/custom_nodes/BizyAir/bizyair_frontend/browser_tests | |
- name: Install bizyair_frontend dependencies | |
run: | | |
npm install | |
working-directory: ComfyUI/custom_nodes/BizyAir/bizyair_frontend | |
- name: Copy over test setup files | |
run: | | |
mkdir -p ComfyUI/user/default | |
cp -r ComfyUI/custom_nodes/BizyAir/bizyair_frontend/browser_tests/workflows ComfyUI/user/default | |
cp ComfyUI/custom_nodes/BizyAir/bizyair_frontend/browser_tests/api_key.ini ComfyUI/custom_nodes/BizyAir/api_key.ini | |
- name: Update bizyair_frontend.js | |
run: | | |
npx vue-tsc -b | |
npx vite build | |
working-directory: ComfyUI/custom_nodes/BizyAir/bizyair_frontend | |
- name: Start ComfyUI server | |
run: | | |
python main.py --cpu & | |
wait-for-it --service 127.0.0.1:8188 -t 600 | |
working-directory: ComfyUI | |
- name: Run Playwright tests and update snapshots | |
run: | | |
npx playwright test --update-snapshots --project chromium chromium-2x --workers=4 | |
working-directory: ComfyUI/custom_nodes/BizyAir/bizyair_frontend/browser_tests | |
- uses: actions/upload-artifact@v4 | |
if: success() || failure() | |
with: | |
name: playwright-report | |
path: ComfyUI/custom_nodes/BizyAir/bizyair_frontend/browser_tests/playwright-report/ | |
retention-days: 30 | |
- name: Debugging info | |
if: success() | |
run: | | |
git status | |
working-directory: ComfyUI/custom_nodes/BizyAir/bizyair_frontend/browser_tests | |
# Use a dedicated branch to update test expectations | |
- name: Commit updated expectations | |
if: success() | |
run: | | |
git config --global user.name 'github-actions' | |
git config --global user.email 'github-actions@github.com' | |
git fetch | |
git checkout -b update_snapshots origin/update_snapshots | |
git add . | |
git commit -m "Update test expectations [skip ci]" | |
git push | |
gh pr create --title "Update test expectations" --body "Update test expectations" --base master --head update_snapshots | |
working-directory: ComfyUI/custom_nodes/BizyAir/bizyair_frontend/browser_tests |