Skip to content

Commit 6af5bd8

Browse files
authored
E2E test: re-enable large python notebook test & add large R notebook test (#7303)
This test was disabled due to failure with the upstream merge. For some reason mouse scroll no longer works to advance down the page with a large Python notebook, but PageDown does. This is good news because it makes the test much faster. However, PageDown does not work with a large R notebook and mouse scroll does (added a large R notebook test based on a conversion of the large Python notebook to R). ### QA Notes @:win @:notebooks
1 parent cd7b539 commit 6af5bd8

File tree

2 files changed

+65
-14
lines changed

2 files changed

+65
-14
lines changed

test/e2e/tests/notebook/notebook-large-python.test.ts

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,40 +8,33 @@ import { test, expect, tags } from '../_test.setup';
88

99
test.use({
1010
suiteId: __filename,
11-
snapshots: false,
1211
});
1312

14-
// Note that this test is too heavy to pass on web and windows
13+
// test is too heavy for web
1514
test.describe('Large Python Notebook', {
1615
tag: [tags.NOTEBOOKS, tags.WIN]
1716
}, () => {
1817

19-
test.skip('Python - Large notebook execution', {
20-
annotation: [{ type: 'issue', description: 'https://github.com/posit-dev/positron/issues/7255' }]
21-
}, async function ({ app, python }) {
22-
test.setTimeout(480_000); // huge timeout because this is a heavy test
18+
test('Python - Large notebook execution', async function ({ app, python }) {
19+
test.slow();
2320
const notebooks = app.workbench.notebooks;
2421

25-
2622
await app.workbench.quickaccess.openDataFile(join(app.workspacePathOrFolder, 'workspaces', 'large_py_notebook', 'spotify.ipynb'));
2723
await notebooks.selectInterpreter('Python');
2824

2925
await notebooks.runAllCells(120000);
3026

27+
await app.workbench.layouts.enterLayout('notebook');
28+
3129
await app.workbench.quickaccess.runCommand('notebook.focusTop');
3230
await app.code.driver.page.locator('span').filter({ hasText: 'import pandas as pd' }).locator('span').first().click();
3331

3432
const allFigures: any[] = [];
3533
const uniqueLocators = new Set<string>();
3634

37-
for (let i = 0; i < 6; i++) {
35+
for (let i = 0; i < 12; i++) {
3836

39-
// the second param to wheel (y) seems to be ignored so we send
40-
// more messages instead of one with a large y value
41-
for (let j = 0; j < 100; j++) {
42-
await app.code.driver.page.mouse.wheel(0, 1);
43-
await app.code.driver.page.waitForTimeout(100);
44-
}
37+
await app.code.driver.page.keyboard.press('PageDown');
4538

4639
const figureLocator = app.workbench.notebooks.frameLocator.locator('.plot-container');
4740
const figures = await figureLocator.all();
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (C) 2025 Posit Software, PBC. All rights reserved.
3+
* Licensed under the Elastic License 2.0. See LICENSE.txt for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
import { join } from 'path';
7+
import { test, expect, tags } from '../_test.setup';
8+
9+
test.use({
10+
suiteId: __filename,
11+
snapshots: false
12+
});
13+
14+
// test is too heavy for web
15+
test.describe('Large R Notebook', {
16+
tag: [tags.NOTEBOOKS, tags.WIN]
17+
}, () => {
18+
19+
test('R - Large notebook execution', async function ({ app, r }) {
20+
test.slow();
21+
const notebooks = app.workbench.notebooks;
22+
23+
await app.workbench.quickaccess.openDataFile(join(app.workspacePathOrFolder, 'workspaces', 'large_r_notebook', 'spotify.ipynb'));
24+
await notebooks.selectInterpreter('R');
25+
26+
await notebooks.runAllCells(120000);
27+
28+
await app.workbench.layouts.enterLayout('notebook');
29+
30+
await app.workbench.quickaccess.runCommand('notebook.focusTop');
31+
await app.code.driver.page.locator('span').filter({ hasText: 'library(dplyr)' }).locator('span').first().click();
32+
33+
const allFigures: any[] = [];
34+
const uniqueLocators = new Set<string>();
35+
36+
for (let i = 0; i < 6; i++) {
37+
38+
for (let j = 0; j < 100; j++) {
39+
// second param to mouse.wheel is not processed correctly so loop is needed
40+
await app.code.driver.page.mouse.wheel(0, 1);
41+
}
42+
43+
const figureLocator = app.workbench.notebooks.frameLocator.locator('.output_container');
44+
const figures = await figureLocator.all();
45+
46+
if (figures!.length > 0) {
47+
for (const figure of figures!) {
48+
if (!uniqueLocators.has(figure.toString())) {
49+
allFigures.push(figure);
50+
uniqueLocators.add(figure.toString());
51+
}
52+
}
53+
}
54+
}
55+
56+
expect(allFigures.length).toBeGreaterThan(20);
57+
});
58+
});

0 commit comments

Comments
 (0)