2
0
mirror of https://github.com/jupyter/notebook.git synced 2025-03-01 12:56:54 +08:00

Test on firefox and chromium on CI

This commit is contained in:
Jeremy Tuloup 2021-01-29 00:34:07 +01:00
parent 677eca8197
commit f889cb4621
8 changed files with 61 additions and 29 deletions

View File

@ -55,16 +55,10 @@ jobs:
jlpm
jlpm run eslint:check
jlpm run prettier:check
- uses: microsoft/playwright-github-action@v1
- name: Test
run: |
jlpm run build:test
jlpm run test:ci
- uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: test-artifacts
path: app/artifacts
jlpm run test
build:
needs: [integrity]
@ -158,3 +152,40 @@ jobs:
jupyter server extension list 2>&1 | grep -ie "jupyterlab_classic.*enabled" -
jupyter classic --version
jupyter classic --help
end2end:
needs: [build]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
browser: [firefox, chromium]
steps:
- 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 jupyterlab_classic*.whl
- uses: microsoft/playwright-github-action@v1
- name: Test
run: |
jlpm run build:test
jlpm run test:e2e
env:
BROWSER: ${{ matrix.browser }}
- uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: test-artifacts
path: app/artifacts

View File

@ -55,16 +55,10 @@ jobs:
jlpm
jlpm run eslint:check
jlpm run prettier:check
- uses: microsoft/playwright-github-action@v1
- name: Test
run: |
jlpm run build:test
jlpm run test:ci
- uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: test-artifacts
path: app/artifacts
jlpm run test
build:
needs: [integrity]

View File

@ -9,8 +9,8 @@
"clean": "rimraf build",
"clean:artifacts": "rimraf artifacts",
"prepublishOnly": "yarn run build",
"test": "jlpm run clean:artifacts && jest",
"test:pwdebug": "jlpm run clean:artifacts && PWDEBUG=1 jlpm run test",
"test:e2e": "jlpm run clean:artifacts && jest",
"test:e2e:pwdebug": "jlpm run clean:artifacts && PWDEBUG=1 jlpm run test:e2e",
"test:cov": "jest --collect-coverage",
"test:debug": "node --inspect-brk node_modules/.bin/jest --runInBand",
"test:debug:watch": "node --inspect-brk node_modules/.bin/jest --runInBand --watch",

View File

@ -1,7 +1,9 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
import { chromium, Browser } from 'playwright';
import { chromium, firefox, Browser } from 'playwright';
import { BrowserName } from './utils';
const JUPYTERLAB_CLASSIC =
'http://localhost:8889/classic/notebooks/app/test/data/example.ipynb';
@ -10,7 +12,8 @@ describe('Notebook', () => {
let browser: Browser;
beforeEach(async () => {
browser = await chromium.launch({ slowMo: 100 });
const browserName = (process.env.BROWSER as BrowserName) || 'chromium';
browser = await { chromium, firefox }[browserName].launch({ slowMo: 100 });
});
afterEach(() => {

View File

@ -1,4 +1,6 @@
import { firefox, Browser, BrowserContext } from 'playwright';
import { chromium, firefox, Browser, BrowserContext } from 'playwright';
import { BrowserName } from './utils';
describe('Smoke', () => {
let browser: Browser;
@ -6,7 +8,8 @@ describe('Smoke', () => {
beforeAll(async () => {
jest.setTimeout(200000);
browser = await firefox.launch({ slowMo: 1000 });
const browserName = (process.env.BROWSER as BrowserName) || 'chromium';
browser = await { chromium, firefox }[browserName].launch({ slowMo: 100 });
context = await browser.newContext({
recordVideo: { dir: 'artifacts/videos/' }
});

View File

@ -1,15 +1,16 @@
import { chromium, Browser } from 'playwright';
import { chromium, firefox, Browser } from 'playwright';
import { BrowserName } from './utils';
const JUPYTERLAB_CLASSIC = 'http://localhost:8889/classic/tree';
const NEW_NOTEBOOK =
'#filebrowser > div.lm-Widget.p-Widget.jp-Toolbar.jp-scrollbar-tiny.jp-FileBrowser-toolbar > div:nth-child(1) > button';
describe('Tree', () => {
let browser: Browser;
beforeEach(async () => {
browser = await chromium.launch({ slowMo: 100 });
const browserName: BrowserName =
(process.env.BROWSER as BrowserName) || 'chromium';
browser = await { chromium, firefox }[browserName].launch({ slowMo: 100 });
});
afterEach(() => {
@ -17,12 +18,11 @@ describe('Tree', () => {
});
describe('File Browser', () => {
it('should be rendered', async () => {
it('should render a New Notebook button', async () => {
const page = await browser.newPage();
await page.goto(JUPYTERLAB_CLASSIC);
await page.waitForSelector(NEW_NOTEBOOK);
const button = await page.$(NEW_NOTEBOOK);
const button = await page.$('text="New Notebook"');
expect(button).toBeDefined();
});
});

1
app/test/utils.ts Normal file
View File

@ -0,0 +1 @@
export type BrowserName = 'chromium' | 'firefox';

View File

@ -33,7 +33,7 @@
"release:patch": "node ./buildutils/lib/release-patch.js",
"start": "jupyter classic --config ./app/test/jupyter_server_config.py --no-browser",
"test": "lerna run test",
"test:ci": "(jlpm run start&) && jlpm run test",
"test:e2e": "(jlpm run start&) && jlpm run test:e2e",
"update:dependency": "node ./node_modules/@jupyterlab/buildutils/lib/update-dependency.js --lerna"
},
"husky": {