Skip to content

Commit da7b8d4

Browse files
Fix flaky mobile UI tests (#7278)
* Fix flaky mobile UI tests * fix test * Update Playwright Snapshots * Update Playwright Snapshots * remove unused import --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent ca5eb17 commit da7b8d4

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

ui-tests/test/mobile.spec.ts

+13-12
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Copyright (c) Jupyter Development Team.
22
// Distributed under the terms of the Modified BSD License.
33

4-
import path from 'path';
5-
64
import { expect } from '@playwright/test';
75

86
import { test } from './fixtures';
@@ -28,26 +26,29 @@ test.describe('Mobile', () => {
2826
tmpPath,
2927
browserName,
3028
}) => {
31-
const notebook = 'empty.ipynb';
32-
await page.contents.uploadFile(
33-
path.resolve(__dirname, `./notebooks/${notebook}`),
34-
`${tmpPath}/${notebook}`
35-
);
36-
await page.goto(`notebooks/${tmpPath}/${notebook}`);
29+
await page.goto(`tree/${tmpPath}`);
30+
31+
// Create a new notebook
32+
const [notebook] = await Promise.all([
33+
page.waitForEvent('popup'),
34+
page.click('text="New"'),
35+
page.click('text="Python 3 (ipykernel)"'),
36+
]);
3737

3838
// wait for the kernel status animations to be finished
39-
await waitForKernelReady(page);
39+
await waitForKernelReady(notebook);
4040

4141
// force switching back to command mode to avoid capturing the cursor in the screenshot
42-
await page.evaluate(async () => {
42+
await notebook.evaluate(async () => {
4343
await window.jupyterapp.commands.execute('notebook:enter-command-mode');
4444
});
4545

4646
// TODO: remove
4747
if (browserName === 'firefox') {
48-
await hideAddCellButton(page);
48+
await hideAddCellButton(notebook);
4949
}
5050

51-
expect(await page.screenshot()).toMatchSnapshot('notebook.png');
51+
expect(await notebook.screenshot()).toMatchSnapshot('notebook.png');
52+
await notebook.close();
5253
});
5354
});
Loading
Loading

0 commit comments

Comments
 (0)