@mablhq/mabl-cli 1.58.25 → 1.58.28
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 +15 -21
- package/api/mablApiClient.js +48 -40
- package/api/mablApiClientFactory.js +1 -1
- package/auth/OktaClient.js +2 -1
- package/browserEngines/chromiumBrowserEngine.js +2 -1
- package/browserEngines/firefoxBrowserEngine.js +2 -2
- package/browserEngines/webkitBrowerEngine.js +2 -2
- package/browserLauncher/browserLauncherFactory.js +3 -2
- package/browserLauncher/elementHandle.js +2 -1
- package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumElementHandleDelegate.js +20 -12
- package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumFrameDelegate.js +1 -1
- package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumPageDelegate.js +10 -7
- package/browserLauncher/playwrightBrowserLauncher/firefox/firefoxFrameDelegate.js +4 -3
- package/browserLauncher/playwrightBrowserLauncher/nonChromium/nonChromiumAbstractElementHandleDelegate.js +5 -4
- package/browserLauncher/playwrightBrowserLauncher/nonChromium/nonChromiumAbstractPageDelegate.js +7 -4
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowser.js +1 -1
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowserLauncher.js +7 -6
- package/browserLauncher/playwrightBrowserLauncher/playwrightDom.js +37 -31
- package/browserLauncher/playwrightBrowserLauncher/playwrightFrame.js +9 -8
- package/browserLauncher/playwrightBrowserLauncher/playwrightHttpRequest.js +8 -4
- package/browserLauncher/playwrightBrowserLauncher/playwrightPage.js +5 -3
- package/browserLauncher/playwrightBrowserLauncher/webkit/webkitElementHandleDelegate.js +2 -1
- package/browserLauncher/playwrightBrowserLauncher/webkit/webkitFrameDelegate.js +1 -1
- package/browserTestMonitoring/metricsRecorder.js +6 -6
- package/commands/commandUtil/branches.js +3 -2
- package/commands/commandUtil/codeInsights.js +16 -13
- package/commands/commandUtil/fileUtil.js +1 -1
- package/commands/commandUtil/util.js +5 -3
- package/commands/commandUtil/versionUtil.js +5 -4
- package/commands/config/config_cmds/list.js +2 -2
- package/commands/datatables/datatables_cmds/create.js +3 -2
- package/commands/datatables/datatables_cmds/export.js +5 -3
- package/commands/datatables/datatables_cmds/list.js +2 -1
- package/commands/datatables/datatables_cmds/scenarios.js +2 -1
- package/commands/datatables/datatables_cmds/update.js +11 -11
- package/commands/datatables/utils.js +9 -9
- package/commands/deploy/deploy_cmds/awaitDeploymentCompletion.js +8 -6
- package/commands/deploy/deploy_cmds/create.js +13 -11
- package/commands/deploy/deploy_cmds/executionResultPresenter.js +11 -8
- package/commands/deploy/deploy_cmds/list.js +4 -3
- package/commands/deploy/deploy_cmds/watch.js +2 -1
- package/commands/environments/environments_cmds/create.js +2 -1
- package/commands/environments/environments_cmds/delete.js +2 -1
- package/commands/environments/environments_cmds/update.js +2 -1
- package/commands/environments/environments_cmds/urls_cmds/list.js +2 -1
- package/commands/flows/flows_cmds/export.js +2 -1
- package/commands/plans/plans_cmds/describe.js +2 -1
- package/commands/tests/mobileEmulationUtil.js +7 -5
- package/commands/tests/testsUtil.js +42 -40
- package/commands/tests/tests_cmds/export.js +2 -1
- package/commands/tests/tests_cmds/import.js +5 -4
- package/commands/tests/tests_cmds/run-cloud.js +13 -12
- package/commands/tests/tests_cmds/run.js +11 -9
- package/commands/users/users_cmds/list.js +2 -2
- package/commands/workspaces/workspace_cmds/copy.js +2 -1
- package/core/execution/ApiTestUtils.js +94 -82
- package/core/messaging/logLineMessaging.js +3 -2
- package/core/messaging/messaging.js +7 -6
- package/core/trainer/trainingSessions.js +15 -15
- package/coreWebVitals/index.js +18 -14
- package/execution/index.js +1 -1
- package/functions/apiTest/utils.js +5 -4
- package/http/MablHttpAgent.js +6 -4
- package/http/RequestSecurityError.js +1 -1
- package/http/axiosProxyConfig.js +5 -3
- package/http/httpUtil.js +3 -2
- package/http/requestInterceptor.js +15 -11
- package/mablscript/MablAction.js +3 -2
- package/mablscript/MablStep.js +4 -2
- package/mablscript/MablSymbol.js +1 -1
- package/mablscript/actions/ConditionAction.js +4 -2
- package/mablscript/actions/FindAction.js +4 -2
- package/mablscript/diffing/diffingUtil.js +7 -8
- package/mablscript/importer.js +2 -1
- package/mablscript/steps/AccessibilityCheck.js +9 -7
- package/mablscript/steps/AssertStep.js +16 -11
- package/mablscript/steps/ClickAndHoldStep.js +2 -1
- package/mablscript/steps/CreateVariableStep.js +2 -1
- package/mablscript/steps/DownloadStep.js +2 -1
- package/mablscript/steps/EnterTextStep.js +2 -1
- package/mablscript/steps/EvaluateFlowStep.js +1 -1
- package/mablscript/steps/IfConditionStep.js +6 -4
- package/mablscript/steps/ReleaseStep.js +2 -1
- package/mablscript/steps/SendHttpRequestStep.js +4 -2
- package/mablscript/steps/SendKeyStep.js +1 -1
- package/mablscript/steps/SetCookieStep.js +8 -7
- package/mablscript/steps/SetViewportStep.js +1 -1
- package/mablscript/steps/SwitchContextStep.js +6 -3
- package/mablscript/steps/SyntheticStep.js +2 -1
- package/middleware.js +2 -1
- package/package.json +1 -1
- package/popupDismissal/index.js +5 -4
- package/providers/authenticationProvider.js +6 -5
- package/providers/cliConfigProvider.js +12 -10
- package/providers/exportRequestProvider.js +5 -3
- package/providers/logging/loggingProvider.js +1 -1
- package/reporters/mochAwesome/mochAwesomeReporter.js +14 -12
- package/util/TestOutputWriter.js +12 -8
- package/util/actionabilityUtil.js +1 -1
- package/util/analytics.js +9 -6
- package/util/browserTestUtils.js +2 -1
- package/util/markdownUtil.js +11 -9
|
@@ -50,7 +50,8 @@ class ChromiumPageDelegate {
|
|
|
50
50
|
return this.getCDPSession().send(method, paramArgs);
|
|
51
51
|
}
|
|
52
52
|
async getWindowInfo() {
|
|
53
|
-
|
|
53
|
+
var _a, _b;
|
|
54
|
+
return this.makeCDPCall('Browser.getWindowForTarget', { targetId: (_a = this.getTargetId()) !== null && _a !== void 0 ? _a : (_b = this.pageImpl) === null || _b === void 0 ? void 0 : _b._guid });
|
|
54
55
|
}
|
|
55
56
|
async getBrowserBounds() {
|
|
56
57
|
const windowInfo = await this.getWindowInfo();
|
|
@@ -71,19 +72,20 @@ class ChromiumPageDelegate {
|
|
|
71
72
|
}
|
|
72
73
|
}
|
|
73
74
|
getCDPSession() {
|
|
75
|
+
var _a, _b, _c, _d;
|
|
74
76
|
this.checkCDPSession();
|
|
75
|
-
const session = this.pageImpl
|
|
76
|
-
this.fallbackCDPSession;
|
|
77
|
+
const session = (_d = (_c = (_b = (_a = this.pageImpl) === null || _a === void 0 ? void 0 : _a._delegate) === null || _b === void 0 ? void 0 : _b._mainFrameSession) === null || _c === void 0 ? void 0 : _c._client) !== null && _d !== void 0 ? _d : this.fallbackCDPSession;
|
|
77
78
|
if (!session) {
|
|
78
79
|
throw new Error('Unable to get the CDP Session of the page');
|
|
79
80
|
}
|
|
80
81
|
return session;
|
|
81
82
|
}
|
|
82
83
|
checkCDPSession() {
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
var _a, _b, _c, _d, _e, _f;
|
|
85
|
+
if (((_c = (_b = (_a = this.pageImpl) === null || _a === void 0 ? void 0 : _a._delegate) === null || _b === void 0 ? void 0 : _b._mainFrameSession) === null || _c === void 0 ? void 0 : _c._client) === undefined) {
|
|
86
|
+
const undefinedField = ((_e = (_d = this.pageImpl) === null || _d === void 0 ? void 0 : _d._delegate) === null || _e === void 0 ? void 0 : _e._mainFrameSession) !== undefined
|
|
85
87
|
? '_client'
|
|
86
|
-
: this.pageImpl
|
|
88
|
+
: ((_f = this.pageImpl) === null || _f === void 0 ? void 0 : _f._delegate) !== undefined
|
|
87
89
|
? '_mainFrameSession'
|
|
88
90
|
: 'pageImpl';
|
|
89
91
|
(0, logUtils_1.logInternal)(`Unable to get the CDP Session of the page (${undefinedField} is undefined).
|
|
@@ -94,7 +96,8 @@ class ChromiumPageDelegate {
|
|
|
94
96
|
}
|
|
95
97
|
}
|
|
96
98
|
getTargetId() {
|
|
97
|
-
|
|
99
|
+
var _a, _b;
|
|
100
|
+
return (_b = (_a = this.pageImpl) === null || _a === void 0 ? void 0 : _a._delegate) === null || _b === void 0 ? void 0 : _b._targetId;
|
|
98
101
|
}
|
|
99
102
|
async createCDPSession() {
|
|
100
103
|
try {
|
|
@@ -6,13 +6,14 @@ const nonChromiumAbstractFrameDelegate_1 = require("../nonChromium/nonChromiumAb
|
|
|
6
6
|
const playwrightFrame_1 = require("../playwrightFrame");
|
|
7
7
|
class FirefoxFrameDelegate extends nonChromiumAbstractFrameDelegate_1.NonChromiumAbstractFrameDelegate {
|
|
8
8
|
async addBindingToSecondaryWorld(binding) {
|
|
9
|
+
var _a;
|
|
9
10
|
const pageImpl = this.parentPageDelegate.pageImpl;
|
|
10
11
|
if (pageImpl) {
|
|
11
|
-
await pageImpl._delegate
|
|
12
|
+
await ((_a = pageImpl._delegate) === null || _a === void 0 ? void 0 : _a._session.send('Page.addBinding', {
|
|
12
13
|
worldName: playwrightFrame_1.UTILITY_CONTEXT_NAME,
|
|
13
14
|
name: binding.name,
|
|
14
15
|
script: binding.source,
|
|
15
|
-
});
|
|
16
|
+
}));
|
|
16
17
|
}
|
|
17
18
|
return;
|
|
18
19
|
}
|
|
@@ -25,7 +26,7 @@ class FirefoxFrameDelegate extends nonChromiumAbstractFrameDelegate_1.NonChromiu
|
|
|
25
26
|
}
|
|
26
27
|
getLifecycleEventStrategy(value) {
|
|
27
28
|
const waitForNetworkIdle = value === types_1.LifecycleEvent.NetworkIdle;
|
|
28
|
-
let waitUntil = value
|
|
29
|
+
let waitUntil = value !== null && value !== void 0 ? value : types_1.LifecycleEvent.Load;
|
|
29
30
|
if (waitForNetworkIdle) {
|
|
30
31
|
waitUntil = types_1.LifecycleEvent.Load;
|
|
31
32
|
}
|
|
@@ -39,7 +39,7 @@ class NonChromiumAbstractElementHandleDelegate {
|
|
|
39
39
|
return this.elementHandle.evaluate((el) => {
|
|
40
40
|
if (el.tagName.toUpperCase() === 'SELECT') {
|
|
41
41
|
return Array.from(el.options)
|
|
42
|
-
.filter((option) => option.text
|
|
42
|
+
.filter((option) => { var _a; return (_a = option.text) === null || _a === void 0 ? void 0 : _a.trim(); })
|
|
43
43
|
.map((option) => option.text)
|
|
44
44
|
.join('\n');
|
|
45
45
|
}
|
|
@@ -54,14 +54,15 @@ class NonChromiumAbstractElementHandleDelegate {
|
|
|
54
54
|
return this.elementImpl;
|
|
55
55
|
}
|
|
56
56
|
getCDPSession() {
|
|
57
|
-
|
|
57
|
+
var _a, _b, _c, _d, _e, _f;
|
|
58
|
+
const session = (_c = (_b = (_a = this.elementImpl) === null || _a === void 0 ? void 0 : _a._context) === null || _b === void 0 ? void 0 : _b._delegate) === null || _c === void 0 ? void 0 : _c._session;
|
|
58
59
|
if (this.elementImpl === undefined) {
|
|
59
60
|
(0, logUtils_1.logInternal)(`Unable to get the Element's internal implementation. Some functionality, such as getting the clickable point or element highlighting might not work.`);
|
|
60
61
|
}
|
|
61
62
|
else if (session === undefined) {
|
|
62
|
-
const undefinedField = this.elementImpl
|
|
63
|
+
const undefinedField = ((_e = (_d = this.elementImpl) === null || _d === void 0 ? void 0 : _d._context) === null || _e === void 0 ? void 0 : _e._delegate) !== undefined
|
|
63
64
|
? '_client'
|
|
64
|
-
: this.elementImpl
|
|
65
|
+
: ((_f = this.elementImpl) === null || _f === void 0 ? void 0 : _f._context) !== undefined
|
|
65
66
|
? '_delegate'
|
|
66
67
|
: '_context';
|
|
67
68
|
(0, logUtils_1.logInternal)(`Unable to get the CDP Session of the element handle. ${undefinedField} is undefined. Some functionality, such as element highlighting will not work.`);
|
package/browserLauncher/playwrightBrowserLauncher/nonChromium/nonChromiumAbstractPageDelegate.js
CHANGED
|
@@ -47,18 +47,21 @@ class NonChromiumAbstractPageDelegate {
|
|
|
47
47
|
return this.page.mainFrame()._id;
|
|
48
48
|
}
|
|
49
49
|
createCDPSession() {
|
|
50
|
-
|
|
50
|
+
var _a;
|
|
51
|
+
return Promise.resolve((_a = this.pageImpl._delegate) === null || _a === void 0 ? void 0 : _a._session);
|
|
51
52
|
}
|
|
52
53
|
makeCDPCall(method, paramArgs) {
|
|
53
54
|
return this.getCDPSession().send(method, paramArgs);
|
|
54
55
|
}
|
|
55
56
|
getCDPSession() {
|
|
57
|
+
var _a, _b;
|
|
56
58
|
this.checkCDPSession();
|
|
57
|
-
return this.pageImpl
|
|
59
|
+
return (_b = (_a = this.pageImpl) === null || _a === void 0 ? void 0 : _a._delegate) === null || _b === void 0 ? void 0 : _b._session;
|
|
58
60
|
}
|
|
59
61
|
checkCDPSession() {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
+
var _a, _b, _c, _d;
|
|
63
|
+
if (((_b = (_a = this.pageImpl) === null || _a === void 0 ? void 0 : _a._delegate) === null || _b === void 0 ? void 0 : _b._session) === undefined) {
|
|
64
|
+
const undefinedField = ((_d = (_c = this.pageImpl) === null || _c === void 0 ? void 0 : _c._delegate) === null || _d === void 0 ? void 0 : _d._session) !== undefined
|
|
62
65
|
? '_session'
|
|
63
66
|
: '_delegate';
|
|
64
67
|
(0, logUtils_1.logInternal)(`Unable to get the CDP Session of the page (${undefinedField} is undefined).
|
|
@@ -131,7 +131,7 @@ class PlaywrightBrowser extends events_1.default {
|
|
|
131
131
|
const playwrightOpener = opener.page;
|
|
132
132
|
const newPage = await this.defaultContext.waitForEvent('page', {
|
|
133
133
|
predicate: async (page) => (await page._opener) === playwrightOpener,
|
|
134
|
-
timeout: options
|
|
134
|
+
timeout: options === null || options === void 0 ? void 0 : options.timeout,
|
|
135
135
|
});
|
|
136
136
|
return this.getOrCreatePage(newPage);
|
|
137
137
|
}
|
|
@@ -17,6 +17,7 @@ const DEFAULT_GEOLOCATION = {
|
|
|
17
17
|
};
|
|
18
18
|
class PlaywrightBrowserLauncher {
|
|
19
19
|
async launch(options) {
|
|
20
|
+
var _a, _b, _c, _d, _e, _f;
|
|
20
21
|
const viewport = options.defaultDeviceDescriptor
|
|
21
22
|
? {
|
|
22
23
|
width: options.defaultDeviceDescriptor.width,
|
|
@@ -42,24 +43,24 @@ class PlaywrightBrowserLauncher {
|
|
|
42
43
|
bypassCSP: options.bypassContentSecurityPolicy,
|
|
43
44
|
channel: browserTypes_1.SupportedBrowserTypeProperties[options.browserType]
|
|
44
45
|
.browserReleaseChannel,
|
|
45
|
-
deviceScaleFactor: options.defaultDeviceDescriptor
|
|
46
|
+
deviceScaleFactor: (_a = options.defaultDeviceDescriptor) === null || _a === void 0 ? void 0 : _a.deviceScaleFactor,
|
|
46
47
|
downloadsPath: getFinalDownloadDestination(options.browserType, options.downloadPath),
|
|
47
48
|
executablePath: options.browserPath,
|
|
48
49
|
extraHTTPHeaders: options.extraHttpHeaders,
|
|
49
50
|
geolocation: DEFAULT_GEOLOCATION,
|
|
50
|
-
hasTouch: options.defaultDeviceDescriptor
|
|
51
|
+
hasTouch: (_b = options.defaultDeviceDescriptor) === null || _b === void 0 ? void 0 : _b.hasTouch,
|
|
51
52
|
headless: options.headless,
|
|
52
53
|
httpCredentials: options.credentials,
|
|
53
54
|
ignoreDefaultArgs: options.ignoreCommandLineDefaultArgs,
|
|
54
55
|
ignoreHTTPSErrors: true,
|
|
55
|
-
isMobile: options.defaultDeviceDescriptor
|
|
56
|
-
locale: options.localizationOptions
|
|
56
|
+
isMobile: (_c = options.defaultDeviceDescriptor) === null || _c === void 0 ? void 0 : _c.isMobile,
|
|
57
|
+
locale: (_d = options.localizationOptions) === null || _d === void 0 ? void 0 : _d.locale,
|
|
57
58
|
logger: playwrightLogger,
|
|
58
59
|
permissions: options.permissions,
|
|
59
60
|
proxy: options.proxy,
|
|
60
61
|
timeout: BROWSER_LAUNCH_TIMEOUT_MS,
|
|
61
|
-
timezoneId: options.localizationOptions
|
|
62
|
-
userAgent: options.userAgent
|
|
62
|
+
timezoneId: (_e = options.localizationOptions) === null || _e === void 0 ? void 0 : _e.timezone_identifier,
|
|
63
|
+
userAgent: (_f = options.userAgent) !== null && _f !== void 0 ? _f : options.defaultUserAgent,
|
|
63
64
|
viewport,
|
|
64
65
|
});
|
|
65
66
|
return playwrightBrowser_1.PlaywrightBrowser.create(playwrightBrowserType, defaultContext, options.downloadPath, '', options.userDataDir, options.disableFocusEmulation);
|
|
@@ -57,8 +57,9 @@ class PlaywrightJsHandle {
|
|
|
57
57
|
return this.handle.jsonValue();
|
|
58
58
|
}
|
|
59
59
|
isContextDestroyed() {
|
|
60
|
+
var _a, _b;
|
|
60
61
|
const elementImpl = playwright._toImpl(this.handle);
|
|
61
|
-
return !!elementImpl._context
|
|
62
|
+
return !!((_b = (_a = elementImpl._context) === null || _a === void 0 ? void 0 : _a._contextDestroyedRace) === null || _b === void 0 ? void 0 : _b._terminateError);
|
|
62
63
|
}
|
|
63
64
|
static unwrapProperties(arg, addSecondaryWorldFlag = false) {
|
|
64
65
|
if (arg === undefined) {
|
|
@@ -119,7 +120,7 @@ class PlaywrightElementHandle extends PlaywrightJsHandle {
|
|
|
119
120
|
return (0, utils_1.mapIfNotNull)(await this.element.boundingBox(), (boundingBox) => boundingBox);
|
|
120
121
|
}
|
|
121
122
|
async maybeOverwriteScrollIntoViewDuringAction(action, options) {
|
|
122
|
-
if (options
|
|
123
|
+
if (options === null || options === void 0 ? void 0 : options.minimizeScrollIntoView) {
|
|
123
124
|
await this.overwriteScrollIntoViewFunction();
|
|
124
125
|
}
|
|
125
126
|
try {
|
|
@@ -129,19 +130,20 @@ class PlaywrightElementHandle extends PlaywrightJsHandle {
|
|
|
129
130
|
throw e;
|
|
130
131
|
}
|
|
131
132
|
finally {
|
|
132
|
-
if (options
|
|
133
|
+
if (options === null || options === void 0 ? void 0 : options.minimizeScrollIntoView) {
|
|
133
134
|
await this.resetScrollIntoViewFunction();
|
|
134
135
|
}
|
|
135
136
|
}
|
|
136
137
|
}
|
|
137
138
|
click(options) {
|
|
138
139
|
return this.maybeOverwriteScrollIntoViewDuringAction(async () => {
|
|
139
|
-
|
|
140
|
+
var _a, _b, _c;
|
|
141
|
+
const trial = (_a = options === null || options === void 0 ? void 0 : options.trial) !== null && _a !== void 0 ? _a : false;
|
|
140
142
|
try {
|
|
141
143
|
await this.element.click({
|
|
142
|
-
button: options
|
|
143
|
-
clickCount: options
|
|
144
|
-
force: options
|
|
144
|
+
button: options === null || options === void 0 ? void 0 : options.button,
|
|
145
|
+
clickCount: (_b = options === null || options === void 0 ? void 0 : options.clickCount) !== null && _b !== void 0 ? _b : 1,
|
|
146
|
+
force: (_c = options === null || options === void 0 ? void 0 : options.force) !== null && _c !== void 0 ? _c : !trial,
|
|
145
147
|
timeout: this.getActionTimeout(options),
|
|
146
148
|
trial,
|
|
147
149
|
});
|
|
@@ -154,15 +156,16 @@ class PlaywrightElementHandle extends PlaywrightJsHandle {
|
|
|
154
156
|
throw error;
|
|
155
157
|
}
|
|
156
158
|
}, {
|
|
157
|
-
minimizeScrollIntoView: options
|
|
159
|
+
minimizeScrollIntoView: options === null || options === void 0 ? void 0 : options.minimizeScrollIntoView,
|
|
158
160
|
});
|
|
159
161
|
}
|
|
160
162
|
async doubleClick(options) {
|
|
161
163
|
return this.maybeOverwriteScrollIntoViewDuringAction(async () => {
|
|
164
|
+
var _a, _b;
|
|
162
165
|
try {
|
|
163
|
-
const trial = options
|
|
166
|
+
const trial = (_a = options === null || options === void 0 ? void 0 : options.trial) !== null && _a !== void 0 ? _a : false;
|
|
164
167
|
return this.element.dblclick({
|
|
165
|
-
force: options
|
|
168
|
+
force: (_b = options === null || options === void 0 ? void 0 : options.force) !== null && _b !== void 0 ? _b : !trial,
|
|
166
169
|
timeout: this.getActionTimeout(options),
|
|
167
170
|
trial,
|
|
168
171
|
});
|
|
@@ -173,13 +176,13 @@ class PlaywrightElementHandle extends PlaywrightJsHandle {
|
|
|
173
176
|
}
|
|
174
177
|
}
|
|
175
178
|
}, {
|
|
176
|
-
minimizeScrollIntoView: options
|
|
179
|
+
minimizeScrollIntoView: options === null || options === void 0 ? void 0 : options.minimizeScrollIntoView,
|
|
177
180
|
});
|
|
178
181
|
}
|
|
179
182
|
async clickablePoint() {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
+
var _a;
|
|
184
|
+
const clickablePoint = await ((_a = this.delegate
|
|
185
|
+
.getElementImpl()) === null || _a === void 0 ? void 0 : _a._clickablePoint());
|
|
183
186
|
if (clickablePoint === 'error:notvisible' ||
|
|
184
187
|
clickablePoint === 'error:notinviewport') {
|
|
185
188
|
return undefined;
|
|
@@ -203,26 +206,27 @@ class PlaywrightElementHandle extends PlaywrightJsHandle {
|
|
|
203
206
|
}
|
|
204
207
|
async select(value, options) {
|
|
205
208
|
return this.maybeOverwriteScrollIntoViewDuringAction(async () => this.element.selectOption(value), {
|
|
206
|
-
minimizeScrollIntoView: options
|
|
209
|
+
minimizeScrollIntoView: options === null || options === void 0 ? void 0 : options.minimizeScrollIntoView,
|
|
207
210
|
});
|
|
208
211
|
}
|
|
209
212
|
async type(text, options) {
|
|
210
213
|
return this.maybeOverwriteScrollIntoViewDuringAction(async () => {
|
|
211
|
-
|
|
214
|
+
var _a;
|
|
215
|
+
const selectText = (_a = options === null || options === void 0 ? void 0 : options.selectText) !== null && _a !== void 0 ? _a : true;
|
|
212
216
|
if (selectText) {
|
|
213
217
|
await this.element.selectText({ force: true });
|
|
214
218
|
}
|
|
215
219
|
await this.element.type(text, {
|
|
216
|
-
delay: options
|
|
220
|
+
delay: options === null || options === void 0 ? void 0 : options.delay,
|
|
217
221
|
timeout: 0,
|
|
218
222
|
});
|
|
219
223
|
}, {
|
|
220
|
-
minimizeScrollIntoView: options
|
|
224
|
+
minimizeScrollIntoView: options === null || options === void 0 ? void 0 : options.minimizeScrollIntoView,
|
|
221
225
|
});
|
|
222
226
|
}
|
|
223
227
|
press(key, options) {
|
|
224
228
|
return this.maybeOverwriteScrollIntoViewDuringAction(async () => this.element.press(key), {
|
|
225
|
-
minimizeScrollIntoView: options
|
|
229
|
+
minimizeScrollIntoView: options === null || options === void 0 ? void 0 : options.minimizeScrollIntoView,
|
|
226
230
|
});
|
|
227
231
|
}
|
|
228
232
|
highlight(highlightDurationMillis, highlightPhases) {
|
|
@@ -232,7 +236,8 @@ class PlaywrightElementHandle extends PlaywrightJsHandle {
|
|
|
232
236
|
return this.element.inputValue();
|
|
233
237
|
}
|
|
234
238
|
async makeCDPCall(method, paramArgs) {
|
|
235
|
-
|
|
239
|
+
var _a;
|
|
240
|
+
return ((_a = this.cdpSession) !== null && _a !== void 0 ? _a : this.page.getCDPSession()).send(method, paramArgs);
|
|
236
241
|
}
|
|
237
242
|
getTagName() {
|
|
238
243
|
return this.element.evaluate((el) => el.tagName.toLowerCase());
|
|
@@ -263,7 +268,7 @@ class PlaywrightElementHandle extends PlaywrightJsHandle {
|
|
|
263
268
|
.item(0)
|
|
264
269
|
.assignedNodes()
|
|
265
270
|
.find((node) => node.nodeType === Node.TEXT_NODE);
|
|
266
|
-
return textNode
|
|
271
|
+
return textNode === null || textNode === void 0 ? void 0 : textNode.data;
|
|
267
272
|
});
|
|
268
273
|
return (0, pureUtil_1.isNullish)(result) ? undefined : result;
|
|
269
274
|
}
|
|
@@ -274,33 +279,34 @@ class PlaywrightElementHandle extends PlaywrightJsHandle {
|
|
|
274
279
|
return this.delegate.focusAndSelect(this);
|
|
275
280
|
}
|
|
276
281
|
getActionTimeout(options) {
|
|
277
|
-
|
|
282
|
+
var _a;
|
|
283
|
+
const defaultTimeout = (options === null || options === void 0 ? void 0 : options.trial)
|
|
278
284
|
? types_1.DefaultTimeouts.defaultTrialTimeoutMs
|
|
279
285
|
: types_1.DefaultTimeouts.defaultActionTimeoutMs;
|
|
280
|
-
return options
|
|
286
|
+
return (_a = options === null || options === void 0 ? void 0 : options.timeout) !== null && _a !== void 0 ? _a : defaultTimeout;
|
|
281
287
|
}
|
|
282
288
|
async overwriteScrollIntoViewFunction() {
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
289
|
+
var _a;
|
|
290
|
+
await ((_a = this.delegate
|
|
291
|
+
.getElementImpl()) === null || _a === void 0 ? void 0 : _a.evaluateInUtility(([, node]) => {
|
|
286
292
|
const element = node;
|
|
287
293
|
if (!element.__mablOriginalScrollIntoView) {
|
|
288
294
|
element.__mablOriginalScrollIntoView = element.scrollIntoView;
|
|
289
295
|
}
|
|
290
296
|
element.scrollIntoView = () => element.scrollIntoViewIfNeeded();
|
|
291
|
-
}, []);
|
|
297
|
+
}, []));
|
|
292
298
|
}
|
|
293
299
|
async resetScrollIntoViewFunction() {
|
|
300
|
+
var _a;
|
|
294
301
|
try {
|
|
295
|
-
await this.delegate
|
|
296
|
-
.getElementImpl()
|
|
297
|
-
?.evaluateInUtility(([, node]) => {
|
|
302
|
+
await ((_a = this.delegate
|
|
303
|
+
.getElementImpl()) === null || _a === void 0 ? void 0 : _a.evaluateInUtility(([, node]) => {
|
|
298
304
|
const element = node;
|
|
299
305
|
const originalFunction = element.__mablOriginalScrollIntoView;
|
|
300
306
|
if (originalFunction) {
|
|
301
307
|
element.scrollIntoView = originalFunction;
|
|
302
308
|
}
|
|
303
|
-
}, []);
|
|
309
|
+
}, []));
|
|
304
310
|
}
|
|
305
311
|
catch (error) {
|
|
306
312
|
(0, logUtils_1.logInternal)(`Error while resetting scrollIntoView function: ${error}`);
|
|
@@ -66,7 +66,7 @@ class PlaywrightFrame extends browserLauncher_1.Frame {
|
|
|
66
66
|
this.utilityWorldAvailable =
|
|
67
67
|
this._contextData.get(UTILITY_CONTEXT).context !== null;
|
|
68
68
|
}
|
|
69
|
-
if (arg
|
|
69
|
+
if (arg === null || arg === void 0 ? void 0 : arg.hasOwnProperty('secondaryWorldValue')) {
|
|
70
70
|
forcedWorld = UTILITY_CONTEXT;
|
|
71
71
|
if (!this.utilityWorldAvailable) {
|
|
72
72
|
this._contextData.set(UTILITY_CONTEXT, this._contextData.get(MAIN_CONTEXT));
|
|
@@ -109,13 +109,13 @@ class PlaywrightFrame extends browserLauncher_1.Frame {
|
|
|
109
109
|
return maybePlaywrightHandles.map((handle) => new playwrightDom_1.PlaywrightElementHandle(handle, this.parentPage, this.parentPage.delegate.createElementHandleDelegate(handle)));
|
|
110
110
|
}
|
|
111
111
|
async $$eval(selector, pageFunction, ...args) {
|
|
112
|
-
const result = await this.frame.$$eval(selector, pageFunction, ...args
|
|
112
|
+
const result = await this.frame.$$eval(selector, pageFunction, ...args === null || args === void 0 ? void 0 : args.map((argument) => argument instanceof playwrightDom_1.PlaywrightJsHandle
|
|
113
113
|
? argument.getPlaywrightHandle()
|
|
114
114
|
: argument));
|
|
115
115
|
return result;
|
|
116
116
|
}
|
|
117
117
|
async $eval(selector, pageFunction, ...args) {
|
|
118
|
-
const result = await this.frame.$eval(selector, pageFunction, ...args
|
|
118
|
+
const result = await this.frame.$eval(selector, pageFunction, ...args === null || args === void 0 ? void 0 : args.map((argument) => argument instanceof playwrightDom_1.PlaywrightJsHandle
|
|
119
119
|
? argument.getPlaywrightHandle()
|
|
120
120
|
: argument));
|
|
121
121
|
return result;
|
|
@@ -142,15 +142,16 @@ class PlaywrightFrame extends browserLauncher_1.Frame {
|
|
|
142
142
|
return new playwrightDom_1.PlaywrightElementHandle(frameElement, this.parentPage, this.parentPage.delegate.createElementHandleDelegate(frameElement));
|
|
143
143
|
}
|
|
144
144
|
async goto(url, options) {
|
|
145
|
-
|
|
145
|
+
var _a;
|
|
146
|
+
const lifecycleEvent = this.delegate.getLifecycleEventStrategy(options === null || options === void 0 ? void 0 : options.waitUntil);
|
|
146
147
|
try {
|
|
147
148
|
const response = await this.frame.goto(url, {
|
|
148
149
|
waitUntil: lifecycleEvent.waitUntil,
|
|
149
|
-
timeout: options
|
|
150
|
+
timeout: options === null || options === void 0 ? void 0 : options.timeout,
|
|
150
151
|
});
|
|
151
152
|
if (lifecycleEvent.waitForNetworkIdle) {
|
|
152
153
|
await this.frame.waitForLoadState('networkidle', {
|
|
153
|
-
timeout: options
|
|
154
|
+
timeout: (_a = options === null || options === void 0 ? void 0 : options.timeout) !== null && _a !== void 0 ? _a : types_1.DefaultTimeouts.defaultWaitTimeoutMs,
|
|
154
155
|
});
|
|
155
156
|
}
|
|
156
157
|
return (0, utils_1.mapIfNotNull)(response, (response) => new playwrightHttpResponse_1.PlaywrightHttpResponse(this.parentPage, response));
|
|
@@ -200,13 +201,13 @@ class PlaywrightFrame extends browserLauncher_1.Frame {
|
|
|
200
201
|
return this.frameImpl;
|
|
201
202
|
}
|
|
202
203
|
getExposedFunctionBindingInfo(functionName) {
|
|
204
|
+
var _a;
|
|
203
205
|
try {
|
|
204
206
|
const pageImpl = this.parentPage.getPageImpl();
|
|
205
207
|
if (!pageImpl) {
|
|
206
208
|
return;
|
|
207
209
|
}
|
|
208
|
-
return (pageImpl._pageBindings.get(functionName)
|
|
209
|
-
pageImpl._browserContext._pageBindings.get(functionName));
|
|
210
|
+
return ((_a = pageImpl._pageBindings.get(functionName)) !== null && _a !== void 0 ? _a : pageImpl._browserContext._pageBindings.get(functionName));
|
|
210
211
|
}
|
|
211
212
|
catch (e) {
|
|
212
213
|
return;
|
|
@@ -28,6 +28,7 @@ const playwright = __importStar(require("@playwright/test"));
|
|
|
28
28
|
const logUtils_1 = require("../../util/logUtils");
|
|
29
29
|
class PlaywrightHttpRequest {
|
|
30
30
|
constructor(page, request, route) {
|
|
31
|
+
var _a;
|
|
31
32
|
this.page = page;
|
|
32
33
|
this.request = request;
|
|
33
34
|
this.route = route;
|
|
@@ -37,19 +38,21 @@ class PlaywrightHttpRequest {
|
|
|
37
38
|
catch (e) {
|
|
38
39
|
(0, logUtils_1.logInternal)(`Unable to get documentId from request: ${e.message}`);
|
|
39
40
|
}
|
|
40
|
-
this.documentId
|
|
41
|
+
(_a = this.documentId) !== null && _a !== void 0 ? _a : (this.documentId = this.request._guid);
|
|
41
42
|
}
|
|
42
43
|
abort() {
|
|
44
|
+
var _a;
|
|
43
45
|
if (this.route === undefined) {
|
|
44
46
|
throw new Error('Unable to abort an unrouted request');
|
|
45
47
|
}
|
|
46
|
-
return this.route
|
|
48
|
+
return (_a = this.route) === null || _a === void 0 ? void 0 : _a.abort();
|
|
47
49
|
}
|
|
48
50
|
continue() {
|
|
51
|
+
var _a;
|
|
49
52
|
if (this.route === undefined) {
|
|
50
53
|
throw new Error('Unable to continue an unrouted request');
|
|
51
54
|
}
|
|
52
|
-
return this.route
|
|
55
|
+
return (_a = this.route) === null || _a === void 0 ? void 0 : _a.continue();
|
|
53
56
|
}
|
|
54
57
|
frame() {
|
|
55
58
|
return this.page.getOrCreateFrame(this.request.frame());
|
|
@@ -58,10 +61,11 @@ class PlaywrightHttpRequest {
|
|
|
58
61
|
return this.documentId;
|
|
59
62
|
}
|
|
60
63
|
respond(response) {
|
|
64
|
+
var _a;
|
|
61
65
|
if (this.route === undefined) {
|
|
62
66
|
throw new Error('Unable to respond an unrouted request');
|
|
63
67
|
}
|
|
64
|
-
return this.route
|
|
68
|
+
return (_a = this.route) === null || _a === void 0 ? void 0 : _a.fulfill(response);
|
|
65
69
|
}
|
|
66
70
|
url() {
|
|
67
71
|
return this.request.url();
|
|
@@ -41,21 +41,23 @@ const uuid = __importStar(require("uuid"));
|
|
|
41
41
|
const path = require("path");
|
|
42
42
|
class PlaywrightPage extends events_1.default {
|
|
43
43
|
constructor(page, browser, delegate) {
|
|
44
|
+
var _a;
|
|
44
45
|
super();
|
|
45
46
|
this.page = page;
|
|
46
47
|
this.browser = browser;
|
|
47
48
|
this.delegate = delegate;
|
|
48
49
|
this.playwrightFrames = new Map();
|
|
49
50
|
const guid = page._guid;
|
|
50
|
-
this.pageId = delegate.getTargetId()
|
|
51
|
+
this.pageId = (_a = delegate.getTargetId()) !== null && _a !== void 0 ? _a : guid;
|
|
51
52
|
page.off('dialog', this.acceptDialogs);
|
|
52
53
|
page.on('dialog', this.acceptDialogs);
|
|
53
54
|
page.on('close', () => {
|
|
54
55
|
this.browser.onPageClose(this);
|
|
55
56
|
});
|
|
56
57
|
page.on('download', async (download) => {
|
|
58
|
+
var _a, _b;
|
|
57
59
|
const guid = uuid.v4();
|
|
58
|
-
const downloadSize = (await download.createReadStream())
|
|
60
|
+
const downloadSize = (_b = (_a = (await download.createReadStream())) === null || _a === void 0 ? void 0 : _a.readableLength) !== null && _b !== void 0 ? _b : 0;
|
|
59
61
|
browser.emit(browserLauncher_1.BrowserEvent.DownloadWillBegin, {
|
|
60
62
|
guid,
|
|
61
63
|
suggestedFilename: download.suggestedFilename(),
|
|
@@ -310,7 +312,7 @@ class PlaywrightPage extends events_1.default {
|
|
|
310
312
|
}
|
|
311
313
|
async waitForLoadState(options) {
|
|
312
314
|
try {
|
|
313
|
-
await this.page.waitForLoadState(options
|
|
315
|
+
await this.page.waitForLoadState(options === null || options === void 0 ? void 0 : options.waitUntil, {
|
|
314
316
|
timeout: options.timeout,
|
|
315
317
|
});
|
|
316
318
|
}
|
|
@@ -6,8 +6,9 @@ class WebkitElementHandleDelegate extends nonChromiumAbstractElementHandleDelega
|
|
|
6
6
|
async focusAndSelect(element) {
|
|
7
7
|
const frame = await element.frame();
|
|
8
8
|
return frame.evaluate((element) => {
|
|
9
|
+
var _a;
|
|
9
10
|
element.focus();
|
|
10
|
-
element.select
|
|
11
|
+
(_a = element.select) === null || _a === void 0 ? void 0 : _a.call(element);
|
|
11
12
|
return element.value;
|
|
12
13
|
}, element);
|
|
13
14
|
}
|
|
@@ -8,7 +8,7 @@ class WebkitFrameDelegate extends nonChromiumAbstractFrameDelegate_1.NonChromium
|
|
|
8
8
|
return Promise.resolve();
|
|
9
9
|
}
|
|
10
10
|
getLifecycleEventStrategy(value) {
|
|
11
|
-
let waitUntil = value
|
|
11
|
+
let waitUntil = value !== null && value !== void 0 ? value : types_1.LifecycleEvent.Load;
|
|
12
12
|
const waitForNetworkIdle = waitUntil !== types_1.LifecycleEvent.DomContentLoaded;
|
|
13
13
|
if (waitForNetworkIdle) {
|
|
14
14
|
waitUntil = types_1.LifecycleEvent.DomContentLoaded;
|
|
@@ -13,6 +13,7 @@ class MetricsRecorder {
|
|
|
13
13
|
await this.metrics.shutdown();
|
|
14
14
|
}
|
|
15
15
|
recordTestMetricsForResult(testResult, metric) {
|
|
16
|
+
var _a, _b, _c, _d, _e;
|
|
16
17
|
const testElapsedTimeMillis = testResult.endTime - testResult.startTime;
|
|
17
18
|
const testPassed = testResult.status === TestResult_1.TestResultStatus.passed;
|
|
18
19
|
this.recordTestMetrics({
|
|
@@ -21,12 +22,11 @@ class MetricsRecorder {
|
|
|
21
22
|
failCount: testPassed ? 0 : 1,
|
|
22
23
|
passCount: testPassed ? 1 : 0,
|
|
23
24
|
runnerCount: 1,
|
|
24
|
-
firstContentfulPaintCategory: metric.find((metric) => metric.name === 'FCP')
|
|
25
|
-
largestContentfulPaintCategory: metric.find((metric) => metric.name === 'LCP')
|
|
26
|
-
cumulativeLayoutShiftCategory: metric.find((metric) => metric.name === 'CLS')
|
|
27
|
-
timeToFirstByteCategory: metric.find((metric) => metric.name === 'TTFB')
|
|
28
|
-
|
|
29
|
-
domContentLoadedCategory: metric.find((metric) => metric.name === 'domContentLoadedEventEnd')?.value,
|
|
25
|
+
firstContentfulPaintCategory: (_a = metric.find((metric) => metric.name === 'FCP')) === null || _a === void 0 ? void 0 : _a.value,
|
|
26
|
+
largestContentfulPaintCategory: (_b = metric.find((metric) => metric.name === 'LCP')) === null || _b === void 0 ? void 0 : _b.value,
|
|
27
|
+
cumulativeLayoutShiftCategory: (_c = metric.find((metric) => metric.name === 'CLS')) === null || _c === void 0 ? void 0 : _c.value,
|
|
28
|
+
timeToFirstByteCategory: (_d = metric.find((metric) => metric.name === 'TTFB')) === null || _d === void 0 ? void 0 : _d.value,
|
|
29
|
+
domContentLoadedCategory: (_e = metric.find((metric) => metric.name === 'domContentLoadedEventEnd')) === null || _e === void 0 ? void 0 : _e.value,
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
recordStepMetricsForResult(result) {
|
|
@@ -27,8 +27,9 @@ function printBranchRunningInfo(branchName) {
|
|
|
27
27
|
}
|
|
28
28
|
exports.printBranchRunningInfo = printBranchRunningInfo;
|
|
29
29
|
function crossCheckBranchWithTest(branchName, test) {
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
var _a, _b;
|
|
31
|
+
if (((_a = test.source_control_tags) === null || _a === void 0 ? void 0 : _a[branchName]) === undefined &&
|
|
32
|
+
((_b = test.source_control_tags) === null || _b === void 0 ? void 0 : _b[constants_1.DefaultBranchName]) === undefined) {
|
|
32
33
|
loggingProvider_1.logger.info(chalk.red('ERROR: Test does not exist on the branch:', chalk.magenta(branchName), 'Use the --mabl-branch flag to specify a branch'));
|
|
33
34
|
process.exit(1);
|
|
34
35
|
}
|