@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.
- package/lib/index.d.ts +4 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -0
- package/lib/index.js.map +1 -1
- package/lib/tests/theia-explorer-view.test.js +25 -5
- package/lib/tests/theia-explorer-view.test.js.map +1 -1
- package/lib/tests/theia-main-menu.test.js +2 -2
- package/lib/tests/theia-main-menu.test.js.map +1 -1
- package/lib/tests/theia-output-view.test.d.ts +2 -0
- package/lib/tests/theia-output-view.test.d.ts.map +1 -0
- package/lib/tests/theia-output-view.test.js +77 -0
- package/lib/tests/theia-output-view.test.js.map +1 -0
- package/lib/tests/theia-quick-command.test.js +14 -0
- package/lib/tests/theia-quick-command.test.js.map +1 -1
- package/lib/tests/theia-sample-app.test.js +3 -30
- package/lib/tests/theia-sample-app.test.js.map +1 -1
- package/lib/tests/theia-terminal-view.test.d.ts +2 -0
- package/lib/tests/theia-terminal-view.test.d.ts.map +1 -0
- package/lib/tests/theia-terminal-view.test.js +76 -0
- package/lib/tests/theia-terminal-view.test.js.map +1 -0
- package/lib/tests/theia-toolbar.test.d.ts +2 -0
- package/lib/tests/theia-toolbar.test.d.ts.map +1 -0
- package/lib/tests/theia-toolbar.test.js +60 -0
- package/lib/tests/theia-toolbar.test.js.map +1 -0
- package/lib/tests/theia-workspace.test.js +5 -3
- package/lib/tests/theia-workspace.test.js.map +1 -1
- package/lib/theia-app.d.ts +7 -0
- package/lib/theia-app.d.ts.map +1 -1
- package/lib/theia-app.js +31 -1
- package/lib/theia-app.js.map +1 -1
- package/lib/theia-explorer-view.d.ts +11 -4
- package/lib/theia-explorer-view.d.ts.map +1 -1
- package/lib/theia-explorer-view.js +54 -6
- package/lib/theia-explorer-view.js.map +1 -1
- package/lib/theia-monaco-editor.d.ts +16 -0
- package/lib/theia-monaco-editor.d.ts.map +1 -0
- package/lib/theia-monaco-editor.js +76 -0
- package/lib/theia-monaco-editor.js.map +1 -0
- package/lib/theia-output-channel.d.ts +25 -0
- package/lib/theia-output-channel.d.ts.map +1 -0
- package/lib/theia-output-channel.js +72 -0
- package/lib/theia-output-channel.js.map +1 -0
- package/lib/theia-output-view.d.ts +10 -0
- package/lib/theia-output-view.d.ts.map +1 -0
- package/lib/theia-output-view.js +82 -0
- package/lib/theia-output-view.js.map +1 -0
- package/lib/theia-quick-command-palette.d.ts +2 -1
- package/lib/theia-quick-command-palette.d.ts.map +1 -1
- package/lib/theia-quick-command-palette.js +9 -2
- package/lib/theia-quick-command-palette.js.map +1 -1
- package/lib/theia-terminal.d.ts +14 -0
- package/lib/theia-terminal.d.ts.map +1 -0
- package/lib/theia-terminal.js +60 -0
- package/lib/theia-terminal.js.map +1 -0
- package/lib/theia-text-editor.d.ts +2 -3
- package/lib/theia-text-editor.d.ts.map +1 -1
- package/lib/theia-text-editor.js +11 -40
- package/lib/theia-text-editor.js.map +1 -1
- package/lib/theia-toolbar-item.d.ts +11 -0
- package/lib/theia-toolbar-item.d.ts.map +1 -0
- package/lib/theia-toolbar-item.js +40 -0
- package/lib/theia-toolbar-item.js.map +1 -0
- package/lib/theia-toolbar.d.ts +20 -0
- package/lib/theia-toolbar.d.ts.map +1 -0
- package/lib/theia-toolbar.js +91 -0
- package/lib/theia-toolbar.js.map +1 -0
- package/lib/theia-tree-node.d.ts +1 -0
- package/lib/theia-tree-node.d.ts.map +1 -1
- package/lib/theia-tree-node.js +8 -0
- package/lib/theia-tree-node.js.map +1 -1
- package/package.json +13 -10
- package/src/index.ts +4 -0
- package/src/tests/resources/sample-files1/sampleFolderCompact/nestedFolder1/nestedFolder2/sampleFile1-1.txt +0 -0
- package/src/tests/theia-explorer-view.test.ts +26 -6
- package/src/tests/theia-main-menu.test.ts +2 -2
- package/src/tests/theia-output-view.test.ts +85 -0
- package/src/tests/theia-quick-command.test.ts +15 -0
- package/src/tests/theia-sample-app.test.ts +3 -34
- package/src/tests/theia-terminal-view.test.ts +85 -0
- package/src/tests/theia-toolbar.test.ts +65 -0
- package/src/tests/theia-workspace.test.ts +5 -3
- package/src/theia-app.ts +38 -1
- package/src/theia-explorer-view.ts +60 -7
- package/src/theia-monaco-editor.ts +83 -0
- package/src/theia-output-channel.ts +88 -0
- package/src/theia-output-view.ts +87 -0
- package/src/theia-quick-command-palette.ts +10 -2
- package/src/theia-terminal.ts +69 -0
- package/src/theia-text-editor.ts +13 -44
- package/src/theia-toolbar-item.ts +41 -0
- package/src/theia-toolbar.ts +99 -0
- package/src/theia-tree-node.ts +10 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/playwright",
|
|
3
|
-
"version": "1.37.0-next.
|
|
3
|
+
"version": "1.37.0-next.11+c33553806",
|
|
4
4
|
"description": "System tests for Theia",
|
|
5
5
|
"license": "EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -12,14 +12,15 @@
|
|
|
12
12
|
},
|
|
13
13
|
"homepage": "https://github.com/eclipse-theia/theia",
|
|
14
14
|
"scripts": {
|
|
15
|
-
"clean": "rimraf lib *.tsbuildinfo",
|
|
16
|
-
"build": "tsc --incremental &&
|
|
15
|
+
"clean": "rimraf lib *.tsbuildinfo .eslintcache",
|
|
16
|
+
"build": "yarn && yarn clean && tsc --incremental && yarn lint && yarn playwright:install",
|
|
17
|
+
"watch": "tsc -w --incremental",
|
|
17
18
|
"theia:start": "rimraf .tmp.cfg && THEIA_CONFIG_DIR=$PWD/.tmp.cfg yarn --cwd ../browser start",
|
|
18
19
|
"lint": "eslint -c ./.eslintrc.js --ext .ts ./src",
|
|
19
20
|
"lint:fix": "eslint -c ./.eslintrc.js --ext .ts ./src --fix",
|
|
20
|
-
"
|
|
21
|
-
"ui-tests
|
|
22
|
-
"ui-tests-headful": "yarn && playwright test --
|
|
21
|
+
"playwright:install": "playwright install chromium",
|
|
22
|
+
"ui-tests": "yarn build && playwright test",
|
|
23
|
+
"ui-tests-headful": "yarn build && playwright test --headed",
|
|
23
24
|
"ui-tests-report-generate": "allure generate ./allure-results --clean -o allure-results/allure-report",
|
|
24
25
|
"ui-tests-report": "yarn ui-tests-report-generate && allure open allure-results/allure-report"
|
|
25
26
|
},
|
|
@@ -28,17 +29,19 @@
|
|
|
28
29
|
"src"
|
|
29
30
|
],
|
|
30
31
|
"dependencies": {
|
|
31
|
-
"@playwright/test": "^1.
|
|
32
|
+
"@playwright/test": "^1.32.1",
|
|
32
33
|
"fs-extra": "^9.0.8"
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|
|
35
36
|
"@types/fs-extra": "^9.0.8",
|
|
36
|
-
"allure-commandline": "^2.
|
|
37
|
-
"allure-playwright": "^2.
|
|
37
|
+
"allure-commandline": "^2.21.0",
|
|
38
|
+
"allure-playwright": "^2.1.0",
|
|
39
|
+
"rimraf": "^2.6.1",
|
|
40
|
+
"typescript": "~4.5.5"
|
|
38
41
|
},
|
|
39
42
|
"publishConfig": {
|
|
40
43
|
"access": "public"
|
|
41
44
|
},
|
|
42
45
|
"main": "lib/index",
|
|
43
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "c33553806b7dc3d17d4a820627104280bc84ab3a"
|
|
44
47
|
}
|
package/src/index.ts
CHANGED
|
@@ -25,6 +25,8 @@ export * from './theia-menu-item';
|
|
|
25
25
|
export * from './theia-menu';
|
|
26
26
|
export * from './theia-notification-indicator';
|
|
27
27
|
export * from './theia-notification-overlay';
|
|
28
|
+
export * from './theia-output-channel';
|
|
29
|
+
export * from './theia-output-view';
|
|
28
30
|
export * from './theia-page-object';
|
|
29
31
|
export * from './theia-preference-view';
|
|
30
32
|
export * from './theia-problem-indicator';
|
|
@@ -35,6 +37,8 @@ export * from './theia-status-bar';
|
|
|
35
37
|
export * from './theia-status-indicator';
|
|
36
38
|
export * from './theia-text-editor';
|
|
37
39
|
export * from './theia-toggle-bottom-indicator';
|
|
40
|
+
export * from './theia-toolbar';
|
|
41
|
+
export * from './theia-toolbar-item';
|
|
38
42
|
export * from './theia-tree-node';
|
|
39
43
|
export * from './theia-view';
|
|
40
44
|
export * from './theia-workspace';
|
|
File without changes
|
|
@@ -29,6 +29,7 @@ test.describe('Theia Explorer View', () => {
|
|
|
29
29
|
const ws = new TheiaWorkspace(['src/tests/resources/sample-files1']);
|
|
30
30
|
app = await TheiaApp.load(page, ws);
|
|
31
31
|
explorer = await app.openView(TheiaExplorerView);
|
|
32
|
+
await explorer.waitForVisibleFileNodes();
|
|
32
33
|
});
|
|
33
34
|
|
|
34
35
|
test('should be visible and active after being opened', async () => {
|
|
@@ -53,24 +54,29 @@ test.describe('Theia Explorer View', () => {
|
|
|
53
54
|
expect(await explorer.isActive()).toBe(true);
|
|
54
55
|
});
|
|
55
56
|
|
|
56
|
-
test('should show one folder named "sampleFolder" and one file named "sample.txt"', async () => {
|
|
57
|
+
test('should show one folder named "sampleFolder", one named "sampleFolderCompact" and one file named "sample.txt"', async () => {
|
|
57
58
|
await explorer.selectTreeNode('sampleFolder');
|
|
58
59
|
expect(await explorer.isTreeNodeSelected('sampleFolder')).toBe(true);
|
|
59
60
|
const fileStatElements = await explorer.visibleFileStatNodes(DOT_FILES_FILTER);
|
|
60
|
-
expect(fileStatElements.length).toBe(
|
|
61
|
+
expect(fileStatElements.length).toBe(3);
|
|
61
62
|
|
|
62
|
-
let file; let folder;
|
|
63
|
+
let file; let folder; let compactFolder;
|
|
63
64
|
if (await fileStatElements[0].isFolder()) {
|
|
64
65
|
folder = fileStatElements[0];
|
|
65
|
-
|
|
66
|
+
compactFolder = fileStatElements[1];
|
|
67
|
+
file = fileStatElements[2];
|
|
66
68
|
} else {
|
|
67
|
-
folder = fileStatElements[
|
|
69
|
+
folder = fileStatElements[2];
|
|
70
|
+
compactFolder = fileStatElements[1];
|
|
68
71
|
file = fileStatElements[0];
|
|
69
72
|
}
|
|
70
73
|
|
|
71
74
|
expect(await folder.label()).toBe('sampleFolder');
|
|
72
75
|
expect(await folder.isFile()).toBe(false);
|
|
73
76
|
expect(await folder.isFolder()).toBe(true);
|
|
77
|
+
expect(await compactFolder.label()).toBe('sampleFolderCompact');
|
|
78
|
+
expect(await compactFolder.isFile()).toBe(false);
|
|
79
|
+
expect(await compactFolder.isFolder()).toBe(true);
|
|
74
80
|
expect(await file.label()).toBe('sample.txt');
|
|
75
81
|
expect(await file.isFolder()).toBe(false);
|
|
76
82
|
expect(await file.isFile()).toBe(true);
|
|
@@ -83,7 +89,7 @@ test.describe('Theia Explorer View', () => {
|
|
|
83
89
|
expect(await file.isFile()).toBe(true);
|
|
84
90
|
});
|
|
85
91
|
|
|
86
|
-
test('should provide file stat nodes that can define whether they are collapsed or not and that can be expanded', async () => {
|
|
92
|
+
test('should provide file stat nodes that can define whether they are collapsed or not and that can be expanded and collapsed', async () => {
|
|
87
93
|
const file = await explorer.getFileStatNodeByLabel('sample.txt');
|
|
88
94
|
expect(await file.isCollapsed()).toBe(false);
|
|
89
95
|
|
|
@@ -92,6 +98,9 @@ test.describe('Theia Explorer View', () => {
|
|
|
92
98
|
|
|
93
99
|
await folder.expand();
|
|
94
100
|
expect(await folder.isCollapsed()).toBe(false);
|
|
101
|
+
|
|
102
|
+
await folder.collapse();
|
|
103
|
+
expect(await folder.isCollapsed()).toBe(true);
|
|
95
104
|
});
|
|
96
105
|
|
|
97
106
|
test('should provide file stat node by path "sampleFolder/sampleFolder1/sampleFolder1-1/sampleFile1-1-1.txt"', async () => {
|
|
@@ -100,6 +109,17 @@ test.describe('Theia Explorer View', () => {
|
|
|
100
109
|
expect(await file.label()).toBe('sampleFile1-1-1.txt');
|
|
101
110
|
});
|
|
102
111
|
|
|
112
|
+
test('should be able to check if compact folder "sampleFolderCompact/nestedFolder1/nestedFolder2" exists', async () => {
|
|
113
|
+
// default setting `explorer.compactFolders=true` renders folders in a compact form - single child folders will be compressed in a combined tree element
|
|
114
|
+
expect(await explorer.existsDirectoryNode('sampleFolderCompact/nestedFolder1/nestedFolder2', true /* compact */)).toBe(true);
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
test('should provide file stat node by path of compact folder "sampleFolderCompact/nestedFolder1/nestedFolder2/sampleFile1-1.txt"', async () => {
|
|
118
|
+
const file = await explorer.fileStatNode('sampleFolderCompact/nestedFolder1/nestedFolder2/sampleFile1-1.txt', true /* compact */);
|
|
119
|
+
if (!file) { throw Error('File stat node could not be retrieved by path'); }
|
|
120
|
+
expect(await file.label()).toBe('sampleFile1-1.txt');
|
|
121
|
+
});
|
|
122
|
+
|
|
103
123
|
test('should open context menu on "sample.txt"', async () => {
|
|
104
124
|
const file = await explorer.getFileStatNodeByLabel('sample.txt');
|
|
105
125
|
const menu = await file.openContextMenu();
|
|
@@ -74,10 +74,10 @@ test.describe('Theia Main Menu', () => {
|
|
|
74
74
|
|
|
75
75
|
test('should be able to show menu item in submenu by path', async () => {
|
|
76
76
|
const mainMenu = await menuBar.openMenu('File');
|
|
77
|
-
const openPreferencesItem = await mainMenu.menuItemByNamePath('Preferences', '
|
|
77
|
+
const openPreferencesItem = await mainMenu.menuItemByNamePath('Preferences', 'Settings');
|
|
78
78
|
|
|
79
79
|
const label = await openPreferencesItem?.label();
|
|
80
|
-
expect(label).toBe('
|
|
80
|
+
expect(label).toBe('Settings');
|
|
81
81
|
});
|
|
82
82
|
|
|
83
83
|
test('should close main menu', async () => {
|
|
@@ -0,0 +1,85 @@
|
|
|
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 { expect } from '@playwright/test';
|
|
18
|
+
import { TheiaOutputViewChannel } from 'src/theia-output-channel';
|
|
19
|
+
import { TheiaApp } from '../theia-app';
|
|
20
|
+
import { TheiaOutputView } from '../theia-output-view';
|
|
21
|
+
import test, { page } from './fixtures/theia-fixture';
|
|
22
|
+
|
|
23
|
+
let app: TheiaApp;
|
|
24
|
+
let outputView: TheiaOutputView;
|
|
25
|
+
let testChannel: TheiaOutputViewChannel;
|
|
26
|
+
|
|
27
|
+
test.describe('Theia Output View', () => {
|
|
28
|
+
|
|
29
|
+
test.beforeAll(async () => {
|
|
30
|
+
app = await TheiaApp.load(page);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
test('should open the output view and check if is visible and active', async () => {
|
|
34
|
+
outputView = await app.openView(TheiaOutputView);
|
|
35
|
+
expect(await outputView.isTabVisible()).toBe(true);
|
|
36
|
+
expect(await outputView.isDisplayed()).toBe(true);
|
|
37
|
+
expect(await outputView.isActive()).toBe(true);
|
|
38
|
+
});
|
|
39
|
+
test('should be opened at the bottom and have the title "Output"', async () => {
|
|
40
|
+
expect(await outputView.isInSidePanel()).toBe(false);
|
|
41
|
+
expect(await outputView.side()).toBe('bottom');
|
|
42
|
+
expect(await outputView.title()).toBe('Output');
|
|
43
|
+
});
|
|
44
|
+
test('should be closable', async () => {
|
|
45
|
+
expect(await outputView.isClosable()).toBe(true);
|
|
46
|
+
await outputView.close();
|
|
47
|
+
expect(await outputView.isTabVisible()).toBe(false);
|
|
48
|
+
expect(await outputView.isDisplayed()).toBe(false);
|
|
49
|
+
expect(await outputView.isActive()).toBe(false);
|
|
50
|
+
});
|
|
51
|
+
test('should select a test output channel', async () => {
|
|
52
|
+
outputView = await app.openView(TheiaOutputView);
|
|
53
|
+
expect(await outputView.isTabVisible()).toBe(true);
|
|
54
|
+
expect(await outputView.isDisplayed()).toBe(true);
|
|
55
|
+
expect(await outputView.isActive()).toBe(true);
|
|
56
|
+
|
|
57
|
+
const testChannelName = 'API Sample: my test channel';
|
|
58
|
+
expect(await outputView.selectOutputChannel(testChannelName)).toBe(true);
|
|
59
|
+
});
|
|
60
|
+
test('should check if the output view of the test output channel', async () => {
|
|
61
|
+
const testChannelName = 'API Sample: my test channel';
|
|
62
|
+
expect(await outputView.isOutputChannelSelected(testChannelName));
|
|
63
|
+
const channel = await outputView.getOutputChannel(testChannelName);
|
|
64
|
+
expect(channel).toBeDefined;
|
|
65
|
+
testChannel = channel!;
|
|
66
|
+
expect(await testChannel!.isDisplayed()).toBe(true);
|
|
67
|
+
});
|
|
68
|
+
test('should check if the output view test channel shows the test output', async () => {
|
|
69
|
+
expect(await testChannel.numberOfLines()).toBe(5);
|
|
70
|
+
expect(await testChannel.textContentOfLineByLineNumber(1)).toMatch('hello info1');
|
|
71
|
+
expect(await testChannel.maxSeverityOfLineByLineNumber(1)).toMatch('info');
|
|
72
|
+
expect(await testChannel.textContentOfLineByLineNumber(2)).toMatch('hello info2');
|
|
73
|
+
expect(await testChannel.maxSeverityOfLineByLineNumber(2)).toMatch('info');
|
|
74
|
+
expect(await testChannel.textContentOfLineByLineNumber(3)).toMatch('hello error');
|
|
75
|
+
expect(await testChannel.maxSeverityOfLineByLineNumber(3)).toMatch('error');
|
|
76
|
+
expect(await testChannel.textContentOfLineByLineNumber(4)).toMatch('hello warning');
|
|
77
|
+
expect(await testChannel.maxSeverityOfLineByLineNumber(4)).toMatch('warning');
|
|
78
|
+
expect(await testChannel.textContentOfLineByLineNumber(5)).toMatch(
|
|
79
|
+
'inlineInfo1 inlineWarning inlineError inlineInfo2'
|
|
80
|
+
);
|
|
81
|
+
expect(await testChannel.maxSeverityOfLineByLineNumber(5)).toMatch('error');
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
});
|
|
85
|
+
|
|
@@ -18,6 +18,8 @@ import { expect } from '@playwright/test';
|
|
|
18
18
|
import { TheiaAboutDialog } from '../theia-about-dialog';
|
|
19
19
|
import { TheiaApp } from '../theia-app';
|
|
20
20
|
import { TheiaExplorerView } from '../theia-explorer-view';
|
|
21
|
+
import { TheiaNotificationIndicator } from '../theia-notification-indicator';
|
|
22
|
+
import { TheiaNotificationOverlay } from '../theia-notification-overlay';
|
|
21
23
|
import { TheiaQuickCommandPalette } from '../theia-quick-command-palette';
|
|
22
24
|
import test, { page } from './fixtures/theia-fixture';
|
|
23
25
|
|
|
@@ -34,6 +36,10 @@ test.describe('Theia Quick Command', () => {
|
|
|
34
36
|
test('should show quick command palette', async () => {
|
|
35
37
|
await quickCommand.open();
|
|
36
38
|
expect(await quickCommand.isOpen()).toBe(true);
|
|
39
|
+
await quickCommand.hide();
|
|
40
|
+
expect(await quickCommand.isOpen()).toBe(false);
|
|
41
|
+
await quickCommand.open();
|
|
42
|
+
expect(await quickCommand.isOpen()).toBe(true);
|
|
37
43
|
});
|
|
38
44
|
|
|
39
45
|
test('should trigger \'About\' command after typing', async () => {
|
|
@@ -58,4 +64,13 @@ test.describe('Theia Quick Command', () => {
|
|
|
58
64
|
expect(await explorerView.isDisplayed()).toBe(true);
|
|
59
65
|
});
|
|
60
66
|
|
|
67
|
+
test('should trigger \'Quick Input: Test Positive Integer\' command by confirming via Enter', async () => {
|
|
68
|
+
await quickCommand.type('Test Positive', true);
|
|
69
|
+
expect(await quickCommand.isOpen()).toBe(true);
|
|
70
|
+
await quickCommand.type('6', true);
|
|
71
|
+
const notificationIndicator = new TheiaNotificationIndicator(app);
|
|
72
|
+
const notification = new TheiaNotificationOverlay(app, notificationIndicator);
|
|
73
|
+
expect(await notification.isEntryVisible('Positive Integer: 6')).toBe(true);
|
|
74
|
+
});
|
|
75
|
+
|
|
61
76
|
});
|
|
@@ -14,44 +14,13 @@
|
|
|
14
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
|
-
import { TheiaApp } from '../theia-app';
|
|
18
|
-
|
|
19
17
|
import { expect } from '@playwright/test';
|
|
18
|
+
import { TheiaApp } from '../theia-app';
|
|
19
|
+
import { TheiaToolbar } from '../theia-toolbar';
|
|
20
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
21
|
|
|
53
22
|
class TheiaSampleApp extends TheiaApp {
|
|
54
|
-
protected toolbar = new
|
|
23
|
+
protected toolbar = new TheiaToolbar(this);
|
|
55
24
|
|
|
56
25
|
override async waitForInitialized(): Promise<void> {
|
|
57
26
|
await this.toolbar.show();
|
|
@@ -0,0 +1,85 @@
|
|
|
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 { expect } from '@playwright/test';
|
|
18
|
+
import { TheiaApp } from '../theia-app';
|
|
19
|
+
import { TheiaWorkspace } from '../theia-workspace';
|
|
20
|
+
import test, { page } from './fixtures/theia-fixture';
|
|
21
|
+
import { TheiaTerminal } from '../theia-terminal';
|
|
22
|
+
|
|
23
|
+
let app: TheiaApp;
|
|
24
|
+
|
|
25
|
+
test.describe('Theia Terminal View', () => {
|
|
26
|
+
|
|
27
|
+
test.beforeAll(async () => {
|
|
28
|
+
const ws = new TheiaWorkspace(['src/tests/resources/sample-files1']);
|
|
29
|
+
app = await TheiaApp.load(page, ws);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
test('should be possible to open a new terminal', async () => {
|
|
33
|
+
const terminal = await app.openTerminal(TheiaTerminal);
|
|
34
|
+
expect(await terminal.isTabVisible()).toBe(true);
|
|
35
|
+
expect(await terminal.isDisplayed()).toBe(true);
|
|
36
|
+
expect(await terminal.isActive()).toBe(true);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test('should be possible to open two terminals, switch among them, and close them', async () => {
|
|
40
|
+
const terminal1 = await app.openTerminal(TheiaTerminal);
|
|
41
|
+
const terminal2 = await app.openTerminal(TheiaTerminal);
|
|
42
|
+
const allTerminals = [terminal1, terminal2];
|
|
43
|
+
|
|
44
|
+
// all terminal tabs should be visible
|
|
45
|
+
for (const terminal of allTerminals) {
|
|
46
|
+
expect(await terminal.isTabVisible()).toBe(true);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// activate one terminal after the other and check that only this terminal is active
|
|
50
|
+
for (const terminal of allTerminals) {
|
|
51
|
+
await terminal.activate();
|
|
52
|
+
expect(await terminal1.isActive()).toBe(terminal1 === terminal);
|
|
53
|
+
expect(await terminal2.isActive()).toBe(terminal2 === terminal);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// close all terminals
|
|
57
|
+
for (const terminal of allTerminals) {
|
|
58
|
+
await terminal.close();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// check that all terminals are closed
|
|
62
|
+
for (const terminal of allTerminals) {
|
|
63
|
+
expect(await terminal.isTabVisible()).toBe(false);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
test('should allow to write and read terminal contents', async () => {
|
|
68
|
+
const terminal = await app.openTerminal(TheiaTerminal);
|
|
69
|
+
await terminal.write('hello');
|
|
70
|
+
const contents = await terminal.contents();
|
|
71
|
+
expect(contents).toContain('hello');
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
test('should allow to submit a command and read output', async () => {
|
|
75
|
+
const terminal = await app.openTerminal(TheiaTerminal);
|
|
76
|
+
if (process.platform === 'win32') {
|
|
77
|
+
await terminal.submit('dir');
|
|
78
|
+
} else {
|
|
79
|
+
await terminal.submit('ls');
|
|
80
|
+
}
|
|
81
|
+
const contents = await terminal.contents();
|
|
82
|
+
expect(contents).toContain('sample.txt');
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
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 { expect } from '@playwright/test';
|
|
18
|
+
import { TheiaApp } from '../theia-app';
|
|
19
|
+
import { TheiaToolbar } from '../theia-toolbar';
|
|
20
|
+
import test, { page } from './fixtures/theia-fixture';
|
|
21
|
+
|
|
22
|
+
let app: TheiaApp;
|
|
23
|
+
let toolbar: TheiaToolbar;
|
|
24
|
+
|
|
25
|
+
test.describe('Theia Toolbar', () => {
|
|
26
|
+
|
|
27
|
+
test.beforeAll(async () => {
|
|
28
|
+
app = await TheiaApp.load(page);
|
|
29
|
+
toolbar = new TheiaToolbar(app);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
test('should toggle the toolbar and check visibility', async () => {
|
|
33
|
+
// depending on the user settings we have different starting conditions for the toolbar
|
|
34
|
+
const isShownInitially = await toolbar.isShown();
|
|
35
|
+
expect(await toolbar.isShown()).toBe(isShownInitially);
|
|
36
|
+
await toolbar.toggle();
|
|
37
|
+
expect(await toolbar.isShown()).toBe(!isShownInitially);
|
|
38
|
+
await toolbar.hide();
|
|
39
|
+
expect(await toolbar.isShown()).toBe(false);
|
|
40
|
+
await toolbar.show();
|
|
41
|
+
expect(await toolbar.isShown()).toBe(true);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test('should show the default toolbar tools of the sample Theia application', async () => {
|
|
45
|
+
expect(await toolbar.toolbarItems()).toHaveLength(5);
|
|
46
|
+
expect(await toolbar.toolbarItemIds()).toStrictEqual([
|
|
47
|
+
'textEditor.commands.go.back',
|
|
48
|
+
'textEditor.commands.go.forward',
|
|
49
|
+
'workbench.action.splitEditorRight',
|
|
50
|
+
'theia-sample-toolbar-contribution',
|
|
51
|
+
'workbench.action.showCommands'
|
|
52
|
+
]);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test('should trigger the "Command Palette" toolbar tool as expect the command palette to open', async () => {
|
|
56
|
+
const commandPaletteTool = await toolbar.toolBarItem('workbench.action.showCommands');
|
|
57
|
+
expect(commandPaletteTool).toBeDefined;
|
|
58
|
+
expect(await commandPaletteTool!.isEnabled()).toBe(true);
|
|
59
|
+
|
|
60
|
+
await commandPaletteTool!.trigger();
|
|
61
|
+
expect(await app.quickCommandPalette.isOpen()).toBe(true);
|
|
62
|
+
await app.quickCommandPalette.hide();
|
|
63
|
+
expect(await app.quickCommandPalette.isOpen()).toBe(false);
|
|
64
|
+
});
|
|
65
|
+
});
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
|
+
import { expect } from '@playwright/test';
|
|
17
18
|
import { TheiaApp } from '../theia-app';
|
|
18
19
|
import { DOT_FILES_FILTER, TheiaExplorerView } from '../theia-explorer-view';
|
|
19
20
|
import { TheiaWorkspace } from '../theia-workspace';
|
|
20
|
-
import { expect } from '@playwright/test';
|
|
21
21
|
import test, { page } from './fixtures/theia-fixture';
|
|
22
22
|
|
|
23
23
|
test.describe('Theia Workspace', () => {
|
|
@@ -33,8 +33,9 @@ test.describe('Theia Workspace', () => {
|
|
|
33
33
|
const ws = new TheiaWorkspace(['src/tests/resources/sample-files1']);
|
|
34
34
|
const app = await TheiaApp.load(page, ws);
|
|
35
35
|
const explorer = await app.openView(TheiaExplorerView);
|
|
36
|
-
// resources/sample-files1 contains
|
|
36
|
+
// resources/sample-files1 contains two folders and one file
|
|
37
37
|
expect(await explorer.existsDirectoryNode('sampleFolder')).toBe(true);
|
|
38
|
+
expect(await explorer.existsDirectoryNode('sampleFolderCompact')).toBe(true);
|
|
38
39
|
expect(await explorer.existsFileNode('sample.txt')).toBe(true);
|
|
39
40
|
});
|
|
40
41
|
|
|
@@ -42,8 +43,9 @@ test.describe('Theia Workspace', () => {
|
|
|
42
43
|
const ws = new TheiaWorkspace(['src/tests/resources/sample-files1', 'src/tests/resources/sample-files2']);
|
|
43
44
|
const app = await TheiaApp.load(page, ws);
|
|
44
45
|
const explorer = await app.openView(TheiaExplorerView);
|
|
45
|
-
// resources/sample-files1 contains
|
|
46
|
+
// resources/sample-files1 contains two folders and one file
|
|
46
47
|
expect(await explorer.existsDirectoryNode('sampleFolder')).toBe(true);
|
|
48
|
+
expect(await explorer.existsDirectoryNode('sampleFolderCompact')).toBe(true);
|
|
47
49
|
expect(await explorer.existsFileNode('sample.txt')).toBe(true);
|
|
48
50
|
// resources/sample-files2 contains one file
|
|
49
51
|
expect(await explorer.existsFileNode('another-sample.txt')).toBe(true);
|
package/src/theia-app.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2021 logi.cals GmbH, EclipseSource and others.
|
|
2
|
+
// Copyright (C) 2021-2023 logi.cals GmbH, EclipseSource and others.
|
|
3
3
|
//
|
|
4
4
|
// This program and the accompanying materials are made available under the
|
|
5
5
|
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -21,6 +21,7 @@ import { TheiaMenuBar } from './theia-main-menu';
|
|
|
21
21
|
import { TheiaPreferenceScope, TheiaPreferenceView } from './theia-preference-view';
|
|
22
22
|
import { TheiaQuickCommandPalette } from './theia-quick-command-palette';
|
|
23
23
|
import { TheiaStatusBar } from './theia-status-bar';
|
|
24
|
+
import { TheiaTerminal } from './theia-terminal';
|
|
24
25
|
import { TheiaView } from './theia-view';
|
|
25
26
|
import { TheiaWorkspace } from './theia-workspace';
|
|
26
27
|
|
|
@@ -109,6 +110,7 @@ export class TheiaApp {
|
|
|
109
110
|
throw Error('TheiaExplorerView could not be opened.');
|
|
110
111
|
}
|
|
111
112
|
if (expectFileNodes) {
|
|
113
|
+
await explorer.waitForVisibleFileNodes();
|
|
112
114
|
const fileStatElements = await explorer.visibleFileStatNodes(DOT_FILES_FILTER);
|
|
113
115
|
if (fileStatElements.length < 1) {
|
|
114
116
|
throw Error('TheiaExplorerView is empty.');
|
|
@@ -146,6 +148,41 @@ export class TheiaApp {
|
|
|
146
148
|
return editor;
|
|
147
149
|
}
|
|
148
150
|
|
|
151
|
+
async openTerminal<T extends TheiaTerminal>(terminalFactory: { new(id: string, app: TheiaApp): T }): Promise<T> {
|
|
152
|
+
const mainMenu = await this.menuBar.openMenu('Terminal');
|
|
153
|
+
const menuItem = await mainMenu.menuItemByName('New Terminal');
|
|
154
|
+
if (!menuItem) {
|
|
155
|
+
throw Error('Menu item \'New Terminal\' could not be found.');
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const newTabIds = await this.runAndWaitForNewTabs(() => menuItem.click());
|
|
159
|
+
if (newTabIds.length > 1) {
|
|
160
|
+
console.warn('More than one new tab detected after opening the terminal');
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return new terminalFactory(newTabIds[0], this);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
protected async runAndWaitForNewTabs(command: () => Promise<void>): Promise<string[]> {
|
|
167
|
+
const tabIdsBefore = await this.visibleTabIds();
|
|
168
|
+
await command();
|
|
169
|
+
return (await this.waitForNewTabs(tabIdsBefore)).filter(item => !tabIdsBefore.includes(item));
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
protected async waitForNewTabs(tabIds: string[]): Promise<string[]> {
|
|
173
|
+
let tabIdsCurrent: string[];
|
|
174
|
+
while ((tabIdsCurrent = (await this.visibleTabIds())).length <= tabIds.length) {
|
|
175
|
+
console.debug('Awaiting a new tab to appear');
|
|
176
|
+
}
|
|
177
|
+
return tabIdsCurrent;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
protected async visibleTabIds(): Promise<string[]> {
|
|
181
|
+
const tabs = await this.page.$$('.p-TabBar-tab');
|
|
182
|
+
const tabIds = (await Promise.all(tabs.map(tab => tab.getAttribute('id')))).filter(id => !!id);
|
|
183
|
+
return tabIds as string[];
|
|
184
|
+
}
|
|
185
|
+
|
|
149
186
|
/** Specific Theia apps may add additional conditions to wait for. */
|
|
150
187
|
async waitForInitialized(): Promise<void> {
|
|
151
188
|
// empty by default
|