Skip to content

Commit

Permalink
Add Galata tests
Browse files Browse the repository at this point in the history
  • Loading branch information
martinRenou committed Oct 8, 2021
1 parent 7933df7 commit d4300f5
Show file tree
Hide file tree
Showing 21 changed files with 4,899 additions and 97 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ dist
coverage
**/*.d.ts
tests
ui-tests/**
ipympl/labextension/**
ipympl/nbextension/extension.js
58 changes: 58 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,61 @@ jobs:

- name: Validate the labextension
run: jupyter labextension list 2>&1 | grep jupyter-matplotlib


visual-regression-tests:
runs-on: ubuntu-latest
needs: [build]

strategy:
fail-fast: false

steps:

- name: Checkout
uses: actions/checkout@v2

- name: Setup conda
uses: conda-incubator/setup-miniconda@v2
with:
python-version: 3.9
mamba-version: "*"
auto-activate-base: false
channels: conda-forge

- name: Install dependencies
run: mamba install pip yarn jupyterlab=3.0.11 ipywidgets jupyter-packaging

- uses: actions/download-artifact@v2
with:
name: dist ${{ github.run_number }}
path: ./dist

- name: Install the package
run: pip install -vv ipympl*.whl
working-directory: dist

- name: Install test dependencies
run: yarn install
working-directory: ui-tests

- name: Launch JupyterLab
run: yarn run start-jlab:detached
working-directory: ui-tests

- name: Wait for JupyterLab
uses: ifaxity/wait-on-action@v1
with:
resource: http-get://localhost:8888/api
timeout: 20000

- name: Run UI Tests
run: yarn run test
working-directory: ui-tests

- name: Upload UI Test artifacts
if: always()
uses: actions/upload-artifact@v2
with:
name: ui-test-output
path: ui-tests/test-output
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ ipympl/nbextension/index.*
ipympl/nbextension/package.json
ipympl/labextension/*.tgz

ui-tests/test-output

# Coverage data
# -------------
**/coverage/
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@
"watch:lib": "tsc -w",
"watch:nbextension": "webpack --watch --mode=development",
"watch:labextension": "jupyter labextension watch .",
"eslint": "eslint . --fix --ignore-path .gitignore --ext .ts",
"eslint:check": "eslint . --ignore-path .gitignore --ext .ts",
"eslint": "eslint . --fix --ignore-path .eslintignore --ext .ts",
"eslint:check": "eslint . --ignore-path .eslintignore --ext .ts",
"lint": "yarn run prettier && yarn run eslint",
"lint:check": "yarn run prettier:check && yarn run eslint:check",
"prepublish": "yarn run clean && yarn run build",
"prettier": "prettier --ignore-path .gitignore --write \"**/*{.ts,.css,.json}\"",
"prettier:check": "prettier --check --ignore-path .gitignore \"**/*{.ts,.css,.json}\""
"prettier": "prettier --ignore-path .eslintignore --write \"**/*{.ts,.css,.json}\"",
"prettier:check": "prettier --check --ignore-path .eslintignore \"**/*{.ts,.css,.json}\""
},
"jupyterlab": {
"extension": "lib/plugin",
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ build-backend = "setuptools.build_meta"

[tool.pytest.ini_options]
testpaths = [
"test-notebooks",
"examples",
]
norecursedirs = [
Expand Down
92 changes: 0 additions & 92 deletions test-notebooks/UAT.ipynb

This file was deleted.

26 changes: 26 additions & 0 deletions ui-tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Visual regression tests using Galata

This directory contains visual regression tests for ipympl, using Galata.

In order to run them, you need to install dependencies:

```bash
const install -c conda-forge yarn jupyterlab=3.0.7

yarn install
```

Then start JupyterLab in one terminal (you need to check that it properly starts on port 8888):
```bash
yarn run start-jlab
```

Finally, run the galata tests:
```bash
yarn run test
```

If bqplot visuals change, you can re-generate reference images by running:
```bash
yarn run update-references
```
3 changes: 3 additions & 0 deletions ui-tests/galata-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"testId": "test"
}
7 changes: 7 additions & 0 deletions ui-tests/jupyter_server_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
c.ServerApp.port = 8888 # noqa
c.ServerApp.token = "" # noqa
c.ServerApp.password = "" # noqa
c.ServerApp.disable_check_xsrf = True # noqa
c.ServerApp.open_browser = False # noqa
c.LabApp.open_browser = False # noqa
c.LabApp.expose_app_in_browser = True # noqa
20 changes: 20 additions & 0 deletions ui-tests/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "ipympl-ui-tests",
"version": "1.0.0",
"description": "ipympl UI Tests",
"private": true,
"scripts": {
"start-jlab": "jupyter lab --config ./jupyter_server_config.py",
"start-jlab:detached": "yarn run start-jlab&",
"clean": "rimraf tests/notebooks/.ipynb_checkpoints && rimraf test-output",
"test": "yarn run clean && galata --image-match-threshold 0.33",
"update-references": "galata --update-references"
},
"author": "ipympl",
"license": "Apache-2.0",
"dependencies": {
"@jupyterlab/galata": "3.0.11-2",
"klaw-sync": "^6.0.0",
"rimraf": "^3.0.2"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit d4300f5

Please sign in to comment.