-
Notifications
You must be signed in to change notification settings - Fork 4.7k
/
mobile.spec.ts
61 lines (46 loc) · 1.83 KB
/
mobile.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// 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';
import { hideAddCellButton, waitForKernelReady } from './utils';
test.use({ autoGoto: false });
test.describe('Mobile', () => {
test('The layout should be more compact on the file browser page', async ({
page,
tmpPath,
}) => {
await page.goto(`tree/${tmpPath}`);
// temporary workaround to trigger a toolbar resize
// TODO: investigate in https://github.com/jupyter/notebook/issues/6553
await page.setViewportSize({ width: 524, height: 800 });
await page.waitForSelector('#top-panel-wrapper', { state: 'hidden' });
expect(await page.screenshot()).toMatchSnapshot('tree.png');
});
test('The layout should be more compact on the notebook page', async ({
page,
tmpPath,
browserName,
}) => {
const notebook = 'empty.ipynb';
await page.contents.uploadFile(
path.resolve(__dirname, `./notebooks/${notebook}`),
`${tmpPath}/${notebook}`
);
await page.goto(`notebooks/${tmpPath}/${notebook}`);
// wait for the kernel status animations to be finished
await waitForKernelReady(page);
// temporary workaround to trigger a toolbar resize
// TODO: investigate in https://github.com/jupyter/notebook/issues/6553
await page.setViewportSize({ width: 524, height: 800 });
// force switching back to command mode to avoid capturing the cursor in the screenshot
await page.evaluate(async () => {
await window.jupyterapp.commands.execute('notebook:enter-command-mode');
});
// TODO: remove
if (browserName === 'firefox') {
await hideAddCellButton(page);
}
expect(await page.screenshot()).toMatchSnapshot('notebook.png');
});
});