graceful-playwright 1.1.4 → 1.1.6
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/core.js +9 -12
- package/package.json +3 -1
package/core.js
CHANGED
|
@@ -49,21 +49,18 @@ class GracefulPage {
|
|
|
49
49
|
}
|
|
50
50
|
catch (error) {
|
|
51
51
|
let message = String(error);
|
|
52
|
-
let
|
|
53
|
-
|
|
52
|
+
let urlStr = JSON.stringify(url);
|
|
53
|
+
let isKnownError = message.includes(`Navigation to ${urlStr} is interrupted by another navigation to ${urlStr}`) ||
|
|
54
54
|
// e.g. 'Timeout 30000ms exceeded'
|
|
55
55
|
/Timeout [\w]+ exceeded/.test(message) ||
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if (flags.retry || flags.restart) {
|
|
56
|
+
message.includes('ERR_NETWORK_CHANGED') ||
|
|
57
|
+
message.includes('ERR_CONNECTION_RESET') ||
|
|
58
|
+
message.includes('ERR_SOCKET_NOT_CONNECTED') ||
|
|
59
|
+
message.includes('ERR_ABORTED') ||
|
|
60
|
+
/page crashed/i.test(message);
|
|
61
|
+
if (isKnownError) {
|
|
63
62
|
this.getOnError()(error);
|
|
64
|
-
|
|
65
|
-
await this.restart();
|
|
66
|
-
}
|
|
63
|
+
await this.restart();
|
|
67
64
|
await sleep(this.getRetryInterval());
|
|
68
65
|
continue;
|
|
69
66
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "graceful-playwright",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
4
4
|
"description": "Gracefully handle timeout and network error with auto retry.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"graceful",
|
|
@@ -55,12 +55,14 @@
|
|
|
55
55
|
"@types/express": "^4.17.21",
|
|
56
56
|
"@types/mocha": "^10.0.6",
|
|
57
57
|
"@types/node": "^20.11.17",
|
|
58
|
+
"@types/sinon": "^17.0.1",
|
|
58
59
|
"chai": "4",
|
|
59
60
|
"express": "^4.18.2",
|
|
60
61
|
"mocha": "^10.3.0",
|
|
61
62
|
"npm-run-all": "^4.1.5",
|
|
62
63
|
"playwright": "^1.41.2",
|
|
63
64
|
"rimraf": "^5.0.5",
|
|
65
|
+
"sinon": "^17.0.1",
|
|
64
66
|
"ts-mocha": "^10.0.0",
|
|
65
67
|
"ts-node": "^10.9.2",
|
|
66
68
|
"ts-node-dev": "^2.0.0",
|