@redhat-developer/page-objects 1.4.0 → 1.5.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.
|
@@ -228,6 +228,17 @@ export declare class TextEditor extends Editor {
|
|
|
228
228
|
* @returns promise which resolves to either Breakpoint page object or undefined
|
|
229
229
|
*/
|
|
230
230
|
getPausedBreakpoint(): Promise<Breakpoint | undefined>;
|
|
231
|
+
/**
|
|
232
|
+
* Get paused breakpoint on line if available. Otherwise, return undefined.
|
|
233
|
+
* @param line number of the line to retrieve
|
|
234
|
+
* @returns promise which resolves to either Breakpoint page object or undefined
|
|
235
|
+
*/
|
|
236
|
+
getBreakpoint(line: number): Promise<Breakpoint | undefined>;
|
|
237
|
+
/**
|
|
238
|
+
* Get all breakpoints.
|
|
239
|
+
* @returns List of Breakpoints.
|
|
240
|
+
*/
|
|
241
|
+
getBreakpoints(): Promise<Breakpoint[]>;
|
|
231
242
|
/**
|
|
232
243
|
* Get all code lenses within the editor
|
|
233
244
|
* @returns list of CodeLens page objects
|
|
@@ -379,7 +379,7 @@ class TextEditor extends Editor_1.Editor {
|
|
|
379
379
|
}
|
|
380
380
|
await inputArea.getDriver().actions().clear();
|
|
381
381
|
await inputArea.sendKeys(lineKey);
|
|
382
|
-
await inputArea.getDriver().sleep(
|
|
382
|
+
await inputArea.getDriver().sleep(50);
|
|
383
383
|
}
|
|
384
384
|
}
|
|
385
385
|
/**
|
|
@@ -398,7 +398,7 @@ class TextEditor extends Editor_1.Editor {
|
|
|
398
398
|
}
|
|
399
399
|
await inputArea.getDriver().actions().clear();
|
|
400
400
|
await inputArea.sendKeys(columnKey);
|
|
401
|
-
await inputArea.getDriver().sleep(
|
|
401
|
+
await inputArea.getDriver().sleep(50);
|
|
402
402
|
if ((await this.getCoordinates())[0] !== coordinates[0]) {
|
|
403
403
|
throw new Error(`Column number ${column} is not accessible on line ${coordinates[0]}`);
|
|
404
404
|
}
|
|
@@ -568,6 +568,42 @@ class TextEditor extends Editor_1.Editor {
|
|
|
568
568
|
}
|
|
569
569
|
return new Breakpoint_1.Breakpoint(breakpoints[0], lineElement);
|
|
570
570
|
}
|
|
571
|
+
/**
|
|
572
|
+
* Get paused breakpoint on line if available. Otherwise, return undefined.
|
|
573
|
+
* @param line number of the line to retrieve
|
|
574
|
+
* @returns promise which resolves to either Breakpoint page object or undefined
|
|
575
|
+
*/
|
|
576
|
+
async getBreakpoint(line) {
|
|
577
|
+
const breakpoints = await this.getBreakpoints();
|
|
578
|
+
for (const breakpoint of breakpoints) {
|
|
579
|
+
if ((await breakpoint.getLineNumber()) === line) {
|
|
580
|
+
return breakpoint;
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
return undefined;
|
|
584
|
+
}
|
|
585
|
+
/**
|
|
586
|
+
* Get all breakpoints.
|
|
587
|
+
* @returns List of Breakpoints.
|
|
588
|
+
*/
|
|
589
|
+
async getBreakpoints() {
|
|
590
|
+
const breakpoints = [];
|
|
591
|
+
const breakpointLocators = Breakpoint_1.Breakpoint.locators.TextEditor.breakpoint;
|
|
592
|
+
const breakpointContainer = TextEditor.versionInfo.version >= '1.80.0' ? await this.findElement(selenium_webdriver_1.By.className('glyph-margin-widgets')) : this;
|
|
593
|
+
const breakpointsSelectors = await breakpointContainer.findElements(breakpointLocators.generalSelector);
|
|
594
|
+
for (const breakpointSelector of breakpointsSelectors) {
|
|
595
|
+
let lineElement;
|
|
596
|
+
if (TextEditor.versionInfo.version >= '1.80.0') {
|
|
597
|
+
const styleTopAttr = await breakpointSelector.getCssValue('top');
|
|
598
|
+
lineElement = await this.findElement(TextEditor.locators.TextEditor.marginArea).findElement(selenium_webdriver_1.By.xpath(`.//div[contains(@style, "${styleTopAttr}")]`));
|
|
599
|
+
}
|
|
600
|
+
else {
|
|
601
|
+
lineElement = await breakpointSelector.findElement(selenium_webdriver_1.By.xpath('./..'));
|
|
602
|
+
}
|
|
603
|
+
breakpoints.push(new Breakpoint_1.Breakpoint(breakpointSelector, lineElement));
|
|
604
|
+
}
|
|
605
|
+
return breakpoints;
|
|
606
|
+
}
|
|
571
607
|
/**
|
|
572
608
|
* Get all code lenses within the editor
|
|
573
609
|
* @returns list of CodeLens page objects
|
|
@@ -58,17 +58,31 @@ class SingleScmProvider extends ScmView_1.ScmProvider {
|
|
|
58
58
|
}
|
|
59
59
|
async takeAction(title) {
|
|
60
60
|
const view = this.enclosingItem;
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
let actions = [];
|
|
62
|
+
let names = [];
|
|
63
63
|
const buttons = [];
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
|
|
64
|
+
if (ScmView_1.ScmProvider.versionInfo.version >= '1.93.0') {
|
|
65
|
+
const header = await view.findElement(selenium_webdriver_1.By.xpath(`.//div[@aria-label='Source Control Section']`));
|
|
66
|
+
actions = await header.findElements(ScmView_1.ScmProvider.locators.ScmView.action);
|
|
67
|
+
names = await Promise.all(actions.map(async (action) => await action.getAttribute(ScmView_1.ScmProvider.locators.ScmView.actionLabel)));
|
|
67
68
|
}
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
else {
|
|
70
|
+
const titlePart = view.getTitlePart();
|
|
71
|
+
const elements = await titlePart.findElements(ScmView_1.ScmView.locators.ScmView.action);
|
|
72
|
+
for (const element of elements) {
|
|
73
|
+
const title = await element.getAttribute(ScmView_1.ScmView.locators.ScmView.actionLabel);
|
|
74
|
+
buttons.push(await new ViewTitlePart_1.TitleActionButton(ScmView_1.ScmView.locators.ScmView.actionConstructor(title), titlePart).wait());
|
|
75
|
+
}
|
|
76
|
+
names = await Promise.all(buttons.map(async (button) => button.getTitle()));
|
|
77
|
+
}
|
|
78
|
+
const index = names.findIndex((item) => item === title);
|
|
70
79
|
if (index > -1) {
|
|
71
|
-
|
|
80
|
+
if (ScmView_1.ScmProvider.versionInfo.version >= '1.93.0') {
|
|
81
|
+
await actions[index].click();
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
await buttons[index].click();
|
|
85
|
+
}
|
|
72
86
|
return true;
|
|
73
87
|
}
|
|
74
88
|
return false;
|
package/out/locators/locators.js
CHANGED
|
@@ -24,7 +24,7 @@ exports.fromAttribute = fromAttribute;
|
|
|
24
24
|
exports.fromText = fromText;
|
|
25
25
|
function hasAttribute(attr, value, locator) {
|
|
26
26
|
return async (el) => {
|
|
27
|
-
el = locator ? el.findElement(locator) : el;
|
|
27
|
+
el = locator ? await el.findElement(locator) : el;
|
|
28
28
|
const attrValue = await el.getAttribute(attr);
|
|
29
29
|
if (value === undefined) {
|
|
30
30
|
return attrValue !== null;
|
|
@@ -34,7 +34,7 @@ function hasAttribute(attr, value, locator) {
|
|
|
34
34
|
}
|
|
35
35
|
function hasClass(classOrPredicate, locator) {
|
|
36
36
|
return async (el) => {
|
|
37
|
-
el = locator ? el.findElement(locator) : el;
|
|
37
|
+
el = locator ? await el.findElement(locator) : el;
|
|
38
38
|
const klasses = await el.getAttribute('class');
|
|
39
39
|
const segments = klasses?.split(/\s+/g);
|
|
40
40
|
const predicate = typeof classOrPredicate === 'string' ? (klass) => klass === classOrPredicate : classOrPredicate;
|
|
@@ -43,7 +43,7 @@ function hasClass(classOrPredicate, locator) {
|
|
|
43
43
|
}
|
|
44
44
|
function hasNotClass(klass, locator) {
|
|
45
45
|
return async (el) => {
|
|
46
|
-
el = locator ? el.findElement(locator) : el;
|
|
46
|
+
el = locator ? await el.findElement(locator) : el;
|
|
47
47
|
return !(await hasClass(klass).call(undefined, el));
|
|
48
48
|
};
|
|
49
49
|
}
|
|
@@ -54,14 +54,14 @@ function hasElement(locatorSelector) {
|
|
|
54
54
|
}
|
|
55
55
|
function fromAttribute(attribute, locator) {
|
|
56
56
|
return async (el) => {
|
|
57
|
-
el = locator ? el.findElement(locator) : el;
|
|
58
|
-
return el.getAttribute(attribute);
|
|
57
|
+
el = locator ? await el.findElement(locator) : el;
|
|
58
|
+
return await el.getAttribute(attribute);
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
61
|
function fromText(locator) {
|
|
62
62
|
return async (el) => {
|
|
63
|
-
el = locator ? el.findElement(locator) : el;
|
|
64
|
-
return el.getText();
|
|
63
|
+
el = locator ? await el.findElement(locator) : el;
|
|
64
|
+
return await el.getText();
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
67
|
//# sourceMappingURL=locators.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redhat-developer/page-objects",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.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",
|
|
@@ -40,11 +40,12 @@
|
|
|
40
40
|
"clipboardy": "^4.0.0",
|
|
41
41
|
"clone-deep": "^4.0.1",
|
|
42
42
|
"compare-versions": "^6.1.1",
|
|
43
|
-
"fs-extra": "^11.2.0"
|
|
43
|
+
"fs-extra": "^11.2.0",
|
|
44
|
+
"type-fest": "^4.26.1"
|
|
44
45
|
},
|
|
45
46
|
"peerDependencies": {
|
|
46
47
|
"selenium-webdriver": ">=4.6.1",
|
|
47
48
|
"typescript": ">=4.6.2"
|
|
48
49
|
},
|
|
49
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "1e2ae6db75e1f18fbc65cae5f4945200a9d93d8d"
|
|
50
51
|
}
|