test(browser): stabilize real shape capture
This commit is contained in:
@@ -95,7 +95,7 @@ try {
|
|||||||
allowed_origins: [site.origin],
|
allowed_origins: [site.origin],
|
||||||
approved: true,
|
approved: true,
|
||||||
target_id: target,
|
target_id: target,
|
||||||
observation_ms: 200,
|
observation_ms: 1_000,
|
||||||
include_accessibility_text: true,
|
include_accessibility_text: true,
|
||||||
include_script_sources: true,
|
include_script_sources: true,
|
||||||
include_console_text: true,
|
include_console_text: true,
|
||||||
@@ -449,16 +449,17 @@ function assertBundleAnalysis(result) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function assertSensitiveShapes(result) {
|
function assertSensitiveShapes(result) {
|
||||||
const request = result.network.requests.find((item) =>
|
const request = result.network.requests.find(
|
||||||
item.url.includes("/api"),
|
(item) =>
|
||||||
|
item.url.includes("/api") &&
|
||||||
|
item.body_shapes.request?.properties.some(
|
||||||
|
({ path }) => path === "/token",
|
||||||
|
) &&
|
||||||
|
item.body_shapes.response?.properties.some(
|
||||||
|
({ path }) => path === "/secret",
|
||||||
|
),
|
||||||
);
|
);
|
||||||
const requestPaths = request?.body_shapes.request?.properties.map(
|
if (request === undefined)
|
||||||
({ path }) => path,
|
|
||||||
);
|
|
||||||
const responsePaths = request?.body_shapes.response?.properties.map(
|
|
||||||
({ path }) => path,
|
|
||||||
);
|
|
||||||
if (!requestPaths?.includes("/token") || !responsePaths?.includes("/secret"))
|
|
||||||
throw new Error("Real Chrome JSON request/response shapes were missing");
|
throw new Error("Real Chrome JSON request/response shapes were missing");
|
||||||
const consoleText = result.console.events.flatMap(
|
const consoleText = result.console.events.flatMap(
|
||||||
(event) => event.text_capture.values,
|
(event) => event.text_capture.values,
|
||||||
|
|||||||
Reference in New Issue
Block a user