@theia/playwright 1.62.0-next.3 → 1.62.1
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/tests/theia-notebook-editor.test.js +10 -5
- package/lib/tests/theia-notebook-editor.test.js.map +1 -1
- package/lib/theia-monaco-editor.d.ts +36 -3
- package/lib/theia-monaco-editor.d.ts.map +1 -1
- package/lib/theia-monaco-editor.js +63 -25
- package/lib/theia-monaco-editor.js.map +1 -1
- package/lib/theia-notebook-cell.d.ts +17 -8
- package/lib/theia-notebook-cell.d.ts.map +1 -1
- package/lib/theia-notebook-cell.js +33 -16
- package/lib/theia-notebook-cell.js.map +1 -1
- package/lib/theia-notebook-editor.d.ts.map +1 -1
- package/lib/theia-notebook-editor.js +2 -1
- package/lib/theia-notebook-editor.js.map +1 -1
- package/lib/theia-output-channel.js +2 -2
- package/lib/theia-output-channel.js.map +1 -1
- package/lib/theia-text-editor.d.ts +3 -3
- package/lib/theia-text-editor.d.ts.map +1 -1
- package/lib/theia-text-editor.js +19 -15
- package/lib/theia-text-editor.js.map +1 -1
- package/lib/theia-toolbar-item.d.ts.map +1 -1
- package/lib/theia-toolbar-item.js +2 -1
- package/lib/theia-toolbar-item.js.map +1 -1
- package/package.json +3 -3
- package/src/tests/theia-notebook-editor.test.ts +12 -5
- package/src/theia-monaco-editor.ts +83 -26
- package/src/theia-notebook-cell.ts +42 -20
- package/src/theia-notebook-editor.ts +2 -1
- package/src/theia-output-channel.ts +2 -2
- package/src/theia-text-editor.ts +16 -16
- package/src/theia-toolbar-item.ts +2 -1
|
@@ -24,7 +24,7 @@ class TheiaOutputViewChannel extends theia_page_object_1.TheiaPageObject {
|
|
|
24
24
|
super(outputView.app);
|
|
25
25
|
this.data = data;
|
|
26
26
|
this.outputView = outputView;
|
|
27
|
-
this.monacoEditor = new theia_monaco_editor_1.TheiaMonacoEditor(this.viewSelector, outputView.app);
|
|
27
|
+
this.monacoEditor = new theia_monaco_editor_1.TheiaMonacoEditor(this.page.locator(this.viewSelector), outputView.app);
|
|
28
28
|
}
|
|
29
29
|
get viewSelector() {
|
|
30
30
|
return this.data.viewSelector;
|
|
@@ -50,7 +50,7 @@ class TheiaOutputViewChannel extends theia_page_object_1.TheiaPageObject {
|
|
|
50
50
|
}
|
|
51
51
|
async maxSeverityOfLineByLineNumber(lineNumber) {
|
|
52
52
|
await this.waitForVisible();
|
|
53
|
-
const lineElement = await this.monacoEditor.
|
|
53
|
+
const lineElement = await (await this.monacoEditor.line(lineNumber)).elementHandle();
|
|
54
54
|
const contents = await (lineElement === null || lineElement === void 0 ? void 0 : lineElement.$$('span > span.mtk1'));
|
|
55
55
|
if (!contents || contents.length < 1) {
|
|
56
56
|
throw new Error(`Could not find contents of line number ${lineNumber}!`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theia-output-channel.js","sourceRoot":"","sources":["../src/theia-output-channel.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,+CAA+C;AAC/C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAIhF,2DAAsD;AACtD,iCAA0C;AAC1C,+DAA0D;AAQ1D,MAAa,sBAAuB,SAAQ,mCAAe;IAIvD,YAA+B,IAAgC,EAAqB,UAA2B;QAC3G,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QADK,SAAI,GAAJ,IAAI,CAA4B;QAAqB,eAAU,GAAV,UAAU,CAAiB;QAE3G,IAAI,CAAC,YAAY,GAAG,IAAI,uCAAiB,CAAC,IAAI,CAAC,YAAY,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"theia-output-channel.js","sourceRoot":"","sources":["../src/theia-output-channel.ts"],"names":[],"mappings":";AAAA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
-
import { ElementHandle } from '@playwright/test';
|
|
1
|
+
import { ElementHandle, Locator } from '@playwright/test';
|
|
2
2
|
import { TheiaApp } from './theia-app';
|
|
3
3
|
import { TheiaEditor } from './theia-editor';
|
|
4
4
|
import { TheiaMonacoEditor } from './theia-monaco-editor';
|
|
@@ -19,8 +19,8 @@ export declare class TheiaTextEditor extends TheiaEditor {
|
|
|
19
19
|
deleteLineContainingText(text: string): Promise<void>;
|
|
20
20
|
addTextToNewLineAfterLineContainingText(textContainedByExistingLine: string, newText: string): Promise<void>;
|
|
21
21
|
addTextToNewLineAfterLineByLineNumber(lineNumber: number, newText: string): Promise<void>;
|
|
22
|
-
protected selectLine(
|
|
23
|
-
protected placeCursorInLine(
|
|
22
|
+
protected selectLine(lineLocator: Locator | undefined): Promise<void>;
|
|
23
|
+
protected placeCursorInLine(lineLocator: Locator | undefined): Promise<void>;
|
|
24
24
|
protected selectedSuggestion(): Promise<ElementHandle<SVGElement | HTMLElement>>;
|
|
25
25
|
getSelectedSuggestionText(): Promise<string>;
|
|
26
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theia-text-editor.d.ts","sourceRoot":"","sources":["../src/theia-text-editor.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"theia-text-editor.d.ts","sourceRoot":"","sources":["../src/theia-text-editor.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAG1D,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,qBAAa,eAAgB,SAAQ,WAAW;IAE5C,SAAS,CAAC,YAAY,EAAE,iBAAiB,CAAC;gBAE9B,QAAQ,EAAE,MAAM,E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AAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;cAQ/E,UAAU,CAAC,WAAW,EAAE,OAAO,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;cAI3D,iBAAiB,CAAC,WAAW,EAAE,OAAO,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;cAIlE,kBAAkB,IAAI,OAAO,CAAC,aAAa,CAAC,UAAU,GAAG,WAAW,CAAC,CAAC;IAIhF,yBAAyB,IAAI,OAAO,CAAC,MAAM,CAAC;CAOrD"}
|
package/lib/theia-text-editor.js
CHANGED
|
@@ -28,7 +28,7 @@ class TheiaTextEditor extends theia_editor_1.TheiaEditor {
|
|
|
28
28
|
tabSelector: (0, util_1.normalizeId)(`#shell-tab-code-editor-opener:file://${(0, util_1.urlEncodePath)((0, path_1.join)(app.workspace.escapedPath, util_1.OSUtil.fileSeparator, filePath))}:1`),
|
|
29
29
|
viewSelector: (0, util_1.normalizeId)(`#code-editor-opener:file://${(0, util_1.urlEncodePath)((0, path_1.join)(app.workspace.escapedPath, util_1.OSUtil.fileSeparator, filePath))}:1`) + '.theia-editor'
|
|
30
30
|
}, app);
|
|
31
|
-
this.monacoEditor = new theia_monaco_editor_1.TheiaMonacoEditor(this.viewSelector, app);
|
|
31
|
+
this.monacoEditor = new theia_monaco_editor_1.TheiaMonacoEditor(this.page.locator(this.data.viewSelector), app);
|
|
32
32
|
}
|
|
33
33
|
async numberOfLines() {
|
|
34
34
|
await this.activate();
|
|
@@ -46,16 +46,18 @@ class TheiaTextEditor extends theia_editor_1.TheiaEditor {
|
|
|
46
46
|
await this.page.keyboard.press('Enter');
|
|
47
47
|
}
|
|
48
48
|
async selectLineWithLineNumber(lineNumber) {
|
|
49
|
+
var _a;
|
|
49
50
|
await this.activate();
|
|
50
|
-
const lineElement = await this.monacoEditor.
|
|
51
|
+
const lineElement = await this.monacoEditor.line(lineNumber);
|
|
51
52
|
await this.selectLine(lineElement);
|
|
52
|
-
return lineElement;
|
|
53
|
+
return (_a = await lineElement.elementHandle()) !== null && _a !== void 0 ? _a : undefined;
|
|
53
54
|
}
|
|
54
55
|
async placeCursorInLineWithLineNumber(lineNumber) {
|
|
56
|
+
var _a;
|
|
55
57
|
await this.activate();
|
|
56
|
-
const lineElement = await this.monacoEditor.
|
|
58
|
+
const lineElement = await this.monacoEditor.line(lineNumber);
|
|
57
59
|
await this.placeCursorInLine(lineElement);
|
|
58
|
-
return lineElement;
|
|
60
|
+
return (_a = await lineElement.elementHandle()) !== null && _a !== void 0 ? _a : undefined;
|
|
59
61
|
}
|
|
60
62
|
async deleteLineByLineNumber(lineNumber) {
|
|
61
63
|
await this.selectLineWithLineNumber(lineNumber);
|
|
@@ -70,40 +72,42 @@ class TheiaTextEditor extends theia_editor_1.TheiaEditor {
|
|
|
70
72
|
await this.typeTextAndHitEnter(newText);
|
|
71
73
|
}
|
|
72
74
|
async selectLineContainingText(text) {
|
|
75
|
+
var _a;
|
|
73
76
|
await this.activate();
|
|
74
|
-
const lineElement = await this.monacoEditor.
|
|
77
|
+
const lineElement = await this.monacoEditor.lineWithText(text);
|
|
75
78
|
await this.selectLine(lineElement);
|
|
76
|
-
return lineElement;
|
|
79
|
+
return (_a = await (lineElement === null || lineElement === void 0 ? void 0 : lineElement.elementHandle())) !== null && _a !== void 0 ? _a : undefined;
|
|
77
80
|
}
|
|
78
81
|
async placeCursorInLineContainingText(text) {
|
|
82
|
+
var _a;
|
|
79
83
|
await this.activate();
|
|
80
|
-
const lineElement = await this.monacoEditor.
|
|
84
|
+
const lineElement = await this.monacoEditor.lineWithText(text);
|
|
81
85
|
await this.placeCursorInLine(lineElement);
|
|
82
|
-
return lineElement;
|
|
86
|
+
return (_a = await (lineElement === null || lineElement === void 0 ? void 0 : lineElement.elementHandle())) !== null && _a !== void 0 ? _a : undefined;
|
|
83
87
|
}
|
|
84
88
|
async deleteLineContainingText(text) {
|
|
85
89
|
await this.selectLineContainingText(text);
|
|
86
90
|
await this.page.keyboard.press('Backspace');
|
|
87
91
|
}
|
|
88
92
|
async addTextToNewLineAfterLineContainingText(textContainedByExistingLine, newText) {
|
|
89
|
-
const existingLine = await this.monacoEditor.
|
|
93
|
+
const existingLine = await this.monacoEditor.lineWithText(textContainedByExistingLine);
|
|
90
94
|
await this.placeCursorInLine(existingLine);
|
|
91
95
|
await this.page.keyboard.press('End');
|
|
92
96
|
await this.page.keyboard.press('Enter');
|
|
93
97
|
await this.page.keyboard.type(newText);
|
|
94
98
|
}
|
|
95
99
|
async addTextToNewLineAfterLineByLineNumber(lineNumber, newText) {
|
|
96
|
-
const existingLine = await this.monacoEditor.
|
|
100
|
+
const existingLine = await this.monacoEditor.line(lineNumber);
|
|
97
101
|
await this.placeCursorInLine(existingLine);
|
|
98
102
|
await this.page.keyboard.press('End');
|
|
99
103
|
await this.page.keyboard.press('Enter');
|
|
100
104
|
await this.page.keyboard.type(newText);
|
|
101
105
|
}
|
|
102
|
-
async selectLine(
|
|
103
|
-
await (
|
|
106
|
+
async selectLine(lineLocator) {
|
|
107
|
+
await (lineLocator === null || lineLocator === void 0 ? void 0 : lineLocator.click({ clickCount: 3 }));
|
|
104
108
|
}
|
|
105
|
-
async placeCursorInLine(
|
|
106
|
-
await (
|
|
109
|
+
async placeCursorInLine(lineLocator) {
|
|
110
|
+
await (lineLocator === null || lineLocator === void 0 ? void 0 : lineLocator.click());
|
|
107
111
|
}
|
|
108
112
|
async selectedSuggestion() {
|
|
109
113
|
return this.page.waitForSelector(this.viewSelector + ' .monaco-list-row.show-file-icons.focused');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theia-text-editor.js","sourceRoot":"","sources":["../src/theia-text-editor.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,+DAA+D;AAC/D,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,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kBAAkB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,qBAAa,gBAAiB,SAAQ,eAAe;IACtB,SAAS,CAAC,OAAO,EAAE,aAAa,CAAC,UAAU,GAAG,WAAW,CAAC;gBAAzE,GAAG,EAAE,QAAQ,EAAY,OAAO,EAAE,aAAa,CAAC,UAAU,GAAG,WAAW,CAAC;IAI/E,SAAS,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAInC,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"theia-toolbar-item.d.ts","sourceRoot":"","sources":["../src/theia-toolbar-item.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,qBAAa,gBAAiB,SAAQ,eAAe;IACtB,SAAS,CAAC,OAAO,EAAE,aAAa,CAAC,UAAU,GAAG,WAAW,CAAC;gBAAzE,GAAG,EAAE,QAAQ,EAAY,OAAO,EAAE,aAAa,CAAC,UAAU,GAAG,WAAW,CAAC;IAI/E,SAAS,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAInC,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC;IAS7B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAGjC"}
|
|
@@ -26,7 +26,8 @@ class TheiaToolbarItem extends theia_page_object_1.TheiaPageObject {
|
|
|
26
26
|
return this.element.getAttribute('id');
|
|
27
27
|
}
|
|
28
28
|
async isEnabled() {
|
|
29
|
-
const
|
|
29
|
+
const child = await this.element.$(':first-child');
|
|
30
|
+
const classAttribute = child && await child.getAttribute('class');
|
|
30
31
|
if (classAttribute === undefined || classAttribute === null) {
|
|
31
32
|
return false;
|
|
32
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theia-toolbar-item.js","sourceRoot":"","sources":["../src/theia-toolbar-item.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,+CAA+C;AAC/C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAIhF,2DAAsD;AAEtD,MAAa,gBAAiB,SAAQ,mCAAe;IACjD,YAAY,GAAa,EAAY,OAAgD;QACjF,KAAK,CAAC,GAAG,CAAC,CAAC;QADsB,YAAO,GAAP,OAAO,CAAyC;IAErF,CAAC;IAED,KAAK,CAAC,SAAS;QACX,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;IAED,KAAK,CAAC,SAAS;QACX,MAAM,
|
|
1
|
+
{"version":3,"file":"theia-toolbar-item.js","sourceRoot":"","sources":["../src/theia-toolbar-item.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,+CAA+C;AAC/C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAIhF,2DAAsD;AAEtD,MAAa,gBAAiB,SAAQ,mCAAe;IACjD,YAAY,GAAa,EAAY,OAAgD;QACjF,KAAK,CAAC,GAAG,CAAC,CAAC;QADsB,YAAO,GAAP,OAAO,CAAyC;IAErF,CAAC;IAED,KAAK,CAAC,SAAS;QACX,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;IAED,KAAK,CAAC,SAAS;QACX,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC;QACnD,MAAM,cAAc,GAAG,KAAK,IAAI,MAAM,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAClE,IAAI,cAAc,KAAK,SAAS,IAAI,cAAc,KAAK,IAAI,EAAE,CAAC;YAC1D,OAAO,KAAK,CAAC;QACjB,CAAC;QACD,OAAO,cAAc,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC9C,CAAC;IAED,KAAK,CAAC,OAAO;QACT,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IAC/B,CAAC;CACJ;AArBD,4CAqBC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/playwright",
|
|
3
|
-
"version": "1.62.
|
|
3
|
+
"version": "1.62.1",
|
|
4
4
|
"description": "System tests for Theia",
|
|
5
5
|
"license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"fs-extra": "^9.0.8"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@theia/cli": "1.62.
|
|
39
|
+
"@theia/cli": "1.62.1",
|
|
40
40
|
"@types/fs-extra": "^9.0.8",
|
|
41
41
|
"allure-commandline": "^2.23.1",
|
|
42
42
|
"allure-playwright": "^2.5.0",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"access": "public"
|
|
49
49
|
},
|
|
50
50
|
"main": "lib/index",
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "0cdb67623c7b5ce0a2d41a1440ed0a78bce890de"
|
|
52
52
|
}
|
|
@@ -112,10 +112,8 @@ test.describe('Theia Notebook Editor interaction', () => {
|
|
|
112
112
|
print("Line-1")
|
|
113
113
|
<|>print("Line-2")
|
|
114
114
|
*/
|
|
115
|
-
const line = await cell.editor.
|
|
115
|
+
const line = await cell.editor.monacoEditor.line(1);
|
|
116
116
|
expect(line, { message: 'Line number 1 should exists' }).toBeDefined();
|
|
117
|
-
const box = await line?.boundingBox();
|
|
118
|
-
console.log(`Split cell test: visible = ${await line?.isVisible()}, box = {${box?.x},${box?.y},${box?.width},${box?.height}}`);
|
|
119
117
|
await line!.click();
|
|
120
118
|
await line!.press('ArrowRight');
|
|
121
119
|
|
|
@@ -217,7 +215,8 @@ test.describe('Theia Notebook Cell interaction', () => {
|
|
|
217
215
|
const secondCell = (await editor.cells())[1];
|
|
218
216
|
// second cell is selected after creation
|
|
219
217
|
expect(await secondCell.isSelected()).toBe(true);
|
|
220
|
-
|
|
218
|
+
// deselect editor focus and focus the whole cell
|
|
219
|
+
await secondCell.selectCell();
|
|
221
220
|
|
|
222
221
|
// select cell above
|
|
223
222
|
await secondCell.editor.page.keyboard.press('k');
|
|
@@ -231,8 +230,16 @@ test.describe('Theia Notebook Cell interaction', () => {
|
|
|
231
230
|
test('Check x/c/v works', async () => {
|
|
232
231
|
const cell = await firstCell(editor);
|
|
233
232
|
await cell.addEditorText('print("First cell")');
|
|
233
|
+
|
|
234
|
+
// add and fill second cell
|
|
234
235
|
await editor.addCodeCell();
|
|
236
|
+
// TODO workaround for create command bug.
|
|
237
|
+
// The first time created cell doesn't contain a monaco-editor child div.
|
|
238
|
+
await ((await editor.cells())[1]).deleteCell();
|
|
239
|
+
await editor.addCodeCell();
|
|
240
|
+
|
|
235
241
|
const secondCell = (await editor.cells())[1];
|
|
242
|
+
await secondCell.locator.waitFor({ state: 'visible' });
|
|
236
243
|
await secondCell.addEditorText('print("Second cell")');
|
|
237
244
|
await secondCell.selectCell(); // deselect editor focus
|
|
238
245
|
|
|
@@ -294,7 +301,7 @@ test.describe('Theia Notebook Cell interaction', () => {
|
|
|
294
301
|
await ensureCodeCompletionVisible(mdCell.editor.locator);
|
|
295
302
|
await editor.page.keyboard.press('Escape'); // close CC
|
|
296
303
|
// check the same cell still selected and not lose the edit mode
|
|
297
|
-
expect(await mdCell.editor.isFocused()).toBe(true);
|
|
304
|
+
expect(await mdCell.editor.monacoEditor.isFocused()).toBe(true);
|
|
298
305
|
|
|
299
306
|
await editor.page.keyboard.press('Control+Space'); // call CC (suggestWidgetVisible=true)
|
|
300
307
|
await ensureCodeCompletionVisible(mdCell.editor.locator);
|
|
@@ -14,64 +14,125 @@
|
|
|
14
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
|
-
import { ElementHandle } from '@playwright/test';
|
|
17
|
+
import { ElementHandle, Locator } from '@playwright/test';
|
|
18
18
|
import { TheiaPageObject } from './theia-page-object';
|
|
19
19
|
import { TheiaApp } from './theia-app';
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Monaco editor page object.
|
|
23
|
+
*
|
|
24
|
+
* Note: The constructor overload using `selector: string` is deprecated. Use the `locator: Locator` overload instead.
|
|
25
|
+
*
|
|
26
|
+
*/
|
|
21
27
|
export class TheiaMonacoEditor extends TheiaPageObject {
|
|
22
|
-
|
|
28
|
+
|
|
29
|
+
public readonly locator: Locator;
|
|
30
|
+
|
|
31
|
+
protected readonly LINES_SELECTOR = '.view-lines > .view-line';
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Monaco editor page object.
|
|
35
|
+
*
|
|
36
|
+
* @param locator The locator of the editor.
|
|
37
|
+
* @param app The Theia app instance.
|
|
38
|
+
*/
|
|
39
|
+
constructor(locator: Locator, app: TheiaApp);
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @deprecated Use the `constructor(locator: Locator, app: TheiaApp)` overload instead.
|
|
43
|
+
*/
|
|
44
|
+
constructor(selector: string, app: TheiaApp);
|
|
45
|
+
|
|
46
|
+
constructor(locatorOrString: Locator | string, app: TheiaApp) {
|
|
23
47
|
super(app);
|
|
48
|
+
if (typeof locatorOrString === 'string') {
|
|
49
|
+
this.locator = app.page.locator(locatorOrString);
|
|
50
|
+
} else {
|
|
51
|
+
this.locator = locatorOrString;
|
|
52
|
+
}
|
|
24
53
|
}
|
|
25
54
|
|
|
26
55
|
async waitForVisible(): Promise<void> {
|
|
27
|
-
await this.
|
|
56
|
+
await this.locator.waitFor({ state: 'visible' });
|
|
57
|
+
// wait until lines are created
|
|
58
|
+
await this.locator.evaluate(editor =>
|
|
59
|
+
editor.querySelectorAll(this.LINES_SELECTOR).length > 0
|
|
60
|
+
);
|
|
28
61
|
}
|
|
29
62
|
|
|
63
|
+
/**
|
|
64
|
+
* @deprecated Use `locator` instead. To get the element handle use `await locator.elementHandle()`.
|
|
65
|
+
* @returns The view element of the editor.
|
|
66
|
+
*/
|
|
30
67
|
protected async viewElement(): Promise<ElementHandle<SVGElement | HTMLElement> | null> {
|
|
31
|
-
return this.
|
|
68
|
+
return this.locator.elementHandle();
|
|
32
69
|
}
|
|
33
70
|
|
|
34
|
-
async numberOfLines(): Promise<number
|
|
71
|
+
async numberOfLines(): Promise<number> {
|
|
35
72
|
await this.waitForVisible();
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
return lineElements?.length;
|
|
73
|
+
const lineElements = await this.locator.locator(this.LINES_SELECTOR).all();
|
|
74
|
+
return lineElements.length;
|
|
39
75
|
}
|
|
40
76
|
|
|
41
77
|
async textContentOfLineByLineNumber(lineNumber: number): Promise<string | undefined> {
|
|
42
78
|
await this.waitForVisible();
|
|
43
|
-
const lineElement = await this.
|
|
79
|
+
const lineElement = await this.line(lineNumber);
|
|
44
80
|
const content = await lineElement?.textContent();
|
|
45
81
|
return content ? this.replaceEditorSymbolsWithSpace(content) : undefined;
|
|
46
82
|
}
|
|
47
83
|
|
|
84
|
+
/**
|
|
85
|
+
* @deprecated Use `line(lineNumber: number)` instead.
|
|
86
|
+
* @param lineNumber The line number to retrieve.
|
|
87
|
+
* @returns The line element of the editor.
|
|
88
|
+
*/
|
|
48
89
|
async lineByLineNumber(lineNumber: number): Promise<ElementHandle<SVGElement | HTMLElement> | undefined> {
|
|
90
|
+
const lineLocator = await this.line(lineNumber);
|
|
91
|
+
return (await lineLocator.elementHandle()) ?? undefined;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
async line(lineNumber: number): Promise<Locator> {
|
|
49
95
|
await this.waitForVisible();
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
if (!lines) {
|
|
96
|
+
const lines = await this.locator.locator(this.LINES_SELECTOR).all();
|
|
97
|
+
if (!lines || lines.length === 0) {
|
|
53
98
|
throw new Error('Couldn\'t retrieve lines of monaco editor');
|
|
54
99
|
}
|
|
55
100
|
|
|
56
101
|
const linesWithXCoordinates = [];
|
|
57
|
-
for (const
|
|
58
|
-
|
|
59
|
-
|
|
102
|
+
for (const line of lines) {
|
|
103
|
+
await line.waitFor({ state: 'visible' });
|
|
104
|
+
const box = await line.boundingBox();
|
|
105
|
+
linesWithXCoordinates.push({ x: box ? box.x : Number.MAX_VALUE, line });
|
|
60
106
|
}
|
|
61
107
|
linesWithXCoordinates.sort((a, b) => a.x.toString().localeCompare(b.x.toString()));
|
|
62
|
-
|
|
108
|
+
const lineInfo = linesWithXCoordinates[lineNumber - 1];
|
|
109
|
+
if (!lineInfo) {
|
|
110
|
+
throw new Error(`Could not find line number ${lineNumber}`);
|
|
111
|
+
}
|
|
112
|
+
return lineInfo.line;
|
|
63
113
|
}
|
|
64
114
|
|
|
65
115
|
async textContentOfLineContainingText(text: string): Promise<string | undefined> {
|
|
66
116
|
await this.waitForVisible();
|
|
67
|
-
const lineElement = await this.
|
|
117
|
+
const lineElement = await this.lineWithText(text);
|
|
68
118
|
const content = await lineElement?.textContent();
|
|
69
119
|
return content ? this.replaceEditorSymbolsWithSpace(content) : undefined;
|
|
70
120
|
}
|
|
71
121
|
|
|
122
|
+
/**
|
|
123
|
+
* @deprecated Use `lineWithText(text: string)` instead.
|
|
124
|
+
* @param text The text to search for in the editor.
|
|
125
|
+
* @returns The line element containing the text.
|
|
126
|
+
*/
|
|
72
127
|
async lineContainingText(text: string): Promise<ElementHandle<SVGElement | HTMLElement> | undefined> {
|
|
73
|
-
const
|
|
74
|
-
return
|
|
128
|
+
const lineWithText = await this.lineWithText(text);
|
|
129
|
+
return await lineWithText?.elementHandle() ?? undefined;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
async lineWithText(text: string): Promise<Locator | undefined> {
|
|
133
|
+
const lineWithText = this.locator.locator(`${this.LINES_SELECTOR}:has-text("${text}")`);
|
|
134
|
+
await lineWithText.waitFor({ state: 'visible' });
|
|
135
|
+
return lineWithText;
|
|
75
136
|
}
|
|
76
137
|
|
|
77
138
|
/**
|
|
@@ -99,7 +160,7 @@ export class TheiaMonacoEditor extends TheiaPageObject {
|
|
|
99
160
|
* @param lineNumber The line number where to add the text. Default is 1.
|
|
100
161
|
*/
|
|
101
162
|
async addEditorText(text: string, lineNumber: number = 1): Promise<void> {
|
|
102
|
-
const line = await this.
|
|
163
|
+
const line = await this.line(lineNumber);
|
|
103
164
|
await line?.click();
|
|
104
165
|
await this.page.keyboard.type(text);
|
|
105
166
|
}
|
|
@@ -108,12 +169,8 @@ export class TheiaMonacoEditor extends TheiaPageObject {
|
|
|
108
169
|
* @returns `true` if the editor is focused, `false` otherwise.
|
|
109
170
|
*/
|
|
110
171
|
async isFocused(): Promise<boolean> {
|
|
111
|
-
|
|
112
|
-
const
|
|
113
|
-
if (!monacoEditor) {
|
|
114
|
-
throw new Error('Couldn\'t retrieve monaco editor element.');
|
|
115
|
-
}
|
|
116
|
-
const editorClass = await monacoEditor.getAttribute('class');
|
|
172
|
+
await this.locator.waitFor({ state: 'visible' });
|
|
173
|
+
const editorClass = await this.locator.getAttribute('class');
|
|
117
174
|
return editorClass?.includes('focused') ?? false;
|
|
118
175
|
}
|
|
119
176
|
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
//
|
|
14
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
15
|
// *****************************************************************************
|
|
16
|
-
import {
|
|
16
|
+
import { FrameLocator, Locator } from '@playwright/test';
|
|
17
17
|
import { TheiaApp } from './theia-app';
|
|
18
18
|
import { TheiaMonacoEditor } from './theia-monaco-editor';
|
|
19
19
|
import { TheiaPageObject } from './theia-page-object';
|
|
@@ -25,19 +25,19 @@ export type CellStatus = 'success' | 'error' | 'waiting';
|
|
|
25
25
|
*/
|
|
26
26
|
export class TheiaNotebookCell extends TheiaPageObject {
|
|
27
27
|
|
|
28
|
-
protected
|
|
28
|
+
protected cellEditor: TheiaNotebookCellEditor;
|
|
29
29
|
|
|
30
|
-
constructor(
|
|
30
|
+
constructor(readonly locator: Locator, protected readonly notebookEditorLocator: Locator, app: TheiaApp) {
|
|
31
31
|
super(app);
|
|
32
32
|
const editorLocator = locator.locator('div.theia-notebook-cell-editor');
|
|
33
|
-
this.
|
|
33
|
+
this.cellEditor = new TheiaNotebookCellEditor(editorLocator, app);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
|
-
* @returns The
|
|
37
|
+
* @returns The cell editor page object.
|
|
38
38
|
*/
|
|
39
|
-
get editor():
|
|
40
|
-
return this.
|
|
39
|
+
get editor(): TheiaNotebookCellEditor {
|
|
40
|
+
return this.cellEditor;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
/**
|
|
@@ -95,7 +95,7 @@ export class TheiaNotebookCell extends TheiaPageObject {
|
|
|
95
95
|
* @returns The text content of the cell editor.
|
|
96
96
|
*/
|
|
97
97
|
async editorText(): Promise<string | undefined> {
|
|
98
|
-
return this.editor.editorText();
|
|
98
|
+
return this.editor.monacoEditor.editorText();
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
/**
|
|
@@ -104,7 +104,7 @@ export class TheiaNotebookCell extends TheiaPageObject {
|
|
|
104
104
|
* @param lineNumber The line number where to add the text. Default is 1.
|
|
105
105
|
*/
|
|
106
106
|
async addEditorText(text: string, lineNumber: number = 1): Promise<void> {
|
|
107
|
-
await this.editor.addEditorText(text, lineNumber);
|
|
107
|
+
await this.editor.monacoEditor.addEditorText(text, lineNumber);
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
/**
|
|
@@ -129,6 +129,15 @@ export class TheiaNotebookCell extends TheiaPageObject {
|
|
|
129
129
|
await execButton.click();
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
+
/**
|
|
133
|
+
* Deletes the cell.
|
|
134
|
+
*/
|
|
135
|
+
async deleteCell(): Promise<void> {
|
|
136
|
+
const button = this.toolbar().locator('[id="notebook.cell.delete"]');
|
|
137
|
+
await button.waitFor({ state: 'visible' });
|
|
138
|
+
await button.click();
|
|
139
|
+
}
|
|
140
|
+
|
|
132
141
|
/**
|
|
133
142
|
* Waits for the cell to reach a specific status.
|
|
134
143
|
* @param status The status to wait for. Possible values are 'success', 'error', 'waiting'.
|
|
@@ -167,14 +176,23 @@ export class TheiaNotebookCell extends TheiaPageObject {
|
|
|
167
176
|
}
|
|
168
177
|
|
|
169
178
|
/**
|
|
179
|
+
* @param acceptEmpty If `true`, accepts empty execution count. Otherwise waits for the execution count to be set.
|
|
170
180
|
* @returns The execution count of the cell.
|
|
171
181
|
*/
|
|
172
|
-
async executionCount(): Promise<string | undefined> {
|
|
182
|
+
async executionCount(acceptEmpty: boolean = false): Promise<string | undefined> {
|
|
173
183
|
const countNode = this.sidebar().locator('span.theia-notebook-code-cell-execution-order');
|
|
174
184
|
await countNode.waitFor({ state: 'visible' });
|
|
175
185
|
await this.waitForCellStatus('success', 'error');
|
|
176
|
-
|
|
177
|
-
|
|
186
|
+
// Wait for the execution count to be set.
|
|
187
|
+
await countNode.page().waitForFunction(
|
|
188
|
+
arg => {
|
|
189
|
+
const text = arg.ele?.textContent;
|
|
190
|
+
return text && (arg.acceptEmpty || text !== '[ ]');
|
|
191
|
+
},
|
|
192
|
+
{ ele: await countNode.elementHandle(), acceptEmpty },
|
|
193
|
+
);
|
|
194
|
+
const counterText = await countNode.textContent();
|
|
195
|
+
return counterText?.substring(1, counterText.length - 1); // remove square brackets
|
|
178
196
|
}
|
|
179
197
|
|
|
180
198
|
/**
|
|
@@ -229,19 +247,23 @@ export class TheiaNotebookCell extends TheiaPageObject {
|
|
|
229
247
|
|
|
230
248
|
}
|
|
231
249
|
|
|
232
|
-
|
|
250
|
+
/**
|
|
251
|
+
* Wrapper around the monaco editor inside a notebook cell.
|
|
252
|
+
*/
|
|
253
|
+
export class TheiaNotebookCellEditor extends TheiaPageObject {
|
|
233
254
|
|
|
234
|
-
|
|
235
|
-
|
|
255
|
+
public readonly monacoEditor: TheiaMonacoEditor;
|
|
256
|
+
|
|
257
|
+
constructor(readonly locator: Locator, app: TheiaApp) {
|
|
258
|
+
super(app);
|
|
259
|
+
this.monacoEditor = new TheiaMonacoEditor(locator.locator('.monaco-editor'), app);
|
|
236
260
|
}
|
|
237
261
|
|
|
238
|
-
|
|
239
|
-
// Use locator instead of page to find the editor element.
|
|
262
|
+
async waitForVisible(): Promise<void> {
|
|
240
263
|
await this.locator.waitFor({ state: 'visible' });
|
|
241
264
|
}
|
|
242
265
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
return this.locator.elementHandle();
|
|
266
|
+
async isVisible(): Promise<boolean> {
|
|
267
|
+
return this.locator.isVisible();
|
|
246
268
|
}
|
|
247
269
|
}
|
|
@@ -49,7 +49,7 @@ export class TheiaNotebookEditor extends TheiaEditor {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
tabLocator(): Locator {
|
|
52
|
-
return this.page.locator(this.data.
|
|
52
|
+
return this.page.locator(this.data.tabSelector);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
override async waitForVisible(): Promise<void> {
|
|
@@ -114,6 +114,7 @@ export class TheiaNotebookEditor extends TheiaEditor {
|
|
|
114
114
|
*/
|
|
115
115
|
async addCodeCell(): Promise<void> {
|
|
116
116
|
const currentCellsCount = (await this.cells()).length;
|
|
117
|
+
// FIXME Command sometimes produces bogus Editor cell without the monaco editor.
|
|
117
118
|
await this.triggerToolbarItem(NotebookCommands.ADD_NEW_CELL_COMMAND);
|
|
118
119
|
await this.waitForCellCountChanged(currentCellsCount);
|
|
119
120
|
}
|
|
@@ -32,7 +32,7 @@ export class TheiaOutputViewChannel extends TheiaPageObject {
|
|
|
32
32
|
|
|
33
33
|
constructor(protected readonly data: TheiaOutputViewChannelData, protected readonly outputView: TheiaOutputView) {
|
|
34
34
|
super(outputView.app);
|
|
35
|
-
this.monacoEditor = new TheiaMonacoEditor(this.viewSelector, outputView.app);
|
|
35
|
+
this.monacoEditor = new TheiaMonacoEditor(this.page.locator(this.viewSelector), outputView.app);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
protected get viewSelector(): string {
|
|
@@ -66,7 +66,7 @@ export class TheiaOutputViewChannel extends TheiaPageObject {
|
|
|
66
66
|
|
|
67
67
|
async maxSeverityOfLineByLineNumber(lineNumber: number): Promise<'error' | 'warning' | 'info'> {
|
|
68
68
|
await this.waitForVisible();
|
|
69
|
-
const lineElement = await this.monacoEditor.
|
|
69
|
+
const lineElement = await (await this.monacoEditor.line(lineNumber)).elementHandle();
|
|
70
70
|
const contents = await lineElement?.$$('span > span.mtk1');
|
|
71
71
|
if (!contents || contents.length < 1) {
|
|
72
72
|
throw new Error(`Could not find contents of line number ${lineNumber}!`);
|