@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.
Files changed (46) hide show
  1. package/lib/index.d.ts +3 -0
  2. package/lib/index.d.ts.map +1 -1
  3. package/lib/index.js +3 -0
  4. package/lib/index.js.map +1 -1
  5. package/lib/tests/theia-notebook-editor.test.d.ts +2 -0
  6. package/lib/tests/theia-notebook-editor.test.d.ts.map +1 -0
  7. package/lib/tests/theia-notebook-editor.test.js +170 -0
  8. package/lib/tests/theia-notebook-editor.test.js.map +1 -0
  9. package/lib/tests/theia-quick-command.test.js +5 -0
  10. package/lib/tests/theia-quick-command.test.js.map +1 -1
  11. package/lib/theia-monaco-editor.d.ts +10 -0
  12. package/lib/theia-monaco-editor.d.ts.map +1 -1
  13. package/lib/theia-monaco-editor.js +29 -1
  14. package/lib/theia-monaco-editor.js.map +1 -1
  15. package/lib/theia-notebook-cell.d.ts +88 -0
  16. package/lib/theia-notebook-cell.d.ts.map +1 -0
  17. package/lib/theia-notebook-cell.js +195 -0
  18. package/lib/theia-notebook-cell.js.map +1 -0
  19. package/lib/theia-notebook-editor.d.ts +50 -0
  20. package/lib/theia-notebook-editor.d.ts.map +1 -0
  21. package/lib/theia-notebook-editor.js +153 -0
  22. package/lib/theia-notebook-editor.js.map +1 -0
  23. package/lib/theia-notebook-toolbar.d.ts +13 -0
  24. package/lib/theia-notebook-toolbar.d.ts.map +1 -0
  25. package/lib/theia-notebook-toolbar.js +47 -0
  26. package/lib/theia-notebook-toolbar.js.map +1 -0
  27. package/lib/theia-preference-view.d.ts +7 -1
  28. package/lib/theia-preference-view.d.ts.map +1 -1
  29. package/lib/theia-preference-view.js +16 -2
  30. package/lib/theia-preference-view.js.map +1 -1
  31. package/lib/theia-quick-command-palette.d.ts +1 -0
  32. package/lib/theia-quick-command-palette.d.ts.map +1 -1
  33. package/lib/theia-quick-command-palette.js +8 -0
  34. package/lib/theia-quick-command-palette.js.map +1 -1
  35. package/package.json +3 -3
  36. package/src/index.ts +3 -0
  37. package/src/tests/resources/notebook-files/.theia/settings.json +3 -0
  38. package/src/tests/resources/notebook-files/sample.ipynb +18 -0
  39. package/src/tests/theia-notebook-editor.test.ts +209 -0
  40. package/src/tests/theia-quick-command.test.ts +6 -0
  41. package/src/theia-monaco-editor.ts +31 -1
  42. package/src/theia-notebook-cell.ts +232 -0
  43. package/src/theia-notebook-editor.ts +171 -0
  44. package/src/theia-notebook-toolbar.ts +53 -0
  45. package/src/theia-preference-view.ts +14 -2
  46. 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
- override async open(preferenceScope = TheiaPreferenceScope.Workspace): Promise<TheiaView> {
90
- await this.app.quickCommandPalette.trigger('Preferences: Open Settings (UI)');
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
  }