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