@mablhq/mabl-cli 1.48.7 → 1.48.22

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.
Files changed (34) hide show
  1. package/api/mablApiClient.js +11 -0
  2. package/browserEngines/chromiumBrowserEngine.js +3 -0
  3. package/browserEngines/firefoxBrowserEngine.js +8 -2
  4. package/browserEngines/unsupportedBrowserEngine.js +3 -0
  5. package/browserEngines/webkitBrowerEngine.js +11 -0
  6. package/browserLauncher/elementHandle.js +10 -1
  7. package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumElementHandleDelegate.js +63 -0
  8. package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumPageDelegate.js +25 -10
  9. package/browserLauncher/playwrightBrowserLauncher/firefox/firefoxBrowserDelegate.js +36 -0
  10. package/browserLauncher/playwrightBrowserLauncher/firefox/firefoxElementHandleDelegate.js +4 -0
  11. package/browserLauncher/playwrightBrowserLauncher/nonChromium/nonChromiumAbstractBrowserDelegate.js +0 -35
  12. package/browserLauncher/playwrightBrowserLauncher/nonChromium/nonChromiumAbstractElementHandleDelegate.js +4 -0
  13. package/browserLauncher/playwrightBrowserLauncher/playwrightDom.js +35 -52
  14. package/browserLauncher/playwrightBrowserLauncher/webkit/webkitBrowserDelegate.js +36 -0
  15. package/browserLauncher/playwrightBrowserLauncher/webkit/webkitElementHandleDelegate.js +9 -0
  16. package/commands/constants.js +5 -2
  17. package/commands/datatables/datatables_cmds/create.js +148 -0
  18. package/commands/datatables/datatables_cmds/export.js +1 -2
  19. package/commands/tests/testsUtil.js +19 -1
  20. package/commands/tests/tests_cmds/run.js +1 -15
  21. package/execution/index.js +1 -1
  22. package/mablApi/index.js +1 -1
  23. package/mablscript/importer.js +2 -0
  24. package/mablscript/steps/DoubleClickStep.js +1 -1
  25. package/mablscript/steps/RightClickStep.js +57 -0
  26. package/mablscriptFind/index.js +1 -1
  27. package/package.json +2 -1
  28. package/popupDismissal/index.js +7 -2
  29. package/resources/mablFind.js +1 -1
  30. package/resources/popupDismissal.js +1 -1
  31. package/util/asyncUtil.js +1 -1
  32. package/util/browserTestUtils.js +2 -2
  33. package/util/clickUtil.js +24 -14
  34. package/util/csvUtil.js +6 -1
@@ -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 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}}]);
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,"elementsAtCoordinate",(function(){return g})),n.d(e,"getAllElementsAbove",(function(){return b})),n.d(e,"detectAndDismissPopupCandidates",(function(){return p})),n.d(e,"elementsInFrontCount",(function(){return y}));const r=["close","dismiss","exit","not at this time","no thanks","no, thanks","i, agree","i agree"],o=[{attributeName:"className",matchFunction:s},{attributeName:"name",matchFunction:s},{attributeName:"id",matchFunction:s},{attributeName:"href",matchFunction:s},{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 c(t){let e=[t];return Array.from(t.children).forEach(t=>{e=e.concat(c(t))}),e}function s(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,c=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(c)}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 g(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 h(t){return new Promise(e=>setTimeout(e,t))}function b(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),s=Array.from(o).map(([t,e])=>({zIndex:t,elements:e.flatMap(c).reverse()}));return s.sort((t,e)=>e.zIndex-t.zIndex),s}async function p(t){const e=t.getBoundingClientRect();try{let n=g(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 h(750),g(t,e.x,e.y).length<r)return!0;return!1};let i=b(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=g(t,e.x,e.y),i=b(t,n);const c=a(i),s=c.length?c[0]:{zIndex:0,elementsInFront:0,dismissedStatus:!1,domCovering:[],actionableElements:[]};return s.elementsInFront=n.length,s.dismissedStatus=!1,{dismissedStatus:s.dismissedStatus,elementsInFront:s.elementsInFront}}catch(t){return{elementsInFront:0,dismissedStatus:!1,error:t.toString()}}}function y(t){return g(t).length}}]);
package/util/asyncUtil.js CHANGED
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.filterAsync = exports.mapAsync = exports.TimeoutError = exports.promiseWithTimeout = void 0;
4
4
  const loggingProvider_1 = require("../providers/logging/loggingProvider");
5
- async function promiseWithTimeout(promise, timeoutMillis, description, timeoutType = 'mabl promise timeout', printToConsole = true) {
5
+ async function promiseWithTimeout(promise, timeoutMillis, description, timeoutType = 'mabl timeout', printToConsole = true) {
6
6
  const startTimeMillis = new Date().getTime();
7
7
  const { timer, cancelTimer, errorMessage } = startTimer(timeoutMillis, description, timeoutType);
8
8
  try {
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
- var _a;
2
+ var _a, _b;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.IS_TEST_BROWSER_WEBKIT = exports.IS_TEST_BROWSER_FIREFOX = exports.IS_TEST_BROWSER_CHROMIUM = exports.TEST_BROWSER_ENGINE = exports.TEST_BROWSER_TYPE = void 0;
5
5
  const browserEngines_1 = require("../browserEngines/browserEngines");
6
6
  const browserTypes_1 = require("../commands/browserTypes");
7
7
  const VALID_TEST_BROWSER_TYPES = ['chrome', 'firefox', 'webkit'];
8
- const browserTypeEnvironmentVariable = (_a = process.env.TEST_BROWSER_TYPE) === null || _a === void 0 ? void 0 : _a.toLowerCase();
8
+ const browserTypeEnvironmentVariable = (_b = (_a = process.env.TEST_BROWSER_TYPE) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== null && _b !== void 0 ? _b : 'chrome';
9
9
  if (browserTypeEnvironmentVariable &&
10
10
  !VALID_TEST_BROWSER_TYPES.includes(browserTypeEnvironmentVariable)) {
11
11
  throw Error(`Test browser type cannot be ${browserTypeEnvironmentVariable}, it must be one of ${VALID_TEST_BROWSER_TYPES}`);
package/util/clickUtil.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.clickOnElement = exports.ClickType = void 0;
3
+ exports.clickOnElement = exports.CLICK_TYPE_TO_HUMAN_TEXT = exports.ClickType = void 0;
4
4
  const messaging_1 = require("../core/messaging/messaging");
5
5
  const ExecutorUtils_1 = require("../execution/actions/ExecutorUtils");
6
6
  const loggingProvider_1 = require("../providers/logging/loggingProvider");
@@ -8,17 +8,29 @@ const actionabilityUtil_1 = require("./actionabilityUtil");
8
8
  const logUtils_1 = require("./logUtils");
9
9
  var ClickType;
10
10
  (function (ClickType) {
11
- ClickType[ClickType["LeftClick"] = 0] = "LeftClick";
12
- ClickType[ClickType["DoubleClick"] = 1] = "DoubleClick";
11
+ ClickType["DoubleClick"] = "double_click";
12
+ ClickType["LeftClick"] = "click";
13
+ ClickType["RightClick"] = "right_click";
13
14
  })(ClickType = exports.ClickType || (exports.ClickType = {}));
15
+ const CLICK_TYPE_TO_JS_FIRER = {
16
+ [ClickType.DoubleClick]: (element) => globalThis.popupDismissal.fireDoubleClickEvent(element),
17
+ [ClickType.LeftClick]: (element) => globalThis.popupDismissal.fireClickEvent(element),
18
+ [ClickType.RightClick]: (element) => globalThis.popupDismissal.fireRightClickEvent(element),
19
+ };
20
+ exports.CLICK_TYPE_TO_HUMAN_TEXT = {
21
+ [ClickType.DoubleClick]: 'double click',
22
+ [ClickType.LeftClick]: 'click',
23
+ [ClickType.RightClick]: 'right click',
24
+ };
14
25
  async function clickOnElement(elementHandle, executionContext, clickType) {
15
26
  const trialClickOptions = {
27
+ button: clickType === ClickType.RightClick ? 'right' : 'left',
16
28
  trial: true,
17
29
  minimizeScrollIntoView: executionContext.browserConfig.minimizeScrollIntoView,
18
30
  };
19
- const elementHandleTrialClickAction = clickType === ClickType.LeftClick
20
- ? () => elementHandle.click(trialClickOptions)
21
- : () => elementHandle.doubleClick(trialClickOptions);
31
+ const elementHandleTrialClickAction = clickType === ClickType.DoubleClick
32
+ ? () => elementHandle.doubleClick(trialClickOptions)
33
+ : () => elementHandle.click(trialClickOptions);
22
34
  const noOverlappingElement = await (0, actionabilityUtil_1.checkPopupDismissalOnAction)(elementHandle, elementHandleTrialClickAction, executionContext);
23
35
  const elementBoundingBox = await elementHandle.boundingBox();
24
36
  const elementHasSurfaceArea = elementBoundingBox
@@ -35,24 +47,22 @@ async function clickOnElement(elementHandle, executionContext, clickType) {
35
47
  ]
36
48
  .filter((reason) => reason !== false)
37
49
  .join(' and ');
38
- const clickText = clickType === ClickType.LeftClick ? 'click' : 'double click';
39
- (0, logUtils_1.logWebUIAndCliOutput)(`Attempting ${clickText} with javascript because ${jsClickReasons}`, loggingProvider_1.LogLevel.Warn, executionContext, {
50
+ (0, logUtils_1.logWebUIAndCliOutput)(`Attempting ${exports.CLICK_TYPE_TO_HUMAN_TEXT[clickType]} with javascript because ${jsClickReasons}`, loggingProvider_1.LogLevel.Warn, executionContext, {
40
51
  executionPhase: messaging_1.ExecutionPhase.DURING_ACTION,
41
52
  });
42
53
  if (noOverlappingElement) {
43
54
  await (0, actionabilityUtil_1.maybeAddPopupLogic)(elementHandle);
44
55
  }
45
- const jsClickEventFirer = clickType === ClickType.LeftClick
46
- ? (element) => globalThis.popupDismissal.fireClickEvent(element)
47
- : (element) => globalThis.popupDismissal.fireDoubleClickEvent(element);
56
+ const jsClickEventFirer = CLICK_TYPE_TO_JS_FIRER[clickType];
48
57
  return elementHandle.evaluate(jsClickEventFirer);
49
58
  }
50
59
  const finalClickOptions = {
60
+ button: clickType === ClickType.RightClick ? 'right' : 'left',
51
61
  timeout: 0,
52
62
  minimizeScrollIntoView: executionContext.browserConfig.minimizeScrollIntoView,
53
63
  };
54
- return clickType === ClickType.LeftClick
55
- ? elementHandle.click(finalClickOptions)
56
- : elementHandle.doubleClick(finalClickOptions);
64
+ return clickType === ClickType.DoubleClick
65
+ ? elementHandle.doubleClick(finalClickOptions)
66
+ : elementHandle.click(finalClickOptions);
57
67
  }
58
68
  exports.clickOnElement = clickOnElement;
package/util/csvUtil.js CHANGED
@@ -1,8 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sanitizeCellInput = void 0;
3
+ exports.desanitizeCellOutput = exports.sanitizeCellInput = void 0;
4
4
  const MALICIOUS_LINE_PREFIX_MATCHER = /^([+\-@=])/;
5
+ const SANITIZED_LINE_PREFIX_MATCHER = /^(`[+\-@=])/;
5
6
  function sanitizeCellInput(input) {
6
7
  return MALICIOUS_LINE_PREFIX_MATCHER.test(input) ? `\`${input}` : input;
7
8
  }
8
9
  exports.sanitizeCellInput = sanitizeCellInput;
10
+ function desanitizeCellOutput(input) {
11
+ return SANITIZED_LINE_PREFIX_MATCHER.test(input) ? input.slice(1) : input;
12
+ }
13
+ exports.desanitizeCellOutput = desanitizeCellOutput;