Skip to content
This repository was archived by the owner on Feb 16, 2023. It is now read-only.

Update UI Tests to use Galata #273

Merged
merged 3 commits into from
Nov 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/actions/build-dist/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: "Build RetroLab"
description: "Build RetroLab fron source"
runs:
using: "composite"
steps:
- name: Install node
uses: actions/setup-node@v2
with:
node-version: '14.x'

- name: Install Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
architecture: 'x64'

- name: Install dependencies
shell: bash
run: |
python -m pip install --upgrade pip wheel
python -m pip install setuptools jupyter_packaging~=0.10 "jupyterlab>=3,<4" build

- name: Build pypi distributions
shell: bash
run: |
python -m build

- name: Build npm distributions
shell: bash
run: |
mkdir pkgs
jlpm lerna exec -- npm pack
cp packages/*/*.tgz pkgs

- name: Build checksum file
shell: bash
run: |
cd dist
sha256sum * | tee SHA256SUMS
cd ../pkgs
sha256sum * | tee SHA256SUMS

- name: Upload distributions
uses: actions/upload-artifact@v2
with:
name: retrolab-dist-${{ github.run_number }}
path: ./dist

- name: Upload distributions
uses: actions/upload-artifact@v2
with:
name: retrolab-pkgs-${{ github.run_number }}
path: ./pkgs
102 changes: 15 additions & 87 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ name: Build

on:
push:
branches: '*'
branches:
- '*'
pull_request:
branches: '*'
branches:
- '*'

permissions:
contents:
Expand All @@ -18,6 +20,15 @@ defaults:
shell: bash -l {0}

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Build
uses: ./.github/actions/build-dist

test:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -52,52 +63,9 @@ jobs:
jlpm run build:test
jlpm run test

build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install node
uses: actions/setup-node@v2
with:
node-version: '14.x'
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
architecture: 'x64'
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
python -m pip install setuptools jupyter_packaging~=0.10 "jupyterlab>=3,<4" build
- name: Build pypi distributions
run: |
python -m build
- name: Build npm distributions
run: |
mkdir pkgs
jlpm lerna exec -- npm pack
cp packages/*/*.tgz pkgs
- name: Build checksum file
run: |
cd dist
sha256sum * | tee SHA256SUMS
cd ../pkgs
sha256sum * | tee SHA256SUMS
- name: Upload distributions
uses: actions/upload-artifact@v2
with:
name: dist ${{ github.run_number }}
path: ./dist
- name: Upload distributions
uses: actions/upload-artifact@v2
with:
name: pkgs ${{ github.run_number }}
path: ./pkgs

install:
runs-on: ${{ matrix.os }}-latest
needs: [build]
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
Expand All @@ -122,7 +90,7 @@ jobs:
architecture: 'x64'
- uses: actions/download-artifact@v2
with:
name: dist ${{ github.run_number }}
name: retrolab-dist-${{ github.run_number }}
path: ./dist
- name: Install the prerequisites
run: |
Expand All @@ -143,43 +111,3 @@ jobs:
jupyter server extension list 2>&1 | grep -ie "retrolab.*enabled" -
jupyter retro --version
jupyter retro --help

end2end:
needs: [build]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
browser: [firefox, chromium]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
architecture: 'x64'
- uses: actions/download-artifact@v2
with:
name: dist ${{ github.run_number }}
path: ./dist
- name: Install the prerequisites
run: |
python -m pip install pip wheel
- name: Install the package
run: |
cd dist
python -m pip install -vv retrolab*.whl
- uses: microsoft/playwright-github-action@v1
- name: Test
run: |
jlpm
jlpm run build:test
jlpm run test:ci
env:
BROWSER: ${{ matrix.browser }}
- uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: test-artifacts-${{ matrix.browser }} ${{ github.run_number }}
path: app/test-results
100 changes: 100 additions & 0 deletions .github/workflows/ui-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: UI Tests

on: [push, pull_request]

jobs:
build:
name: Build
runs-on: ubuntu-latest

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

- name: Build
uses: ./.github/actions/build-dist

ui-tests:
needs: [build]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
browser: [firefox, chromium]
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
architecture: 'x64'

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

- name: Install the prerequisites
run: |
python -m pip install pip wheel

- name: Install the package
run: |
cd dist
python -m pip install -vv retrolab*.whl

- name: Install the test dependencies
run: |
cd ui-tests
jlpm --frozen-lockfile
jlpm playwright install

- name: Start RetroLab
run: |
cd ui-tests
jlpm start:detached

- name: Wait for RetroLab
uses: ifaxity/wait-on-action@v1
with:
resource: http-get://127.0.0.1:8888/
timeout: 360000

- name: Test
run: |
cd ui-tests
jlpm test --browser ${{ matrix.browser }}

- name: Upload Playwright Test assets
if: always()
uses: actions/upload-artifact@v2
with:
name: retrolab-${{ matrix.browser }}-test-assets
path: |
ui-tests/test-results

- name: Upload Playwright Test report
if: always()
uses: actions/upload-artifact@v2
with:
name: retrolab-${{ matrix.browser }}-test-report
path: |
ui-tests/playwright-report

- name: Update snapshots
if: failure()
run: |
cd ui-tests
# remove previous snapshots from other browser
jlpm rimraf "test/**/*-snapshots/*.png"
# generate new snapshots
jlpm run test:update --browser ${{ matrix.browser }}

- name: Upload updated snapshots
if: failure()
uses: actions/upload-artifact@v2
with:
name: retrolab-${{ matrix.browser }}-updated-snapshots
path: ui-tests/test
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -119,5 +119,5 @@ retrolab/labextension
retrolab/schemas

# playwright
app/test-results
app/test/data
ui-tests/test-results
ui-tests/playwright-report
4 changes: 0 additions & 4 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@
"build:prod": "webpack --mode=production",
"build:test": "tsc --build tsconfig.test.json",
"clean": "rimraf build && jlpm run clean:static",
"clean:artifacts": "rimraf artifacts",
"clean:static": "rimraf -g \"../retrolab/static/!(favicons)\"",
"prepublishOnly": "yarn run build",
"test:e2e": "jlpm run clean:artifacts && playwright test",
"test:e2e:pwdebug": "jlpm run clean:artifacts && PWDEBUG=1 jlpm run test:e2e",
"watch": "webpack --config ./webpack.config.watch.js"
},
"resolutions": {
Expand Down Expand Up @@ -132,7 +129,6 @@
"devDependencies": {
"@jupyterlab/builder": "^3.2.0",
"@jupyterlab/buildutils": "^3.2.0",
"@playwright/test": "^1.12.3",
"@types/rimraf": "^3.0.0",
"css-loader": "~5.0.1",
"file-loader": "~5.0.2",
Expand Down
23 changes: 0 additions & 23 deletions app/playwright.config.ts

This file was deleted.

Loading