|
| 1 | +name: UI Tests |
| 2 | + |
| 3 | +on: [push, pull_request] |
| 4 | + |
| 5 | +defaults: |
| 6 | + run: |
| 7 | + shell: bash -l {0} |
| 8 | + |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + name: Build |
| 12 | + runs-on: ubuntu-latest |
| 13 | + |
| 14 | + steps: |
| 15 | + - name: Checkout |
| 16 | + uses: actions/checkout@v4 |
| 17 | + |
| 18 | + - name: Install Conda environment with Micromamba |
| 19 | + uses: mamba-org/setup-micromamba@v1 |
| 20 | + with: |
| 21 | + micromamba-version: '1.5.1-0' |
| 22 | + environment-file: environment.yml |
| 23 | + cache-environment: true |
| 24 | + |
| 25 | + - name: Install jupyterlite-xeus-python |
| 26 | + run: | |
| 27 | + jlpm |
| 28 | + jlpm run build |
| 29 | + python -m pip install -v . |
| 30 | +
|
| 31 | + - name: Build UI tests |
| 32 | + run: | |
| 33 | + cd ui-tests |
| 34 | + jlpm |
| 35 | + # Build the JupyterLite website |
| 36 | + jlpm build |
| 37 | +
|
| 38 | + - name: Upload the JupyterLite website |
| 39 | + uses: actions/upload-artifact@v3 |
| 40 | + with: |
| 41 | + name: jupyterlite-xeus-python-ui-tests-app-${{ github.run_number }} |
| 42 | + path: ./ui-tests/ui-tests-app |
| 43 | + |
| 44 | + ui-tests: |
| 45 | + needs: [build] |
| 46 | + name: Visual Regression |
| 47 | + runs-on: ubuntu-latest |
| 48 | + strategy: |
| 49 | + fail-fast: false |
| 50 | + matrix: |
| 51 | + browser: [firefox, chromium] |
| 52 | + steps: |
| 53 | + - name: Checkout |
| 54 | + uses: actions/checkout@v4 |
| 55 | + |
| 56 | + - uses: actions/download-artifact@v3 |
| 57 | + with: |
| 58 | + name: jupyterlite-xeus-python-ui-tests-app-${{ github.run_number }} |
| 59 | + path: ./ui-tests/ui-tests-app |
| 60 | + |
| 61 | + - name: Base Setup |
| 62 | + uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 |
| 63 | + |
| 64 | + - name: Install dependencies and browser |
| 65 | + run: | |
| 66 | + # Install JupyterLab to get jlpm |
| 67 | + python -m pip install jupyterlab~=4.0 |
| 68 | + cd ui-tests |
| 69 | + jlpm |
| 70 | + jlpm playwright install ${{ matrix.browser }} --with-deps |
| 71 | +
|
| 72 | + - name: Test |
| 73 | + run: | |
| 74 | + cd ui-tests |
| 75 | + jlpm run test --browser ${{ matrix.browser }} |
| 76 | +
|
| 77 | + - name: Upload Playwright Test assets |
| 78 | + if: always() |
| 79 | + uses: actions/upload-artifact@v3 |
| 80 | + with: |
| 81 | + name: jupyterlite-xeux-python-${{ matrix.browser }}-test-assets |
| 82 | + path: | |
| 83 | + ui-tests/test-results |
| 84 | +
|
| 85 | + - name: Upload Playwright Test report |
| 86 | + if: always() |
| 87 | + uses: actions/upload-artifact@v3 |
| 88 | + with: |
| 89 | + name: jupyterlite-xeus-python-${{ matrix.browser }}-test-report |
| 90 | + path: | |
| 91 | + ui-tests/playwright-report |
| 92 | +
|
| 93 | + - name: Update snapshots |
| 94 | + if: failure() |
| 95 | + run: | |
| 96 | + cd ui-tests |
| 97 | + # remove previous snapshots from other browser |
| 98 | + jlpm run clean:snapshots |
| 99 | + # generate new snapshots |
| 100 | + jlpm run test:update --browser ${{ matrix.browser }} |
| 101 | +
|
| 102 | + - name: Upload updated snapshots |
| 103 | + if: failure() |
| 104 | + uses: actions/upload-artifact@v3 |
| 105 | + with: |
| 106 | + name: jupyterlite-xeus-python-${{ matrix.browser }}-updated-snapshots |
| 107 | + path: ui-tests/test |
0 commit comments