Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Discovery retry support + fixed a race condition in network handling #1529

Merged
merged 13 commits into from
Mar 8, 2024
Merged
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.28.1-beta.0",
"version": "1.28.1-alpha.1",
"packages": [
"packages/*"
],
Expand Down
8 changes: 4 additions & 4 deletions packages/cli-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@percy/cli-app",
"version": "1.28.1-beta.0",
"version": "1.28.1-alpha.1",
"license": "MIT",
"repository": {
"type": "git",
Expand All @@ -9,7 +9,7 @@
},
"publishConfig": {
"access": "public",
"tag": "beta"
"tag": "alpha"
},
"engines": {
"node": ">=14"
Expand All @@ -33,7 +33,7 @@
]
},
"dependencies": {
"@percy/cli-command": "1.28.1-beta.0",
"@percy/cli-exec": "1.28.1-beta.0"
"@percy/cli-command": "1.28.1-alpha.1",
"@percy/cli-exec": "1.28.1-alpha.1"
}
}
6 changes: 3 additions & 3 deletions packages/cli-build/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@percy/cli-build",
"version": "1.28.1-beta.0",
"version": "1.28.1-alpha.1",
"license": "MIT",
"repository": {
"type": "git",
Expand All @@ -9,7 +9,7 @@
},
"publishConfig": {
"access": "public",
"tag": "beta"
"tag": "alpha"
},
"engines": {
"node": ">=14"
Expand All @@ -33,6 +33,6 @@
]
},
"dependencies": {
"@percy/cli-command": "1.28.1-beta.0"
"@percy/cli-command": "1.28.1-alpha.1"
}
}
10 changes: 5 additions & 5 deletions packages/cli-command/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@percy/cli-command",
"version": "1.28.1-beta.0",
"version": "1.28.1-alpha.1",
"license": "MIT",
"repository": {
"type": "git",
Expand All @@ -9,7 +9,7 @@
},
"publishConfig": {
"access": "public",
"tag": "beta"
"tag": "alpha"
},
"files": [
"dist",
Expand All @@ -36,8 +36,8 @@
"test:coverage": "yarn test --coverage"
},
"dependencies": {
"@percy/config": "1.28.1-beta.0",
"@percy/core": "1.28.1-beta.0",
"@percy/logger": "1.28.1-beta.0"
"@percy/config": "1.28.1-alpha.1",
"@percy/core": "1.28.1-alpha.1",
"@percy/logger": "1.28.1-alpha.1"
}
}
6 changes: 3 additions & 3 deletions packages/cli-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@percy/cli-config",
"version": "1.28.1-beta.0",
"version": "1.28.1-alpha.1",
"license": "MIT",
"repository": {
"type": "git",
Expand All @@ -9,7 +9,7 @@
},
"publishConfig": {
"access": "public",
"tag": "beta"
"tag": "alpha"
},
"engines": {
"node": ">=14"
Expand All @@ -33,6 +33,6 @@
]
},
"dependencies": {
"@percy/cli-command": "1.28.1-beta.0"
"@percy/cli-command": "1.28.1-alpha.1"
}
}
6 changes: 3 additions & 3 deletions packages/cli-exec/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@percy/cli-exec",
"version": "1.28.1-beta.0",
"version": "1.28.1-alpha.1",
"license": "MIT",
"repository": {
"type": "git",
Expand All @@ -9,7 +9,7 @@
},
"publishConfig": {
"access": "public",
"tag": "beta"
"tag": "alpha"
},
"engines": {
"node": ">=14"
Expand All @@ -33,7 +33,7 @@
]
},
"dependencies": {
"@percy/cli-command": "1.28.1-beta.0",
"@percy/cli-command": "1.28.1-alpha.1",
"cross-spawn": "^7.0.3",
"which": "^2.0.2"
}
Expand Down
6 changes: 3 additions & 3 deletions packages/cli-snapshot/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@percy/cli-snapshot",
"version": "1.28.1-beta.0",
"version": "1.28.1-alpha.1",
"license": "MIT",
"repository": {
"type": "git",
Expand All @@ -9,7 +9,7 @@
},
"publishConfig": {
"access": "public",
"tag": "beta"
"tag": "alpha"
},
"engines": {
"node": ">=14"
Expand All @@ -33,7 +33,7 @@
]
},
"dependencies": {
"@percy/cli-command": "1.28.1-beta.0",
"@percy/cli-command": "1.28.1-alpha.1",
"yaml": "^2.0.0"
}
}
6 changes: 3 additions & 3 deletions packages/cli-upload/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@percy/cli-upload",
"version": "1.28.1-beta.0",
"version": "1.28.1-alpha.1",
"license": "MIT",
"repository": {
"type": "git",
Expand All @@ -9,7 +9,7 @@
},
"publishConfig": {
"access": "public",
"tag": "beta"
"tag": "alpha"
},
"engines": {
"node": ">=14"
Expand All @@ -33,7 +33,7 @@
]
},
"dependencies": {
"@percy/cli-command": "1.28.1-beta.0",
"@percy/cli-command": "1.28.1-alpha.1",
"fast-glob": "^3.2.11",
"image-size": "^1.0.0"
}
Expand Down
22 changes: 11 additions & 11 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@percy/cli",
"version": "1.28.1-beta.0",
"version": "1.28.1-alpha.1",
"license": "MIT",
"repository": {
"type": "git",
Expand All @@ -9,7 +9,7 @@
},
"publishConfig": {
"access": "public",
"tag": "beta"
"tag": "alpha"
},
"files": [
"bin",
Expand All @@ -31,14 +31,14 @@
"test:coverage": "yarn test --coverage"
},
"dependencies": {
"@percy/cli-app": "1.28.1-beta.0",
"@percy/cli-build": "1.28.1-beta.0",
"@percy/cli-command": "1.28.1-beta.0",
"@percy/cli-config": "1.28.1-beta.0",
"@percy/cli-exec": "1.28.1-beta.0",
"@percy/cli-snapshot": "1.28.1-beta.0",
"@percy/cli-upload": "1.28.1-beta.0",
"@percy/client": "1.28.1-beta.0",
"@percy/logger": "1.28.1-beta.0"
"@percy/cli-app": "1.28.1-alpha.1",
"@percy/cli-build": "1.28.1-alpha.1",
"@percy/cli-command": "1.28.1-alpha.1",
"@percy/cli-config": "1.28.1-alpha.1",
"@percy/cli-exec": "1.28.1-alpha.1",
"@percy/cli-snapshot": "1.28.1-alpha.1",
"@percy/cli-upload": "1.28.1-alpha.1",
"@percy/client": "1.28.1-alpha.1",
"@percy/logger": "1.28.1-alpha.1"
}
}
8 changes: 4 additions & 4 deletions packages/client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@percy/client",
"version": "1.28.1-beta.0",
"version": "1.28.1-alpha.1",
"license": "MIT",
"repository": {
"type": "git",
Expand All @@ -9,7 +9,7 @@
},
"publishConfig": {
"access": "public",
"tag": "beta"
"tag": "alpha"
},
"engines": {
"node": ">=14"
Expand All @@ -32,7 +32,7 @@
"test:coverage": "yarn test --coverage"
},
"dependencies": {
"@percy/env": "1.28.1-beta.0",
"@percy/logger": "1.28.1-beta.0"
"@percy/env": "1.28.1-alpha.1",
"@percy/logger": "1.28.1-alpha.1"
}
}
6 changes: 3 additions & 3 deletions packages/config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@percy/config",
"version": "1.28.1-beta.0",
"version": "1.28.1-alpha.1",
"license": "MIT",
"repository": {
"type": "git",
Expand All @@ -9,7 +9,7 @@
},
"publishConfig": {
"access": "public",
"tag": "beta"
"tag": "alpha"
},
"engines": {
"node": ">=14"
Expand Down Expand Up @@ -38,7 +38,7 @@
"test:types": "tsd"
},
"dependencies": {
"@percy/logger": "1.28.1-beta.0",
"@percy/logger": "1.28.1-alpha.1",
"ajv": "^8.6.2",
"cosmiconfig": "^8.0.0",
"yaml": "^2.0.0"
Expand Down
14 changes: 7 additions & 7 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@percy/core",
"version": "1.28.1-beta.0",
"version": "1.28.1-alpha.1",
"license": "MIT",
"repository": {
"type": "git",
Expand All @@ -9,7 +9,7 @@
},
"publishConfig": {
"access": "public",
"tag": "beta"
"tag": "alpha"
},
"engines": {
"node": ">=14"
Expand Down Expand Up @@ -43,11 +43,11 @@
"test:types": "tsd"
},
"dependencies": {
"@percy/client": "1.28.1-beta.0",
"@percy/config": "1.28.1-beta.0",
"@percy/dom": "1.28.1-beta.0",
"@percy/logger": "1.28.1-beta.0",
"@percy/webdriver-utils": "1.28.1-beta.0",
"@percy/client": "1.28.1-alpha.1",
"@percy/config": "1.28.1-alpha.1",
"@percy/dom": "1.28.1-alpha.1",
"@percy/logger": "1.28.1-alpha.1",
"@percy/webdriver-utils": "1.28.1-alpha.1",
"content-disposition": "^0.5.4",
"cross-spawn": "^7.0.3",
"extract-zip": "^2.0.1",
Expand Down
11 changes: 10 additions & 1 deletion packages/core/src/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export class Network {
#requests = new Map();
#authentications = new Set();
#aborted = new Set();
#finishedUrls = new Set();

constructor(page, options) {
this.page = page;
Expand Down Expand Up @@ -86,6 +87,13 @@ export class Network {
}

requests = Array.from(this.#requests.values()).filter(filter);
// remove requests which are finished at least once
// this happens when same request is made multiple times by browser in parallel and one of
// them gets stuck in pending state in browser [ need to debug why ]. So we dont receive
// loadingFinished event, causing it to show up in Active requests, but we can only store one
// response per url so as long as we have captured one, we dont care about other such requests
requests = requests.filter((req) => !this.#finishedUrls.has(req.url));

return requests.length === 0;
}, {
timeout: Network.TIMEOUT,
Expand Down Expand Up @@ -131,9 +139,10 @@ export class Network {
}

// Called when a request should be removed from various trackers
_forgetRequest({ requestId, interceptId }, keepPending) {
_forgetRequest({ requestId, interceptId, url }, keepPending) {
this.#requests.delete(requestId);
this.#authentications.delete(interceptId);
this.#finishedUrls.add(url);

if (!keepPending) {
this.#pending.delete(requestId);
Expand Down
4 changes: 2 additions & 2 deletions packages/dom/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@percy/dom",
"version": "1.28.1-beta.0",
"version": "1.28.1-alpha.1",
"license": "MIT",
"repository": {
"type": "git",
Expand All @@ -9,7 +9,7 @@
},
"publishConfig": {
"access": "public",
"tag": "beta"
"tag": "alpha"
},
"main": "dist/bundle.js",
"browser": "dist/bundle.js",
Expand Down
6 changes: 3 additions & 3 deletions packages/env/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@percy/env",
"version": "1.28.1-beta.0",
"version": "1.28.1-alpha.1",
"license": "MIT",
"repository": {
"type": "git",
Expand All @@ -9,7 +9,7 @@
},
"publishConfig": {
"access": "public",
"tag": "beta"
"tag": "alpha"
},
"engines": {
"node": ">=14"
Expand All @@ -32,6 +32,6 @@
"test:coverage": "yarn test --coverage"
},
"dependencies": {
"@percy/logger": "1.28.1-beta.0"
"@percy/logger": "1.28.1-alpha.1"
}
}