diff --git a/ui-tests/test/mobile.spec.ts b/ui-tests/test/mobile.spec.ts index 4bbf0951c..7817171a7 100644 --- a/ui-tests/test/mobile.spec.ts +++ b/ui-tests/test/mobile.spec.ts @@ -1,8 +1,6 @@ // 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'; @@ -28,26 +26,29 @@ test.describe('Mobile', () => { tmpPath, browserName, }) => { - const notebook = 'empty.ipynb'; - await page.contents.uploadFile( - path.resolve(__dirname, `./notebooks/${notebook}`), - `${tmpPath}/${notebook}` - ); - await page.goto(`notebooks/${tmpPath}/${notebook}`); + await page.goto(`tree/${tmpPath}`); + + // Create a new notebook + const [notebook] = await Promise.all([ + page.waitForEvent('popup'), + page.click('text="New"'), + page.click('text="Python 3 (ipykernel)"'), + ]); // wait for the kernel status animations to be finished - await waitForKernelReady(page); + await waitForKernelReady(notebook); // force switching back to command mode to avoid capturing the cursor in the screenshot - await page.evaluate(async () => { + await notebook.evaluate(async () => { await window.jupyterapp.commands.execute('notebook:enter-command-mode'); }); // TODO: remove if (browserName === 'firefox') { - await hideAddCellButton(page); + await hideAddCellButton(notebook); } - expect(await page.screenshot()).toMatchSnapshot('notebook.png'); + expect(await notebook.screenshot()).toMatchSnapshot('notebook.png'); + await notebook.close(); }); }); diff --git a/ui-tests/test/mobile.spec.ts-snapshots/notebook-chromium-linux.png b/ui-tests/test/mobile.spec.ts-snapshots/notebook-chromium-linux.png index 9535be4aa..add05a9ae 100644 Binary files a/ui-tests/test/mobile.spec.ts-snapshots/notebook-chromium-linux.png and b/ui-tests/test/mobile.spec.ts-snapshots/notebook-chromium-linux.png differ diff --git a/ui-tests/test/mobile.spec.ts-snapshots/notebook-firefox-linux.png b/ui-tests/test/mobile.spec.ts-snapshots/notebook-firefox-linux.png index bf78c42da..db1c2ea08 100644 Binary files a/ui-tests/test/mobile.spec.ts-snapshots/notebook-firefox-linux.png and b/ui-tests/test/mobile.spec.ts-snapshots/notebook-firefox-linux.png differ