@redhat-developer/page-objects 1.12.1 → 1.13.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.
- package/out/components/ActionButtonElementDropdown.js +3 -6
- package/out/components/editor/ExtensionEditorDetailsSection.d.ts +7 -1
- package/out/components/editor/ExtensionEditorDetailsSection.js +15 -2
- package/out/components/menu/ContextMenu.js +13 -0
- package/out/components/sidebar/scm/NewScmView.d.ts +1 -0
- package/out/components/sidebar/scm/NewScmView.js +8 -2
- package/out/components/workbench/input/Input.d.ts +2 -2
- package/out/components/workbench/input/Input.js +19 -10
- package/out/locators/locators.d.ts +2 -0
- package/package.json +3 -3
|
@@ -17,17 +17,15 @@
|
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
19
|
exports.ActionButtonElementDropdown = void 0;
|
|
20
|
-
const ElementWithContextMenu_1 = require("./ElementWithContextMenu");
|
|
21
20
|
const ContextMenu_1 = require("./menu/ContextMenu");
|
|
22
|
-
const selenium_webdriver_1 = require("selenium-webdriver");
|
|
23
21
|
const AbstractElement_1 = require("./AbstractElement");
|
|
22
|
+
const selenium_webdriver_1 = require("selenium-webdriver");
|
|
24
23
|
class ActionButtonElementDropdown extends AbstractElement_1.AbstractElement {
|
|
25
24
|
async open() {
|
|
26
25
|
await this.click();
|
|
27
|
-
const shadowRootHost = await this.enclosingItem.findElements(
|
|
26
|
+
const shadowRootHost = await this.enclosingItem.findElements(ActionButtonElementDropdown.locators.ContextMenu.shadowRootHost);
|
|
28
27
|
const actions = this.getDriver().actions();
|
|
29
28
|
await actions.clear();
|
|
30
|
-
await actions.sendKeys(selenium_webdriver_1.Key.ESCAPE).perform();
|
|
31
29
|
if (shadowRootHost.length > 0) {
|
|
32
30
|
if ((await this.getAttribute('aria-expanded')) !== 'true') {
|
|
33
31
|
await this.click();
|
|
@@ -36,8 +34,7 @@ class ActionButtonElementDropdown extends AbstractElement_1.AbstractElement {
|
|
|
36
34
|
return new ContextMenu_1.ContextMenu(await shadowRoot.findElement(selenium_webdriver_1.By.className('monaco-menu-container'))).wait();
|
|
37
35
|
}
|
|
38
36
|
else {
|
|
39
|
-
await this.
|
|
40
|
-
const workbench = await this.getDriver().findElement(ElementWithContextMenu_1.ElementWithContextMenu.locators.Workbench.constructor);
|
|
37
|
+
const workbench = await this.getDriver().findElement(ActionButtonElementDropdown.locators.Workbench.constructor);
|
|
41
38
|
return new ContextMenu_1.ContextMenu(workbench).wait();
|
|
42
39
|
}
|
|
43
40
|
}
|
|
@@ -40,9 +40,15 @@ export declare class ExtensionEditorDetailsSection extends ExtensionEditorView {
|
|
|
40
40
|
*/
|
|
41
41
|
getMoreInfoItem(key: string): Promise<string>;
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
43
|
+
* Get readme WebView element.
|
|
44
|
+
* @returns Promise resolving WebView element containing the readme content.
|
|
44
45
|
*/
|
|
45
46
|
getReadme(): Promise<WebView>;
|
|
47
|
+
/**
|
|
48
|
+
* Get readme content as a string.
|
|
49
|
+
* @returns Promise resolving the text content of the readme.
|
|
50
|
+
*/
|
|
51
|
+
getReadmeContent(): Promise<string>;
|
|
46
52
|
/**
|
|
47
53
|
* Get version of extension.
|
|
48
54
|
* @returns Promise resolving version of extension.
|
|
@@ -73,10 +73,23 @@ class ExtensionEditorDetailsSection extends __1.ExtensionEditorView {
|
|
|
73
73
|
return moreInfo[key];
|
|
74
74
|
}
|
|
75
75
|
/**
|
|
76
|
-
*
|
|
76
|
+
* Get readme WebView element.
|
|
77
|
+
* @returns Promise resolving WebView element containing the readme content.
|
|
77
78
|
*/
|
|
78
79
|
async getReadme() {
|
|
79
|
-
|
|
80
|
+
return new __1.WebView();
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Get readme content as a string.
|
|
84
|
+
* @returns Promise resolving the text content of the readme.
|
|
85
|
+
*/
|
|
86
|
+
async getReadmeContent() {
|
|
87
|
+
const view = await this.getReadme();
|
|
88
|
+
await view.switchToFrame(5000);
|
|
89
|
+
const readmeContent = await view.findWebElement(ExtensionEditorDetailsSection.locators.ExtensionEditorDetailsSection.readmeContent);
|
|
90
|
+
const text = await readmeContent.getText();
|
|
91
|
+
await view.switchBack();
|
|
92
|
+
return text;
|
|
80
93
|
}
|
|
81
94
|
/**
|
|
82
95
|
* Get version of extension.
|
|
@@ -120,6 +120,19 @@ class ContextMenuItem extends __1.MenuItem {
|
|
|
120
120
|
if (await this.isNesting()) {
|
|
121
121
|
return await new ContextMenu(this).wait();
|
|
122
122
|
}
|
|
123
|
+
try {
|
|
124
|
+
if (await this.parent.isDisplayed()) {
|
|
125
|
+
const actions = this.getDriver().actions();
|
|
126
|
+
await actions.clear();
|
|
127
|
+
await this.getDriver().actions().sendKeys(selenium_webdriver_1.Key.ESCAPE).perform();
|
|
128
|
+
await this.getDriver().wait(selenium_webdriver_1.until.elementIsNotVisible(this));
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
catch (err) {
|
|
132
|
+
if (!(err instanceof selenium_webdriver_1.error.StaleElementReferenceError)) {
|
|
133
|
+
throw err;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
123
136
|
return undefined;
|
|
124
137
|
}
|
|
125
138
|
async getLabel() {
|
|
@@ -35,6 +35,7 @@ export declare class SingleScmProvider extends ScmProvider {
|
|
|
35
35
|
*/
|
|
36
36
|
getType(): Promise<string>;
|
|
37
37
|
takeAction(title: string): Promise<boolean>;
|
|
38
|
+
private getProviderHeaderActions;
|
|
38
39
|
openMoreActions(): Promise<ContextMenu>;
|
|
39
40
|
getChanges(staged?: boolean): Promise<ScmChange[]>;
|
|
40
41
|
}
|
|
@@ -63,8 +63,7 @@ class SingleScmProvider extends ScmView_1.ScmProvider {
|
|
|
63
63
|
let names = [];
|
|
64
64
|
const buttons = [];
|
|
65
65
|
if ((0, compare_versions_1.satisfies)(ScmView_1.ScmProvider.versionInfo.version, '>=1.93.0')) {
|
|
66
|
-
|
|
67
|
-
actions = await header.findElements(ScmView_1.ScmProvider.locators.ScmView.action);
|
|
66
|
+
actions = await this.getProviderHeaderActions(view);
|
|
68
67
|
names = await Promise.all(actions.map(async (action) => await action.getAttribute(ScmView_1.ScmProvider.locators.ScmView.actionLabel)));
|
|
69
68
|
}
|
|
70
69
|
else {
|
|
@@ -79,6 +78,7 @@ class SingleScmProvider extends ScmView_1.ScmProvider {
|
|
|
79
78
|
const index = names.findIndex((item) => item === title);
|
|
80
79
|
if (index > -1) {
|
|
81
80
|
if ((0, compare_versions_1.satisfies)(ScmView_1.ScmProvider.versionInfo.version, '>=1.93.0')) {
|
|
81
|
+
actions = await this.getProviderHeaderActions(view);
|
|
82
82
|
await actions[index].click();
|
|
83
83
|
}
|
|
84
84
|
else {
|
|
@@ -88,6 +88,12 @@ class SingleScmProvider extends ScmView_1.ScmProvider {
|
|
|
88
88
|
}
|
|
89
89
|
return false;
|
|
90
90
|
}
|
|
91
|
+
async getProviderHeaderActions(view) {
|
|
92
|
+
const header = await view.findElement(ScmView_1.ScmView.locators.ScmView.sourceControlSection);
|
|
93
|
+
await this.getDriver().actions().move({ origin: header }).perform();
|
|
94
|
+
await this.getDriver().sleep(1_000);
|
|
95
|
+
return await header.findElements(ScmView_1.ScmProvider.locators.ScmView.action);
|
|
96
|
+
}
|
|
91
97
|
async openMoreActions() {
|
|
92
98
|
const view = this.enclosingItem;
|
|
93
99
|
return await new ScmView_1.MoreAction(view).openContextMenu();
|
|
@@ -47,7 +47,7 @@ export declare abstract class Input extends AbstractElement {
|
|
|
47
47
|
*/
|
|
48
48
|
cancel(): Promise<void>;
|
|
49
49
|
/**
|
|
50
|
-
* Clear the
|
|
50
|
+
* Clear the input field
|
|
51
51
|
* @returns Promise resolving when the field is cleared
|
|
52
52
|
*/
|
|
53
53
|
clear(): Promise<void>;
|
|
@@ -72,7 +72,7 @@ export declare abstract class Input extends AbstractElement {
|
|
|
72
72
|
/**
|
|
73
73
|
* Scroll through the quick picks to find an item by the name or index
|
|
74
74
|
* @param indexOrText index (number) or text (string) of the item to search by
|
|
75
|
-
* @returns Promise
|
|
75
|
+
* @returns Promise resolving to QuickPickItem if found, to undefined otherwise
|
|
76
76
|
*/
|
|
77
77
|
findQuickPick(indexOrText: string | number): Promise<QuickPickItem | undefined>;
|
|
78
78
|
/**
|
|
@@ -20,6 +20,7 @@ exports.QuickInputAction = exports.QuickPickItem = exports.Input = void 0;
|
|
|
20
20
|
const AbstractElement_1 = require("../../AbstractElement");
|
|
21
21
|
const selenium_webdriver_1 = require("selenium-webdriver");
|
|
22
22
|
const __1 = require("../../..");
|
|
23
|
+
const path_1 = require("path");
|
|
23
24
|
/**
|
|
24
25
|
* Abstract page object for input fields
|
|
25
26
|
*/
|
|
@@ -89,7 +90,7 @@ class Input extends AbstractElement_1.AbstractElement {
|
|
|
89
90
|
await input.sendKeys(selenium_webdriver_1.Key.ESCAPE);
|
|
90
91
|
}
|
|
91
92
|
/**
|
|
92
|
-
* Clear the
|
|
93
|
+
* Clear the input field
|
|
93
94
|
* @returns Promise resolving when the field is cleared
|
|
94
95
|
*/
|
|
95
96
|
async clear() {
|
|
@@ -126,21 +127,20 @@ class Input extends AbstractElement_1.AbstractElement {
|
|
|
126
127
|
* @returns Promise resolving when all quick picks have been toggled to desired state
|
|
127
128
|
*/
|
|
128
129
|
async toggleAllQuickPicks(state) {
|
|
129
|
-
const
|
|
130
|
-
if (!
|
|
130
|
+
const selectAllCheckbox = await this.findElement(Input.locators.Input.quickPickSelectAll);
|
|
131
|
+
if (!selectAllCheckbox) {
|
|
131
132
|
return;
|
|
132
133
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
await checkboxes[0].click();
|
|
134
|
+
const isSelected = await selectAllCheckbox.getAttribute(Input.locators.Input.quickPickIsSelected);
|
|
135
|
+
const selected = isSelected === 'true' || (await selectAllCheckbox.isSelected());
|
|
136
|
+
if (selected !== state) {
|
|
137
|
+
await selectAllCheckbox.click();
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
/**
|
|
141
141
|
* Scroll through the quick picks to find an item by the name or index
|
|
142
142
|
* @param indexOrText index (number) or text (string) of the item to search by
|
|
143
|
-
* @returns Promise
|
|
143
|
+
* @returns Promise resolving to QuickPickItem if found, to undefined otherwise
|
|
144
144
|
*/
|
|
145
145
|
async findQuickPick(indexOrText) {
|
|
146
146
|
const input = await this.findElement(Input.locators.Input.inputBox).findElement(Input.locators.Input.input);
|
|
@@ -203,7 +203,16 @@ class Input extends AbstractElement_1.AbstractElement {
|
|
|
203
203
|
async resetPosition() {
|
|
204
204
|
const text = await this.getText();
|
|
205
205
|
await this.clear();
|
|
206
|
-
|
|
206
|
+
// handle path as path, not as text - use platform-specific separator
|
|
207
|
+
const hasTrailingSeparator = text.endsWith(path_1.sep);
|
|
208
|
+
if (hasTrailingSeparator) {
|
|
209
|
+
await this.setText(text.slice(0, -1));
|
|
210
|
+
const input = await this.findElement(Input.locators.Input.inputBox).findElement(Input.locators.Input.input);
|
|
211
|
+
await input.sendKeys(path_1.sep);
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
await this.setText(text);
|
|
215
|
+
}
|
|
207
216
|
}
|
|
208
217
|
}
|
|
209
218
|
exports.Input = Input;
|
|
@@ -235,6 +235,7 @@ export interface Locators {
|
|
|
235
235
|
moreInfoContainer: By;
|
|
236
236
|
moreInfo: By;
|
|
237
237
|
moreInfoElements: By;
|
|
238
|
+
readmeContent: By;
|
|
238
239
|
};
|
|
239
240
|
EditorAction: {
|
|
240
241
|
shadowRootHost: By;
|
|
@@ -249,6 +250,7 @@ export interface Locators {
|
|
|
249
250
|
itemText: string;
|
|
250
251
|
itemNesting: By;
|
|
251
252
|
viewBlock: By;
|
|
253
|
+
shadowRootHost: By;
|
|
252
254
|
};
|
|
253
255
|
TitleBar: {
|
|
254
256
|
constructor: By;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redhat-developer/page-objects",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.0",
|
|
4
4
|
"description": "Page Object API implementation for a VS Code editor used by ExTester framework.",
|
|
5
5
|
"main": "out/index.js",
|
|
6
6
|
"types": "out/index.d.ts",
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
"clone-deep": "^4.0.1",
|
|
42
42
|
"compare-versions": "^6.1.1",
|
|
43
43
|
"fs-extra": "^11.3.0",
|
|
44
|
-
"type-fest": "^4.
|
|
44
|
+
"type-fest": "^4.41.0"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"selenium-webdriver": ">=4.6.1",
|
|
48
48
|
"typescript": ">=4.6.2"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "4db425755901a5152c4379656b75ab97193c1988"
|
|
51
51
|
}
|