@trackunit/iris-app-playwright 0.1.18 → 0.1.19-alpha-0424feab298.0
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/iris-app-playwright",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.19-alpha-0424feab298.0",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"generators": "./generators.json",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@nx/devkit": "22.
|
|
34
|
-
"@nx/playwright": "22.
|
|
33
|
+
"@nx/devkit": "22.7.5",
|
|
34
|
+
"@nx/playwright": "22.7.5",
|
|
35
35
|
"jszip": "^3.10.1",
|
|
36
36
|
"prettier": "^3.4.2",
|
|
37
37
|
"tslib": "^2.6.2"
|
|
@@ -6,9 +6,21 @@ const featureFlagsCache = new WeakMap();
|
|
|
6
6
|
const featureFlagsInFlight = new WeakMap();
|
|
7
7
|
const listenerInstalled = new WeakSet();
|
|
8
8
|
const extractFlags = async (response) => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
// The response body is not always retrievable by the time this runs: a
|
|
10
|
+
// navigation (e.g. the post-login redirect) can discard the network resource
|
|
11
|
+
// before `response.json()` reads it, making Playwright reject with
|
|
12
|
+
// "Protocol error (Network.getResponseBody): No resource with given identifier
|
|
13
|
+
// found". This listener is a passive observer, so a missed capture is benign —
|
|
14
|
+
// swallow it and report "no flags" rather than letting the rejection surface
|
|
15
|
+
// as an unhandled error that fails the in-flight test.
|
|
16
|
+
try {
|
|
17
|
+
const body = await response.json();
|
|
18
|
+
const flags = body?.data?.featureFlags;
|
|
19
|
+
return Array.isArray(flags) ? flags : undefined;
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
12
24
|
};
|
|
13
25
|
// Tracks the in-flight extraction promise per page so `configCat` can await it
|
|
14
26
|
// instead of falling through to `page.waitForResponse(...)`, which would wait
|
|
@@ -36,7 +48,10 @@ const installFlagListener = (page) => {
|
|
|
36
48
|
listenerInstalled.add(page);
|
|
37
49
|
page.on("response", response => {
|
|
38
50
|
if (response.url().includes("ValidateFeatureFlags") && response.ok()) {
|
|
39
|
-
|
|
51
|
+
// Defensive: `trackExtraction` already swallows body-read failures, but
|
|
52
|
+
// guard the floating promise so nothing can become an unhandled rejection
|
|
53
|
+
// that would fail an unrelated in-flight test.
|
|
54
|
+
void trackExtraction(page, response).catch(() => undefined);
|
|
40
55
|
}
|
|
41
56
|
});
|
|
42
57
|
};
|