@redhat-developer/page-objects 1.21.0 → 1.22.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/AbstractElement.js +2 -1
- package/out/components/ElementWithContextMenu.d.ts +11 -0
- package/out/components/ElementWithContextMenu.js +63 -15
- package/out/components/WebviewMixin.js +73 -7
- package/out/components/activityBar/ViewControl.d.ts +16 -0
- package/out/components/activityBar/ViewControl.js +45 -8
- package/out/components/bottomBar/BottomBarPanel.js +26 -11
- package/out/components/editor/ContentAssist.d.ts +9 -1
- package/out/components/editor/ContentAssist.js +88 -13
- package/out/components/editor/CustomEditor.js +1 -1
- package/out/components/editor/EditorView.d.ts +6 -0
- package/out/components/editor/EditorView.js +73 -3
- package/out/components/editor/SettingsEditor.d.ts +1 -0
- package/out/components/editor/SettingsEditor.js +17 -1
- package/out/components/editor/TextEditor.d.ts +3 -1
- package/out/components/editor/TextEditor.js +79 -52
- package/out/components/editor/WebView.js +6 -1
- package/out/components/menu/ContextMenu.d.ts +1 -1
- package/out/components/menu/ContextMenu.js +7 -4
- package/out/components/menu/Menu.js +3 -1
- package/out/components/sidebar/ViewItem.js +1 -0
- package/out/components/sidebar/tree/default/DefaultTreeSection.js +6 -0
- package/out/components/workbench/DebugToolbar.js +1 -1
- package/out/components/workbench/NotificationsCenter.js +6 -1
- package/out/components/workbench/Workbench.js +1 -1
- package/out/components/workbench/input/Input.d.ts +18 -0
- package/out/components/workbench/input/Input.js +68 -0
- package/out/components/workbench/input/QuickOpenBox.js +1 -1
- package/out/errors/ExTesterError.js +1 -1
- package/out/index.d.ts +1 -0
- package/out/index.js +1 -0
- package/out/locators/locators.js +26 -3
- package/out/utils/TimeoutConstants.d.ts +59 -0
- package/out/utils/TimeoutConstants.js +63 -0
- package/out/utils/WaitHelper.js +8 -2
- package/package.json +6 -3
package/out/index.js
CHANGED
|
@@ -64,6 +64,7 @@ __exportStar(require("./locators/locators"), exports);
|
|
|
64
64
|
__exportStar(require("./errors/NullAttributeError"), exports);
|
|
65
65
|
__exportStar(require("./errors/ExTesterError"), exports);
|
|
66
66
|
__exportStar(require("./utils/WaitHelper"), exports);
|
|
67
|
+
__exportStar(require("./utils/TimeoutConstants"), exports);
|
|
67
68
|
__exportStar(require("./components/menu/Menu"), exports);
|
|
68
69
|
__exportStar(require("./components/menu/MenuItem"), exports);
|
|
69
70
|
__exportStar(require("./components/menu/TitleBar"), exports);
|
package/out/locators/locators.js
CHANGED
|
@@ -66,14 +66,37 @@ function fromText(locator) {
|
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
68
|
async function findBestContainingElement(container, testElements) {
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
if (testElements.length === 0) {
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
// Short-circuit: single candidate needs no geometry.
|
|
73
|
+
if (testElements.length === 1) {
|
|
74
|
+
return testElements[0];
|
|
75
|
+
}
|
|
76
|
+
const rects = await Promise.all(testElements.map((el) => el.getRect()));
|
|
77
|
+
// When the container has not been laid out yet its rect is {0,0,0,0}.
|
|
78
|
+
// In that case overlap with any non-zero-position iframe would be negative
|
|
79
|
+
// for all candidates, causing the function to incorrectly return undefined.
|
|
80
|
+
// Fall back to picking the element with the largest own area so that the
|
|
81
|
+
// poll loop in switchToFrame can still make progress.
|
|
82
|
+
const containerArea = container.width * container.height;
|
|
83
|
+
if (containerArea === 0) {
|
|
84
|
+
let bestIdx = 0;
|
|
85
|
+
for (let i = 1; i < rects.length; i++) {
|
|
86
|
+
if (rects[i].width * rects[i].height > rects[bestIdx].width * rects[bestIdx].height) {
|
|
87
|
+
bestIdx = i;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return testElements[bestIdx];
|
|
91
|
+
}
|
|
92
|
+
// Normal case: pick the iframe whose intersection with the container is largest.
|
|
93
|
+
const areas = rects.map((rect) => {
|
|
71
94
|
const ax = Math.max(container.x, rect.x);
|
|
72
95
|
const ay = Math.max(container.y, rect.y);
|
|
73
96
|
const bx = Math.min(container.x + container.width, rect.x + rect.width);
|
|
74
97
|
const by = Math.min(container.y + container.height, rect.y + rect.height);
|
|
75
98
|
return (bx - ax) * (by - ay);
|
|
76
|
-
})
|
|
99
|
+
});
|
|
77
100
|
let bestIdx = -1;
|
|
78
101
|
for (let i = 0; i < testElements.length; i++) {
|
|
79
102
|
if (areas[i] < 0) {
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
3
|
+
* contributor license agreements. See the NOTICE file distributed with
|
|
4
|
+
* this work for additional information regarding copyright ownership.
|
|
5
|
+
* The ASF licenses this file to You under the Apache License, Version 2.0
|
|
6
|
+
* (the "License", destination); you may not use this file except in compliance with
|
|
7
|
+
* the License. You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Centralized timeout constants for page-object operations.
|
|
19
|
+
* Components should reference these instead of hardcoding values.
|
|
20
|
+
* Consumers can override by assigning to the mutable fields.
|
|
21
|
+
*/
|
|
22
|
+
export declare const TimeoutConstants: {
|
|
23
|
+
/** Default wait for an element to become visible (ms) */
|
|
24
|
+
ELEMENT_VISIBLE: number;
|
|
25
|
+
/** Default wait for an element to become stable (ms) */
|
|
26
|
+
ELEMENT_STABLE: number;
|
|
27
|
+
/** Wait for a menu to appear after context-click (ms) */
|
|
28
|
+
MENU_APPEAR: number;
|
|
29
|
+
/** Wait for a menu item count to stabilize (ms) */
|
|
30
|
+
MENU_STABLE: number;
|
|
31
|
+
/** Wait for an input box to appear (ms) */
|
|
32
|
+
INPUT_APPEAR: number;
|
|
33
|
+
/** Wait for quick open / command palette (ms) */
|
|
34
|
+
QUICK_OPEN: number;
|
|
35
|
+
/** Wait for editor to load (ms) */
|
|
36
|
+
EDITOR_LOAD: number;
|
|
37
|
+
/** Wait for content assist to populate (ms) */
|
|
38
|
+
CONTENT_ASSIST: number;
|
|
39
|
+
/** Wait for a tree section row container (ms) */
|
|
40
|
+
TREE_SECTION: number;
|
|
41
|
+
/** Wait for extension install from marketplace (ms) */
|
|
42
|
+
EXTENSION_INSTALL: number;
|
|
43
|
+
/** Wait for notifications to appear/dismiss (ms) */
|
|
44
|
+
NOTIFICATION: number;
|
|
45
|
+
/** Close all editors timeout (ms) */
|
|
46
|
+
CLOSE_ALL_EDITORS: number;
|
|
47
|
+
/** Wait for dialog / workbench elements (ms) */
|
|
48
|
+
DIALOG: number;
|
|
49
|
+
/** Debug toolbar / breakpoint wait (ms) */
|
|
50
|
+
DEBUG: number;
|
|
51
|
+
/** Webview frame switching (ms) */
|
|
52
|
+
WEBVIEW: number;
|
|
53
|
+
/** Wait for clipboard operations (ms) */
|
|
54
|
+
CLIPBOARD: number;
|
|
55
|
+
/** Default poll interval for condition waits (ms) */
|
|
56
|
+
POLL_INTERVAL: number;
|
|
57
|
+
/** Default number of stability checks */
|
|
58
|
+
STABILITY_CHECKS: number;
|
|
59
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
4
|
+
* contributor license agreements. See the NOTICE file distributed with
|
|
5
|
+
* this work for additional information regarding copyright ownership.
|
|
6
|
+
* The ASF licenses this file to You under the Apache License, Version 2.0
|
|
7
|
+
* (the "License", destination); you may not use this file except in compliance with
|
|
8
|
+
* the License. You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.TimeoutConstants = void 0;
|
|
20
|
+
/**
|
|
21
|
+
* Centralized timeout constants for page-object operations.
|
|
22
|
+
* Components should reference these instead of hardcoding values.
|
|
23
|
+
* Consumers can override by assigning to the mutable fields.
|
|
24
|
+
*/
|
|
25
|
+
exports.TimeoutConstants = {
|
|
26
|
+
/** Default wait for an element to become visible (ms) */
|
|
27
|
+
ELEMENT_VISIBLE: 5_000,
|
|
28
|
+
/** Default wait for an element to become stable (ms) */
|
|
29
|
+
ELEMENT_STABLE: 2_000,
|
|
30
|
+
/** Wait for a menu to appear after context-click (ms) */
|
|
31
|
+
MENU_APPEAR: 2_000,
|
|
32
|
+
/** Wait for a menu item count to stabilize (ms) */
|
|
33
|
+
MENU_STABLE: 1_000,
|
|
34
|
+
/** Wait for an input box to appear (ms) */
|
|
35
|
+
INPUT_APPEAR: 5_000,
|
|
36
|
+
/** Wait for quick open / command palette (ms) */
|
|
37
|
+
QUICK_OPEN: 10_000,
|
|
38
|
+
/** Wait for editor to load (ms) */
|
|
39
|
+
EDITOR_LOAD: 5_000,
|
|
40
|
+
/** Wait for content assist to populate (ms) */
|
|
41
|
+
CONTENT_ASSIST: 10_000,
|
|
42
|
+
/** Wait for a tree section row container (ms) */
|
|
43
|
+
TREE_SECTION: 5_000,
|
|
44
|
+
/** Wait for extension install from marketplace (ms) */
|
|
45
|
+
EXTENSION_INSTALL: 300_000,
|
|
46
|
+
/** Wait for notifications to appear/dismiss (ms) */
|
|
47
|
+
NOTIFICATION: 2_000,
|
|
48
|
+
/** Close all editors timeout (ms) */
|
|
49
|
+
CLOSE_ALL_EDITORS: 60_000,
|
|
50
|
+
/** Wait for dialog / workbench elements (ms) */
|
|
51
|
+
DIALOG: 5_000,
|
|
52
|
+
/** Debug toolbar / breakpoint wait (ms) */
|
|
53
|
+
DEBUG: 10_000,
|
|
54
|
+
/** Webview frame switching (ms) */
|
|
55
|
+
WEBVIEW: 5_000,
|
|
56
|
+
/** Wait for clipboard operations (ms) */
|
|
57
|
+
CLIPBOARD: 2_000,
|
|
58
|
+
/** Default poll interval for condition waits (ms) */
|
|
59
|
+
POLL_INTERVAL: 100,
|
|
60
|
+
/** Default number of stability checks */
|
|
61
|
+
STABILITY_CHECKS: 3,
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=TimeoutConstants.js.map
|
package/out/utils/WaitHelper.js
CHANGED
|
@@ -54,8 +54,14 @@ class WaitHelper {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
catch (e) {
|
|
57
|
-
// Store error but continue retrying for transient
|
|
58
|
-
|
|
57
|
+
// Store error but continue retrying for transient failures.
|
|
58
|
+
// TimeoutError from driver.wait(until.elementIsVisible) means the element
|
|
59
|
+
// exists but is not yet visible — the condition should be retried rather
|
|
60
|
+
// than aborting the outer poll loop.
|
|
61
|
+
if (e instanceof selenium_webdriver_1.error.StaleElementReferenceError ||
|
|
62
|
+
e instanceof selenium_webdriver_1.error.NoSuchElementError ||
|
|
63
|
+
e instanceof selenium_webdriver_1.error.TimeoutError ||
|
|
64
|
+
e?.name === 'TimeoutError') {
|
|
59
65
|
lastError = e;
|
|
60
66
|
}
|
|
61
67
|
else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redhat-developer/page-objects",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.22.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",
|
|
@@ -17,6 +17,9 @@
|
|
|
17
17
|
},
|
|
18
18
|
"author": "Red Hat",
|
|
19
19
|
"license": "Apache-2.0",
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=22"
|
|
22
|
+
},
|
|
20
23
|
"publishConfig": {
|
|
21
24
|
"access": "public"
|
|
22
25
|
},
|
|
@@ -43,8 +46,8 @@
|
|
|
43
46
|
"fs-extra": "^11.4.0"
|
|
44
47
|
},
|
|
45
48
|
"peerDependencies": {
|
|
46
|
-
"selenium-webdriver": "
|
|
49
|
+
"selenium-webdriver": "^4.48.0",
|
|
47
50
|
"typescript": ">=4.6.2"
|
|
48
51
|
},
|
|
49
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "46f92f28229b4fd407b7fbb54488abb1bfc2b4a8"
|
|
50
53
|
}
|