Skip to content

Commit

Permalink
Fix flaky mobile UI tests (#7278)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
jtpio and github-actions[bot] authored Feb 26, 2024
1 parent ca5eb17 commit da7b8d4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions ui-tests/test/mobile.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright (c) Jupyter Development Team.

Check failure on line 1 in ui-tests/test/mobile.spec.ts

View workflow job for this annotation

GitHub Actions / ui-tests (chromium)

[chromium] › test/mobile.spec.ts:24:7 › Mobile › The layout should be more compact on the notebook page

1) [chromium] › test/mobile.spec.ts:24:7 › Mobile › The layout should be more compact on the notebook page Test timeout of 60000ms exceeded.

Check failure on line 1 in ui-tests/test/mobile.spec.ts

View workflow job for this annotation

GitHub Actions / ui-tests (chromium)

[chromium] › test/mobile.spec.ts:24:7 › Mobile › The layout should be more compact on the notebook page

1) [chromium] › test/mobile.spec.ts:24:7 › Mobile › The layout should be more compact on the notebook page Pending operations: - proxy.click at test/mobile.spec.ts:35:12
// Distributed under the terms of the Modified BSD License.

import path from 'path';

import { expect } from '@playwright/test';

import { test } from './fixtures';
Expand All @@ -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'),

Check failure on line 33 in ui-tests/test/mobile.spec.ts

View workflow job for this annotation

GitHub Actions / ui-tests (chromium)

[chromium] › test/mobile.spec.ts:24:7 › Mobile › The layout should be more compact on the notebook page

1) [chromium] › test/mobile.spec.ts:24:7 › Mobile › The layout should be more compact on the notebook page Error: proxy.waitForEvent: Page closed =========================== logs =========================== waiting for event "popup" ============================================================ 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 | ]); at /home/runner/work/notebook/notebook/ui-tests/test/mobile.spec.ts:33:12
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();
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit da7b8d4

Please sign in to comment.