Skip to content

armgit / rea

Public Imported from GitHub
0

Reverse engineer anything with agents, from app behavior down to native binaries.

test: isolate host discovery and update current capture fixtures

morlutobfd76c5d16a4
diff --git a/scripts/lib/browser-scenario-service-workers-e2e.mjs b/scripts/lib/browser-scenario-service-workers-e2e.mjs
index bf88717ac..4b3658039 100644
--- a/scripts/lib/browser-scenario-service-workers-e2e.mjs
+++ b/scripts/lib/browser-scenario-service-workers-e2e.mjs
@@ -144,14 +144,19 @@ export async function verifyScenarioServiceWorkers(endpoint, targetId) {
true,
);
};
- const assertRejected = async (scenario) => {
+ const assertRejected = async (scenario, expectedReason) => {
const result = await provider.captureScenario(scenario);
assert.equal(
result.ok,
false,
"Worker-influenced capture unexpectedly succeeded",
);
- assert.equal(result.error.reason, "target_not_allowed");
+ assert.equal(result.error.reason, expectedReason);
+ if (expectedReason === "service_worker_blocked")
+ assert.match(
+ result.error.userMessage,
+ /environment\.service_workers to allow/,
+ );
assert.equal(
result.error.partialObservation.capture.browser.cleanup,
"disconnected-external",
@@ -229,7 +234,7 @@ export async function verifyScenarioServiceWorkers(endpoint, targetId) {
"worker",
);
await page.goto("about:blank");
- await assertRejected(scenarioFor(second.origin));
+ await assertRejected(scenarioFor(second.origin), "service_worker_blocked");
await page.goto("about:blank");
await assertRejected(
scenarioFor(first.origin, [
@@ -240,6 +245,7 @@ export async function verifyScenarioServiceWorkers(endpoint, targetId) {
wait_until: "load",
},
]),
+ "target_not_allowed",
);
await page.goto("about:blank");
await assertRejected(
@@ -251,9 +257,13 @@ export async function verifyScenarioServiceWorkers(endpoint, targetId) {
},
{ step_id: "loaded", action: "wait_for_timeout", duration_ms: 100 },
]),
+ "target_not_allowed",
);
await page.goto("about:blank");
- await assertRejected(scenarioFor(`${first.origin}/frame`));
+ await assertRejected(
+ scenarioFor(`${first.origin}/frame`),
+ "target_not_allowed",
+ );
const allowed = await provider.captureScenario(
scenarioFor(second.origin, [], "allow"),
diff --git a/tests/acceptance/artifactInventoryJvmClass.test.ts b/tests/acceptance/artifactInventoryJvmClass.test.ts
index 408888ce7..51f3e01eb 100644
--- a/tests/acceptance/artifactInventoryJvmClass.test.ts
+++ b/tests/acceptance/artifactInventoryJvmClass.test.ts
@@ -107,8 +107,8 @@ it("keeps valid JVM classes from being classified as Mach-O while identifying FA
},
{
logical_path: "pkg/Big.class",
- artifact_kind: "unknown",
- artifact_format: "unknown",
+ artifact_kind: "resource",
+ artifact_format: "file",
},
]);
const jarClassIds = new Set(
@@ -121,7 +121,7 @@ it("keeps valid JVM classes from being classified as Mach-O while identifying FA
.filter(({ artifact_id }) => jarClassIds.has(artifact_id))
.map(({ format }) => format)
.sort(),
- ).toEqual(["file", "unknown"]);
+ ).toEqual(["file", "file"]);
const mixedPath = join(directory, "mixed.zip");
await writeFile(mixedPath, await archive([...javaEntries, ...fatControls]));
@@ -135,11 +135,10 @@ it("keeps valid JVM classes from being classified as Mach-O while identifying FA
),
);
for (const [name] of javaEntries)
- expect(formatsByPath.get(name)).toEqual(
- name === "Hello.class"
- ? { artifact_kind: "resource", artifact_format: "file" }
- : { artifact_kind: "unknown", artifact_format: "unknown" },
- );
+ expect(formatsByPath.get(name)).toEqual({
+ artifact_kind: "resource",
+ artifact_format: "file",
+ });
for (const [name] of fatControls)
expect(formatsByPath.get(name)).toEqual({
artifact_kind: "executable",
diff --git a/tests/acceptance/setup/registrationRuntimeEnvironmentCli.test.ts b/tests/acceptance/setup/registrationRuntimeEnvironmentCli.test.ts
index c3ea4ed5a..1dc63877d 100644
--- a/tests/acceptance/setup/registrationRuntimeEnvironmentCli.test.ts
+++ b/tests/acceptance/setup/registrationRuntimeEnvironmentCli.test.ts
@@ -175,6 +175,9 @@ cliTest(
HOME: home,
USERPROFILE: home,
XDG_CONFIG_HOME: join(home, ".config"),
+ // Select an absent launcher so host-installed Hopper cannot make this
+ // configuration merge test plan an unrelated provider-environment edit.
+ HOPPER_LAUNCHER_PATH: join(home, "missing-hopper"),
};
const run = (args: readonly string[]) =>
cli.run({ arguments: [...args, "--json"], cwd: home, environment });
diff --git a/tests/fixtures/browserScenarioCancellation.mjs b/tests/fixtures/browserScenarioCancellation.mjs
index 75c278f05..ecb85e608 100644
--- a/tests/fixtures/browserScenarioCancellation.mjs
+++ b/tests/fixtures/browserScenarioCancellation.mjs
@@ -48,7 +48,16 @@ class ControlledSession {
return 0;
}
events() {
- return { retained: 0, dropped: 0, items: [] };
+ return {
+ retained: 0,
+ dropped: 0,
+ items: [],
+ omissions: {
+ by_kind: [],
+ network_transactions: [],
+ network_transaction_range: null,
+ },
+ };
}
async perform(action, signal) {
assert.equal(action.action, "wait_for_timeout");