Skip to content

Commit

Permalink
Merge branch 'jupyterlab:main' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
FoSuCloud authored Mar 5, 2024
2 parents 16a3a06 + be1c486 commit df3b904
Show file tree
Hide file tree
Showing 26 changed files with 501 additions and 168 deletions.
8 changes: 8 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,14 @@ pkg:mermaid:
- packages/mermaid-extension/**/*
- packages/mermaid-extension/*

pkg:metadataform:
- changed-files:
- any-glob-to-any-file:
- packages/metadataform/**/*
- packages/metadataform/*
- packages/metadataform-extension/**/*
- packages/metadataform-extension/*

pkg:notebook:
- changed-files:
- any-glob-to-any-file:
Expand Down
1 change: 0 additions & 1 deletion buildutils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
"dependencies": {
"@yarnpkg/core": "^3.0.0",
"@yarnpkg/parsers": "^2.0.0",
"child_process": "~1.0.2",
"commander": "^9.4.1",
"crypto": "~1.0.1",
"dependency-graph": "^0.11.0",
Expand Down
10 changes: 8 additions & 2 deletions buildutils/src/ensure-repo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,17 @@ const URL_CONFIG = {
// Data to ignore.
const MISSING: Dict<string[]> = {
'@jupyterlab/coreutils': ['path'],
'@jupyterlab/buildutils': ['assert', 'fs', 'path', 'webpack'],
'@jupyterlab/buildutils': [
'assert',
'child_process',
'fs',
'path',
'webpack'
],
'@jupyterlab/builder': ['path'],
'@jupyterlab/galata': ['fs', 'path', '@jupyterlab/galata'],
'@jupyterlab/markedparser-extension': ['Tokens', 'MarkedOptions'],
'@jupyterlab/testing': ['fs', 'path'],
'@jupyterlab/testing': ['child_process', 'fs', 'path'],
'@jupyterlab/vega5-extension': ['vega-embed']
};

Expand Down
39 changes: 39 additions & 0 deletions galata/src/helpers/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,45 @@ export class SidebarHelper {
});
}

/**
* Set the sidebar width
*
* @param width Sidebar width in pixels
* @param side Which sidebar to set: 'left' or 'right'
*/
async setWidth(
width = 251,
side: galata.SidebarPosition = 'left'
): Promise<boolean> {
if (!(await this.isOpen(side))) {
return false;
}

const handles = this.page.locator(
'#jp-main-split-panel > .lm-SplitPanel-handle:not(.lm-mod-hidden)'
);
const splitHandle =
side === 'left'
? await handles.first().elementHandle()
: await handles.last().elementHandle();
const handleBBox = await splitHandle!.boundingBox();

await this.page.mouse.move(
handleBBox!.x + 0.5 * handleBBox!.width,
handleBBox!.y + 0.5 * handleBBox!.height
);
await this.page.mouse.down();
await this.page.mouse.move(
side === 'left'
? 33 + width
: this.page.viewportSize()!.width - 33 - width,
handleBBox!.y + 0.5 * handleBBox!.height
);
await this.page.mouse.up();

return true;
}

/**
* Get the selector for a given tab
*
Expand Down
19 changes: 9 additions & 10 deletions galata/test/documentation/customization.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Distributed under the terms of the Modified BSD License.

import { expect, galata, test } from '@jupyterlab/galata';
import { setSidebarWidth } from './utils';

test.use({
autoGoto: false,
Expand All @@ -23,7 +22,7 @@ test.describe('Default', () => {
}`
});

await setSidebarWidth(page);
await page.sidebar.setWidth();

await page.menu.clickMenuItem('File>New>Terminal');

Expand All @@ -42,7 +41,7 @@ test.describe('Default', () => {
}`
});

await setSidebarWidth(page);
await page.sidebar.setWidth();

await page.dblclick(
'[aria-label="File Browser Section"] >> text=notebooks'
Expand Down Expand Up @@ -75,7 +74,7 @@ test.describe('Default', () => {
}`
});

await setSidebarWidth(page);
await page.sidebar.setWidth();

await page.click('text=Tabs');

Expand All @@ -95,7 +94,7 @@ test.describe('Default', () => {
}`
});

await setSidebarWidth(page);
await page.sidebar.setWidth();

await page.dblclick(
'[aria-label="File Browser Section"] >> text=notebooks'
Expand Down Expand Up @@ -199,13 +198,13 @@ test.describe('Customized', () => {
}`
});

await setSidebarWidth(page);
await page.sidebar.setWidth();

await page.menu.clickMenuItem('File>New>Terminal');

await page.waitForSelector('.jp-Terminal');

await setSidebarWidth(page, 271, 'right');
await page.sidebar.setWidth(271, 'right');

expect(await page.screenshot()).toMatchSnapshot(
'customized-terminal-position-single.png'
Expand All @@ -220,7 +219,7 @@ test.describe('Customized', () => {
}`
});

await setSidebarWidth(page);
await page.sidebar.setWidth();

await page.dblclick(
'[aria-label="File Browser Section"] >> text=notebooks'
Expand All @@ -247,7 +246,7 @@ test.describe('Customized', () => {
}`
});

await setSidebarWidth(page);
await page.sidebar.setWidth();

await page.click('text=Tabs');

Expand All @@ -267,7 +266,7 @@ test.describe('Customized', () => {
}`
});

await setSidebarWidth(page);
await page.sidebar.setWidth();

await page.dblclick(
'[aria-label="File Browser Section"] >> text=notebooks'
Expand Down
22 changes: 11 additions & 11 deletions galata/test/documentation/debugger.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
IJupyterLabPageFixture,
test
} from '@jupyterlab/galata';
import { positionMouseOver, setSidebarWidth } from './utils';
import { positionMouseOver } from './utils';

test.use({
autoGoto: false,
Expand Down Expand Up @@ -43,7 +43,7 @@ test.describe('Debugger', () => {

await page.debugger.switchOn();
await page.waitForCondition(() => page.debugger.isOpen());
await setSidebarWidth(page, 251, 'right');
await page.sidebar.setWidth(251, 'right');

expect(
await page.screenshot({ clip: { y: 62, x: 780, width: 210, height: 32 } })
Expand All @@ -57,7 +57,7 @@ test.describe('Debugger', () => {

await page.debugger.switchOn();
await page.waitForCondition(() => page.debugger.isOpen());
await setSidebarWidth(page, 251, 'right');
await page.sidebar.setWidth(251, 'right');

await setBreakpoint(page);

Expand Down Expand Up @@ -105,7 +105,7 @@ test.describe('Debugger', () => {

await page.debugger.switchOn();
await page.waitForCondition(() => page.debugger.isOpen());
await setSidebarWidth(page, 251, 'right');
await page.sidebar.setWidth(251, 'right');

await setBreakpoint(page);

Expand All @@ -131,7 +131,7 @@ test.describe('Debugger', () => {

await page.debugger.switchOn();
await page.waitForCondition(() => page.debugger.isOpen());
await setSidebarWidth(page, 251, 'right');
await page.sidebar.setWidth(251, 'right');

await expect(
page.locator('jp-button.jp-PauseOnExceptions')
Expand Down Expand Up @@ -201,7 +201,7 @@ test.describe('Debugger', () => {
'[data-id="jp-debugger-sidebar"]'
);
await sidebar.click();
await setSidebarWidth(page, 251, 'right');
await page.sidebar.setWidth(251, 'right');

// Inject mouse pointer
await page.evaluate(
Expand All @@ -225,7 +225,7 @@ test.describe('Debugger', () => {

await page.debugger.switchOn();
await page.waitForCondition(() => page.debugger.isOpen());
await setSidebarWidth(page, 251, 'right');
await page.sidebar.setWidth(251, 'right');

await setBreakpoint(page);

Expand All @@ -252,7 +252,7 @@ test.describe('Debugger', () => {

await page.debugger.switchOn();
await page.waitForCondition(() => page.debugger.isOpen());
await setSidebarWidth(page, 251, 'right');
await page.sidebar.setWidth(251, 'right');

await setBreakpoint(page);

Expand Down Expand Up @@ -283,7 +283,7 @@ test.describe('Debugger', () => {

await page.debugger.switchOn();
await page.waitForCondition(() => page.debugger.isOpen());
await setSidebarWidth(page, 251, 'right');
await page.sidebar.setWidth(251, 'right');

await setBreakpoint(page);

Expand Down Expand Up @@ -313,7 +313,7 @@ test.describe('Debugger', () => {

await page.debugger.switchOn();
await page.waitForCondition(() => page.debugger.isOpen());
await setSidebarWidth(page, 251, 'right');
await page.sidebar.setWidth(251, 'right');

await setBreakpoint(page);

Expand All @@ -340,7 +340,7 @@ test.describe('Debugger', () => {
async function createNotebook(page: IJupyterLabPageFixture) {
await page.notebook.createNew();

await setSidebarWidth(page);
await page.sidebar.setWidth();

await page.waitForSelector('text=Python 3 (ipykernel) | Idle');
}
Expand Down
5 changes: 2 additions & 3 deletions galata/test/documentation/export_notebook.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Distributed under the terms of the Modified BSD License.

import { expect, galata, test } from '@jupyterlab/galata';
import { setSidebarWidth } from './utils';

test.use({
autoGoto: false,
Expand All @@ -14,7 +13,7 @@ test.describe('Export Notebook', () => {
test('Export Menu', async ({ page }) => {
await page.goto();

await setSidebarWidth(page);
await page.sidebar.setWidth();

await page.dblclick(
'[aria-label="File Browser Section"] >> text=notebooks'
Expand All @@ -40,7 +39,7 @@ test.describe('Export Notebook', () => {
test('Slides', async ({ page }) => {
await page.goto();

await setSidebarWidth(page);
await page.sidebar.setWidth();

await page
.locator('[aria-label="File Browser Section"]')
Expand Down
4 changes: 2 additions & 2 deletions galata/test/documentation/extension_manager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
IJupyterLabPageFixture,
test
} from '@jupyterlab/galata';
import { setSidebarWidth, stubGitHubUserIcons } from './utils';
import { stubGitHubUserIcons } from './utils';
import { default as extensionsList } from './data/extensions.json';
import { default as allExtensionsList } from './data/extensions-search-all.json';
import { default as drawioExtensionsList } from './data/extensions-search-drawio.json';
Expand Down Expand Up @@ -198,5 +198,5 @@ async function openExtensionSidebar(page: IJupyterLabPageFixture) {
'.jp-extensionmanager-view >> .jp-AccordionPanel-title[aria-expanded="false"] >> text=Warning'
);

await setSidebarWidth(page);
await page.sidebar.setWidth();
}
Loading

0 comments on commit df3b904

Please sign in to comment.