@theia/playwright 1.25.0-next.9 → 1.25.0

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 (173) hide show
  1. package/lib/index.d.ts +26 -0
  2. package/lib/index.d.ts.map +1 -0
  3. package/lib/index.js +53 -0
  4. package/lib/index.js.map +1 -0
  5. package/lib/tests/fixtures/theia-fixture.d.ts +4 -0
  6. package/lib/tests/fixtures/theia-fixture.d.ts.map +1 -0
  7. package/lib/tests/fixtures/theia-fixture.js +24 -0
  8. package/lib/tests/fixtures/theia-fixture.js.map +1 -0
  9. package/lib/tests/theia-app.test.d.ts +2 -0
  10. package/lib/tests/theia-app.test.d.ts.map +1 -0
  11. package/lib/tests/theia-app.test.js +30 -0
  12. package/lib/tests/theia-app.test.js.map +1 -0
  13. package/lib/tests/theia-explorer-view.test.d.ts +2 -0
  14. package/lib/tests/theia-explorer-view.test.d.ts.map +1 -0
  15. package/lib/tests/theia-explorer-view.test.js +110 -0
  16. package/lib/tests/theia-explorer-view.test.js.map +1 -0
  17. package/lib/tests/theia-main-menu.test.d.ts +2 -0
  18. package/lib/tests/theia-main-menu.test.d.ts.map +1 -0
  19. package/lib/tests/theia-main-menu.test.js +74 -0
  20. package/lib/tests/theia-main-menu.test.js.map +1 -0
  21. package/lib/tests/theia-preference-view.test.d.ts +2 -0
  22. package/lib/tests/theia-preference-view.test.d.ts.map +1 -0
  23. package/lib/tests/theia-preference-view.test.js +79 -0
  24. package/lib/tests/theia-preference-view.test.js.map +1 -0
  25. package/lib/tests/theia-problems-view.test.d.ts +2 -0
  26. package/lib/tests/theia-problems-view.test.d.ts.map +1 -0
  27. package/lib/tests/theia-problems-view.test.js +53 -0
  28. package/lib/tests/theia-problems-view.test.js.map +1 -0
  29. package/lib/tests/theia-quick-command.test.d.ts +2 -0
  30. package/lib/tests/theia-quick-command.test.d.ts.map +1 -0
  31. package/lib/tests/theia-quick-command.test.js +54 -0
  32. package/lib/tests/theia-quick-command.test.js.map +1 -0
  33. package/lib/tests/theia-sample-app.test.d.ts +2 -0
  34. package/lib/tests/theia-sample-app.test.d.ts.map +1 -0
  35. package/lib/tests/theia-sample-app.test.js +81 -0
  36. package/lib/tests/theia-sample-app.test.js.map +1 -0
  37. package/lib/tests/theia-status-bar.test.d.ts +2 -0
  38. package/lib/tests/theia-status-bar.test.d.ts.map +1 -0
  39. package/lib/tests/theia-status-bar.test.js +42 -0
  40. package/lib/tests/theia-status-bar.test.js.map +1 -0
  41. package/lib/tests/theia-text-editor.test.d.ts +2 -0
  42. package/lib/tests/theia-text-editor.test.d.ts.map +1 -0
  43. package/lib/tests/theia-text-editor.test.js +148 -0
  44. package/lib/tests/theia-text-editor.test.js.map +1 -0
  45. package/lib/tests/theia-workspace.test.d.ts +2 -0
  46. package/lib/tests/theia-workspace.test.d.ts.map +1 -0
  47. package/lib/tests/theia-workspace.test.js +48 -0
  48. package/lib/tests/theia-workspace.test.js.map +1 -0
  49. package/lib/theia-about-dialog.d.ts +5 -0
  50. package/lib/theia-about-dialog.d.ts.map +1 -0
  51. package/lib/theia-about-dialog.js +27 -0
  52. package/lib/theia-about-dialog.js.map +1 -0
  53. package/lib/theia-app.d.ts +44 -0
  54. package/lib/theia-app.d.ts.map +1 -0
  55. package/lib/theia-app.js +136 -0
  56. package/lib/theia-app.js.map +1 -0
  57. package/lib/theia-context-menu.d.ts +9 -0
  58. package/lib/theia-context-menu.d.ts.map +1 -0
  59. package/lib/theia-context-menu.js +38 -0
  60. package/lib/theia-context-menu.js.map +1 -0
  61. package/lib/theia-dialog.d.ts +28 -0
  62. package/lib/theia-dialog.d.ts.map +1 -0
  63. package/lib/theia-dialog.js +99 -0
  64. package/lib/theia-dialog.js.map +1 -0
  65. package/lib/theia-editor.d.ts +10 -0
  66. package/lib/theia-editor.d.ts.map +1 -0
  67. package/lib/theia-editor.js +69 -0
  68. package/lib/theia-editor.js.map +1 -0
  69. package/lib/theia-explorer-view.d.ts +39 -0
  70. package/lib/theia-explorer-view.d.ts.map +1 -0
  71. package/lib/theia-explorer-view.js +210 -0
  72. package/lib/theia-explorer-view.js.map +1 -0
  73. package/lib/theia-main-menu.d.ts +13 -0
  74. package/lib/theia-main-menu.d.ts.map +1 -0
  75. package/lib/theia-main-menu.js +54 -0
  76. package/lib/theia-main-menu.js.map +1 -0
  77. package/lib/theia-menu-item.d.ts +14 -0
  78. package/lib/theia-menu-item.d.ts.map +1 -0
  79. package/lib/theia-menu-item.js +55 -0
  80. package/lib/theia-menu-item.js.map +1 -0
  81. package/lib/theia-menu.d.ts +17 -0
  82. package/lib/theia-menu.d.ts.map +1 -0
  83. package/lib/theia-menu.js +87 -0
  84. package/lib/theia-menu.js.map +1 -0
  85. package/lib/theia-notification-indicator.d.ts +9 -0
  86. package/lib/theia-notification-indicator.d.ts.map +1 -0
  87. package/lib/theia-notification-indicator.js +45 -0
  88. package/lib/theia-notification-indicator.js.map +1 -0
  89. package/lib/theia-notification-overlay.d.ts +23 -0
  90. package/lib/theia-notification-overlay.d.ts.map +1 -0
  91. package/lib/theia-notification-overlay.js +80 -0
  92. package/lib/theia-notification-overlay.js.map +1 -0
  93. package/lib/theia-page-object.d.ts +8 -0
  94. package/lib/theia-page-object.d.ts.map +1 -0
  95. package/lib/theia-page-object.js +28 -0
  96. package/lib/theia-page-object.js.map +1 -0
  97. package/lib/theia-preference-view.d.ts +51 -0
  98. package/lib/theia-preference-view.d.ts.map +1 -0
  99. package/lib/theia-preference-view.js +197 -0
  100. package/lib/theia-preference-view.js.map +1 -0
  101. package/lib/theia-problem-indicator.d.ts +9 -0
  102. package/lib/theia-problem-indicator.d.ts.map +1 -0
  103. package/lib/theia-problem-indicator.js +40 -0
  104. package/lib/theia-problem-indicator.js.map +1 -0
  105. package/lib/theia-problem-view.d.ts +6 -0
  106. package/lib/theia-problem-view.d.ts.map +1 -0
  107. package/lib/theia-problem-view.js +31 -0
  108. package/lib/theia-problem-view.js.map +1 -0
  109. package/lib/theia-quick-command-palette.d.ts +12 -0
  110. package/lib/theia-quick-command-palette.d.ts.map +1 -0
  111. package/lib/theia-quick-command-palette.js +74 -0
  112. package/lib/theia-quick-command-palette.js.map +1 -0
  113. package/lib/theia-rename-dialog.d.ts +6 -0
  114. package/lib/theia-rename-dialog.d.ts.map +1 -0
  115. package/lib/theia-rename-dialog.js +36 -0
  116. package/lib/theia-rename-dialog.js.map +1 -0
  117. package/lib/theia-status-bar.d.ts +14 -0
  118. package/lib/theia-status-bar.d.ts.map +1 -0
  119. package/lib/theia-status-bar.js +40 -0
  120. package/lib/theia-status-bar.js.map +1 -0
  121. package/lib/theia-status-indicator.d.ts +15 -0
  122. package/lib/theia-status-indicator.d.ts.map +1 -0
  123. package/lib/theia-status-indicator.js +77 -0
  124. package/lib/theia-status-indicator.js.map +1 -0
  125. package/lib/theia-text-editor.d.ts +28 -0
  126. package/lib/theia-text-editor.d.ts.map +1 -0
  127. package/lib/theia-text-editor.js +149 -0
  128. package/lib/theia-text-editor.js.map +1 -0
  129. package/lib/theia-toggle-bottom-indicator.d.ts +5 -0
  130. package/lib/theia-toggle-bottom-indicator.d.ts.map +1 -0
  131. package/lib/theia-toggle-bottom-indicator.js +27 -0
  132. package/lib/theia-toggle-bottom-indicator.js.map +1 -0
  133. package/lib/theia-tree-node.d.ts +17 -0
  134. package/lib/theia-tree-node.d.ts.map +1 -0
  135. package/lib/theia-tree-node.js +54 -0
  136. package/lib/theia-tree-node.js.map +1 -0
  137. package/lib/theia-view.d.ts +33 -0
  138. package/lib/theia-view.d.ts.map +1 -0
  139. package/lib/theia-view.js +152 -0
  140. package/lib/theia-view.js.map +1 -0
  141. package/lib/theia-workspace.d.ts +19 -0
  142. package/lib/theia-workspace.d.ts.map +1 -0
  143. package/lib/theia-workspace.js +70 -0
  144. package/lib/theia-workspace.js.map +1 -0
  145. package/lib/util.d.ts +20 -0
  146. package/lib/util.d.ts.map +1 -0
  147. package/lib/util.js +94 -0
  148. package/lib/util.js.map +1 -0
  149. package/package.json +8 -6
  150. package/src/index.ts +41 -0
  151. package/src/tests/fixtures/theia-fixture.ts +25 -0
  152. package/src/tests/resources/sample-files1/sample.txt +4 -0
  153. package/src/tests/resources/sample-files1/sampleFolder/sampleFolder1/sampleFolder1-1/sampleFile1-1-1.txt +1 -0
  154. package/src/tests/resources/sample-files1/sampleFolder/sampleFolder1/sampleFolder1-1/sampleFile1-1-2.txt +1 -0
  155. package/src/tests/resources/sample-files1/sampleFolder/sampleFolder1/sampleFolder1-2/sampleFile1-2-1.txt +1 -0
  156. package/src/tests/resources/sample-files1/sampleFolder/sampleFolder1/sampleFolder1-2/sampleFile1-2-2.txt +1 -0
  157. package/src/tests/resources/sample-files1/sampleFolder/sampleFolder2/sampleFolder2-1/sampleFile2-1-1.txt +1 -0
  158. package/src/tests/resources/sample-files1/sampleFolder/sampleFolder2/sampleFolder2-1/sampleFile2-1-2.txt +1 -0
  159. package/src/tests/resources/sample-files1/sampleFolder/sampleFolder2/sampleFolder2-2/sampleFile2-2-1.txt +1 -0
  160. package/src/tests/resources/sample-files1/sampleFolder/sampleFolder2/sampleFolder2-2/sampleFile2-2-2.txt +1 -0
  161. package/src/tests/resources/sample-files2/another-sample.txt +1 -0
  162. package/src/tests/theia-app.test.ts +34 -0
  163. package/src/tests/theia-explorer-view.test.ts +124 -0
  164. package/src/tests/theia-main-menu.test.ts +89 -0
  165. package/src/tests/theia-preference-view.test.ts +93 -0
  166. package/src/tests/theia-problems-view.test.ts +60 -0
  167. package/src/tests/theia-quick-command.test.ts +61 -0
  168. package/src/tests/theia-sample-app.test.ts +92 -0
  169. package/src/tests/theia-status-bar.test.ts +47 -0
  170. package/src/tests/theia-text-editor.test.ts +176 -0
  171. package/src/tests/theia-workspace.test.ts +51 -0
  172. package/src/theia-app.ts +32 -14
  173. package/src/theia-workspace.ts +4 -0
@@ -0,0 +1,124 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2021 logi.cals GmbH, 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 { expect } from '@playwright/test';
18
+ import { TheiaApp } from '../theia-app';
19
+ import { DOT_FILES_FILTER, TheiaExplorerView } from '../theia-explorer-view';
20
+ import { TheiaWorkspace } from '../theia-workspace';
21
+ import test, { page } from './fixtures/theia-fixture';
22
+
23
+ let app: TheiaApp;
24
+ let explorer: TheiaExplorerView;
25
+
26
+ test.describe('Theia Explorer View', () => {
27
+
28
+ test.beforeAll(async () => {
29
+ const ws = new TheiaWorkspace(['src/tests/resources/sample-files1']);
30
+ app = await TheiaApp.load(page, ws);
31
+ explorer = await app.openView(TheiaExplorerView);
32
+ });
33
+
34
+ test('should be visible and active after being opened', async () => {
35
+ expect(await explorer.isTabVisible()).toBe(true);
36
+ expect(await explorer.isDisplayed()).toBe(true);
37
+ expect(await explorer.isActive()).toBe(true);
38
+ });
39
+
40
+ test("should be opened at the left and have the title 'Explorer'", async () => {
41
+ expect(await explorer.isInSidePanel()).toBe(true);
42
+ expect(await explorer.side()).toBe('left');
43
+ expect(await explorer.title()).toBe('Explorer');
44
+ });
45
+
46
+ test('should be possible to close and reopen it', async () => {
47
+ await explorer.close();
48
+ expect(await explorer.isTabVisible()).toBe(false);
49
+
50
+ explorer = await app.openView(TheiaExplorerView);
51
+ expect(await explorer.isTabVisible()).toBe(true);
52
+ expect(await explorer.isDisplayed()).toBe(true);
53
+ expect(await explorer.isActive()).toBe(true);
54
+ });
55
+
56
+ test('should show one folder named "sampleFolder" and one file named "sample.txt"', async () => {
57
+ await explorer.selectTreeNode('sampleFolder');
58
+ expect(await explorer.isTreeNodeSelected('sampleFolder')).toBe(true);
59
+ const fileStatElements = await explorer.visibleFileStatNodes(DOT_FILES_FILTER);
60
+ expect(fileStatElements.length).toBe(2);
61
+
62
+ let file; let folder;
63
+ if (await fileStatElements[0].isFolder()) {
64
+ folder = fileStatElements[0];
65
+ file = fileStatElements[1];
66
+ } else {
67
+ folder = fileStatElements[1];
68
+ file = fileStatElements[0];
69
+ }
70
+
71
+ expect(await folder.label()).toBe('sampleFolder');
72
+ expect(await folder.isFile()).toBe(false);
73
+ expect(await folder.isFolder()).toBe(true);
74
+ expect(await file.label()).toBe('sample.txt');
75
+ expect(await file.isFolder()).toBe(false);
76
+ expect(await file.isFile()).toBe(true);
77
+ });
78
+
79
+ test('should provide file stat node by single path fragment "sample.txt"', async () => {
80
+ const file = await explorer.getFileStatNodeByLabel('sample.txt');
81
+ expect(await file.label()).toBe('sample.txt');
82
+ expect(await file.isFolder()).toBe(false);
83
+ expect(await file.isFile()).toBe(true);
84
+ });
85
+
86
+ test('should provide file stat nodes that can define whether they are collapsed or not and that can be expanded', async () => {
87
+ const file = await explorer.getFileStatNodeByLabel('sample.txt');
88
+ expect(await file.isCollapsed()).toBe(false);
89
+
90
+ const folder = await explorer.getFileStatNodeByLabel('sampleFolder');
91
+ expect(await folder.isCollapsed()).toBe(true);
92
+
93
+ await folder.expand();
94
+ expect(await folder.isCollapsed()).toBe(false);
95
+ });
96
+
97
+ test('should provide file stat node by path "sampleFolder/sampleFolder1/sampleFolder1-1/sampleFile1-1-1.txt"', async () => {
98
+ const file = await explorer.fileStatNode('sampleFolder/sampleFolder1/sampleFolder1-1/sampleFile1-1-1.txt');
99
+ if (!file) { throw Error('File stat node could not be retrieved by path'); }
100
+ expect(await file.label()).toBe('sampleFile1-1-1.txt');
101
+ });
102
+
103
+ test('should open context menu on "sample.txt"', async () => {
104
+ const file = await explorer.getFileStatNodeByLabel('sample.txt');
105
+ const menu = await file.openContextMenu();
106
+ expect(await menu.isOpen()).toBe(true);
107
+
108
+ const menuItems = await menu.visibleMenuItems();
109
+ expect(menuItems).toContain('Open');
110
+ expect(menuItems).toContain('Delete');
111
+ expect(menuItems).toContain('Download');
112
+
113
+ await menu.close();
114
+ expect(await menu.isOpen()).toBe(false);
115
+ });
116
+
117
+ test('should rename "sample.txt"', async () => {
118
+ await explorer.renameNode('sample.txt', 'sample-new.txt');
119
+ expect(await explorer.existsFileNode('sample-new.txt')).toBe(true);
120
+ await explorer.renameNode('sample-new.txt', 'sample.txt');
121
+ expect(await explorer.existsFileNode('sample.txt')).toBe(true);
122
+ });
123
+
124
+ });
@@ -0,0 +1,89 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2021 logi.cals GmbH, 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 { expect } from '@playwright/test';
18
+ import { OSUtil } from '../util';
19
+ import { TheiaApp } from '../theia-app';
20
+ import { TheiaMenuBar } from '../theia-main-menu';
21
+ import test, { page } from './fixtures/theia-fixture';
22
+
23
+ let menuBar: TheiaMenuBar;
24
+
25
+ test.describe('Theia Main Menu', () => {
26
+
27
+ test.beforeAll(async () => {
28
+ const app = await TheiaApp.load(page);
29
+ menuBar = app.menuBar;
30
+ });
31
+
32
+ test('should show the main menu bar', async () => {
33
+ const menuBarItems = await menuBar.visibleMenuBarItems();
34
+ expect(menuBarItems).toContain('File');
35
+ expect(menuBarItems).toContain('Edit');
36
+ expect(menuBarItems).toContain('Help');
37
+ });
38
+
39
+ test("should open main menu 'File'", async () => {
40
+ const mainMenu = await menuBar.openMenu('File');
41
+ expect(await mainMenu.isOpen()).toBe(true);
42
+ });
43
+
44
+ test("should show the menu items 'New File' and 'New Folder'", async () => {
45
+ const mainMenu = await menuBar.openMenu('File');
46
+ const menuItems = await mainMenu.visibleMenuItems();
47
+ expect(menuItems).toContain('New File');
48
+ expect(menuItems).toContain('New Folder');
49
+ });
50
+
51
+ test("should return menu item by name 'New File'", async () => {
52
+ const mainMenu = await menuBar.openMenu('File');
53
+ const menuItem = await mainMenu.menuItemByName('New File');
54
+ expect(menuItem).toBeDefined();
55
+
56
+ const label = await menuItem?.label();
57
+ expect(label).toBe('New File');
58
+
59
+ const shortCut = await menuItem?.shortCut();
60
+ expect(shortCut).toBe(OSUtil.isMacOS ? 'N' : 'Alt+N');
61
+
62
+ const hasSubmenu = await menuItem?.hasSubmenu();
63
+ expect(hasSubmenu).toBe(false);
64
+ });
65
+
66
+ test('should detect whether menu item has submenu', async () => {
67
+ const mainMenu = await menuBar.openMenu('File');
68
+ const newFileItem = await mainMenu.menuItemByName('New File');
69
+ const settingsItem = await mainMenu.menuItemByName('Preferences');
70
+
71
+ expect(await newFileItem?.hasSubmenu()).toBe(false);
72
+ expect(await settingsItem?.hasSubmenu()).toBe(true);
73
+ });
74
+
75
+ test('should be able to show menu item in submenu by path', async () => {
76
+ const mainMenu = await menuBar.openMenu('File');
77
+ const openPreferencesItem = await mainMenu.menuItemByNamePath('Preferences', 'Open Settings (UI)');
78
+
79
+ const label = await openPreferencesItem?.label();
80
+ expect(label).toBe('Open Settings (UI)');
81
+ });
82
+
83
+ test('should close main menu', async () => {
84
+ const mainMenu = await menuBar.openMenu('File');
85
+ await mainMenu.close();
86
+ expect(await mainMenu.isOpen()).toBe(false);
87
+ });
88
+
89
+ });
@@ -0,0 +1,93 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2021 logi.cals GmbH, 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 { expect } from '@playwright/test';
18
+ import { TheiaApp } from '../theia-app';
19
+ import { DefaultPreferences, PreferenceIds, TheiaPreferenceView } from '../theia-preference-view';
20
+ import test, { page } from './fixtures/theia-fixture';
21
+
22
+ let app: TheiaApp;
23
+
24
+ test.describe('Preference View', () => {
25
+
26
+ test.beforeAll(async () => {
27
+ app = await TheiaApp.load(page);
28
+ });
29
+
30
+ test('should be visible and active after being opened', async () => {
31
+ const preferenceView = await app.openPreferences(TheiaPreferenceView);
32
+ expect(await preferenceView.isTabVisible()).toBe(true);
33
+ expect(await preferenceView.isDisplayed()).toBe(true);
34
+ expect(await preferenceView.isActive()).toBe(true);
35
+ });
36
+
37
+ test('should be able to read, set, and reset String preferences', async () => {
38
+ const preferences = await app.openPreferences(TheiaPreferenceView);
39
+ const preferenceId = PreferenceIds.DiffEditor.MaxComputationTime;
40
+
41
+ await preferences.resetStringPreferenceById(preferenceId);
42
+ expect(await preferences.getStringPreferenceById(preferenceId)).toBe(DefaultPreferences.DiffEditor.MaxComputationTime);
43
+
44
+ await preferences.setStringPreferenceById(preferenceId, '8000');
45
+ await preferences.waitForModified(preferenceId);
46
+ expect(await preferences.getStringPreferenceById(preferenceId)).toBe('8000');
47
+
48
+ await preferences.resetStringPreferenceById(preferenceId);
49
+ expect(await preferences.getStringPreferenceById(preferenceId)).toBe(DefaultPreferences.DiffEditor.MaxComputationTime);
50
+ });
51
+
52
+ test('should be able to read, set, and reset Boolean preferences', async () => {
53
+ const preferences = await app.openPreferences(TheiaPreferenceView);
54
+ const preferenceId = PreferenceIds.Explorer.AutoReveal;
55
+
56
+ await preferences.resetBooleanPreferenceById(preferenceId);
57
+ expect(await preferences.getBooleanPreferenceById(preferenceId)).toBe(DefaultPreferences.Explorer.AutoReveal.Enabled);
58
+
59
+ await preferences.setBooleanPreferenceById(preferenceId, false);
60
+ await preferences.waitForModified(preferenceId);
61
+ expect(await preferences.getBooleanPreferenceById(preferenceId)).toBe(false);
62
+
63
+ await preferences.resetBooleanPreferenceById(preferenceId);
64
+ expect(await preferences.getBooleanPreferenceById(preferenceId)).toBe(DefaultPreferences.Explorer.AutoReveal.Enabled);
65
+ });
66
+
67
+ test('should throw an error if we try to read, set, or reset a non-existing preference', async () => {
68
+ const preferences = await app.openPreferences(TheiaPreferenceView);
69
+
70
+ preferences.customTimeout = 500;
71
+ try {
72
+ await expect(preferences.getBooleanPreferenceById('no.a.real.preference')).rejects.toThrowError();
73
+ await expect(preferences.setBooleanPreferenceById('no.a.real.preference', true)).rejects.toThrowError();
74
+ await expect(preferences.resetBooleanPreferenceById('no.a.real.preference')).rejects.toThrowError();
75
+
76
+ await expect(preferences.getStringPreferenceById('no.a.real.preference')).rejects.toThrowError();
77
+ await expect(preferences.setStringPreferenceById('no.a.real.preference', 'a')).rejects.toThrowError();
78
+ await expect(preferences.resetStringPreferenceById('no.a.real.preference')).rejects.toThrowError();
79
+ } finally {
80
+ preferences.customTimeout = undefined;
81
+ }
82
+ });
83
+
84
+ test('should throw an error if we try to read, or set a preference with the wrong type', async () => {
85
+ const preferences = await app.openPreferences(TheiaPreferenceView);
86
+ const stringPreference = PreferenceIds.DiffEditor.MaxComputationTime;
87
+ const booleanPreference = PreferenceIds.Explorer.AutoReveal;
88
+
89
+ await expect(preferences.getBooleanPreferenceById(stringPreference)).rejects.toThrowError();
90
+ await expect(preferences.setBooleanPreferenceById(stringPreference, true)).rejects.toThrowError();
91
+ await expect(preferences.setStringPreferenceById(booleanPreference, 'true')).rejects.toThrowError();
92
+ });
93
+ });
@@ -0,0 +1,60 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2021 logi.cals GmbH, 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 { expect } from '@playwright/test';
18
+ import { TheiaApp } from '../theia-app';
19
+ import { TheiaProblemsView } from '../theia-problem-view';
20
+ import test, { page } from './fixtures/theia-fixture';
21
+
22
+ let app: TheiaApp;
23
+
24
+ test.describe('Theia Problems View', () => {
25
+
26
+ test.beforeAll(async () => {
27
+ app = await TheiaApp.load(page);
28
+ });
29
+
30
+ test('should be visible and active after being opened', async () => {
31
+ const problemsView = await app.openView(TheiaProblemsView);
32
+ expect(await problemsView.isTabVisible()).toBe(true);
33
+ expect(await problemsView.isDisplayed()).toBe(true);
34
+ expect(await problemsView.isActive()).toBe(true);
35
+ });
36
+
37
+ test("should be opened at the bottom and have the title 'Problems'", async () => {
38
+ const problemsView = await app.openView(TheiaProblemsView);
39
+ expect(await problemsView.isInSidePanel()).toBe(false);
40
+ expect(await problemsView.side()).toBe('bottom');
41
+ expect(await problemsView.title()).toBe('Problems');
42
+ });
43
+
44
+ test('should be closable', async () => {
45
+ const problemsView = await app.openView(TheiaProblemsView);
46
+ expect(await problemsView.isClosable()).toBe(true);
47
+
48
+ await problemsView.close();
49
+ expect(await problemsView.isTabVisible()).toBe(false);
50
+ expect(await problemsView.isDisplayed()).toBe(false);
51
+ expect(await problemsView.isActive()).toBe(false);
52
+ });
53
+
54
+ test("should not throw an error if 'close' is called twice", async () => {
55
+ const problemsView = await app.openView(TheiaProblemsView);
56
+ await problemsView.close();
57
+ await problemsView.close();
58
+ });
59
+
60
+ });
@@ -0,0 +1,61 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2021 logi.cals GmbH, 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 { expect } from '@playwright/test';
18
+ import { TheiaAboutDialog } from '../theia-about-dialog';
19
+ import { TheiaApp } from '../theia-app';
20
+ import { TheiaExplorerView } from '../theia-explorer-view';
21
+ import { TheiaQuickCommandPalette } from '../theia-quick-command-palette';
22
+ import test, { page } from './fixtures/theia-fixture';
23
+
24
+ let app: TheiaApp;
25
+ let quickCommand: TheiaQuickCommandPalette;
26
+
27
+ test.describe('Theia Quick Command', () => {
28
+
29
+ test.beforeAll(async () => {
30
+ app = await TheiaApp.load(page);
31
+ quickCommand = app.quickCommandPalette;
32
+ });
33
+
34
+ test('should show quick command palette', async () => {
35
+ await quickCommand.open();
36
+ expect(await quickCommand.isOpen()).toBe(true);
37
+ });
38
+
39
+ test('should trigger \'About\' command after typing', async () => {
40
+ await quickCommand.type('About');
41
+ await quickCommand.trigger('About');
42
+ expect(await quickCommand.isOpen()).toBe(false);
43
+ const aboutDialog = new TheiaAboutDialog(app);
44
+ expect(await aboutDialog.isVisible()).toBe(true);
45
+ await aboutDialog.close();
46
+ expect(await aboutDialog.isVisible()).toBe(false);
47
+
48
+ await quickCommand.type('Select All');
49
+ await quickCommand.trigger('Select All');
50
+ expect(await quickCommand.isOpen()).toBe(false);
51
+ });
52
+
53
+ test('should trigger \'Toggle Explorer View\' command after typing', async () => {
54
+ await quickCommand.type('Toggle Explorer');
55
+ await quickCommand.trigger('Toggle Explorer View');
56
+ expect(await quickCommand.isOpen()).toBe(false);
57
+ const explorerView = new TheiaExplorerView(app);
58
+ expect(await explorerView.isDisplayed()).toBe(true);
59
+ });
60
+
61
+ });
@@ -0,0 +1,92 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2022 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 { TheiaApp } from '../theia-app';
18
+
19
+ import { expect } from '@playwright/test';
20
+ import test, { page } from './fixtures/theia-fixture';
21
+ import { TheiaPageObject } from '../theia-page-object';
22
+
23
+ class TheiaSampleToolbar extends TheiaPageObject {
24
+ protected selector = '#main-toolbar';
25
+
26
+ async show(): Promise<void> {
27
+ if (!await this.isShown()) {
28
+ await this.toggle();
29
+ }
30
+ }
31
+
32
+ async toggle(): Promise<void> {
33
+ const isShown = await this.isShown();
34
+ const viewMenu = await this.app.menuBar.openMenu('View');
35
+ await viewMenu.clickMenuItem('Toggle Toolbar');
36
+ isShown ? await this.waitUntilHidden() : await this.waitUntilShown();
37
+ }
38
+
39
+ async waitUntilHidden(): Promise<void> {
40
+ await this.page.waitForSelector(this.selector, { state: 'hidden' });
41
+ }
42
+
43
+ async waitUntilShown(): Promise<void> {
44
+ await this.page.waitForSelector(this.selector, { state: 'visible' });
45
+ }
46
+
47
+ async isShown(): Promise<boolean> {
48
+ const toolbar = await this.page.$(this.selector);
49
+ return !!toolbar && toolbar.isVisible();
50
+ }
51
+ }
52
+
53
+ class TheiaSampleApp extends TheiaApp {
54
+ protected toolbar = new TheiaSampleToolbar(this);
55
+
56
+ override async waitForInitialized(): Promise<void> {
57
+ await this.toolbar.show();
58
+ }
59
+
60
+ async toggleToolbar(): Promise<void> {
61
+ await this.toolbar.toggle();
62
+ }
63
+
64
+ async isToolbarVisible(): Promise<boolean> {
65
+ return this.toolbar.isShown();
66
+ }
67
+ }
68
+
69
+ let app: TheiaSampleApp;
70
+
71
+ test.describe('Theia Sample Application', () => {
72
+
73
+ test('should load', async () => {
74
+ app = await TheiaApp.loadApp(page, TheiaSampleApp);
75
+ });
76
+
77
+ test('should start with visible toolbar', async () => {
78
+ expect(await app.isToolbarVisible()).toBe(true);
79
+ });
80
+
81
+ test('should toggle toolbar', async () => {
82
+ await app.toggleToolbar();
83
+ expect(await app.isToolbarVisible()).toBe(false);
84
+
85
+ await app.toggleToolbar();
86
+ expect(await app.isToolbarVisible()).toBe(true);
87
+
88
+ await app.toggleToolbar();
89
+ expect(await app.isToolbarVisible()).toBe(false);
90
+ });
91
+
92
+ });
@@ -0,0 +1,47 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2021 logi.cals GmbH, 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 { expect } from '@playwright/test';
18
+ import { TheiaApp } from '../theia-app';
19
+ import { TheiaNotificationIndicator } from '../theia-notification-indicator';
20
+ import { TheiaProblemIndicator } from '../theia-problem-indicator';
21
+ import { TheiaStatusBar } from '../theia-status-bar';
22
+ import { TheiaToggleBottomIndicator } from '../theia-toggle-bottom-indicator';
23
+ import test, { page } from './fixtures/theia-fixture';
24
+
25
+ let statusBar: TheiaStatusBar;
26
+
27
+ test.describe('Theia Status Bar', () => {
28
+
29
+ test.beforeAll(async () => {
30
+ const app = await TheiaApp.load(page);
31
+ statusBar = app.statusBar;
32
+ });
33
+
34
+ test('should show status bar', async () => {
35
+ expect(await statusBar.isVisible()).toBe(true);
36
+ });
37
+
38
+ test('should contain status bar elements', async () => {
39
+ const problemIndicator = await statusBar.statusIndicator(TheiaProblemIndicator);
40
+ const notificationIndicator = await statusBar.statusIndicator(TheiaNotificationIndicator);
41
+ const toggleBottomIndicator = await statusBar.statusIndicator(TheiaToggleBottomIndicator);
42
+ expect(await problemIndicator.isVisible()).toBe(true);
43
+ expect(await notificationIndicator.isVisible()).toBe(true);
44
+ expect(await toggleBottomIndicator.isVisible()).toBe(true);
45
+ });
46
+
47
+ });