@mablhq/mabl-cli 1.48.26 → 1.48.35
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/api/mablApiClient.js +6 -2
- package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumElementHandleDelegate.js +3 -0
- package/browserLauncher/playwrightBrowserLauncher/nonChromium/nonChromiumAbstractElementHandleDelegate.js +18 -10
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowser.js +10 -1
- package/browserLauncher/playwrightBrowserLauncher/playwrightDom.js +1 -1
- package/browserLauncher/playwrightBrowserLauncher/playwrightPage.js +3 -2
- package/execution/index.js +1 -1
- package/mablApi/index.js +1 -1
- package/mablscript/importer.js +2 -0
- package/mablscript/steps/EnterAuthCodeStep.js +51 -0
- package/package.json +3 -3
- package/popupDismissal/index.js +14 -10
- package/resources/popupDismissal.js +1 -1
package/mablscript/importer.js
CHANGED
|
@@ -52,6 +52,7 @@ const CountAction_1 = require("./actions/CountAction");
|
|
|
52
52
|
const AccessibilityCheck_1 = require("./steps/AccessibilityCheck");
|
|
53
53
|
const EvaluateFlowStep_1 = require("./steps/EvaluateFlowStep");
|
|
54
54
|
const RightClickStep_1 = require("./steps/RightClickStep");
|
|
55
|
+
const EnterAuthCodeStep_1 = require("./steps/EnterAuthCodeStep");
|
|
55
56
|
const ActionTypes = [
|
|
56
57
|
AwaitDownloadAction_1.AwaitDownloadAction,
|
|
57
58
|
AwaitPDFDownloadAction_1.AwaitPDFDownloadAction,
|
|
@@ -81,6 +82,7 @@ const StepTypes = [
|
|
|
81
82
|
ElseStep_1.ElseStep,
|
|
82
83
|
ElseIfConditionStep_1.ElseIfConditionStep,
|
|
83
84
|
EndStep_1.EndStep,
|
|
85
|
+
EnterAuthCodeStep_1.EnterAuthCodeStep,
|
|
84
86
|
EnterTextStep_1.EnterTextStep,
|
|
85
87
|
EvaluateFlowStep_1.EvaluateFlowStep,
|
|
86
88
|
HoverStep_1.HoverStep,
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EnterAuthCodeStep = void 0;
|
|
4
|
+
const FindAction_1 = require("../actions/FindAction");
|
|
5
|
+
const MablStep_1 = require("../MablStep");
|
|
6
|
+
const domUtil_1 = require("../../domUtil");
|
|
7
|
+
const ActionsUtils_1 = require("./ActionsUtils");
|
|
8
|
+
class EnterAuthCodeStep extends MablStep_1.MablStep {
|
|
9
|
+
constructor(name, args, actions) {
|
|
10
|
+
super(name, args, actions);
|
|
11
|
+
this.findAction = ActionsUtils_1.ActionsUtils.validateSingleFindAction(this.actions);
|
|
12
|
+
}
|
|
13
|
+
getStepName() {
|
|
14
|
+
return 'EnterAuthCode';
|
|
15
|
+
}
|
|
16
|
+
toStepDescriptor() {
|
|
17
|
+
const find = this.findAction.toDescriptor();
|
|
18
|
+
switch (find.findType) {
|
|
19
|
+
case domUtil_1.FindType.FIND_FIRST:
|
|
20
|
+
case domUtil_1.FindType.FIND_LAST:
|
|
21
|
+
case domUtil_1.FindType.FIND_ANY:
|
|
22
|
+
case domUtil_1.FindType.FIND_ONE:
|
|
23
|
+
return {
|
|
24
|
+
find,
|
|
25
|
+
descriptorToActionMap: new Map().set(find, this.findAction),
|
|
26
|
+
};
|
|
27
|
+
default:
|
|
28
|
+
throw new Error(`Error generating step descriptor for ${this.getStepName()}: Unexpected find type ${find.findType}`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
getFormattedStep(_fullLocatorsOn) {
|
|
32
|
+
return {
|
|
33
|
+
EnterAuthCode: {
|
|
34
|
+
...super.annotationsAsYml(),
|
|
35
|
+
...this.findAction.toYaml(),
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
static fromYaml(_stepName, stepArgs) {
|
|
40
|
+
return new EnterAuthCodeStep('enter_auth_code', [], [FindAction_1.FindAction.findActionFromStepArgs(stepArgs)]);
|
|
41
|
+
}
|
|
42
|
+
toMablscript() {
|
|
43
|
+
return `${this.findAction.toMablscript()}.enter_auth_code()`;
|
|
44
|
+
}
|
|
45
|
+
getInputVariables() {
|
|
46
|
+
return this.findAction.getInputVariables();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.EnterAuthCodeStep = EnterAuthCodeStep;
|
|
50
|
+
EnterAuthCodeStep.mablScriptStepNames = ['enter_auth_code'];
|
|
51
|
+
EnterAuthCodeStep.yamlMablScriptNames = ['EnterAuthCode'];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mablhq/mabl-cli",
|
|
3
|
-
"version": "1.48.
|
|
3
|
+
"version": "1.48.35",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"description": "The official mabl command line interface tool",
|
|
6
6
|
"main": "index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@mablhq/newman-reporter-mabl-console": "0.1.0",
|
|
24
|
-
"@playwright/test": "1.
|
|
24
|
+
"@playwright/test": "1.30.0",
|
|
25
25
|
"@types/fs-extra": "8.1.1",
|
|
26
26
|
"@types/serve-handler": "6.1.0",
|
|
27
27
|
"@types/tmp": "0.2.0",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"newman": "5.3.2",
|
|
70
70
|
"open": "6.4.0",
|
|
71
71
|
"ora": "4.0.4",
|
|
72
|
-
"playwright-core": "1.
|
|
72
|
+
"playwright-core": "1.30.0",
|
|
73
73
|
"pluralize": "8.0.0",
|
|
74
74
|
"pngjs": "6.0.0",
|
|
75
75
|
"portfinder": "1.0.28",
|
package/popupDismissal/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.elementsInFrontCount = exports.detectAndDismissPopupCandidates = exports.getAllElementsAbove = exports.
|
|
3
|
+
exports.elementsInFrontCount = exports.detectAndDismissPopupCandidates = exports.getAllElementsAbove = exports.getOverlappingElements = exports.fireRightClickEvent = exports.fireClickEvent = exports.fireDoubleClickEvent = exports.elementsByHigherZIndex = void 0;
|
|
4
4
|
const DISMISSAL_WAIT_TIME_MS = 750;
|
|
5
5
|
const ZINDEX_AUTO = 'auto';
|
|
6
6
|
const MINIMUM_POPUP_DISPLAY_COVERAGE_PX = 0.95;
|
|
@@ -150,14 +150,19 @@ function fireRightClickEvent(targetElement, leftEdgeClick = false) {
|
|
|
150
150
|
dispatchMouseEvent(targetElement, 'contextmenu', leftEdgeClick);
|
|
151
151
|
}
|
|
152
152
|
exports.fireRightClickEvent = fireRightClickEvent;
|
|
153
|
-
function
|
|
154
|
-
|
|
155
|
-
|
|
153
|
+
function getCenterCoordinates(rect) {
|
|
154
|
+
return {
|
|
155
|
+
x: rect.left + rect.width / 2,
|
|
156
|
+
y: rect.top + rect.height / 2,
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
function getOverlappingElements(element) {
|
|
160
|
+
const { x, y } = getCenterCoordinates(element.getBoundingClientRect());
|
|
156
161
|
const elementsAtPoint = document.elementsFromPoint(x, y);
|
|
157
162
|
const targetIndex = elementsAtPoint.findIndex((iterElement) => iterElement === element);
|
|
158
163
|
return targetIndex ? elementsAtPoint.slice(0, targetIndex) : [];
|
|
159
164
|
}
|
|
160
|
-
exports.
|
|
165
|
+
exports.getOverlappingElements = getOverlappingElements;
|
|
161
166
|
function sleep(time) {
|
|
162
167
|
return new Promise((resolve) => setTimeout(resolve, time));
|
|
163
168
|
}
|
|
@@ -182,9 +187,8 @@ function getAllElementsAbove(targetElement, elements) {
|
|
|
182
187
|
}
|
|
183
188
|
exports.getAllElementsAbove = getAllElementsAbove;
|
|
184
189
|
async function detectAndDismissPopupCandidates(element) {
|
|
185
|
-
const elementBoundingBox = element.getBoundingClientRect();
|
|
186
190
|
try {
|
|
187
|
-
let higherElements =
|
|
191
|
+
let higherElements = getOverlappingElements(element);
|
|
188
192
|
const elementsInFrontCount = higherElements.length;
|
|
189
193
|
if (elementsInFrontCount === 0) {
|
|
190
194
|
return {
|
|
@@ -196,7 +200,7 @@ async function detectAndDismissPopupCandidates(element) {
|
|
|
196
200
|
for (const candidate of candidates) {
|
|
197
201
|
fireClickEvent(candidate, leftEdgeClick);
|
|
198
202
|
await sleep(DISMISSAL_WAIT_TIME_MS);
|
|
199
|
-
if (
|
|
203
|
+
if (getOverlappingElements(element).length < elementsInFrontCount) {
|
|
200
204
|
return true;
|
|
201
205
|
}
|
|
202
206
|
}
|
|
@@ -216,7 +220,7 @@ async function detectAndDismissPopupCandidates(element) {
|
|
|
216
220
|
};
|
|
217
221
|
}
|
|
218
222
|
}
|
|
219
|
-
higherElements =
|
|
223
|
+
higherElements = getOverlappingElements(element);
|
|
220
224
|
allElements = getAllElementsAbove(element, higherElements);
|
|
221
225
|
const candidates = developCloseCandidates(allElements);
|
|
222
226
|
const result = candidates.length
|
|
@@ -245,6 +249,6 @@ async function detectAndDismissPopupCandidates(element) {
|
|
|
245
249
|
}
|
|
246
250
|
exports.detectAndDismissPopupCandidates = detectAndDismissPopupCandidates;
|
|
247
251
|
function elementsInFrontCount(element) {
|
|
248
|
-
return
|
|
252
|
+
return getOverlappingElements(element).length;
|
|
249
253
|
}
|
|
250
254
|
exports.elementsInFrontCount = elementsInFrontCount;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
window.popupDismissal=function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){"use strict";n.r(e),n.d(e,"elementsByHigherZIndex",(function(){return i})),n.d(e,"fireDoubleClickEvent",(function(){return d})),n.d(e,"fireClickEvent",(function(){return f})),n.d(e,"fireRightClickEvent",(function(){return m})),n.d(e,"
|
|
1
|
+
window.popupDismissal=function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){"use strict";n.r(e),n.d(e,"elementsByHigherZIndex",(function(){return i})),n.d(e,"fireDoubleClickEvent",(function(){return d})),n.d(e,"fireClickEvent",(function(){return f})),n.d(e,"fireRightClickEvent",(function(){return m})),n.d(e,"getOverlappingElements",(function(){return h})),n.d(e,"getAllElementsAbove",(function(){return p})),n.d(e,"detectAndDismissPopupCandidates",(function(){return b})),n.d(e,"elementsInFrontCount",(function(){return v}));const r=["close","dismiss","exit","not at this time","no thanks","no, thanks","i, agree","i agree"],o=[{attributeName:"className",matchFunction:c},{attributeName:"name",matchFunction:c},{attributeName:"id",matchFunction:c},{attributeName:"href",matchFunction:c},{attributeName:"innerText",matchFunction:function(t,e){const n=new RegExp(`\\b${e}\\b`);return!!t.toLowerCase().match(n)}}];function i(t){return Array.from(document.querySelectorAll("body *")).reduce((e,n)=>{const r=parseFloat(globalThis.getComputedStyle(n).zIndex);return!Number.isNaN(r)&&r>=t&&(e.has(r)?e.get(r).push(n):e.set(r,[n])),e},new Map)}function u(t){const e=t=>void 0===t||"html"===t.tagName.toLowerCase();let n=t;for(;!e(n);){const t=globalThis.getComputedStyle(n).zIndex;if(t&&"auto"!==t)return parseInt(t,10);n=(null==n?void 0:n.parentElement)?n.parentElement:void 0}return 0}function s(t){let e=[t];return Array.from(t.children).forEach(t=>{e=e.concat(s(t))}),e}function c(t,e){return t.toLowerCase().includes(e)}function a(t){const e=[];return t.forEach(t=>{const n=[],i=[];t.elements.forEach(t=>{var e;(null==t?void 0:t.offsetParent)&&(["BUTTON","A","DIV"].includes(null===(e=t.tagName)||void 0===e?void 0:e.toUpperCase())&&function(t){let e=0;return o.forEach(n=>{r.forEach(r=>{t.getAttribute(n.attributeName)&&n.matchFunction(t.getAttribute(n.attributeName),r)&&(e+=1)})}),e}(t)&&!i.includes(t)?i.push(t):function(t){if(t.getBoundingClientRect){const e=t.getBoundingClientRect(),n=e.width/globalThis.innerWidth,r=e.height/globalThis.innerHeight;return n>.95&&r>.95}return!1}(t)&&n.push(t))}),e.push({zIndex:t.zIndex,actionableElements:i,domCovering:n,dismissedStatus:!1,elementsInFront:0})}),e}function l(t,e,n=!1){const r=t.getBoundingClientRect(),o=r.height/2,i=n?1:r.width/2,u="contextmenu"===e?2:0,s=new MouseEvent(e,{bubbles:!0,cancelable:!0,view:window,detail:0,screenX:r.left+i,screenY:r.top+o,clientX:t.clientLeft+i,clientY:t.clientTop+o,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:u,relatedTarget:void 0});t.dispatchEvent(s)}function d(t){f(t,!1),f(t,!1),l(t,"dblclick")}function f(t,e=!1){l(t,"click",e)}function m(t,e=!1){l(t,"contextmenu",e)}function h(t){const{x:e,y:n}={x:(r=t.getBoundingClientRect()).left+r.width/2,y:r.top+r.height/2};var r;const o=document.elementsFromPoint(e,n),i=o.findIndex(e=>e===t);return i?o.slice(0,i):[]}function g(t){return new Promise(e=>setTimeout(e,t))}function p(t,e){if(0===e.length)return[];const n=u(t),r=Math.min(...null==e?void 0:e.map(t=>u(t)));if(r<=n)return[];const o=i(r),c=Array.from(o).map(([t,e])=>({zIndex:t,elements:e.flatMap(s).reverse()}));return c.sort((t,e)=>e.zIndex-t.zIndex),c}async function b(t){try{let e=h(t);const n=e.length;if(0===n)return{elementsInFront:0,dismissedStatus:!1};const r=async function(e,r){for(const o of e)if(f(o,r),await g(750),h(t).length<n)return!0;return!1};let o=p(t,e);const i=a(o);for(const t of i){let e=await r(t.domCovering,!0);if(e||(e=await r(t.actionableElements,!1)),e)return{dismissedStatus:!0,elementsInFront:0}}e=h(t),o=p(t,e);const u=a(o),s=u.length?u[0]:{zIndex:0,elementsInFront:0,dismissedStatus:!1,domCovering:[],actionableElements:[]};return s.elementsInFront=e.length,s.dismissedStatus=!1,{dismissedStatus:s.dismissedStatus,elementsInFront:s.elementsInFront}}catch(t){return{elementsInFront:0,dismissedStatus:!1,error:t.toString()}}}function v(t){return h(t).length}}]);
|