Add playwright browser test (#48)

* Add playwright

* Add test:browser command

* Remove test examples

* Add basic node tests

* Add drag node test

* Merge workflows

* nit

* Localize jest

* Add local config

* Change working dir

* Use consistent fonts

* Fix emoji fonts

* Update github action to save expectation

* update on test failure

* push to head

* Update test expectations [skip ci]

---------

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Chenlei Hu
2024-06-24 09:41:40 -04:00
committed by GitHub
parent 3ace859106
commit 51b925f7ef
13 changed files with 370 additions and 8 deletions

View File

@@ -1,8 +1,10 @@
name: Tests CI
on:
- push
- pull_request
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
jobs:
test:
@@ -19,9 +21,19 @@ jobs:
with:
repository: "huchenlei/ComfyUI_frontend"
path: "ComfyUI_frontend"
ref: ${{ github.head_ref }}
- name: Get commit message
id: commit-message
run: echo "::set-output name=message::$(git log -1 --pretty=%B)"
working-directory: ComfyUI_frontend
- name: Skip CI
if: contains(steps.commit-message.outputs.message, '[skip ci]')
run: echo "Skipping CI as commit contains '[skip ci]'"
continue-on-error: true
working-directory: ComfyUI_frontend
- uses: actions/setup-node@v3
with:
node-version: 18
node-version: lts/*
- uses: actions/setup-python@v4
with:
python-version: '3.10'
@@ -32,14 +44,49 @@ jobs:
pip install -r requirements.txt
pip install wait-for-it
working-directory: ComfyUI
- name: Build & Install ComfyUI_frontend
run: |
npm ci
npm run build
rm -rf ../ComfyUI/web/*
mv dist/* ../ComfyUI/web/
working-directory: ComfyUI_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 UI tests
run: |
wait-for-it --service 127.0.0.1:8188 -t 600
npm ci
npm run test:generate
npm test -- --verbose
working-directory: ComfyUI_frontend
- name: Install Playwright Browsers
run: npx playwright install --with-deps
working-directory: ComfyUI_frontend
- name: Run Playwright tests
id: playwright-tests
run: npx playwright test
continue-on-error: true
working-directory: ComfyUI_frontend
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: ComfyUI_frontend/playwright-report/
retention-days: 30
- name: Debugging info
run: |
echo "Branch: ${{ github.head_ref }}"
git status
working-directory: ComfyUI_frontend
- name: Commit updated expectations
if: steps.playwright-tests.outcome == 'failure' && contains(github.event.pull_request.labels.*.name, 'New Browser Test Expectations')
# Pushes back to the source branch of the PR
run: |
git config --global user.name 'github-actions'
git config --global user.email 'github-actions@github.com'
git add browser_tests
git commit -m "Update test expectations [skip ci]"
git push origin HEAD:${{ github.head_ref }}
working-directory: ComfyUI_frontend