mirror of
https://github.com/jupyter/notebook.git
synced 2024-11-27 03:20:27 +08:00
787339c09e
* Update to JupyterLab 4.0.0b1 * fix resolutions * more updates * Remove previous shortcuts plugin * Bump `jupyter_server` dependency * Align playwright dependency * Update to JupyterLab 4.0.0b2 * fix some deps * Update yarn.lock * add util fallback * style the footer * fix footer background * move mouse before taking the screnshot * update ui tests yarn.lock * disable the notebook footer for now * update snapshots
49 lines
1.5 KiB
TypeScript
49 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');
|
|
});
|
|
|
|
// make sure the mouse does not hover on the footer
|
|
await page.mouse.move(0, 0);
|
|
|
|
expect(await page.screenshot()).toMatchSnapshot('notebook.png');
|
|
});
|
|
});
|