@theia/playwright 1.55.0-next.14 → 1.55.0-next.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +3 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -0
- package/lib/index.js.map +1 -1
- package/lib/tests/theia-notebook-editor.test.d.ts +2 -0
- package/lib/tests/theia-notebook-editor.test.d.ts.map +1 -0
- package/lib/tests/theia-notebook-editor.test.js +170 -0
- package/lib/tests/theia-notebook-editor.test.js.map +1 -0
- package/lib/tests/theia-quick-command.test.js +5 -0
- package/lib/tests/theia-quick-command.test.js.map +1 -1
- package/lib/theia-monaco-editor.d.ts +10 -0
- package/lib/theia-monaco-editor.d.ts.map +1 -1
- package/lib/theia-monaco-editor.js +29 -1
- package/lib/theia-monaco-editor.js.map +1 -1
- package/lib/theia-notebook-cell.d.ts +88 -0
- package/lib/theia-notebook-cell.d.ts.map +1 -0
- package/lib/theia-notebook-cell.js +195 -0
- package/lib/theia-notebook-cell.js.map +1 -0
- package/lib/theia-notebook-editor.d.ts +50 -0
- package/lib/theia-notebook-editor.d.ts.map +1 -0
- package/lib/theia-notebook-editor.js +153 -0
- package/lib/theia-notebook-editor.js.map +1 -0
- package/lib/theia-notebook-toolbar.d.ts +13 -0
- package/lib/theia-notebook-toolbar.d.ts.map +1 -0
- package/lib/theia-notebook-toolbar.js +47 -0
- package/lib/theia-notebook-toolbar.js.map +1 -0
- package/lib/theia-preference-view.d.ts +7 -1
- package/lib/theia-preference-view.d.ts.map +1 -1
- package/lib/theia-preference-view.js +16 -2
- package/lib/theia-preference-view.js.map +1 -1
- package/lib/theia-quick-command-palette.d.ts +1 -0
- package/lib/theia-quick-command-palette.d.ts.map +1 -1
- package/lib/theia-quick-command-palette.js +8 -0
- package/lib/theia-quick-command-palette.js.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +3 -0
- package/src/tests/resources/notebook-files/.theia/settings.json +3 -0
- package/src/tests/resources/notebook-files/sample.ipynb +18 -0
- package/src/tests/theia-notebook-editor.test.ts +209 -0
- package/src/tests/theia-quick-command.test.ts +6 -0
- package/src/theia-monaco-editor.ts +31 -1
- package/src/theia-notebook-cell.ts +232 -0
- package/src/theia-notebook-editor.ts +171 -0
- package/src/theia-notebook-toolbar.ts +53 -0
- package/src/theia-preference-view.ts +14 -2
- package/src/theia-quick-command-palette.ts +10 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2024 TypeFox GmbH and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import { ElementHandle, Locator } from '@playwright/test';
|
|
18
|
+
import { TheiaApp } from './theia-app';
|
|
19
|
+
import { TheiaToolbar } from './theia-toolbar';
|
|
20
|
+
|
|
21
|
+
export class TheiaNotebookToolbar extends TheiaToolbar {
|
|
22
|
+
public readonly locator: Locator;
|
|
23
|
+
|
|
24
|
+
constructor(parentLocator: Locator, app: TheiaApp) {
|
|
25
|
+
super(app);
|
|
26
|
+
this.selector = 'div#notebook-main-toolbar';
|
|
27
|
+
this.locator = parentLocator.locator(this.selector);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
protected override toolBarItemSelector(toolbarItemId = ''): string {
|
|
31
|
+
return `div.theia-notebook-main-toolbar-item${toolbarItemId ? `[id="${toolbarItemId}"]` : ''}`;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
protected override async toolbarElementHandle(): Promise<ElementHandle<SVGElement | HTMLElement> | null> {
|
|
35
|
+
// Use locator instead of page to find the toolbar element.
|
|
36
|
+
return this.locator.elementHandle();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
override async waitForVisible(): Promise<void> {
|
|
40
|
+
// Use locator instead of page to find the toolbar element.
|
|
41
|
+
await this.locator.waitFor({ state: 'visible' });
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
override async waitUntilHidden(): Promise<void> {
|
|
45
|
+
// Use locator instead of page to find the toolbar element.
|
|
46
|
+
await this.locator.waitFor({ state: 'hidden' });
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
override async waitUntilShown(): Promise<void> {
|
|
50
|
+
// Use locator instead of page to find the toolbar element.
|
|
51
|
+
await this.locator.waitFor({ state: 'visible' });
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -86,8 +86,20 @@ export class TheiaPreferenceView extends TheiaView {
|
|
|
86
86
|
super(TheiaSettingsViewData, app);
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
/**
|
|
90
|
+
* @param preferenceScope The preference scope (Workspace or User) to open the view for. Default is Workspace.
|
|
91
|
+
* @param useMenu If true, the view will be opened via the main menu. If false,
|
|
92
|
+
* the view will be opened via the quick command palette. Default is using the main menu.
|
|
93
|
+
* @returns The TheiaPreferenceView page object instance.
|
|
94
|
+
*/
|
|
95
|
+
override async open(preferenceScope = TheiaPreferenceScope.Workspace, useMenu: boolean = true): Promise<TheiaView> {
|
|
96
|
+
if (useMenu) {
|
|
97
|
+
const mainMenu = await this.app.menuBar.openMenu('File');
|
|
98
|
+
await (await mainMenu.menuItemByNamePath('Preferences', 'Settings'))?.click();
|
|
99
|
+
} else {
|
|
100
|
+
await this.app.quickCommandPalette.type('Preferences:');
|
|
101
|
+
await this.app.quickCommandPalette.trigger('Preferences: Open Settings (UI)');
|
|
102
|
+
}
|
|
91
103
|
await this.waitForVisible();
|
|
92
104
|
await this.openPreferenceScope(preferenceScope);
|
|
93
105
|
return this;
|
|
@@ -78,4 +78,14 @@ export class TheiaQuickCommandPalette extends TheiaPageObject {
|
|
|
78
78
|
}
|
|
79
79
|
return command.$('.monaco-list-row.focused .monaco-highlighted-label');
|
|
80
80
|
}
|
|
81
|
+
|
|
82
|
+
async visibleItems(): Promise<ElementHandle<SVGElement | HTMLElement>[]> {
|
|
83
|
+
// FIXME rewrite with locators
|
|
84
|
+
const command = await this.page.waitForSelector(this.selector);
|
|
85
|
+
if (!command) {
|
|
86
|
+
throw new Error('No selected command found!');
|
|
87
|
+
}
|
|
88
|
+
return command.$$('.monaco-highlighted-label');
|
|
89
|
+
}
|
|
90
|
+
|
|
81
91
|
}
|