@mablhq/mabl-cli 1.12.9 → 1.12.38
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 +1 -1
- package/api/mablApiClient.js +9 -9
- package/auth/AuthClient.js +1 -4
- package/browserLauncher/browserLauncher.js +3 -1
- package/browserLauncher/browserLauncherFactory.js +6 -2
- package/browserLauncher/elementHandle.js +8 -1
- package/browserLauncher/frame.js +15 -0
- package/browserLauncher/frameBase.js +4 -0
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowser.js +2 -2
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowserLauncher.js +1 -0
- package/browserLauncher/playwrightBrowserLauncher/playwrightDom.js +119 -31
- package/browserLauncher/playwrightBrowserLauncher/playwrightFrame.js +32 -21
- package/browserLauncher/playwrightBrowserLauncher/playwrightHttpResponse.js +3 -0
- package/browserLauncher/playwrightBrowserLauncher/playwrightPage.js +43 -75
- package/browserLauncher/playwrightBrowserLauncher/wrappers.js +1 -1
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerBrowser.js +3 -3
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerElementHandle.js +59 -5
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerFrame.js +9 -8
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerHttpRequest.js +1 -1
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerHttpResponse.js +4 -1
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerJsHandle.js +3 -3
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerPage.js +23 -61
- package/browserLauncher/puppeteerBrowserLauncher/wrappers.js +1 -1
- package/cli.js +6 -4
- package/commands/applications/applications_cmds/list.js +1 -1
- package/commands/branches/branches_cmds/create.js +1 -1
- package/commands/branches/branches_cmds/list.js +1 -1
- package/commands/branches/branches_cmds/merge.js +1 -1
- package/commands/commandUtil/awaitCompletion.js +2 -2
- package/commands/commandUtil/codeInsights.js +6 -6
- package/commands/commandUtil/fileUtil.js +1 -1
- package/commands/commandUtil/util.js +12 -12
- package/commands/config/config_cmds/list.js +1 -1
- package/commands/constants.js +1 -1
- package/commands/credentials/credentials_cmds/list.js +1 -1
- package/commands/deploy/deploy_cmds/create.js +2 -2
- package/commands/deploy/deploy_cmds/executionResultPresenter.js +7 -7
- package/commands/deploy/deploy_cmds/list.js +1 -1
- package/commands/environments/environments_cmds/create.js +3 -3
- package/commands/environments/environments_cmds/list.js +1 -1
- package/commands/environments/environments_cmds/urls_cmds/add.js +1 -1
- package/commands/flows/flows_cmds/list.js +1 -1
- package/commands/plans/plans_cmds/list.js +1 -1
- package/commands/test-runs/test-runs_cmds/export.js +1 -1
- package/commands/tests/executionUtil.js +1 -1
- package/commands/tests/testsUtil.js +16 -20
- package/commands/tests/tests_cmds/edit.js +1 -1
- package/commands/tests/tests_cmds/export.js +1 -1
- package/commands/tests/tests_cmds/import.js +13 -13
- package/commands/tests/tests_cmds/list.js +2 -2
- package/commands/tests/tests_cmds/run-alpha.js +1 -1
- package/commands/tests/tests_cmds/run-cloud.js +7 -7
- package/commands/tests/tests_cmds/run-legacy.js +2 -2
- package/commands/tests/tests_cmds/run.js +25 -7
- package/commands/workspaces/workspace_cmds/copy.js +1 -1
- package/commands/workspaces/workspace_cmds/list.js +1 -1
- package/configGenerators/flowConfigGenerator.js +3 -3
- package/configGenerators/selIdeGenerator.js +1 -1
- package/configGenerators/testConfigGenerator.js +7 -8
- package/core/execution/ApiTestUtils.js +2 -2
- package/core/messaging/messaging.js +14 -1
- package/core/trainer/openUtils.js +47 -0
- package/core/trainer/trainingSessions.js +36 -61
- package/env/defaultEnv.js +2 -1
- package/env/dev.js +2 -1
- package/env/env.js +3 -1
- package/env/local.js +2 -1
- package/env/prod.js +2 -1
- package/execution/index.js +1 -1
- package/index.d.ts +7 -0
- package/mablApi/index.js +1 -1
- package/mablscript/MablStep.js +11 -7
- package/mablscript/actions/ConditionAction.js +2 -4
- package/mablscript/actions/FindAction.js +4 -4
- package/mablscript/importer.js +16 -14
- package/mablscript/steps/AccessibilityCheck.js +88 -0
- package/mablscript/steps/AssertStep.js +6 -5
- package/mablscript/steps/CreateVariableStep.js +2 -3
- package/mablscript/steps/DownloadStep.js +1 -2
- package/mablscript/steps/EnterTextStep.js +2 -1
- package/mablscript/steps/IfConditionStep.js +3 -3
- package/mablscript/steps/SendHttpRequestStep.js +2 -2
- package/mablscript/steps/SendKeyStep.js +2 -2
- package/mablscript/steps/SetFilesStep.js +1 -1
- package/mablscript/steps/SwitchContextStep.js +2 -1
- package/mablscript/types/AccessibilityCheckStepDescriptor.js +2 -0
- package/mablscript/types/AccessibilityCheckTypes.js +9 -0
- package/mablscript/types/VariableDataType.js +1 -8
- package/mablscript/types/VariableNamespace.js +1 -1
- package/mablscriptFind/index.js +1 -1
- package/package.json +6 -4
- package/popupDismissal/index.js +13 -12
- package/providers/authenticationProvider.js +2 -3
- package/providers/cliConfigProvider.js +1 -1
- package/providers/exportRequestProvider.js +1 -1
- package/providers/logging/loggingProvider.js +2 -2
- package/providers/scmContextProvider.js +1 -1
- package/reporters/mochAwesome/mochAwesomeReporter.js +10 -6
- package/reporters/reporter.js +1 -1
- package/resources/mablFind.js +1 -1
- package/resources/popupDismissal.js +1 -1
- package/util/RichPromise.js +2 -2
- package/util/actionabilityUtil.js +44 -14
- package/util/downloadUtil.js +1 -1
- package/util/logUtils.js +20 -1
- package/util/markdownUtil.js +3 -3
- package/util/pureUtil.js +6 -6
- package/util/resourceUtil.js +14 -1
- package/core/trainer/trainerBrowserUtil.js +0 -33
|
@@ -1 +1 @@
|
|
|
1
|
-
window.popupDismissal=function(t){var e={};function n(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},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 o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(o,r,function(e){return t[e]}.bind(null,r));return o},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,"detectAndDismissPopupCandidates",(function(){return h})),n.d(e,"elementsInFrontCount",(function(){return g}));const o=["close","dismiss","exit","not at this time","no thanks","no, thanks","i, agree","i agree"],r=[{attributeName:"className",matchFunction:a},{attributeName:"name",matchFunction:a},{attributeName:"id",matchFunction:a},{attributeName:"href",matchFunction:a},{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 o=parseFloat(window.getComputedStyle(n).zIndex);return!Number.isNaN(o)&&o>=t&&(e.has(o)?e.get(o).push(n):e.set(o,[n])),e},new Map)}function u(t){let e=[t];return Array.from(t.children).forEach(t=>{e=e.concat(u(t))}),e}function a(t,e){return t.toLowerCase().includes(e)}function c(t){const e=[];return t.forEach(t=>{const n=[],i=[];t.elements.forEach(t=>{var e,u;(null===(e=t)||void 0===e?void 0:e.offsetParent)&&(["BUTTON","A","DIV"].includes(null===(u=t.tagName)||void 0===u?void 0:u.toUpperCase())&&function(t){let e=0;return r.forEach(n=>{o.forEach(o=>{t.getAttribute(n.attributeName)&&n.matchFunction(t.getAttribute(n.attributeName),o)&&(e+=1)})}),e}(t)&&!i.includes(t)?i.push(t):function(t){if(t.getBoundingClientRect){const e=t.getBoundingClientRect(),n=e.width/window.innerWidth,o=e.height/window.innerHeight;return n>.95&&o>.95}return!1}(t)&&n.push(t))}),e.push({zIndex:t.zIndex,actionableElements:i,domCovering:n,dismissedStatus:!1,elementsInFront:0})}),e}function s(t,e){const n=t.getBoundingClientRect(),o=n.height/2,r=e?1:n.width/2,i=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window,detail:0,screenX:n.left+r,screenY:n.top+o,clientX:t.clientLeft+r,clientY:t.clientTop+o,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:void 0});t.dispatchEvent(i)}function l(t,e,n){const o=void 0!==e?e:f(t).x,r=void 0!==n?n:f(t).y,i=document.elementsFromPoint(o,r),u=i.findIndex(e=>e===t);return u?i.slice(0,u):[]}function d(t){return new Promise(e=>setTimeout(e,t))}function f(t){const e=t.getBoundingClientRect();return{x:Math.floor(e.x),y:Math.floor(e.y),top:Math.floor(e.top),bottom:Math.ceil(e.bottom),left:Math.floor(e.left),right:Math.ceil(e.right),height:Math.floor(e.bottom)-Math.ceil(e.top),width:Math.floor(e.right)-Math.ceil(e.left)}}function m(t){const e=i(function(t
|
|
1
|
+
window.popupDismissal=function(t){var e={};function n(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},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 o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(o,r,function(e){return t[e]}.bind(null,r));return o},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,"getAllElementsAbove",(function(){return m})),n.d(e,"detectAndDismissPopupCandidates",(function(){return h})),n.d(e,"elementsInFrontCount",(function(){return g}));const o=["close","dismiss","exit","not at this time","no thanks","no, thanks","i, agree","i agree"],r=[{attributeName:"className",matchFunction:a},{attributeName:"name",matchFunction:a},{attributeName:"id",matchFunction:a},{attributeName:"href",matchFunction:a},{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 o=parseFloat(window.getComputedStyle(n).zIndex);return!Number.isNaN(o)&&o>=t&&(e.has(o)?e.get(o).push(n):e.set(o,[n])),e},new Map)}function u(t){let e=[t];return Array.from(t.children).forEach(t=>{e=e.concat(u(t))}),e}function a(t,e){return t.toLowerCase().includes(e)}function c(t){const e=[];return t.forEach(t=>{const n=[],i=[];t.elements.forEach(t=>{var e,u;(null===(e=t)||void 0===e?void 0:e.offsetParent)&&(["BUTTON","A","DIV"].includes(null===(u=t.tagName)||void 0===u?void 0:u.toUpperCase())&&function(t){let e=0;return r.forEach(n=>{o.forEach(o=>{t.getAttribute(n.attributeName)&&n.matchFunction(t.getAttribute(n.attributeName),o)&&(e+=1)})}),e}(t)&&!i.includes(t)?i.push(t):function(t){if(t.getBoundingClientRect){const e=t.getBoundingClientRect(),n=e.width/window.innerWidth,o=e.height/window.innerHeight;return n>.95&&o>.95}return!1}(t)&&n.push(t))}),e.push({zIndex:t.zIndex,actionableElements:i,domCovering:n,dismissedStatus:!1,elementsInFront:0})}),e}function s(t,e){const n=t.getBoundingClientRect(),o=n.height/2,r=e?1:n.width/2,i=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window,detail:0,screenX:n.left+r,screenY:n.top+o,clientX:t.clientLeft+r,clientY:t.clientTop+o,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:void 0});t.dispatchEvent(i)}function l(t,e,n){const o=void 0!==e?e:f(t).x,r=void 0!==n?n:f(t).y,i=document.elementsFromPoint(o,r),u=i.findIndex(e=>e===t);return u?i.slice(0,u):[]}function d(t){return new Promise(e=>setTimeout(e,t))}function f(t){const e=t.getBoundingClientRect();return{x:Math.floor(e.x),y:Math.floor(e.y),top:Math.floor(e.top),bottom:Math.ceil(e.bottom),left:Math.floor(e.left),right:Math.ceil(e.right),height:Math.floor(e.bottom)-Math.ceil(e.top),width:Math.floor(e.right)-Math.ceil(e.left)}}function m(t){const e=i(function(t){const e=t=>void 0===t||"html"===t.tagName.toLowerCase();let n=t;for(;!e(n);){const e=window.getComputedStyle(t).zIndex;if(e&&"auto"!==e)return e;n=(null==n?void 0:n.parentElement)?n.parentElement:void 0}return 0}(t[t.length-1])),n=Array.from(e).map(([t,e])=>({zIndex:t,elements:e.flatMap(u).reverse()}));return n.sort((t,e)=>e.zIndex-t.zIndex),n}async function h(t){const e=f(t);try{let n=l(t,e.x,e.y);const o=n.length;if(0===o)return{zIndex:0,elementsInFront:0,dismissedStatus:!1,domCovering:[],actionableElements:[]};const r=async function(n,r){for(const i of n)if(s(i,r),await d(750),l(t,e.x,e.y).length<o)return!0;return!1};let i=m(n);const u=c(i);for(const t of u){let e=await r(t.domCovering,!0);if(e||(e=await r(t.actionableElements,!1)),e)return t.dismissedStatus=!0,t}n=l(t,e.x,e.y),i=m(n);const a=c(i),f=a.length?a[0]:{zIndex:0,elementsInFront:0,dismissedStatus:!1,domCovering:[],actionableElements:[]};return f.elementsInFront=n.length,f.dismissedStatus=!1,f}catch(t){return{zIndex:0,elementsInFront:0,dismissedStatus:!1,domCovering:[],actionableElements:[],errorInDetection:t.toString()}}}function g(t){return l(t).length}}]);
|
package/util/RichPromise.js
CHANGED
|
@@ -19,15 +19,45 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.maybeAddPopupLogic = exports.checkActionabilityAt = void 0;
|
|
22
|
+
exports.maybeAddPopupLogic = exports.checkActionabilityAt = exports.checkActionabilityAtWithRetries = void 0;
|
|
23
23
|
const fs = __importStar(require("fs"));
|
|
24
24
|
const resourceUtil_1 = require("./resourceUtil");
|
|
25
25
|
const messaging_1 = require("../core/messaging/messaging");
|
|
26
|
+
const ExecutorUtils_1 = require("../execution/actions/ExecutorUtils");
|
|
27
|
+
const logUtils_1 = require("./logUtils");
|
|
28
|
+
const loggingProvider_1 = require("../providers/logging/loggingProvider");
|
|
26
29
|
const ACTIONABILITY_CHECK_SCRIPT_LOCATION = resourceUtil_1.findResource('actionabilityCheck.js');
|
|
27
30
|
const EMBEDDED_POPUP_SCRIPT_LOCATION = resourceUtil_1.findResource('popupDismissal.js');
|
|
31
|
+
const NO_CLICKABLE_POINT_ERROR = 'Unable to find a clickable point for the element';
|
|
28
32
|
let embeddedPopupScript;
|
|
29
33
|
let embeddedActionabilityLogic;
|
|
30
|
-
async function
|
|
34
|
+
async function checkActionabilityAtWithRetries(elementHandle, executionContext, failIfClickablePointWasNotFound = true) {
|
|
35
|
+
var _a, _b, _c, _d;
|
|
36
|
+
let actionabilityResult;
|
|
37
|
+
try {
|
|
38
|
+
actionabilityResult = await ExecutorUtils_1.runWithRetries(() => checkActionabilityAt(elementHandle, executionContext), 10, [
|
|
39
|
+
'Element not at point',
|
|
40
|
+
'Element not clickable at point',
|
|
41
|
+
NO_CLICKABLE_POINT_ERROR,
|
|
42
|
+
], executionContext);
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
if (failIfClickablePointWasNotFound &&
|
|
46
|
+
error.message === NO_CLICKABLE_POINT_ERROR) {
|
|
47
|
+
throw new Error(NO_CLICKABLE_POINT_ERROR);
|
|
48
|
+
}
|
|
49
|
+
logUtils_1.logWebUIAndCliOutput(`Found element may not be actionable`, loggingProvider_1.LogLevel.Warn, executionContext, {
|
|
50
|
+
executionPhase: messaging_1.ExecutionPhase.DURING_ACTION,
|
|
51
|
+
});
|
|
52
|
+
logUtils_1.logInternal(`Found element might not be actionable at the expected point (x: ${(_b = (_a = actionabilityResult === null || actionabilityResult === void 0 ? void 0 : actionabilityResult.clickablePoint) === null || _a === void 0 ? void 0 : _a.x) !== null && _b !== void 0 ? _b : 'Not found'}, y: ${(_d = (_c = actionabilityResult === null || actionabilityResult === void 0 ? void 0 : actionabilityResult.clickablePoint) === null || _c === void 0 ? void 0 : _c.y) !== null && _d !== void 0 ? _d : 'Not found'}), performing action anyway`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.checkActionabilityAtWithRetries = checkActionabilityAtWithRetries;
|
|
56
|
+
async function checkActionabilityAt(elementHandle, executionContext, recheckOnFail = true) {
|
|
57
|
+
let point = await elementHandle.clickablePoint();
|
|
58
|
+
if (point === undefined) {
|
|
59
|
+
throw new Error(NO_CLICKABLE_POINT_ERROR);
|
|
60
|
+
}
|
|
31
61
|
const frame = await elementHandle.frame();
|
|
32
62
|
if (frame === null || frame === void 0 ? void 0 : frame.parentFrame()) {
|
|
33
63
|
const element = await frame.getFrameOwnerElement();
|
|
@@ -40,43 +70,43 @@ async function checkActionabilityAt(elementHandle, point, executionContext, with
|
|
|
40
70
|
}
|
|
41
71
|
}
|
|
42
72
|
await maybeAddActionabilityLogic(elementHandle);
|
|
43
|
-
const result = await elementHandle.evaluate((node, point) => mablCheckActionability(node, point), point);
|
|
73
|
+
const result = await elementHandle.evaluate((node, point) => mablCheckActionability(node, point), { ...point });
|
|
44
74
|
if (result !== 'done') {
|
|
45
75
|
if (typeof result === 'object' && 'actionabilityDescription' in result) {
|
|
46
|
-
|
|
47
|
-
await attemptPopupDismissal(elementHandle
|
|
48
|
-
if (
|
|
49
|
-
return checkActionabilityAt(elementHandle,
|
|
76
|
+
logUtils_1.logInternal(`${result.actionabilityDescription} intercepts pointer events. Trying to auto-dismiss popups.`);
|
|
77
|
+
await attemptPopupDismissal(elementHandle);
|
|
78
|
+
if (recheckOnFail) {
|
|
79
|
+
return checkActionabilityAt(elementHandle, executionContext, false);
|
|
50
80
|
}
|
|
51
81
|
throw new Error(`Element not clickable at point.`);
|
|
52
82
|
}
|
|
53
83
|
throw new Error(`Element not at point. ${result}`);
|
|
54
84
|
}
|
|
55
|
-
return result;
|
|
85
|
+
return { result, clickablePoint: point };
|
|
56
86
|
}
|
|
57
87
|
exports.checkActionabilityAt = checkActionabilityAt;
|
|
58
|
-
async function attemptPopupDismissal(element
|
|
88
|
+
async function attemptPopupDismissal(element) {
|
|
59
89
|
const frame = await element.frame();
|
|
60
90
|
if (frame === undefined) {
|
|
61
91
|
return false;
|
|
62
92
|
}
|
|
63
93
|
await maybeAddPopupLogic(element);
|
|
64
|
-
const { dismissedStatus, elementsInFront } = await element.evaluate(element => window.popupDismissal.detectAndDismissPopupCandidates(element));
|
|
94
|
+
const { dismissedStatus, elementsInFront } = await element.evaluate((element) => window.popupDismissal.detectAndDismissPopupCandidates(element));
|
|
65
95
|
if (!dismissedStatus) {
|
|
66
96
|
if (elementsInFront) {
|
|
67
|
-
|
|
97
|
+
logUtils_1.logInternal('Failed to auto dismiss and there are still elements in front. Sending escape key to body.');
|
|
68
98
|
const bodyElement = await frame.$('BODY');
|
|
69
99
|
if (bodyElement) {
|
|
70
100
|
await bodyElement.press('Escape');
|
|
71
101
|
}
|
|
72
|
-
const elementsInFront = await element.evaluate(element => window.popupDismissal.elementsInFrontCount(element));
|
|
102
|
+
const elementsInFront = await element.evaluate((element) => window.popupDismissal.elementsInFrontCount(element));
|
|
73
103
|
if (elementsInFront) {
|
|
74
|
-
|
|
104
|
+
logUtils_1.logInternal('The popup did not dismiss using the escape key.');
|
|
75
105
|
return false;
|
|
76
106
|
}
|
|
77
107
|
}
|
|
78
108
|
else {
|
|
79
|
-
|
|
109
|
+
logUtils_1.logInternal('Failed to auto dismiss. No elements found in front of target element.');
|
|
80
110
|
return false;
|
|
81
111
|
}
|
|
82
112
|
}
|
package/util/downloadUtil.js
CHANGED
|
@@ -54,7 +54,7 @@ async function getLatestFile(downloadDirectory, filePathSuffix) {
|
|
|
54
54
|
const filesInDownloadDir = await readDirectoryAsync(downloadDirectory);
|
|
55
55
|
let latestFileTime = 0;
|
|
56
56
|
let latestFilePath;
|
|
57
|
-
filesInDownloadDir.forEach(fileName => {
|
|
57
|
+
filesInDownloadDir.forEach((fileName) => {
|
|
58
58
|
const fullPath = `${downloadDirectory}/${fileName}`;
|
|
59
59
|
try {
|
|
60
60
|
const stats = fs.statSync(path.normalize(fullPath));
|
package/util/logUtils.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.logWebUIAndCliOutput = exports.findResultSeverityToLogLevel = exports.logCliOutput = exports.logInternal = void 0;
|
|
6
|
+
exports.formatTimestamp = exports.valueToString = exports.logWebUIAndCliOutput = exports.findResultSeverityToLogLevel = exports.logCliOutput = exports.logInternal = void 0;
|
|
4
7
|
const mablscriptFind_1 = require("../mablscriptFind");
|
|
5
8
|
const loggingProvider_1 = require("../providers/logging/loggingProvider");
|
|
9
|
+
const moment_1 = __importDefault(require("moment"));
|
|
10
|
+
const constants_1 = require("../commands/constants");
|
|
6
11
|
function logInternal(logLine) {
|
|
7
12
|
loggingProvider_1.logger.debug(logLine);
|
|
8
13
|
}
|
|
@@ -55,3 +60,17 @@ function logWebUIAndCliOutput(logLine, logLevel, executionContext, metadata) {
|
|
|
55
60
|
}
|
|
56
61
|
}
|
|
57
62
|
exports.logWebUIAndCliOutput = logWebUIAndCliOutput;
|
|
63
|
+
function valueToString(value) {
|
|
64
|
+
if (typeof value !== 'object') {
|
|
65
|
+
return '' + value;
|
|
66
|
+
}
|
|
67
|
+
return JSON.stringify(value);
|
|
68
|
+
}
|
|
69
|
+
exports.valueToString = valueToString;
|
|
70
|
+
function formatTimestamp(timeAsNumber) {
|
|
71
|
+
if (!timeAsNumber) {
|
|
72
|
+
return '';
|
|
73
|
+
}
|
|
74
|
+
return moment_1.default.utc(timeAsNumber).format(constants_1.ListTimeFormat);
|
|
75
|
+
}
|
|
76
|
+
exports.formatTimestamp = formatTimestamp;
|
package/util/markdownUtil.js
CHANGED
|
@@ -19,7 +19,7 @@ function formatResultsAsGithubMarkdown(results) {
|
|
|
19
19
|
const tableRows = [];
|
|
20
20
|
tableRows.push(['Plan', 'Test', 'Browser', 'Status', 'Run Time']);
|
|
21
21
|
const finalExecutions = (_a = results === null || results === void 0 ? void 0 : results.executions) !== null && _a !== void 0 ? _a : [];
|
|
22
|
-
finalExecutions.forEach(summary => {
|
|
22
|
+
finalExecutions.forEach((summary) => {
|
|
23
23
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
24
24
|
const retryPrefix = ((_a = summary === null || summary === void 0 ? void 0 : summary.plan_execution) === null || _a === void 0 ? void 0 : _a.is_retry) ? '[Retry] ' : '';
|
|
25
25
|
const planName = retryPrefix + ((_c = (_b = summary.plan) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : '<plan name unavailable>');
|
|
@@ -29,7 +29,7 @@ function formatResultsAsGithubMarkdown(results) {
|
|
|
29
29
|
maybeCapitalize(humanizedPlanRunStatus === null || humanizedPlanRunStatus === void 0 ? void 0 : humanizedPlanRunStatus.toString());
|
|
30
30
|
const planHref = (_e = summary.plan) === null || _e === void 0 ? void 0 : _e.app_href;
|
|
31
31
|
const journeyMap = new Map();
|
|
32
|
-
(_f = summary.journeys) === null || _f === void 0 ? void 0 : _f.forEach(journeySummary => journeyMap.set(journeySummary.id, journeySummary));
|
|
32
|
+
(_f = summary.journeys) === null || _f === void 0 ? void 0 : _f.forEach((journeySummary) => journeyMap.set(journeySummary.id, journeySummary));
|
|
33
33
|
tableRows.push([
|
|
34
34
|
`[${planName}](${planHref})`,
|
|
35
35
|
'---',
|
|
@@ -37,7 +37,7 @@ function formatResultsAsGithubMarkdown(results) {
|
|
|
37
37
|
planRunStatus,
|
|
38
38
|
summaryToElapsedTime(summary),
|
|
39
39
|
]);
|
|
40
|
-
(_g = summary.journey_executions) === null || _g === void 0 ? void 0 : _g.forEach(journeyRun => {
|
|
40
|
+
(_g = summary.journey_executions) === null || _g === void 0 ? void 0 : _g.forEach((journeyRun) => {
|
|
41
41
|
const humanizedJourneyRunStatus = humanizeMablStatus(journeyRun.status);
|
|
42
42
|
const journeyStatus = humanizedMablStatusToGithubIcon(humanizedJourneyRunStatus) +
|
|
43
43
|
' ' +
|
package/util/pureUtil.js
CHANGED
|
@@ -32,8 +32,8 @@ function getCliPackage() {
|
|
|
32
32
|
return cliPackage;
|
|
33
33
|
}
|
|
34
34
|
const packagePath = possibleCliPackagePaths
|
|
35
|
-
.map(relativePath => path.resolve(__dirname, relativePath))
|
|
36
|
-
.find(path => fs.existsSync(path));
|
|
35
|
+
.map((relativePath) => path.resolve(__dirname, relativePath))
|
|
36
|
+
.find((path) => fs.existsSync(path));
|
|
37
37
|
if (!packagePath) {
|
|
38
38
|
throw new Error('Cannot find package.json');
|
|
39
39
|
}
|
|
@@ -82,10 +82,10 @@ exports.getCliName = getCliName;
|
|
|
82
82
|
function extractKeyCountsFromArgs(argv) {
|
|
83
83
|
const ignoreKeys = ['$0', '_'];
|
|
84
84
|
const keysUsed = Object.keys(argv)
|
|
85
|
-
.filter(key => !ignoreKeys.includes(key))
|
|
86
|
-
.filter(key => !/[A-Z]/.test(key));
|
|
85
|
+
.filter((key) => !ignoreKeys.includes(key))
|
|
86
|
+
.filter((key) => !/[A-Z]/.test(key));
|
|
87
87
|
const keyValueCountMap = {};
|
|
88
|
-
keysUsed.forEach(key => {
|
|
88
|
+
keysUsed.forEach((key) => {
|
|
89
89
|
const value = argv[key];
|
|
90
90
|
let count;
|
|
91
91
|
if (value === undefined || value === null) {
|
|
@@ -118,7 +118,7 @@ function extractKeyCountsFromArgs(argv) {
|
|
|
118
118
|
}
|
|
119
119
|
exports.extractKeyCountsFromArgs = extractKeyCountsFromArgs;
|
|
120
120
|
function getCaseInsensitiveProperty(obj, key) {
|
|
121
|
-
const keyInObject = Object.keys(obj).find(k => k.toLowerCase() === key.toLowerCase());
|
|
121
|
+
const keyInObject = Object.keys(obj).find((k) => k.toLowerCase() === key.toLowerCase());
|
|
122
122
|
if (keyInObject !== undefined) {
|
|
123
123
|
return obj[keyInObject];
|
|
124
124
|
}
|
package/util/resourceUtil.js
CHANGED
|
@@ -19,7 +19,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.findDirectory = exports.findResource = void 0;
|
|
22
|
+
exports.findNodeModulesDirectory = exports.findDirectory = exports.findResource = void 0;
|
|
23
23
|
const path = __importStar(require("path"));
|
|
24
24
|
const fs = __importStar(require("fs"));
|
|
25
25
|
function findResource(pathInResource) {
|
|
@@ -40,3 +40,16 @@ function findDirectory(pathFromBase) {
|
|
|
40
40
|
return packedPath;
|
|
41
41
|
}
|
|
42
42
|
exports.findDirectory = findDirectory;
|
|
43
|
+
function findNodeModulesDirectory() {
|
|
44
|
+
const unpackedPath = path.normalize(path.resolve(`${__dirname}/../../../node_modules`));
|
|
45
|
+
if (fs.existsSync(unpackedPath)) {
|
|
46
|
+
return unpackedPath;
|
|
47
|
+
}
|
|
48
|
+
const packedAsMabltronDependency = path.normalize(path.resolve(`${__dirname}/../../mabl-cli-internal/node_modules/`));
|
|
49
|
+
if (fs.existsSync(packedAsMabltronDependency)) {
|
|
50
|
+
return packedAsMabltronDependency;
|
|
51
|
+
}
|
|
52
|
+
const packedPath = path.normalize(path.resolve(`${__dirname}/../../node_modules`));
|
|
53
|
+
return packedPath;
|
|
54
|
+
}
|
|
55
|
+
exports.findNodeModulesDirectory = findNodeModulesDirectory;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addClosedAllWindowsEventWatch = exports.addManualCloseEventWatch = void 0;
|
|
4
|
-
const messaging_1 = require("../messaging/messaging");
|
|
5
|
-
const testsUtil_1 = require("../../commands/tests/testsUtil");
|
|
6
|
-
const browserLauncher_1 = require("../../browserLauncher/browserLauncher");
|
|
7
|
-
function addManualCloseEventWatch(trainingBrowser, closeAction) {
|
|
8
|
-
trainingBrowser.on(browserLauncher_1.BrowserEvent.Disconnected, async () => {
|
|
9
|
-
await testsUtil_1.sleep(1000);
|
|
10
|
-
if (closeAction) {
|
|
11
|
-
closeAction();
|
|
12
|
-
}
|
|
13
|
-
trainingBrowser
|
|
14
|
-
.close()
|
|
15
|
-
.catch(error => messaging_1.mablEventEmitter.log('Error shutting down browser on manual close' + error));
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
exports.addManualCloseEventWatch = addManualCloseEventWatch;
|
|
19
|
-
function addClosedAllWindowsEventWatch(trainingBrowser, closeAction) {
|
|
20
|
-
trainingBrowser.on(browserLauncher_1.BrowserEvent.PageDestroyed, async () => {
|
|
21
|
-
const pages = await trainingBrowser.pages();
|
|
22
|
-
if (pages.length === 0) {
|
|
23
|
-
await testsUtil_1.sleep(1000);
|
|
24
|
-
if (closeAction) {
|
|
25
|
-
closeAction();
|
|
26
|
-
}
|
|
27
|
-
trainingBrowser
|
|
28
|
-
.close()
|
|
29
|
-
.catch(error => messaging_1.mablEventEmitter.log('Error shutting down browser on manual close' + error));
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
exports.addClosedAllWindowsEventWatch = addClosedAllWindowsEventWatch;
|