yarn --frozen-lockfile
yarn start
yarn test
Last active
November 9, 2021 14:25
-
-
Save jtpio/8046759a49e9ba15382aaf8ec5d6a99d to your computer and use it in GitHub Desktop.
Galata getCellOutput
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
node_modules | |
playwright-report | |
test-results | |
yarn.lock |
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
import { test } from '@jupyterlab/galata'; | |
import { expect } from '@playwright/test'; | |
import * as path from 'path'; | |
test.describe('Visual Regression', () => { | |
test.beforeEach(async ({ page, tmpPath }) => { | |
await page.contents.uploadFile( | |
path.resolve(__dirname, './test.ipynb'), | |
`${tmpPath}/test.ipynb` | |
); | |
await page.filebrowser.openDirectory(tmpPath); | |
}); | |
test('Run test.ipynb', async ({ | |
page, | |
tmpPath, | |
}) => { | |
const notebook = 'test.ipynb'; | |
await page.notebook.openByPath(`${tmpPath}/${notebook}`); | |
await page.notebook.activate(notebook); | |
const captures = new Array<Buffer>(); | |
const cellCount = await page.notebook.getCellCount(); | |
await page.notebook.runCellByCell(); | |
await page.notebook.save(); | |
const cell = await page.notebook.getCellOutput(0); | |
expect(await cell.screenshot()).toMatchSnapshot(); | |
}); | |
}); |
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
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.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
{ | |
"name": "test", | |
"private": true, | |
"version": "0.1.0", | |
"description": "test", | |
"scripts": { | |
"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": "~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
const baseConfig = require('@jupyterlab/galata/lib/playwright-config'); | |
module.exports = { | |
...baseConfig, | |
timeout: 240000, | |
retries: 1, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment