-
Notifications
You must be signed in to change notification settings - Fork 947
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3279 from jtpio/update-galata
Update to the new Galata
- Loading branch information
Showing
100 changed files
with
2,835 additions
and
3,471 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,4 +37,5 @@ temp/* | |
|
||
tsconfig.tsbuildinfo | ||
|
||
ui-tests/test-output/* | ||
ui-tests/test-results | ||
ui-tests/playwright-report |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
from tempfile import mkdtemp | ||
|
||
c.ServerApp.port = 8888 | ||
c.ServerApp.open_browser = False | ||
c.ServerApp.root_dir = mkdtemp(prefix='galata-test-') | ||
c.ServerApp.token = "" | ||
c.ServerApp.password = "" | ||
c.ServerApp.disable_check_xsrf = True | ||
c.ServerApp.open_browser = False | ||
c.LabApp.open_browser = False | ||
|
||
c.LabApp.expose_app_in_browser = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,19 @@ | ||
{ | ||
"name": "ipywidgets-ui-tests", | ||
"version": "1.0.0", | ||
"description": "ipywidgets UI Tests", | ||
"name": "@jupyter-widgets/ui-tests", | ||
"private": true, | ||
"version": "0.1.0", | ||
"description": "ipywidgets UI Tests", | ||
"scripts": { | ||
"start-jlab": "jupyter lab --config ./jupyter_server_config.py", | ||
"start-jlab:detached": "yarn run start-jlab&", | ||
"test:create-references": "galata --skip-visual-regression --skip-html-regression", | ||
"test": "galata" | ||
"start": "jupyter lab --config ./jupyter_server_config.py", | ||
"start:detached": "yarn run start&", | ||
"test": "playwright test", | ||
"test:debug": "PWDEBUG=1 playwright test", | ||
"test:report": "http-server ./playwright-report -a localhost -o", | ||
"test:update": "playwright test --update-snapshots" | ||
}, | ||
"author": "Project Jupyter", | ||
"license": "BSD-3-Clause", | ||
"dependencies": { | ||
"@jupyterlab/galata": "3.0.11-2" | ||
"@jupyterlab/galata": "~4.0.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const baseConfig = require('@jupyterlab/galata/lib/playwright-config'); | ||
|
||
module.exports = { | ||
...baseConfig, | ||
timeout: 240000, | ||
retries: 1, | ||
}; |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,90 +1,46 @@ | ||
// Copyright (c) Jupyter Development Team. | ||
// Distributed under the terms of the Modified BSD License. | ||
|
||
import { galata, describe, test } from '@jupyterlab/galata'; | ||
import * as path from 'path'; | ||
|
||
jest.setTimeout(100000); | ||
import { test } from '@jupyterlab/galata'; | ||
|
||
describe('Widget Visual Regression', () => { | ||
beforeAll(async () => { | ||
await galata.resetUI(); | ||
galata.context.capturePrefix = 'widgets'; | ||
}); | ||
import { expect } from '@playwright/test'; | ||
|
||
afterAll(async () => { | ||
galata.context.capturePrefix = ''; | ||
}); | ||
import * as path from 'path'; | ||
|
||
test('Upload files to JupyterLab', async () => { | ||
await galata.contents.moveDirectoryToServer( | ||
path.resolve(__dirname, `./notebooks`), | ||
'uploaded' | ||
test.describe('Widget Visual Regression', () => { | ||
test.beforeEach(async ({ page, tmpPath }) => { | ||
await page.contents.uploadDirectory( | ||
path.resolve(__dirname, './notebooks'), | ||
tmpPath | ||
); | ||
expect( | ||
await galata.contents.fileExists('uploaded/widgets.ipynb') | ||
).toBeTruthy(); | ||
expect( | ||
await galata.contents.fileExists('uploaded/WidgetArch.png') | ||
).toBeTruthy(); | ||
}); | ||
|
||
test('Refresh File Browser', async () => { | ||
await galata.filebrowser.refresh(); | ||
}); | ||
|
||
test('Open directory uploaded', async () => { | ||
await galata.filebrowser.openDirectory('uploaded'); | ||
expect( | ||
await galata.filebrowser.isFileListedInBrowser('widgets.ipynb') | ||
).toBeTruthy(); | ||
await page.filebrowser.openDirectory(tmpPath); | ||
}); | ||
|
||
test('Run notebook widgets.ipynb and capture cell outputs', async () => { | ||
test('Run notebook widgets.ipynb and capture cell outputs', async ({ | ||
page, | ||
tmpPath, | ||
}) => { | ||
const notebook = 'widgets.ipynb'; | ||
await galata.notebook.open(notebook); | ||
expect(await galata.notebook.isOpen(notebook)).toBeTruthy(); | ||
await galata.notebook.activate(notebook); | ||
expect(await galata.notebook.isActive(notebook)).toBeTruthy(); | ||
await page.notebook.openByPath(`${tmpPath}/${notebook}`); | ||
await page.notebook.activate(notebook); | ||
|
||
let numCellImages = 0; | ||
const captures = new Array<Buffer>(); | ||
const cellCount = await page.notebook.getCellCount(); | ||
|
||
const getCaptureImageName = (id: number): string => { | ||
return `cell-${id}`; | ||
}; | ||
|
||
await galata.notebook.runCellByCell({ | ||
await page.notebook.runCellByCell({ | ||
onAfterCellRun: async (cellIndex: number) => { | ||
const cell = await galata.notebook.getCellOutput(cellIndex); | ||
const cell = await page.notebook.getCellOutput(cellIndex); | ||
if (cell) { | ||
if ( | ||
await galata.capture.screenshot( | ||
getCaptureImageName(numCellImages), | ||
cell | ||
) | ||
) { | ||
numCellImages++; | ||
} | ||
captures.push(await cell.screenshot()); | ||
} | ||
}, | ||
}); | ||
|
||
for (let c = 0; c < numCellImages; ++c) { | ||
expect( | ||
await galata.capture.compareScreenshot(getCaptureImageName(c)) | ||
).toBe('same'); | ||
} | ||
}); | ||
|
||
test('Close notebook widgets.ipynb', async () => { | ||
await galata.notebook.close(true); | ||
}); | ||
|
||
test('Open home directory', async () => { | ||
await galata.filebrowser.openHomeDirectory(); | ||
}); | ||
await page.notebook.save(); | ||
|
||
test('Delete uploaded directory', async () => { | ||
await galata.contents.deleteDirectory('uploaded'); | ||
for (let i = 0; i < cellCount; i++) { | ||
const image = `widgets-cell-${i}.png`; | ||
expect(captures[i]).toMatchSnapshot(image); | ||
} | ||
}); | ||
}); |
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.