Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ repos:
rev: 'v2.2.6'
hooks:
- id: codespell
args: ['-L', 'hart,noteable']
args: ['-L', 'hart,noteable', '--skip', "*.spec.ts"]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like afterAll makes the pre-commit check fail: https://results.pre-commit.ci/run/github/33653601/1715676598.F47qygP7RKuJagZupcWLmA

image

Adding afterAll to the list of ignored words (via -L) does not seem to help, but skipping all .spec.ts files does. Might be worth investigating more in a separate issue or PR.

exclude: |
(?x)^(
yarn.lock|
Expand Down
4 changes: 2 additions & 2 deletions ui-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"test:update": "playwright test --update-snapshots"
},
"dependencies": {
"@jupyterlab/galata": "~5.2.0-rc.0",
"@playwright/test": "^1.33.0",
"@jupyterlab/galata": "~5.2.0",
"@playwright/test": "^1.44.0",
"rimraf": "^3.0.2"
}
}
2 changes: 1 addition & 1 deletion ui-tests/test/editor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import path from 'path';

import { test } from './fixtures';

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

const FILE = 'environment.yml';

Expand Down
2 changes: 1 addition & 1 deletion ui-tests/test/filebrowser.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import path from 'path';

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

import { test } from './fixtures';

Expand Down
2 changes: 1 addition & 1 deletion ui-tests/test/general.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import path from 'path';

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

import { test } from './fixtures';

Expand Down
2 changes: 1 addition & 1 deletion ui-tests/test/layout.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import path from 'path';

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

import { galata } from '@jupyterlab/galata';

Expand Down
2 changes: 1 addition & 1 deletion ui-tests/test/links.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import path from 'path';

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

import { test } from './fixtures';

Expand Down
2 changes: 1 addition & 1 deletion ui-tests/test/menus.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import path from 'path';

import { test } from './fixtures';

import { expect } from '@playwright/test';
import { expect } from '@jupyterlab/galata';
import { waitForKernelReady } from './utils';

const NOTEBOOK = 'empty.ipynb';
Expand Down
34 changes: 27 additions & 7 deletions ui-tests/test/mobile.spec.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,32 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.

import { expect } from '@playwright/test';
import { IJupyterLabPage, expect, galata } from '@jupyterlab/galata';

import { test } from './fixtures';

import { hideAddCellButton, waitForKernelReady } from './utils';

test.use({ autoGoto: false, viewport: { width: 524, height: 800 } });
test.use({
autoGoto: false,
viewport: { width: 524, height: 800 },
// Set a fixed string as Playwright is preventing the unique test name to be too long
// and replaces part of the path with a hash
tmpPath: 'mobile-layout',
});

test.describe('Mobile', () => {
// manually create the test directory since tmpPath is set to a fixed value
test.beforeAll(async ({ request, tmpPath }) => {
const contents = galata.newContentsHelper(request);
await contents.createDirectory(tmpPath);
});

test.afterAll(async ({ request, tmpPath }) => {
const contents = galata.newContentsHelper(request);
await contents.deleteDirectory(tmpPath);
});

test('The layout should be more compact on the file browser page', async ({
page,
tmpPath,
Expand All @@ -29,11 +46,14 @@ test.describe('Mobile', () => {
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)"'),
]);
const notebookPromise = page.waitForEvent('popup');
await page.click('text="New"');
await page
.locator(
'[data-command="notebook:create-new"] >> text="Python 3 (ipykernel)"'
)
.click();
const notebook = await notebookPromise;

// wait for the kernel status animations to be finished
await waitForKernelReady(notebook);
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ui-tests/test/mobile.spec.ts-snapshots/tree-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ui-tests/test/mobile.spec.ts-snapshots/tree-firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion ui-tests/test/notebook.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import path from 'path';

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

import { test } from './fixtures';

Expand Down
16 changes: 14 additions & 2 deletions ui-tests/test/settings.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,23 @@

import { test } from './fixtures';

import { expect } from '@playwright/test';
import { expect, galata } from '@jupyterlab/galata';

test.use({ autoGoto: false });
// Set a fixed string as Playwright is preventing the unique test name to be too long
// and replaces part of the path with a hash
test.use({ autoGoto: false, tmpPath: 'settings' });

test.describe('Settings', () => {
test.beforeAll(async ({ request, tmpPath }) => {
const contents = galata.newContentsHelper(request);
await contents.createDirectory(tmpPath);
});

test.afterAll(async ({ request, tmpPath }) => {
const contents = galata.newContentsHelper(request);
await contents.deleteDirectory(tmpPath);
});

test('Should be persisted after reloading the page', async ({
page,
tmpPath,
Expand Down
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.
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.
15 changes: 9 additions & 6 deletions ui-tests/test/smoke.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { expect } from '@playwright/test';
import { expect } from '@jupyterlab/galata';

import { test } from './fixtures';

Expand All @@ -24,11 +24,14 @@ test.describe('Smoke', () => {
await console.waitForSelector('.jp-CodeConsole');

// Create a new notebook
const [notebook] = await Promise.all([
page.waitForEvent('popup'),
page.click('text="New"'),
page.click('text="Python 3 (ipykernel)"'),
]);
const notebookPromise = page.waitForEvent('popup');
await page.click('text="New"');
await page
.locator(
'[data-command="notebook:create-new"] >> text="Python 3 (ipykernel)"'
)
.click();
const notebook = await notebookPromise;

try {
// we may have to select the kernel first
Expand Down
2 changes: 1 addition & 1 deletion ui-tests/test/tree.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import { test } from './fixtures';

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

const SUBFOLDER = 'subfolder';

Expand Down
8 changes: 2 additions & 6 deletions ui-tests/test/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ export async function runAndAdvance(
/**
* Wait for the kernel to be ready
*/
export async function waitForKernelReady(
page: IJupyterLabPageFixture
): Promise<void> {
export async function waitForKernelReady(page: Page): Promise<void> {
await page.waitForSelector('.jp-NotebookKernelStatus-fade');
await page.waitForFunction(() => {
const status = window.document.getElementsByClassName(
Expand All @@ -41,9 +39,7 @@ export async function waitForKernelReady(
* Special case for firefox headless issue
* See https://github.com/jupyter/notebook/pull/6872#issuecomment-1549594166 for more details
*/
export async function hideAddCellButton(
page: IJupyterLabPageFixture
): Promise<void> {
export async function hideAddCellButton(page: Page): Promise<void> {
await page
.locator('.jp-Notebook-footer')
.evaluate((element) => (element.style.display = 'none'));
Expand Down
Loading