Skip to content

Instantly share code, notes, and snippets.

@jtpio
Last active November 9, 2021 14:25
Show Gist options
  • Save jtpio/8046759a49e9ba15382aaf8ec5d6a99d to your computer and use it in GitHub Desktop.
Save jtpio/8046759a49e9ba15382aaf8ec5d6a99d to your computer and use it in GitHub Desktop.
Galata getCellOutput
node_modules
playwright-report
test-results
yarn.lock

Galata getCellOutput

yarn --frozen-lockfile

yarn start

yarn test
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();
});
});
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
{
"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"
}
}
const baseConfig = require('@jupyterlab/galata/lib/playwright-config');
module.exports = {
...baseConfig,
timeout: 240000,
retries: 1,
};
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment