test(insomnia-test): adapt specs to ResponseView statusBar/preview

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Bob QiuandClaude Sonnet 5.5 committed 2026-11-06 15:51:26 +08:00
1 parent 7e3784f65e
commit ee6f8d89c7
33 files changed
+70 -70

No files matched your search

@@ -24,7 +24,7 @@ test('Verify Event Stream Request Sends the API Key Header Until Authentication
const authenticatedResponse = await eventStreamRequestFlow.send(request);
await expect
.poll(() => authenticatedResponse.console?.(), {
.poll(() => authenticatedResponse.console(), {
timeout: DEFAULT_TIMEOUT,
})
.toContain(`${apiKeyName}: ${apiKeyValue}`);
@@ -33,9 +33,9 @@ test('Verify Event Stream Request Sends the API Key Header Until Authentication
const unauthenticatedResponse = await eventStreamRequestFlow.send(request);
await expect
.poll(() => unauthenticatedResponse.console?.(), {
.poll(() => unauthenticatedResponse.console(), {
timeout: DEFAULT_TIMEOUT,
})
.toContain('GET /sse-events/1');
expect(await unauthenticatedResponse.console?.()).not.toContain(apiKeyName);
expect(await unauthenticatedResponse.console()).not.toContain(apiKeyName);
});
@@ -26,7 +26,7 @@ test('Verify Event Stream Request Sends the Basic Authentication Header Until Au
const authenticatedResponse = await eventStreamRequestFlow.send(request);
await expect
.poll(() => authenticatedResponse.console?.(), {
.poll(() => authenticatedResponse.console(), {
timeout: DEFAULT_TIMEOUT,
})
.toContain(`Authorization: Basic ${Buffer.from(`${username}:${password}`).toString('base64')}`);
@@ -35,9 +35,9 @@ test('Verify Event Stream Request Sends the Basic Authentication Header Until Au
const unauthenticatedResponse = await eventStreamRequestFlow.send(request);
await expect
.poll(() => unauthenticatedResponse.console?.(), {
.poll(() => unauthenticatedResponse.console(), {
timeout: DEFAULT_TIMEOUT,
})
.toContain('GET /sse-events/1');
expect(await unauthenticatedResponse.console?.()).not.toContain('Authorization:');
expect(await unauthenticatedResponse.console()).not.toContain('Authorization:');
});
@@ -30,7 +30,7 @@ test("Verify Event Stream Request Sends the Bearer Token Header Until Authentica
const authenticatedResponse = await eventStreamRequestFlow.send(request);
await expect
.poll(() => authenticatedResponse.console?.(), {
.poll(() => authenticatedResponse.console(), {
timeout: DEFAULT_TIMEOUT,
})
.toContain(`Authorization: Bearer ${token}`);
@@ -39,11 +39,11 @@ test("Verify Event Stream Request Sends the Bearer Token Header Until Authentica
const unauthenticatedResponse = await eventStreamRequestFlow.send(request);
await expect
.poll(() => unauthenticatedResponse.console?.(), {
.poll(() => unauthenticatedResponse.console(), {
timeout: DEFAULT_TIMEOUT,
})
.toContain("GET /sse-events/1");
expect(await unauthenticatedResponse.console?.()).not.toContain(
expect(await unauthenticatedResponse.console()).not.toContain(
"Authorization:",
);
});
@@ -38,6 +38,6 @@ test("Verify Linked Cookie Is Sent With Event Stream Request", async ({
const responseView = await eventStreamRequestFlow.send(request);
await expect
.poll(() => responseView.console?.(), { timeout: DEFAULT_TIMEOUT })
.poll(() => responseView.console(), { timeout: DEFAULT_TIMEOUT })
.toContain("Enable cookie sending with jar of 1 cookie");
});
@@ -37,6 +37,6 @@ test("Verify Duplicated Event Stream Request Keeps Url, Method and Headers", asy
expect(duplicated!.url).toBe(request.url);
expect(duplicated!.method).toBe(request.method);
await expect
.poll(() => responseView.console?.(), { timeout: DEFAULT_TIMEOUT })
.poll(() => responseView.console(), { timeout: DEFAULT_TIMEOUT })
.toContain(`X-Custom: ${headerValue}`);
});
@@ -29,7 +29,7 @@ test('Verify Event Stream Request Sends the OAuth 2.0 Header Until Authenticatio
const authenticatedResponse = await eventStreamRequestFlow.send(request);
await expect
.poll(() => authenticatedResponse.console?.(), {
.poll(() => authenticatedResponse.console(), {
timeout: DEFAULT_TIMEOUT,
})
.toContain(`Authorization: Bearer ${tokens.accessToken}`);
@@ -38,9 +38,9 @@ test('Verify Event Stream Request Sends the OAuth 2.0 Header Until Authenticatio
const unauthenticatedResponse = await eventStreamRequestFlow.send(request);
await expect
.poll(() => unauthenticatedResponse.console?.(), {
.poll(() => unauthenticatedResponse.console(), {
timeout: DEFAULT_TIMEOUT,
})
.toContain('GET /sse-events/1');
expect(await unauthenticatedResponse.console?.()).not.toContain('Authorization:');
expect(await unauthenticatedResponse.console()).not.toContain('Authorization:');
});
@@ -39,6 +39,6 @@ test("Verify Enabling a Proxy Routes Event Stream Requests Through It", async ({
});
await expect
.poll(() => responseView.console?.(), { timeout: DEFAULT_TIMEOUT })
.poll(() => responseView.console(), { timeout: DEFAULT_TIMEOUT })
.toContain("Using proxy: http://127.0.0.1:1111");
});
@@ -34,6 +34,6 @@ test("Verify Template Tag in Event Stream Request Header Is Resolved", async ({
const responseView = await eventStreamRequestFlow.send(request);
await expect
.poll(() => responseView.console?.(), { timeout: DEFAULT_TIMEOUT })
.poll(() => responseView.console(), { timeout: DEFAULT_TIMEOUT })
.toContain("X-Tag: YWJj");
});
@@ -29,7 +29,7 @@ test("Verify Event Stream Request Over a TLS Connection", async ({ user }) => {
const responseView = await eventStreamRequestFlow.send(request);
await expect
.poll(() => responseView.console?.(), { timeout: DEFAULT_TIMEOUT })
.poll(() => responseView.console(), { timeout: DEFAULT_TIMEOUT })
.toContain("TLSv1.3");
await expect
.poll(
@@ -30,14 +30,14 @@ test('Verify GraphQL Request Sends the API Key Header Until Authentication Is Se
await graphqlRequestFlow.setAuthentication(request, { type: 'none' });
const unauthenticatedResponse = await graphqlRequestFlow.send(request);
expect(authenticatedResponse.statusCode).toBe(200);
expect(authenticatedResponse.body).toMatchObject({
expect(authenticatedResponse.statusBar.code).toBe(200);
expect(authenticatedResponse.preview).toMatchObject({
headers: expect.objectContaining({
[apiKeyName.toLowerCase()]: apiKeyValue,
}),
});
expect(unauthenticatedResponse.statusCode).toBe(200);
expect((unauthenticatedResponse.body as { headers: Record<string, string> }).headers).not.toHaveProperty(
expect(unauthenticatedResponse.statusBar.code).toBe(200);
expect((unauthenticatedResponse.preview as { headers: Record<string, string> }).headers).not.toHaveProperty(
apiKeyName.toLowerCase(),
);
});
@@ -32,14 +32,14 @@ test('Verify GraphQL Request Sends the Basic Authentication Header Until Authent
await graphqlRequestFlow.setAuthentication(request, { type: 'none' });
const unauthenticatedResponse = await graphqlRequestFlow.send(request);
expect(authenticatedResponse.statusCode).toBe(200);
expect(authenticatedResponse.body).toMatchObject({
expect(authenticatedResponse.statusBar.code).toBe(200);
expect(authenticatedResponse.preview).toMatchObject({
headers: expect.objectContaining({
authorization: `Basic ${Buffer.from(`${username}:${password}`).toString('base64')}`,
}),
});
expect(unauthenticatedResponse.statusCode).toBe(200);
expect((unauthenticatedResponse.body as { headers: Record<string, string> }).headers).not.toHaveProperty(
expect(unauthenticatedResponse.statusBar.code).toBe(200);
expect((unauthenticatedResponse.preview as { headers: Record<string, string> }).headers).not.toHaveProperty(
'authorization',
);
});
@@ -36,13 +36,13 @@ test("Verify GraphQL Request Sends the Bearer Token Header Until Authentication
await graphqlRequestFlow.setAuthentication(request, { type: "none" });
const unauthenticatedResponse = await graphqlRequestFlow.send(request);
expect(authenticatedResponse.statusCode).toBe(200);
expect(authenticatedResponse.body).toMatchObject({
expect(authenticatedResponse.statusBar.code).toBe(200);
expect(authenticatedResponse.preview).toMatchObject({
headers: expect.objectContaining({ authorization: `Bearer ${token}` }),
});
expect(unauthenticatedResponse.statusCode).toBe(200);
expect(unauthenticatedResponse.statusBar.code).toBe(200);
expect(
(unauthenticatedResponse.body as { headers: Record<string, string> })
(unauthenticatedResponse.preview as { headers: Record<string, string> })
.headers,
).not.toHaveProperty("authorization");
});
@@ -50,6 +50,6 @@ test('Verify Cancelling an In-Flight GraphQL Request Shows a Cancellation Messag
const laterResponse = await graphqlRequestFlow.send(laterRequest);
expect(requestStateAfterCancel).toBe(RequestState.Idle);
expect(cancelledResponse.statusCode).toBeUndefined();
expect(laterResponse.statusCode).toBe(200);
expect(cancelledResponse.statusBar.code).toBeUndefined();
expect(laterResponse.statusBar.code).toBe(200);
});
@@ -37,8 +37,8 @@ test("Verify Linked Cookie Is Sent With GraphQL Request", async ({ user }) => {
const responseView = await graphqlRequestFlow.send(request);
expect(responseView.statusCode).toBe(200);
expect(responseView.body).toMatchObject({
expect(responseView.statusBar.code).toBe(200);
expect(responseView.preview).toMatchObject({
headers: expect.objectContaining({
cookie: `${cookieKey}=${cookieValue}`,
}),
@@ -41,7 +41,7 @@ test("Verify Duplicated GraphQL Request Keeps Url, Body and Headers", async ({
expect(duplicated).toBeTruthy();
expect(duplicated!.url).toBe(request.url);
expect(duplicated!.body!.text).toBe(request.body!.text);
expect(responseView.body).toMatchObject({
expect(responseView.preview).toMatchObject({
headers: expect.objectContaining({ "x-custom": headerValue }),
});
});
@@ -35,8 +35,8 @@ test("Verify Create GraphQL Request", async ({ user }) => {
body: body,
});
const responseView = await graphqlRequestFlow.send(request);
expect(responseView.statusCode).toBe(200);
expect(responseView.statusMessage).toBe("OK");
expect(responseView.statusBar.code).toBe(200);
expect(responseView.statusBar.message).toBe("OK");
expect(responseView.headers).toEqual(
expect.arrayContaining([
expect.objectContaining({
@@ -45,7 +45,7 @@ test("Verify Create GraphQL Request", async ({ user }) => {
}),
]),
);
expect(responseView.body).toMatchObject({
expect(responseView.preview).toMatchObject({
data: {
characters: {
results: expect.arrayContaining(
@@ -51,8 +51,8 @@ test("Verify GraphQL Request Renders a Numeric Environment Variable", async ({
});
const responseView = await graphqlRequestFlow.send(request);
expect(responseView.statusCode).toBe(200);
expect(responseView.body).toMatchObject({
expect(responseView.statusBar.code).toBe(200);
expect(responseView.preview).toMatchObject({
data: { episode: { id: episodeId } },
});
});
@@ -35,14 +35,14 @@ test('Verify GraphQL Request Sends the OAuth 2.0 Header Until Authentication Is
await graphqlRequestFlow.setAuthentication(request, { type: 'none' });
const unauthenticatedResponse = await graphqlRequestFlow.send(request);
expect(authenticatedResponse.statusCode).toBe(200);
expect(authenticatedResponse.body).toMatchObject({
expect(authenticatedResponse.statusBar.code).toBe(200);
expect(authenticatedResponse.preview).toMatchObject({
headers: expect.objectContaining({
authorization: `Bearer ${tokens.accessToken}`,
}),
});
expect(unauthenticatedResponse.statusCode).toBe(200);
expect((unauthenticatedResponse.body as { headers: Record<string, string> }).headers).not.toHaveProperty(
expect(unauthenticatedResponse.statusBar.code).toBe(200);
expect((unauthenticatedResponse.preview as { headers: Record<string, string> }).headers).not.toHaveProperty(
'authorization',
);
});
@@ -37,8 +37,8 @@ test("Verify GraphQL Request With Object Variables", async ({ user }) => {
});
const responseView = await graphqlRequestFlow.send(request);
expect(responseView.statusCode).toBe(200);
expect(responseView.body).toMatchObject({
expect(responseView.statusBar.code).toBe(200);
expect(responseView.preview).toMatchObject({
data: {
characters: {
results: [{ name: "Summer Smith", status: "Dead" }],
@@ -37,8 +37,8 @@ test("Verify Pre-Request Script Adds a Header to GraphQL Request", async ({
});
const responseView = await graphqlRequestFlow.send(request);
expect(responseView.statusCode).toBe(200);
expect(responseView.body).toMatchObject({
expect(responseView.statusBar.code).toBe(200);
expect(responseView.preview).toMatchObject({
headers: expect.objectContaining({ "x-hello": headerValue }),
});
});
@@ -47,8 +47,8 @@ test("Verify GraphQL Schema Documentation Shows Field Descriptions", async ({
}),
]),
});
expect(responseView.statusCode).toBe(200);
expect(responseView.body).toMatchObject({
expect(responseView.statusBar.code).toBe(200);
expect(responseView.preview).toMatchObject({
data: {
characters: {
results: expect.arrayContaining([
@@ -38,8 +38,8 @@ test("Verify GraphQL Request Header With a Template Tag Is Resolved", async ({
});
const responseView = await graphqlRequestFlow.send(request);
expect(responseView.statusCode).toBe(200);
expect(responseView.body).toMatchObject({
expect(responseView.statusBar.code).toBe(200);
expect(responseView.preview).toMatchObject({
headers: expect.objectContaining({ "x-header-name": "aGVhZGVyLXZhbHVl" }),
});
});
@@ -33,8 +33,8 @@ test("Verify GraphQL Request Over a TLS Connection", async ({ user }) => {
});
const responseView = await graphqlRequestFlow.send(request);
expect(responseView.statusCode).toBe(200);
const sent = JSON.parse((responseView.body as { data: string }).data) as {
expect(responseView.statusBar.code).toBe(200);
const sent = JSON.parse((responseView.preview as { data: string }).data) as {
query: string;
};
expect(sent.query.replace(/\s+/g, " ").trim()).toBe(query);
@@ -23,7 +23,7 @@ test('Verify WebSocket Connection Sends the API Key Header Until Authentication
const authenticatedResponse = await webSocketRequestFlow.disconnect(request);
await expect
.poll(() => authenticatedResponse.console?.(), {
.poll(() => authenticatedResponse.console(), {
timeout: DEFAULT_TIMEOUT,
})
.toContain(`${apiKeyName}: ${apiKeyValue}`);
@@ -33,9 +33,9 @@ test('Verify WebSocket Connection Sends the API Key Header Until Authentication
const unauthenticatedResponse = await webSocketRequestFlow.disconnect(request);
await expect
.poll(() => unauthenticatedResponse.console?.(), {
.poll(() => unauthenticatedResponse.console(), {
timeout: DEFAULT_TIMEOUT,
})
.toContain('host:');
expect(await unauthenticatedResponse.console?.()).not.toContain(apiKeyName);
expect(await unauthenticatedResponse.console()).not.toContain(apiKeyName);
});
@@ -25,7 +25,7 @@ test('Verify WebSocket Connection Sends the Basic Authentication Header Until Au
const authenticatedResponse = await webSocketRequestFlow.disconnect(request);
await expect
.poll(() => authenticatedResponse.console?.(), {
.poll(() => authenticatedResponse.console(), {
timeout: DEFAULT_TIMEOUT,
})
.toContain(`authorization: Basic ${Buffer.from(`${username}:${password}`).toString('base64')}`);
@@ -35,9 +35,9 @@ test('Verify WebSocket Connection Sends the Basic Authentication Header Until Au
const unauthenticatedResponse = await webSocketRequestFlow.disconnect(request);
await expect
.poll(() => unauthenticatedResponse.console?.(), {
.poll(() => unauthenticatedResponse.console(), {
timeout: DEFAULT_TIMEOUT,
})
.toContain('host:');
expect(await unauthenticatedResponse.console?.()).not.toContain('authorization:');
expect(await unauthenticatedResponse.console()).not.toContain('authorization:');
});
@@ -29,7 +29,7 @@ test("Verify WebSocket Connection Sends the Bearer Token Header Until Authentica
const authenticatedResponse = await webSocketRequestFlow.disconnect(request);
await expect
.poll(() => authenticatedResponse.console?.(), {
.poll(() => authenticatedResponse.console(), {
timeout: DEFAULT_TIMEOUT,
})
.toContain(`authorization: Bearer ${token}`);
@@ -40,11 +40,11 @@ test("Verify WebSocket Connection Sends the Bearer Token Header Until Authentica
await webSocketRequestFlow.disconnect(request);
await expect
.poll(() => unauthenticatedResponse.console?.(), {
.poll(() => unauthenticatedResponse.console(), {
timeout: DEFAULT_TIMEOUT,
})
.toContain("host:");
expect(await unauthenticatedResponse.console?.()).not.toContain(
expect(await unauthenticatedResponse.console()).not.toContain(
"authorization:",
);
});
@@ -34,6 +34,6 @@ test("Verify Linked Cookie Is Sent With WebSocket Connection", async ({
const responseView = await webSocketRequestFlow.disconnect(request);
await expect
.poll(() => responseView.console?.(), { timeout: DEFAULT_TIMEOUT })
.poll(() => responseView.console(), { timeout: DEFAULT_TIMEOUT })
.toContain(`cookie: ${cookieKey}=${cookieValue}`);
});
@@ -44,7 +44,7 @@ test("Verify Environment Variable in WebSocket Request URL Is Resolved", async (
const responseView = await webSocketRequestFlow.disconnect(request);
await expect
.poll(() => responseView.console?.(), { timeout: DEFAULT_TIMEOUT })
.poll(() => responseView.console(), { timeout: DEFAULT_TIMEOUT })
.toContain(`Preparing request to ${WS_SERVER}`);
await expect
.poll(
@@ -39,7 +39,7 @@ test("Verify Create WebSocket Request", async ({ user }) => {
]),
);
await expect
.poll(() => responseView.console?.(), { timeout: DEFAULT_TIMEOUT })
.poll(() => responseView.console(), { timeout: DEFAULT_TIMEOUT })
.toContain("101 Switching Protocols");
await expect
.poll(
@@ -43,10 +43,10 @@ test("Verify Import from URL Moves Query String Into Params and Preserves It on
]),
);
await expect
.poll(() => responseView.console?.(), { timeout: DEFAULT_TIMEOUT })
.poll(() => responseView.console(), { timeout: DEFAULT_TIMEOUT })
.toContain("101 Switching Protocols");
await expect
.poll(() => responseView.console?.(), { timeout: DEFAULT_TIMEOUT })
.poll(() => responseView.console(), { timeout: DEFAULT_TIMEOUT })
.toContain(
`Preparing request to ${baseUrl}?${paramName1}=${paramValue1}&${paramName2}=${paramValue2}`,
);
@@ -104,7 +104,7 @@ test("Verify WebSocket Requests Are Routed Through the Preferences Proxy", async
);
await expect
.poll(() => responseView.console?.(), { timeout: DEFAULT_TIMEOUT })
.poll(() => responseView.console(), { timeout: DEFAULT_TIMEOUT })
.toContain("101 Switching Protocols");
expect(proxy.targets).toContain(hostOf(WS_SERVER));
} finally {
@@ -35,7 +35,7 @@ test("Verify Template Tags in WebSocket Header and Message Are Resolved", async
const responseView = await webSocketRequestFlow.disconnect(request);
await expect
.poll(() => responseView.console?.(), { timeout: DEFAULT_TIMEOUT })
.poll(() => responseView.console(), { timeout: DEFAULT_TIMEOUT })
.toContain("x-tag: YWJj");
await expect
.poll(
@@ -28,7 +28,7 @@ test("Verify WebSocket Request Over a TLS Connection", async ({ user }) => {
const responseView = await webSocketRequestFlow.disconnect(request);
await expect
.poll(() => responseView.console?.(), { timeout: DEFAULT_TIMEOUT })
.poll(() => responseView.console(), { timeout: DEFAULT_TIMEOUT })
.toContain("101 Switching Protocols");
await expect
.poll(