Skip to content

Commit

Permalink
Backport PR #12040: Update Playwright snapshots from PR comments (#12403
Browse files Browse the repository at this point in the history
)
  • Loading branch information
fcollonval committed Apr 14, 2022
1 parent c1caba5 commit fc78ad3
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 14 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/galata-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Update Playwright Snapshots

on:
issue_comment:
types: [created, edited]

permissions:
contents: write
pull-requests: write

jobs:
update-galata-snapshots:
name: Update Galata References
if: ${{ github.event.issue.pull_request && (contains(github.event.comment.body, 'please update galata snapshots') || contains(github.event.comment.body, 'please update snapshots')) }}
timeout-minutes: 80
runs-on: ubuntu-20.04

steps:
- name: Checkout
uses: actions/checkout@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Configure git to use https
run: git config --global hub.protocol https

- name: Checkout the branch from the PR that triggered the job
run: hub pr checkout ${{ github.event.issue.number }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1

- name: Install dependencies
run: |
bash ./scripts/ci_install.sh
# Build dev-mode
jlpm run build
- uses: jupyterlab/maintainer-tools/.github/actions/update-snapshots@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
server_url: http-get://localhost:8888/lab
test_folder: galata
13 changes: 0 additions & 13 deletions .github/workflows/galata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,6 @@ jobs:
path: |
galata/playwright-report
- name: Update snapshots
if: failure()
run: |
cd galata
jlpm run test:update
- name: Upload updated snapshots
if: failure()
uses: actions/upload-artifact@v2
with:
name: jupyterlab-galata-updated-snapshots
path: galata/test/**/*-snapshots/*.*

- name: Print JupyterLab logs
if: always()
run: |
Expand Down
8 changes: 7 additions & 1 deletion docs/source/developer/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,13 @@ Main reasons for UI test failures are:

2. **An intended update to user interface**:

If your code change is introducing an update to UI which causes existing UI Tests to fail, then you will need to update reference image(s) for the failing tests. In order to do that, simply go to GitHub Actions page for the failed test and download test artifacts. It will contain test captures in directory ``test/screenshots``. You can copy the capture for the failed test and paste into reference screenshots directory in JupyterLab source code, replacing the failing test's reference capture. Reference captures are located in ``ui-tests/reference-output/screenshots`` in JupyterLab source code.
If your code change is introducing an update to UI which causes existing UI Tests to
fail, then you will need to update reference image(s) for the failing tests. In order
to do that, you can post a comment on your PR with the following content:

- ``please update galata snapshots``: A bot will push a new commit to your PR updating galata
test snaphsots.
- ``please update snapshots``: Combine the two previous comments effects.

For more information on UI Testing, please read the `UI Testing developer documentation <https://github.com/jupyterlab/jupyterlab/blob/3.3.x/galata/README.md>`__ and `Galata documentation <https://github.com/jupyterlab/galata/blob/main/README.md>`__.

Expand Down

0 comments on commit fc78ad3

Please sign in to comment.