test: isolate host discovery and update current capture fixtures
This commit is contained in:
1 parent
9ac91e0c1e
commit
bfd76c5d16
4 files changed
+34
-13
No files matched your search
@@ -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"),
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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 });
|
||||
|
||||
+10
-1
@@ -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");
|
||||
|
||||
Reference in new issue
Block a user