testaro 75.2.0 → 75.2.1
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/package.json +1 -1
- package/procs/catalog.js +2 -2
- package/procs/launch.js +20 -1
package/package.json
CHANGED
package/procs/catalog.js
CHANGED
|
@@ -35,7 +35,7 @@ exports.getCatalog = async report => {
|
|
|
35
35
|
const targetURL = report.target?.url;
|
|
36
36
|
// If the report specifies a global browser ID and a global target URL:
|
|
37
37
|
if (browserID && targetURL) {
|
|
38
|
-
// Launch a browser
|
|
38
|
+
// Launch a browser and visit the target, or abort the job on failure.
|
|
39
39
|
const page = await launch({
|
|
40
40
|
report,
|
|
41
41
|
actIndex: null,
|
|
@@ -159,7 +159,7 @@ exports.getCatalog = async report => {
|
|
|
159
159
|
return catalog;
|
|
160
160
|
}
|
|
161
161
|
// Otherwise, i.e. if the launch or navigation failed, report and return this.
|
|
162
|
-
console.log('ERROR: Launch or navigation failure prevented
|
|
162
|
+
console.log('ERROR: Launch or navigation failure prevented cataloguing and aborted job');
|
|
163
163
|
return {};
|
|
164
164
|
}
|
|
165
165
|
// Otherwise, i.e. if the report specification is incomplete, report and return this.
|
package/procs/launch.js
CHANGED
|
@@ -132,6 +132,7 @@ const goTo = exports.goTo = async (report, page, url, timeout, waitUntil) => {
|
|
|
132
132
|
const actualURL = page.url();
|
|
133
133
|
const actualNorm = actualURL.startsWith('file:') ? normalizeURL(actualURL) : actualURL;
|
|
134
134
|
const urlNorm = url.startsWith('file:') ? normalizeURL(url) : url;
|
|
135
|
+
const title = await page.title();
|
|
135
136
|
// If the browser was redirected in violation of a strictness requirement:
|
|
136
137
|
if (report.strict && deSlash(actualNorm) !== deSlash(urlNorm)) {
|
|
137
138
|
// Return an error.
|
|
@@ -141,6 +142,15 @@ const goTo = exports.goTo = async (report, page, url, timeout, waitUntil) => {
|
|
|
141
142
|
error: 'badRedirection'
|
|
142
143
|
};
|
|
143
144
|
}
|
|
145
|
+
// Otherwise, if the browser was redirected to a CAPTCHA barrier:
|
|
146
|
+
else if ([urlNorm, title].some(identifier => identifier.includes('captcha'))) {
|
|
147
|
+
// Return this.
|
|
148
|
+
console.log(`ERROR: Visit to ${url} redirected to CAPTCHA barrier (${actualURL})`);
|
|
149
|
+
return {
|
|
150
|
+
success: false,
|
|
151
|
+
error: 'captchaBarrier'
|
|
152
|
+
};
|
|
153
|
+
}
|
|
144
154
|
// Otherwise, i.e. if no prohibited redirection occurred:
|
|
145
155
|
else {
|
|
146
156
|
// Press the Escape key to dismiss any modal dialog.
|
|
@@ -179,6 +189,15 @@ const goTo = exports.goTo = async (report, page, url, timeout, waitUntil) => {
|
|
|
179
189
|
error: `status429/retryAfterSeconds=${waitSeconds}`
|
|
180
190
|
};
|
|
181
191
|
}
|
|
192
|
+
// Otherwise, if the response status was a suspension:
|
|
193
|
+
else if (httpStatus === 202) {
|
|
194
|
+
// Return this.
|
|
195
|
+
console.log(`ERROR: Visit to ${url} suspended (status 202)`);
|
|
196
|
+
return {
|
|
197
|
+
success: false,
|
|
198
|
+
error: 'status202'
|
|
199
|
+
};
|
|
200
|
+
}
|
|
182
201
|
// Otherwise, i.e. if the response status was otherwise abnormal:
|
|
183
202
|
else {
|
|
184
203
|
// Return an error.
|
|
@@ -626,7 +645,7 @@ exports.launch = async (opts = {}) => {
|
|
|
626
645
|
// Report this and, if so configured, that the job was aborted.
|
|
627
646
|
addError(
|
|
628
647
|
true,
|
|
629
|
-
abortAssertively,
|
|
648
|
+
actIndex === null ? true : abortAssertively,
|
|
630
649
|
report,
|
|
631
650
|
actIndex,
|
|
632
651
|
`Launch or navigation failed; retries and browser types exhausted`
|