Skip to content

Commit

Permalink
Merge pull request #6380 from jtpio/test-markdown
Browse files Browse the repository at this point in the history
Add UI tests for a simple notebook
  • Loading branch information
jtpio authored Apr 26, 2022
2 parents 722f1d7 + af3764b commit b40b7b4
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 0 deletions.
33 changes: 33 additions & 0 deletions ui-tests/test/general.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// 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']"
);

// 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');
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions ui-tests/test/notebooks/simple.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Test Notebook"
]
}
],
"metadata": {
"language_info": {
"name": "python"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}

0 comments on commit b40b7b4

Please sign in to comment.