@theia/playwright 1.37.0-next.1 → 1.37.0-next.11

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 (92) hide show
  1. package/lib/index.d.ts +4 -0
  2. package/lib/index.d.ts.map +1 -1
  3. package/lib/index.js +4 -0
  4. package/lib/index.js.map +1 -1
  5. package/lib/tests/theia-explorer-view.test.js +25 -5
  6. package/lib/tests/theia-explorer-view.test.js.map +1 -1
  7. package/lib/tests/theia-main-menu.test.js +2 -2
  8. package/lib/tests/theia-main-menu.test.js.map +1 -1
  9. package/lib/tests/theia-output-view.test.d.ts +2 -0
  10. package/lib/tests/theia-output-view.test.d.ts.map +1 -0
  11. package/lib/tests/theia-output-view.test.js +77 -0
  12. package/lib/tests/theia-output-view.test.js.map +1 -0
  13. package/lib/tests/theia-quick-command.test.js +14 -0
  14. package/lib/tests/theia-quick-command.test.js.map +1 -1
  15. package/lib/tests/theia-sample-app.test.js +3 -30
  16. package/lib/tests/theia-sample-app.test.js.map +1 -1
  17. package/lib/tests/theia-terminal-view.test.d.ts +2 -0
  18. package/lib/tests/theia-terminal-view.test.d.ts.map +1 -0
  19. package/lib/tests/theia-terminal-view.test.js +76 -0
  20. package/lib/tests/theia-terminal-view.test.js.map +1 -0
  21. package/lib/tests/theia-toolbar.test.d.ts +2 -0
  22. package/lib/tests/theia-toolbar.test.d.ts.map +1 -0
  23. package/lib/tests/theia-toolbar.test.js +60 -0
  24. package/lib/tests/theia-toolbar.test.js.map +1 -0
  25. package/lib/tests/theia-workspace.test.js +5 -3
  26. package/lib/tests/theia-workspace.test.js.map +1 -1
  27. package/lib/theia-app.d.ts +7 -0
  28. package/lib/theia-app.d.ts.map +1 -1
  29. package/lib/theia-app.js +31 -1
  30. package/lib/theia-app.js.map +1 -1
  31. package/lib/theia-explorer-view.d.ts +11 -4
  32. package/lib/theia-explorer-view.d.ts.map +1 -1
  33. package/lib/theia-explorer-view.js +54 -6
  34. package/lib/theia-explorer-view.js.map +1 -1
  35. package/lib/theia-monaco-editor.d.ts +16 -0
  36. package/lib/theia-monaco-editor.d.ts.map +1 -0
  37. package/lib/theia-monaco-editor.js +76 -0
  38. package/lib/theia-monaco-editor.js.map +1 -0
  39. package/lib/theia-output-channel.d.ts +25 -0
  40. package/lib/theia-output-channel.d.ts.map +1 -0
  41. package/lib/theia-output-channel.js +72 -0
  42. package/lib/theia-output-channel.js.map +1 -0
  43. package/lib/theia-output-view.d.ts +10 -0
  44. package/lib/theia-output-view.d.ts.map +1 -0
  45. package/lib/theia-output-view.js +82 -0
  46. package/lib/theia-output-view.js.map +1 -0
  47. package/lib/theia-quick-command-palette.d.ts +2 -1
  48. package/lib/theia-quick-command-palette.d.ts.map +1 -1
  49. package/lib/theia-quick-command-palette.js +9 -2
  50. package/lib/theia-quick-command-palette.js.map +1 -1
  51. package/lib/theia-terminal.d.ts +14 -0
  52. package/lib/theia-terminal.d.ts.map +1 -0
  53. package/lib/theia-terminal.js +60 -0
  54. package/lib/theia-terminal.js.map +1 -0
  55. package/lib/theia-text-editor.d.ts +2 -3
  56. package/lib/theia-text-editor.d.ts.map +1 -1
  57. package/lib/theia-text-editor.js +11 -40
  58. package/lib/theia-text-editor.js.map +1 -1
  59. package/lib/theia-toolbar-item.d.ts +11 -0
  60. package/lib/theia-toolbar-item.d.ts.map +1 -0
  61. package/lib/theia-toolbar-item.js +40 -0
  62. package/lib/theia-toolbar-item.js.map +1 -0
  63. package/lib/theia-toolbar.d.ts +20 -0
  64. package/lib/theia-toolbar.d.ts.map +1 -0
  65. package/lib/theia-toolbar.js +91 -0
  66. package/lib/theia-toolbar.js.map +1 -0
  67. package/lib/theia-tree-node.d.ts +1 -0
  68. package/lib/theia-tree-node.d.ts.map +1 -1
  69. package/lib/theia-tree-node.js +8 -0
  70. package/lib/theia-tree-node.js.map +1 -1
  71. package/package.json +13 -10
  72. package/src/index.ts +4 -0
  73. package/src/tests/resources/sample-files1/sampleFolderCompact/nestedFolder1/nestedFolder2/sampleFile1-1.txt +0 -0
  74. package/src/tests/theia-explorer-view.test.ts +26 -6
  75. package/src/tests/theia-main-menu.test.ts +2 -2
  76. package/src/tests/theia-output-view.test.ts +85 -0
  77. package/src/tests/theia-quick-command.test.ts +15 -0
  78. package/src/tests/theia-sample-app.test.ts +3 -34
  79. package/src/tests/theia-terminal-view.test.ts +85 -0
  80. package/src/tests/theia-toolbar.test.ts +65 -0
  81. package/src/tests/theia-workspace.test.ts +5 -3
  82. package/src/theia-app.ts +38 -1
  83. package/src/theia-explorer-view.ts +60 -7
  84. package/src/theia-monaco-editor.ts +83 -0
  85. package/src/theia-output-channel.ts +88 -0
  86. package/src/theia-output-view.ts +87 -0
  87. package/src/theia-quick-command-palette.ts +10 -2
  88. package/src/theia-terminal.ts +69 -0
  89. package/src/theia-text-editor.ts +13 -44
  90. package/src/theia-toolbar-item.ts +41 -0
  91. package/src/theia-toolbar.ts +99 -0
  92. package/src/theia-tree-node.ts +10 -1
@@ -0,0 +1,99 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2023 EclipseSource 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 WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { ElementHandle } from '@playwright/test';
18
+ import { TheiaPageObject } from './theia-page-object';
19
+ import { TheiaToolbarItem } from './theia-toolbar-item';
20
+
21
+ export class TheiaToolbar extends TheiaPageObject {
22
+ selector = 'div#main-toolbar.p-TabBar-toolbar';
23
+
24
+ protected async toolbarElementHandle(): Promise<ElementHandle<SVGElement | HTMLElement> | null> {
25
+ return this.page.$(this.selector);
26
+ }
27
+
28
+ async waitForVisible(): Promise<void> {
29
+ await this.page.waitForSelector(this.selector, { state: 'visible' });
30
+ }
31
+
32
+ async isShown(): Promise<boolean> {
33
+ const statusBar = await this.toolbarElementHandle();
34
+ return !!statusBar && statusBar.isVisible();
35
+ }
36
+
37
+ async show(): Promise<void> {
38
+ if (!await this.isShown()) {
39
+ await this.toggle();
40
+ }
41
+ }
42
+
43
+ async hide(): Promise<void> {
44
+ if (await this.isShown()) {
45
+ await this.toggle();
46
+ }
47
+ }
48
+
49
+ async toggle(): Promise<void> {
50
+ const isShown = await this.isShown();
51
+ const viewMenu = await this.app.menuBar.openMenu('View');
52
+ await viewMenu.clickMenuItem('Toggle Toolbar');
53
+ isShown ? await this.waitUntilHidden() : await this.waitUntilShown();
54
+ }
55
+
56
+ async waitUntilHidden(): Promise<void> {
57
+ await this.page.waitForSelector(this.selector, { state: 'hidden' });
58
+ }
59
+
60
+ async waitUntilShown(): Promise<void> {
61
+ await this.page.waitForSelector(this.selector, { state: 'visible' });
62
+ }
63
+
64
+ async toolbarItems(): Promise<TheiaToolbarItem[]> {
65
+ const toolbarHandle = await this.toolbarElementHandle();
66
+ if (!toolbarHandle) {
67
+ return [];
68
+ }
69
+ const items = await toolbarHandle.$$(this.toolBarItemSelector());
70
+ return items.map(element => new TheiaToolbarItem(this.app, element));
71
+ }
72
+
73
+ async toolbarItemIds(): Promise<string[]> {
74
+ const items = await this.toolbarItems();
75
+ return this.toCommandIdArray(items);
76
+ }
77
+
78
+ async toolBarItem(commandId: string): Promise<TheiaToolbarItem | undefined> {
79
+ const toolbarHandle = await this.toolbarElementHandle();
80
+ if (!toolbarHandle) {
81
+ return undefined;
82
+ }
83
+ const item = await toolbarHandle.$(this.toolBarItemSelector(commandId));
84
+ if (item) {
85
+ return new TheiaToolbarItem(this.app, item);
86
+ }
87
+ return undefined;
88
+ }
89
+
90
+ protected toolBarItemSelector(toolbarItemId = ''): string {
91
+ return `div.toolbar-item${toolbarItemId ? `[id="${toolbarItemId}"]` : ''}`;
92
+ }
93
+
94
+ protected async toCommandIdArray(items: TheiaToolbarItem[]): Promise<string[]> {
95
+ const contents = items.map(item => item.commandId());
96
+ const resolvedContents = await Promise.all(contents);
97
+ return resolvedContents.filter(id => id !== undefined) as string[];
98
+ }
99
+ }
@@ -45,7 +45,7 @@ export class TheiaTreeNode {
45
45
  }
46
46
 
47
47
  async expand(): Promise<void> {
48
- if (! await this.isCollapsed()) {
48
+ if (!await this.isCollapsed()) {
49
49
  return;
50
50
  }
51
51
  const expansionToggle = await this.elementHandle.waitForSelector(this.expansionToggleCssClass);
@@ -53,6 +53,15 @@ export class TheiaTreeNode {
53
53
  await this.elementHandle.waitForSelector(`${this.expansionToggleCssClass}:not(${this.collapsedCssClass})`);
54
54
  }
55
55
 
56
+ async collapse(): Promise<void> {
57
+ if (await this.isCollapsed()) {
58
+ return;
59
+ }
60
+ const expansionToggle = await this.elementHandle.waitForSelector(this.expansionToggleCssClass);
61
+ await expansionToggle.click();
62
+ await this.elementHandle.waitForSelector(`${this.expansionToggleCssClass}${this.collapsedCssClass}`);
63
+ }
64
+
56
65
  async openContextMenu(): Promise<TheiaMenu> {
57
66
  return TheiaContextMenu.open(this.app, () => this.elementHandle.waitForSelector(this.labelElementCssClass));
58
67
  }