Skip to content

Commit c53c33b

Browse files
committed
Add a test on Table of Contents
1 parent facec2b commit c53c33b

File tree

2 files changed

+90
-0
lines changed

2 files changed

+90
-0
lines changed

ui-tests/test/notebook.spec.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,29 @@ test.describe('Notebook', () => {
9191
// check the short output area is not auto scrolled
9292
expect(await checkCell(1)).toBe(false);
9393
});
94+
95+
test('Open table of content left panel', async ({ page, tmpPath }) => {
96+
const notebook = 'simple_toc.ipynb';
97+
const menuPath = 'View>Show Left Sidebar>Table Of Contents';
98+
await page.contents.uploadFile(
99+
path.resolve(__dirname, `./notebooks/${notebook}`),
100+
`${tmpPath}/${notebook}`
101+
);
102+
await page.goto(`notebooks/${tmpPath}/${notebook}`);
103+
104+
await waitForKernelReady(page);
105+
106+
await page.menu.open(menuPath);
107+
108+
await expect(
109+
page.locator(
110+
'.jp-SidePanel-content > .jp-TableOfContents-tree > .jp-TableOfContents-content'
111+
)
112+
).toHaveCount(1);
113+
await expect(
114+
page.locator(
115+
'.jp-SidePanel-content > .jp-TableOfContents-tree > .jp-TableOfContents-content > .jp-tocItem'
116+
)
117+
).toHaveCount(3);
118+
});
94119
});
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# part 1"
8+
]
9+
},
10+
{
11+
"cell_type": "markdown",
12+
"metadata": {},
13+
"source": [
14+
"## subpart 1"
15+
]
16+
},
17+
{
18+
"cell_type": "markdown",
19+
"metadata": {},
20+
"source": [
21+
"## subpart 2"
22+
]
23+
},
24+
{
25+
"cell_type": "markdown",
26+
"metadata": {},
27+
"source": [
28+
"# part 2"
29+
]
30+
},
31+
{
32+
"cell_type": "markdown",
33+
"metadata": {},
34+
"source": [
35+
"# part 3"
36+
]
37+
}
38+
],
39+
"metadata": {
40+
"kernelspec": {
41+
"display_name": "Python 3 (ipykernel)",
42+
"language": "python",
43+
"name": "python3"
44+
},
45+
"language_info": {
46+
"codemirror_mode": {
47+
"name": "ipython",
48+
"version": 3
49+
},
50+
"file_extension": ".py",
51+
"mimetype": "text/x-python",
52+
"name": "python",
53+
"nbconvert_exporter": "python",
54+
"pygments_lexer": "ipython3",
55+
"version": "3.10.5"
56+
},
57+
"vscode": {
58+
"interpreter": {
59+
"hash": "0508733a7f73e6ddc798c911e704189485d436785f398d29dd8c20885fc63cb3"
60+
}
61+
}
62+
},
63+
"nbformat": 4,
64+
"nbformat_minor": 4
65+
}

0 commit comments

Comments
 (0)