mirror of
https://github.com/jupyter/notebook.git
synced 2024-11-27 03:20:27 +08:00
27c2bfbb80
* Update to JupyterLab 4.0.0a33 * Update Lumino packages * Update to React 18 * Fix default browser * Add defaultFileBrowser plugin * Update yarn.lock * Require Python 3.8 * Remove docprovider * Bump Python dependencies * Move Python bumps * Unbump `jupyterlab_server` * Align `jupyterlab_server`dep * Bump jupyterlab_server * Try with 3.10 * Manually set checkpoint text in UI tests * Fix checkpoints value in UI tests * Update snapshots
46 lines
1.5 KiB
TypeScript
46 lines
1.5 KiB
TypeScript
// Copyright (c) Jupyter Development Team.
|
|
// Distributed under the terms of the Modified BSD License.
|
|
|
|
import path from 'path';
|
|
|
|
import { expect } from '@playwright/test';
|
|
|
|
import { test } from './fixtures';
|
|
|
|
import { waitForKernelReady } from './utils';
|
|
|
|
test.describe('General', () => {
|
|
test('The notebook should render', async ({ page, tmpPath }) => {
|
|
const notebook = 'simple.ipynb';
|
|
await page.contents.uploadFile(
|
|
path.resolve(__dirname, `./notebooks/${notebook}`),
|
|
`${tmpPath}/${notebook}`
|
|
);
|
|
await page.goto(`notebooks/${tmpPath}/${notebook}`);
|
|
|
|
// wait for the kernel status animations to be finished
|
|
await waitForKernelReady(page);
|
|
await page.waitForSelector(
|
|
".jp-Notebook-ExecutionIndicator[data-status='idle']"
|
|
);
|
|
|
|
const checkpointLocator = '.jp-NotebookCheckpoint';
|
|
// wait for the checkpoint indicator to be displayed
|
|
await page.waitForSelector(checkpointLocator);
|
|
|
|
// remove the amount of seconds manually since it might display strings such as "3 seconds ago"
|
|
await page
|
|
.locator(checkpointLocator)
|
|
.evaluate(
|
|
element => (element.innerHTML = 'Last Checkpoint: 3 seconds ago')
|
|
);
|
|
|
|
// force switching back to command mode to avoid capturing the cursor in the screenshot
|
|
await page.evaluate(async () => {
|
|
await window.jupyterapp.commands.execute('notebook:enter-command-mode');
|
|
});
|
|
|
|
expect(await page.screenshot()).toMatchSnapshot('notebook.png');
|
|
});
|
|
});
|