@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
package/src/theia-text-editor.ts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
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 { join } from 'path';
|
|
19
19
|
|
|
20
20
|
import { TheiaApp } from './theia-app';
|
|
@@ -33,7 +33,7 @@ export class TheiaTextEditor extends TheiaEditor {
|
|
|
33
33
|
tabSelector: normalizeId(`#shell-tab-code-editor-opener:file://${urlEncodePath(join(app.workspace.escapedPath, OSUtil.fileSeparator, filePath))}:1`),
|
|
34
34
|
viewSelector: normalizeId(`#code-editor-opener:file://${urlEncodePath(join(app.workspace.escapedPath, OSUtil.fileSeparator, filePath))}:1`) + '.theia-editor'
|
|
35
35
|
}, app);
|
|
36
|
-
this.monacoEditor = new TheiaMonacoEditor(this.viewSelector, app);
|
|
36
|
+
this.monacoEditor = new TheiaMonacoEditor(this.page.locator(this.data.viewSelector), app);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
async numberOfLines(): Promise<number | undefined> {
|
|
@@ -57,16 +57,16 @@ export class TheiaTextEditor extends TheiaEditor {
|
|
|
57
57
|
|
|
58
58
|
async selectLineWithLineNumber(lineNumber: number): Promise<ElementHandle<SVGElement | HTMLElement> | undefined> {
|
|
59
59
|
await this.activate();
|
|
60
|
-
const lineElement = await this.monacoEditor.
|
|
60
|
+
const lineElement = await this.monacoEditor.line(lineNumber);
|
|
61
61
|
await this.selectLine(lineElement);
|
|
62
|
-
return lineElement;
|
|
62
|
+
return await lineElement.elementHandle() ?? undefined;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
async placeCursorInLineWithLineNumber(lineNumber: number): Promise<ElementHandle<SVGElement | HTMLElement> | undefined> {
|
|
66
66
|
await this.activate();
|
|
67
|
-
const lineElement = await this.monacoEditor.
|
|
67
|
+
const lineElement = await this.monacoEditor.line(lineNumber);
|
|
68
68
|
await this.placeCursorInLine(lineElement);
|
|
69
|
-
return lineElement;
|
|
69
|
+
return await lineElement.elementHandle() ?? undefined;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
async deleteLineByLineNumber(lineNumber: number): Promise<void> {
|
|
@@ -86,16 +86,16 @@ export class TheiaTextEditor extends TheiaEditor {
|
|
|
86
86
|
|
|
87
87
|
async selectLineContainingText(text: string): Promise<ElementHandle<SVGElement | HTMLElement> | undefined> {
|
|
88
88
|
await this.activate();
|
|
89
|
-
const lineElement = await this.monacoEditor.
|
|
89
|
+
const lineElement = await this.monacoEditor.lineWithText(text);
|
|
90
90
|
await this.selectLine(lineElement);
|
|
91
|
-
return lineElement;
|
|
91
|
+
return await lineElement?.elementHandle() ?? undefined;
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
async placeCursorInLineContainingText(text: string): Promise<ElementHandle<SVGElement | HTMLElement> | undefined> {
|
|
95
95
|
await this.activate();
|
|
96
|
-
const lineElement = await this.monacoEditor.
|
|
96
|
+
const lineElement = await this.monacoEditor.lineWithText(text);
|
|
97
97
|
await this.placeCursorInLine(lineElement);
|
|
98
|
-
return lineElement;
|
|
98
|
+
return await lineElement?.elementHandle() ?? undefined;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
async deleteLineContainingText(text: string): Promise<void> {
|
|
@@ -104,7 +104,7 @@ export class TheiaTextEditor extends TheiaEditor {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
async addTextToNewLineAfterLineContainingText(textContainedByExistingLine: string, newText: string): Promise<void> {
|
|
107
|
-
const existingLine = await this.monacoEditor.
|
|
107
|
+
const existingLine = await this.monacoEditor.lineWithText(textContainedByExistingLine);
|
|
108
108
|
await this.placeCursorInLine(existingLine);
|
|
109
109
|
await this.page.keyboard.press('End');
|
|
110
110
|
await this.page.keyboard.press('Enter');
|
|
@@ -112,19 +112,19 @@ export class TheiaTextEditor extends TheiaEditor {
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
async addTextToNewLineAfterLineByLineNumber(lineNumber: number, newText: string): Promise<void> {
|
|
115
|
-
const existingLine = await this.monacoEditor.
|
|
115
|
+
const existingLine = await this.monacoEditor.line(lineNumber);
|
|
116
116
|
await this.placeCursorInLine(existingLine);
|
|
117
117
|
await this.page.keyboard.press('End');
|
|
118
118
|
await this.page.keyboard.press('Enter');
|
|
119
119
|
await this.page.keyboard.type(newText);
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
protected async selectLine(
|
|
123
|
-
await
|
|
122
|
+
protected async selectLine(lineLocator: Locator | undefined): Promise<void> {
|
|
123
|
+
await lineLocator?.click({ clickCount: 3 });
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
protected async placeCursorInLine(
|
|
127
|
-
await
|
|
126
|
+
protected async placeCursorInLine(lineLocator: Locator | undefined): Promise<void> {
|
|
127
|
+
await lineLocator?.click();
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
protected async selectedSuggestion(): Promise<ElementHandle<SVGElement | HTMLElement>> {
|
|
@@ -28,7 +28,8 @@ export class TheiaToolbarItem extends TheiaPageObject {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
async isEnabled(): Promise<boolean> {
|
|
31
|
-
const
|
|
31
|
+
const child = await this.element.$(':first-child');
|
|
32
|
+
const classAttribute = child && await child.getAttribute('class');
|
|
32
33
|
if (classAttribute === undefined || classAttribute === null) {
|
|
33
34
|
return false;
|
|
34
35
|
}
|