@mablhq/mabl-cli 2.5.0 → 2.5.2
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.
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RUNNER_ERRORS = exports.TimeoutError = exports.RunnerError = void 0;
|
|
3
|
+
exports.RUNNER_ERRORS = exports.NavigationInterruptedError = exports.TimeoutError = exports.RunnerError = void 0;
|
|
4
4
|
class RunnerError extends Error {
|
|
5
5
|
constructor(message) {
|
|
6
6
|
super(message);
|
|
7
7
|
this.name = this.constructor.name;
|
|
8
8
|
Error.captureStackTrace(this, this.constructor);
|
|
9
9
|
}
|
|
10
|
+
static isPlaywrightNavigationInterruptedError(error) {
|
|
11
|
+
const errorString = error.message.toLowerCase();
|
|
12
|
+
return (errorString.includes('interrupted by another navigation') &&
|
|
13
|
+
errorString.includes('frame.goto'));
|
|
14
|
+
}
|
|
10
15
|
}
|
|
11
16
|
exports.RunnerError = RunnerError;
|
|
12
17
|
class TimeoutError extends RunnerError {
|
|
13
18
|
}
|
|
14
19
|
exports.TimeoutError = TimeoutError;
|
|
20
|
+
class NavigationInterruptedError extends RunnerError {
|
|
21
|
+
}
|
|
22
|
+
exports.NavigationInterruptedError = NavigationInterruptedError;
|
|
15
23
|
exports.RUNNER_ERRORS = {
|
|
16
24
|
TimeoutError,
|
|
25
|
+
NavigationInterruptedError,
|
|
17
26
|
};
|
|
@@ -142,19 +142,9 @@ 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
|
-
var _a;
|
|
146
145
|
const lifecycleEvent = this.delegate.getLifecycleEventStrategy(options === null || options === void 0 ? void 0 : options.waitUntil);
|
|
147
146
|
try {
|
|
148
|
-
|
|
149
|
-
waitUntil: lifecycleEvent.waitUntil,
|
|
150
|
-
timeout: options === null || options === void 0 ? void 0 : options.timeout,
|
|
151
|
-
});
|
|
152
|
-
if (lifecycleEvent.waitForNetworkIdle) {
|
|
153
|
-
await this.frame.waitForLoadState(types_1.LifecycleEvent.NetworkIdle, {
|
|
154
|
-
timeout: (_a = options === null || options === void 0 ? void 0 : options.timeout) !== null && _a !== void 0 ? _a : types_1.DefaultTimeouts.defaultWaitTimeoutMs,
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
return (0, utils_1.mapIfNotNull)(response, (response) => new playwrightHttpResponse_1.PlaywrightHttpResponse(this.parentPage, response));
|
|
147
|
+
return await this.tryGoto(url, lifecycleEvent, options);
|
|
158
148
|
}
|
|
159
149
|
catch (e) {
|
|
160
150
|
if (e instanceof playwright.errors.TimeoutError) {
|
|
@@ -163,6 +153,32 @@ class PlaywrightFrame extends browserLauncher_1.Frame {
|
|
|
163
153
|
throw new browserLauncher_1.RunnerError(e.message);
|
|
164
154
|
}
|
|
165
155
|
}
|
|
156
|
+
async tryGoto(url, lifecycleEvent, options) {
|
|
157
|
+
var _a;
|
|
158
|
+
const timeout = (_a = options === null || options === void 0 ? void 0 : options.timeout) !== null && _a !== void 0 ? _a : types_1.DefaultTimeouts.defaultWaitTimeoutMs;
|
|
159
|
+
let response;
|
|
160
|
+
let responseHasNavigationError = false;
|
|
161
|
+
try {
|
|
162
|
+
response = await this.frame.goto(url, {
|
|
163
|
+
waitUntil: lifecycleEvent.waitUntil,
|
|
164
|
+
timeout: options === null || options === void 0 ? void 0 : options.timeout,
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
catch (e) {
|
|
168
|
+
if (browserLauncher_1.RunnerError.isPlaywrightNavigationInterruptedError(e)) {
|
|
169
|
+
responseHasNavigationError = true;
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
throw e;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
if (lifecycleEvent.waitForNetworkIdle || responseHasNavigationError) {
|
|
176
|
+
await this.frame.waitForLoadState(types_1.LifecycleEvent.NetworkIdle, {
|
|
177
|
+
timeout,
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
return (0, utils_1.mapIfNotNull)(response, (response) => new playwrightHttpResponse_1.PlaywrightHttpResponse(this.parentPage, response));
|
|
181
|
+
}
|
|
166
182
|
id() {
|
|
167
183
|
return this.frame._guid;
|
|
168
184
|
}
|