Add a test on Table of Contents

pull/6487/head
Nicolas Brichet 4 years ago committed by foo
parent 60dc750718
commit 86283fe5fd

@ -99,4 +99,29 @@ test.describe('Notebook', () => {
// check the short output area is not auto scrolled
expect(await checkCell(1)).toBe(false);
});
test('Open table of content left panel', async ({ page, tmpPath }) => {
const notebook = 'simple_toc.ipynb';
const menuPath = 'View>Show Left Sidebar>Table Of Contents';
await page.contents.uploadFile(
path.resolve(__dirname, `./notebooks/${notebook}`),
`${tmpPath}/${notebook}`
);
await page.goto(`notebooks/${tmpPath}/${notebook}`);
await waitForKernelReady(page);
await page.menu.open(menuPath);
await expect(
page.locator(
'.jp-SidePanel-content > .jp-TableOfContents-tree > .jp-TableOfContents-content'
)
).toHaveCount(1);
await expect(
page.locator(
'.jp-SidePanel-content > .jp-TableOfContents-tree > .jp-TableOfContents-content > .jp-tocItem'
)
).toHaveCount(3);
});
});

@ -0,0 +1,65 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# part 1"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## subpart 1"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## subpart 2"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# part 2"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# part 3"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.5"
},
"vscode": {
"interpreter": {
"hash": "0508733a7f73e6ddc798c911e704189485d436785f398d29dd8c20885fc63cb3"
}
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Loading…
Cancel
Save