Skip to content

Commit

Permalink
[1.x] Fix CI, run lint, reduce end-to-end tests flakiness (#425)
Browse files Browse the repository at this point in the history
* modify the commit for 1.x

* Fix CI, run lint, reduce end-to-end tests flakiness (#417)

* add macos tests

* add locally-generated snapshots

* check if filebrowser is already open before opening it

* add actual snapshoy from CI

* Update Playwright Snapshots

* use notebook toolbar, mask bttns on the right

* correct selector

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* run lint

* Update Playwright Snapshots

* timestampLocator -> timestamp

* wait until fonts are ready before taking a snapshot

* add maxDiffPixels

* Revert "wait until fonts are ready before taking a snapshot"

This reverts commit 9554559.

* pin jupyterlab version for e2e tests and snapshots

* remove macos tests

* rename relevant job to end-to-end test

* remove darwin/macos snapshots

* specify jupyterlab version correctly

* run lint

* add jlpm install to Lint the extension step

* remove ubuntu postfix from test report

* Make e2e tests a separate file

* add build steps

* pin version of jupyterlab in e2e test file

* introduce modifyListResponse, remove maxDiffPixels

* modifyListResponse -> setJobList

* set expected URL

* always set create_time to 1

* update list view snapshot

* run check option for lint

* run lint locally

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* fix install chromium command

* remove playwrght from dev dependencies

* fix comma

* Roll back 402 changes

* roll back changes to build.yml

* run lint

* update snapshots

* remove integration step

* reinstate d423ede

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Aug 15, 2023
1 parent 73ee948 commit 3efcbb4
Show file tree
Hide file tree
Showing 17 changed files with 342 additions and 197 deletions.
59 changes: 2 additions & 57 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ jobs:
- name: Lint the extension
run: |
set -eux
jlpm
jlpm install
jlpm run lint:check
- name: Test the extension
run: |
Expand Down Expand Up @@ -94,59 +95,3 @@ jobs:
jupyter labextension list
jupyter labextension list 2>&1 | grep -ie "@jupyterlab/scheduler.*OK"
python -m jupyterlab.browser_check --no-chrome-test
integration-tests:
name: Integration tests
needs: build
runs-on: ubuntu-latest

env:
PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/pw-browsers

steps:
- name: Checkout
uses: actions/checkout@v2

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

- name: Download extension package
uses: actions/download-artifact@v2
with:
name: extension-artifacts

- name: Install the extension
run: |
set -eux
python -m pip install "jupyterlab~=3.1" jupyter_scheduler*.whl
- name: Install dependencies
working-directory: ui-tests
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run: jlpm install

- name: Set up browser cache
uses: actions/cache@v2
with:
path: |
${{ github.workspace }}/pw-browsers
key: ${{ runner.os }}-${{ hashFiles('ui-tests/yarn.lock') }}

- name: Install browser
run: jlpm playwright install chromium
working-directory: ui-tests

- name: Execute integration tests
working-directory: ui-tests
run: |
jlpm playwright test
- name: Upload Playwright Test report
if: always()
uses: actions/upload-artifact@v2
with:
name: jupyter_scheduler-playwright-tests
path: |
ui-tests/test-results
ui-tests/playwright-report
71 changes: 71 additions & 0 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: E2E Tests

# suppress warning raised by https://github.com/jupyter/jupyter_core/pull/292
env:
JUPYTER_PLATFORM_DIRS: '1'

on:
push:
branches: main
pull_request:
branches: '*'

jobs:
e2e-tests:
name: Linux
runs-on: ubuntu-latest

env:
PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/pw-browsers

steps:
- name: Checkout
uses: actions/checkout@v2

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

- name: Install extension dependencies
run: python -m pip install -U jupyterlab~=3.1

- name: Build the extension
run: |
set -eux
python -m pip install .
jupyter server extension list
jupyter server extension list 2>&1 | grep -ie "jupyter_scheduler.*OK"
jupyter labextension list
jupyter labextension list 2>&1 | grep -ie "@jupyterlab/scheduler.*OK"
python -m jupyterlab.browser_check
- name: Install ui-tests dependencies
working-directory: ui-tests
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run: jlpm install

- name: Set up browser cache
uses: actions/cache@v2
with:
path: |
${{ github.workspace }}/pw-browsers
key: ${{ runner.os }}-${{ hashFiles('ui-tests/yarn.lock') }}

- name: Install browser
working-directory: ui-tests
run: jlpm playwright install chromium

- name: Execute integration tests
working-directory: ui-tests
run: jlpm test

- name: Upload Playwright Test report
if: always()
uses: actions/upload-artifact@v2
with:
name: jupyter_scheduler-playwright-tests-linux
path: |
ui-tests/test-results
ui-tests/playwright-report
14 changes: 9 additions & 5 deletions .github/workflows/update-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ name: Update Playwright Snapshots

on:
workflow_dispatch:
inputs:
number:
description: 'PR number'
required: true
issue_comment:
types: [created, edited]

Expand All @@ -10,10 +14,8 @@ permissions:
pull-requests: write

jobs:


update-snapshots:
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, 'please update playwright snapshots') }}
if: ${{ github.event.inputs || (github.event.issue.pull_request && contains(github.event.comment.body, 'please update playwright snapshots')) }}
runs-on: ubuntu-latest

steps:
Expand All @@ -26,7 +28,7 @@ jobs:
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 }}
run: hub pr checkout ${{ github.event.inputs.number || github.event.issue.number }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -36,7 +38,7 @@ jobs:
python_version: '3.11'

- name: Install dependencies
run: python -m pip install -U jupyterlab~=3.1 jupyter-archive
run: python -m pip install -U jupyterlab~=3.1

- name: Install extension
run: |
Expand All @@ -50,3 +52,5 @@ jobs:
# Playwright knows how to start JupyterLab server
start_server_script: 'null'
test_folder: ui-tests
# use jlpm (not default yet)
npm_client: jlpm
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,10 @@ dev/jobs

# jupyter releaser local checkout
.jupyter_releaser_checkout

# Yarn 3 cache
.yarn

# Jest coverage reports and a side effect
coverage
junit.xml
Loading

0 comments on commit 3efcbb4

Please sign in to comment.