@mablhq/mabl-cli 1.45.8 → 1.47.12
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/basicApiClient.js +6 -0
- package/api/featureSet.js +0 -4
- package/api/mablApiClient.js +8 -0
- package/browserEngines/browserEngine.js +40 -0
- package/browserEngines/browserEngines.js +14 -0
- package/browserEngines/chromiumBrowserEngine.js +176 -0
- package/browserEngines/firefoxBrowserEngine.js +84 -0
- package/browserEngines/unsupportedBrowserEngine.js +27 -0
- package/browserLauncher/frameBase.js +5 -1
- package/browserLauncher/pageEvent.js +1 -0
- package/browserLauncher/playwrightBrowserLauncher/browserDelegate.js +2 -0
- package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumBrowserDelegate.js +55 -0
- package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumElementHandleDelegate.js +62 -0
- package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumFrameDelegate.js +12 -0
- package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumPageDelegate.js +117 -0
- package/browserLauncher/playwrightBrowserLauncher/elementHandleDelegate.js +2 -0
- package/browserLauncher/playwrightBrowserLauncher/firefox/firefoxBrowserDelegate.js +51 -0
- package/browserLauncher/playwrightBrowserLauncher/firefox/firefoxElementHandleDelegate.js +61 -0
- package/browserLauncher/playwrightBrowserLauncher/firefox/firefoxFrameDelegate.js +23 -0
- package/browserLauncher/playwrightBrowserLauncher/firefox/firefoxPageDelegate.js +83 -0
- package/browserLauncher/playwrightBrowserLauncher/frameDelegate.js +2 -0
- package/browserLauncher/playwrightBrowserLauncher/pageDelegate.js +2 -0
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowser.js +41 -35
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowserLauncher.js +28 -3
- package/browserLauncher/playwrightBrowserLauncher/playwrightDom.js +32 -63
- package/browserLauncher/playwrightBrowserLauncher/playwrightFrame.js +35 -11
- package/browserLauncher/playwrightBrowserLauncher/playwrightHttpRequest.js +1 -25
- package/browserLauncher/playwrightBrowserLauncher/playwrightPage.js +28 -50
- package/commands/constants.js +6 -1
- package/commands/tests/testsUtil.js +14 -153
- package/commands/tests/tests_cmds/import.js +2 -2
- package/commands/tests/tests_cmds/run.js +9 -9
- package/commands/workspaces/workspace_cmds/copy.js +1 -2
- package/domUtil/index.js +1 -1
- package/execution/index.js +1 -1
- package/functions/apiTest/utils.js +47 -0
- package/functions/types.js +2 -0
- package/functions/utils.js +12 -0
- package/mablApi/index.js +1 -1
- package/mablscript/types/VariableNamespace.js +3 -3
- package/mablscriptFind/index.js +1 -1
- package/package.json +4 -3
- package/popupDismissal/index.js +7 -20
- package/resources/mablFind.js +1 -1
- package/resources/popupDismissal.js +1 -1
- package/util/actionabilityUtil.js +4 -4
- package/util/clickUtil.js +2 -2
- package/util/fileUploadUtil.js +1 -1
- package/util/jestUtil.js +21 -0
- package/mablscript/types/VariableDataType.js +0 -28
|
@@ -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,"elementsAtCoordinate",(function(){return m})),n.d(e,"getAllElementsAbove",(function(){return
|
|
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,"elementsAtCoordinate",(function(){return m})),n.d(e,"getAllElementsAbove",(function(){return h})),n.d(e,"detectAndDismissPopupCandidates",(function(){return b})),n.d(e,"elementsInFrontCount",(function(){return p}));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=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:0,relatedTarget:void 0});t.dispatchEvent(u)}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,n){const r=void 0!==e?e:t.getBoundingClientRect().x,o=void 0!==n?n:t.getBoundingClientRect().y,i=document.elementsFromPoint(r,o),u=i.findIndex(e=>e===t);return u?i.slice(0,u):[]}function g(t){return new Promise(e=>setTimeout(e,t))}function h(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){const e=t.getBoundingClientRect();try{let n=m(t,e.x,e.y);const r=n.length;if(0===r)return{elementsInFront:0,dismissedStatus:!1};const o=async function(n,o){for(const i of n)if(f(i,o),await g(750),m(t,e.x,e.y).length<r)return!0;return!1};let i=h(t,n);const u=a(i);for(const t of u){let e=await o(t.domCovering,!0);if(e||(e=await o(t.actionableElements,!1)),e)return{dismissedStatus:!0,elementsInFront:0}}n=m(t,e.x,e.y),i=h(t,n);const s=a(i),c=s.length?s[0]:{zIndex:0,elementsInFront:0,dismissedStatus:!1,domCovering:[],actionableElements:[]};return c.elementsInFront=n.length,c.dismissedStatus=!1,{dismissedStatus:c.dismissedStatus,elementsInFront:c.elementsInFront}}catch(t){return{elementsInFront:0,dismissedStatus:!1,error:t.toString()}}}function p(t){return m(t).length}}]);
|
|
@@ -106,7 +106,7 @@ async function attemptPopupDismissal(element, executionContext) {
|
|
|
106
106
|
return false;
|
|
107
107
|
}
|
|
108
108
|
await maybeAddPopupLogic(element);
|
|
109
|
-
const { dismissedStatus, elementsInFront, error } = await element.evaluate((element) =>
|
|
109
|
+
const { dismissedStatus, elementsInFront, error } = await element.evaluate((element) => globalThis.popupDismissal.detectAndDismissPopupCandidates(element));
|
|
110
110
|
if (error) {
|
|
111
111
|
(0, logUtils_1.logInternal)(`Error while trying to dismiss popups: ${error}`);
|
|
112
112
|
}
|
|
@@ -117,7 +117,7 @@ async function attemptPopupDismissal(element, executionContext) {
|
|
|
117
117
|
if (bodyElement) {
|
|
118
118
|
await bodyElement.press('Escape');
|
|
119
119
|
}
|
|
120
|
-
const elementsInFront = await element.evaluate((element) =>
|
|
120
|
+
const elementsInFront = await element.evaluate((element) => globalThis.popupDismissal.elementsInFrontCount(element));
|
|
121
121
|
if (elementsInFront) {
|
|
122
122
|
(0, logUtils_1.logInternal)('The popup did not dismiss using the escape key.');
|
|
123
123
|
return false;
|
|
@@ -154,10 +154,10 @@ async function maybeAddActionabilityLogic(element) {
|
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
function isActionabilityLogicInTarget(element) {
|
|
157
|
-
return element.evaluate(() => !!
|
|
157
|
+
return element.evaluate(() => !!globalThis.mablCheckActionability);
|
|
158
158
|
}
|
|
159
159
|
function isPopupDismissalInTarget(element) {
|
|
160
|
-
return element.evaluate(() => !!
|
|
160
|
+
return element.evaluate(() => !!globalThis.popupDismissal);
|
|
161
161
|
}
|
|
162
162
|
function isElementWithPopup(element) {
|
|
163
163
|
return element.evaluate((element) => element.getAttribute('aria-expanded') === 'true' &&
|
package/util/clickUtil.js
CHANGED
|
@@ -38,8 +38,8 @@ async function clickOnElement(elementHandle, executionContext, clickType) {
|
|
|
38
38
|
await (0, actionabilityUtil_1.maybeAddPopupLogic)(elementHandle);
|
|
39
39
|
}
|
|
40
40
|
const jsClickEventFirer = clickType === ClickType.LeftClick
|
|
41
|
-
? (element) =>
|
|
42
|
-
: (element) =>
|
|
41
|
+
? (element) => globalThis.popupDismissal.fireClickEvent(element)
|
|
42
|
+
: (element) => globalThis.popupDismissal.fireDoubleClickEvent(element);
|
|
43
43
|
return elementHandle.evaluate(jsClickEventFirer);
|
|
44
44
|
}
|
|
45
45
|
const finalClickOptions = {
|
package/util/fileUploadUtil.js
CHANGED
|
@@ -81,7 +81,7 @@ async function downloadFileUpload(fileUploadUrl, fileUpload, downloadDirectory,
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
exports.downloadFileUpload = downloadFileUpload;
|
|
84
|
-
function cleanupOldFiles(ageInMs) {
|
|
84
|
+
function cleanupOldFiles(ageInMs = 0) {
|
|
85
85
|
try {
|
|
86
86
|
const dir = Globals_1.Globals.getUploadDirectory();
|
|
87
87
|
const prefix = Globals_1.Globals.getUploadDirectoryPrefix();
|
package/util/jestUtil.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.itIf = exports.describeIf = void 0;
|
|
4
|
+
const describeIf = (name, condition, reason, testSuite) => {
|
|
5
|
+
if (condition()) {
|
|
6
|
+
describe(name, testSuite);
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
console.warn(`[skipped]: ${name} (reason: ${reason})`);
|
|
10
|
+
describe.skip(name, testSuite);
|
|
11
|
+
};
|
|
12
|
+
exports.describeIf = describeIf;
|
|
13
|
+
const itIf = (name, condition, reason, fn) => {
|
|
14
|
+
if (condition()) {
|
|
15
|
+
it(name, fn);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
console.warn(`[skipped]: ${name} (reason: ${reason})`);
|
|
19
|
+
it.skip(name, fn);
|
|
20
|
+
};
|
|
21
|
+
exports.itIf = itIf;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isSimpleObject = exports.isVariableDataType = void 0;
|
|
4
|
-
function isVariableDataType(value) {
|
|
5
|
-
if (value === null ||
|
|
6
|
-
value === undefined ||
|
|
7
|
-
typeof value === 'boolean' ||
|
|
8
|
-
typeof value === 'number' ||
|
|
9
|
-
typeof value === 'bigint' ||
|
|
10
|
-
typeof value === 'string') {
|
|
11
|
-
return true;
|
|
12
|
-
}
|
|
13
|
-
if (typeof value === 'object') {
|
|
14
|
-
if (Array.isArray(value)) {
|
|
15
|
-
return value.every(isVariableDataType);
|
|
16
|
-
}
|
|
17
|
-
if (!isSimpleObject(value)) {
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
return !!Object.entries(value).every(([key, val]) => key && typeof key === 'string' && isVariableDataType(val));
|
|
21
|
-
}
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
exports.isVariableDataType = isVariableDataType;
|
|
25
|
-
function isSimpleObject(value) {
|
|
26
|
-
return Object.prototype.constructor === value.constructor;
|
|
27
|
-
}
|
|
28
|
-
exports.isSimpleObject = isSimpleObject;
|