From ee6f8d89c7ad01e958cd2b4d4cc2affcb3db684e Mon Sep 17 00:00:00 2001 From: Bob Qiu Date: Mon, 2 Nov 2026 17:56:59 +0800 Subject: [PATCH] test(insomnia-test): adapt specs to ResponseView statusBar/preview Co-Authored-By: Claude Sonnet 5.5 --- .../event-stream-request/api-key-authentication.spec.ts | 6 +++--- .../event-stream-request/basic-authentication.spec.ts | 6 +++--- .../event-stream-request/bearer-authentication.spec.ts | 6 +++--- .../event-stream-request/cookie-sent-with-request.spec.ts | 2 +- .../tests/event-stream-request/duplicate-request.spec.ts | 2 +- .../oauth2-client-credentials-authentication.spec.ts | 6 +++--- .../tests/event-stream-request/proxy-settings.spec.ts | 2 +- .../event-stream-request/template-tag-in-header.spec.ts | 2 +- .../tests/event-stream-request/tls-connection.spec.ts | 2 +- .../tests/graphql-request/api-key-authentication.spec.ts | 8 ++++---- .../tests/graphql-request/basic-authentication.spec.ts | 8 ++++---- .../tests/graphql-request/bearer-authentication.spec.ts | 8 ++++---- .../graphql-request/cancel-in-flight-request.spec.ts | 4 ++-- .../graphql-request/cookie-sent-with-request.spec.ts | 4 ++-- .../tests/graphql-request/duplicate-request.spec.ts | 2 +- .../tests/graphql-request/happy-path.spec.ts | 6 +++--- .../graphql-request/numeric-environment-variable.spec.ts | 4 ++-- .../oauth2-client-credentials-authentication.spec.ts | 8 ++++---- .../tests/graphql-request/object-variables.spec.ts | 4 ++-- .../graphql-request/pre-request-script-header.spec.ts | 4 ++-- .../tests/graphql-request/schema-documentation.spec.ts | 4 ++-- .../tests/graphql-request/template-tag-in-header.spec.ts | 4 ++-- .../tests/graphql-request/tls-connection.spec.ts | 4 ++-- .../web-socket-request/api-key-authentication.spec.ts | 6 +++--- .../tests/web-socket-request/basic-authentication.spec.ts | 6 +++--- .../web-socket-request/bearer-authentication.spec.ts | 6 +++--- .../cookie-sent-with-connection.spec.ts | 2 +- .../environment-variable-in-url.spec.ts | 2 +- .../tests/web-socket-request/happy-path.spec.ts | 2 +- .../import-params-from-url-websocket.spec.ts | 4 ++-- .../tests/web-socket-request/proxy-settings.spec.ts | 2 +- .../template-tag-in-header-and-message.spec.ts | 2 +- .../tests/web-socket-request/tls-connection.spec.ts | 2 +- 33 files changed, 70 insertions(+), 70 deletions(-) diff --git a/packages/insomnia-test/tests/event-stream-request/api-key-authentication.spec.ts b/packages/insomnia-test/tests/event-stream-request/api-key-authentication.spec.ts index 4abad21f37..41215164b5 100644 --- a/packages/insomnia-test/tests/event-stream-request/api-key-authentication.spec.ts +++ b/packages/insomnia-test/tests/event-stream-request/api-key-authentication.spec.ts @@ -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); }); diff --git a/packages/insomnia-test/tests/event-stream-request/basic-authentication.spec.ts b/packages/insomnia-test/tests/event-stream-request/basic-authentication.spec.ts index 0e02d18ce1..240a78a65e 100644 --- a/packages/insomnia-test/tests/event-stream-request/basic-authentication.spec.ts +++ b/packages/insomnia-test/tests/event-stream-request/basic-authentication.spec.ts @@ -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:'); }); diff --git a/packages/insomnia-test/tests/event-stream-request/bearer-authentication.spec.ts b/packages/insomnia-test/tests/event-stream-request/bearer-authentication.spec.ts index b8792ce572..ee7684b2f3 100644 --- a/packages/insomnia-test/tests/event-stream-request/bearer-authentication.spec.ts +++ b/packages/insomnia-test/tests/event-stream-request/bearer-authentication.spec.ts @@ -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:", ); }); diff --git a/packages/insomnia-test/tests/event-stream-request/cookie-sent-with-request.spec.ts b/packages/insomnia-test/tests/event-stream-request/cookie-sent-with-request.spec.ts index 193f09fe32..a3c51c72bb 100644 --- a/packages/insomnia-test/tests/event-stream-request/cookie-sent-with-request.spec.ts +++ b/packages/insomnia-test/tests/event-stream-request/cookie-sent-with-request.spec.ts @@ -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"); }); diff --git a/packages/insomnia-test/tests/event-stream-request/duplicate-request.spec.ts b/packages/insomnia-test/tests/event-stream-request/duplicate-request.spec.ts index c3568721f4..20a0cf50d1 100644 --- a/packages/insomnia-test/tests/event-stream-request/duplicate-request.spec.ts +++ b/packages/insomnia-test/tests/event-stream-request/duplicate-request.spec.ts @@ -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}`); }); diff --git a/packages/insomnia-test/tests/event-stream-request/oauth2-client-credentials-authentication.spec.ts b/packages/insomnia-test/tests/event-stream-request/oauth2-client-credentials-authentication.spec.ts index e8630c7f8c..c3d90916e6 100644 --- a/packages/insomnia-test/tests/event-stream-request/oauth2-client-credentials-authentication.spec.ts +++ b/packages/insomnia-test/tests/event-stream-request/oauth2-client-credentials-authentication.spec.ts @@ -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:'); }); diff --git a/packages/insomnia-test/tests/event-stream-request/proxy-settings.spec.ts b/packages/insomnia-test/tests/event-stream-request/proxy-settings.spec.ts index f580f8c856..e6ca6f7b72 100644 --- a/packages/insomnia-test/tests/event-stream-request/proxy-settings.spec.ts +++ b/packages/insomnia-test/tests/event-stream-request/proxy-settings.spec.ts @@ -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"); }); diff --git a/packages/insomnia-test/tests/event-stream-request/template-tag-in-header.spec.ts b/packages/insomnia-test/tests/event-stream-request/template-tag-in-header.spec.ts index 544db654e1..ef03e53e11 100644 --- a/packages/insomnia-test/tests/event-stream-request/template-tag-in-header.spec.ts +++ b/packages/insomnia-test/tests/event-stream-request/template-tag-in-header.spec.ts @@ -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"); }); diff --git a/packages/insomnia-test/tests/event-stream-request/tls-connection.spec.ts b/packages/insomnia-test/tests/event-stream-request/tls-connection.spec.ts index 84422da43f..ed9a5f3b21 100644 --- a/packages/insomnia-test/tests/event-stream-request/tls-connection.spec.ts +++ b/packages/insomnia-test/tests/event-stream-request/tls-connection.spec.ts @@ -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( diff --git a/packages/insomnia-test/tests/graphql-request/api-key-authentication.spec.ts b/packages/insomnia-test/tests/graphql-request/api-key-authentication.spec.ts index e525f3b8ee..9927e69507 100644 --- a/packages/insomnia-test/tests/graphql-request/api-key-authentication.spec.ts +++ b/packages/insomnia-test/tests/graphql-request/api-key-authentication.spec.ts @@ -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 }).headers).not.toHaveProperty( + expect(unauthenticatedResponse.statusBar.code).toBe(200); + expect((unauthenticatedResponse.preview as { headers: Record }).headers).not.toHaveProperty( apiKeyName.toLowerCase(), ); }); diff --git a/packages/insomnia-test/tests/graphql-request/basic-authentication.spec.ts b/packages/insomnia-test/tests/graphql-request/basic-authentication.spec.ts index 0be82051f8..b7395c5c88 100644 --- a/packages/insomnia-test/tests/graphql-request/basic-authentication.spec.ts +++ b/packages/insomnia-test/tests/graphql-request/basic-authentication.spec.ts @@ -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 }).headers).not.toHaveProperty( + expect(unauthenticatedResponse.statusBar.code).toBe(200); + expect((unauthenticatedResponse.preview as { headers: Record }).headers).not.toHaveProperty( 'authorization', ); }); diff --git a/packages/insomnia-test/tests/graphql-request/bearer-authentication.spec.ts b/packages/insomnia-test/tests/graphql-request/bearer-authentication.spec.ts index cb6ed93b1c..ca2a64cf49 100644 --- a/packages/insomnia-test/tests/graphql-request/bearer-authentication.spec.ts +++ b/packages/insomnia-test/tests/graphql-request/bearer-authentication.spec.ts @@ -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 }) + (unauthenticatedResponse.preview as { headers: Record }) .headers, ).not.toHaveProperty("authorization"); }); diff --git a/packages/insomnia-test/tests/graphql-request/cancel-in-flight-request.spec.ts b/packages/insomnia-test/tests/graphql-request/cancel-in-flight-request.spec.ts index 646195343f..87c71a97c4 100644 --- a/packages/insomnia-test/tests/graphql-request/cancel-in-flight-request.spec.ts +++ b/packages/insomnia-test/tests/graphql-request/cancel-in-flight-request.spec.ts @@ -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); }); diff --git a/packages/insomnia-test/tests/graphql-request/cookie-sent-with-request.spec.ts b/packages/insomnia-test/tests/graphql-request/cookie-sent-with-request.spec.ts index 2eec111b22..4d6f59d4b0 100644 --- a/packages/insomnia-test/tests/graphql-request/cookie-sent-with-request.spec.ts +++ b/packages/insomnia-test/tests/graphql-request/cookie-sent-with-request.spec.ts @@ -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}`, }), diff --git a/packages/insomnia-test/tests/graphql-request/duplicate-request.spec.ts b/packages/insomnia-test/tests/graphql-request/duplicate-request.spec.ts index 8399107d1b..74776ef448 100644 --- a/packages/insomnia-test/tests/graphql-request/duplicate-request.spec.ts +++ b/packages/insomnia-test/tests/graphql-request/duplicate-request.spec.ts @@ -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 }), }); }); diff --git a/packages/insomnia-test/tests/graphql-request/happy-path.spec.ts b/packages/insomnia-test/tests/graphql-request/happy-path.spec.ts index 6709002440..fa09919179 100644 --- a/packages/insomnia-test/tests/graphql-request/happy-path.spec.ts +++ b/packages/insomnia-test/tests/graphql-request/happy-path.spec.ts @@ -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( diff --git a/packages/insomnia-test/tests/graphql-request/numeric-environment-variable.spec.ts b/packages/insomnia-test/tests/graphql-request/numeric-environment-variable.spec.ts index 68074efd46..5b117a61a9 100644 --- a/packages/insomnia-test/tests/graphql-request/numeric-environment-variable.spec.ts +++ b/packages/insomnia-test/tests/graphql-request/numeric-environment-variable.spec.ts @@ -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 } }, }); }); diff --git a/packages/insomnia-test/tests/graphql-request/oauth2-client-credentials-authentication.spec.ts b/packages/insomnia-test/tests/graphql-request/oauth2-client-credentials-authentication.spec.ts index e1b13ed485..9973b5eeb6 100644 --- a/packages/insomnia-test/tests/graphql-request/oauth2-client-credentials-authentication.spec.ts +++ b/packages/insomnia-test/tests/graphql-request/oauth2-client-credentials-authentication.spec.ts @@ -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 }).headers).not.toHaveProperty( + expect(unauthenticatedResponse.statusBar.code).toBe(200); + expect((unauthenticatedResponse.preview as { headers: Record }).headers).not.toHaveProperty( 'authorization', ); }); diff --git a/packages/insomnia-test/tests/graphql-request/object-variables.spec.ts b/packages/insomnia-test/tests/graphql-request/object-variables.spec.ts index 837a43bd0c..0e501b02d1 100644 --- a/packages/insomnia-test/tests/graphql-request/object-variables.spec.ts +++ b/packages/insomnia-test/tests/graphql-request/object-variables.spec.ts @@ -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" }], diff --git a/packages/insomnia-test/tests/graphql-request/pre-request-script-header.spec.ts b/packages/insomnia-test/tests/graphql-request/pre-request-script-header.spec.ts index f212d9a714..2c6a97ac39 100644 --- a/packages/insomnia-test/tests/graphql-request/pre-request-script-header.spec.ts +++ b/packages/insomnia-test/tests/graphql-request/pre-request-script-header.spec.ts @@ -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 }), }); }); diff --git a/packages/insomnia-test/tests/graphql-request/schema-documentation.spec.ts b/packages/insomnia-test/tests/graphql-request/schema-documentation.spec.ts index 330c9234ec..3b1cf4662d 100644 --- a/packages/insomnia-test/tests/graphql-request/schema-documentation.spec.ts +++ b/packages/insomnia-test/tests/graphql-request/schema-documentation.spec.ts @@ -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([ diff --git a/packages/insomnia-test/tests/graphql-request/template-tag-in-header.spec.ts b/packages/insomnia-test/tests/graphql-request/template-tag-in-header.spec.ts index 656dbfaaa1..5072ce0a70 100644 --- a/packages/insomnia-test/tests/graphql-request/template-tag-in-header.spec.ts +++ b/packages/insomnia-test/tests/graphql-request/template-tag-in-header.spec.ts @@ -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" }), }); }); diff --git a/packages/insomnia-test/tests/graphql-request/tls-connection.spec.ts b/packages/insomnia-test/tests/graphql-request/tls-connection.spec.ts index 56428a6f9c..33a469feea 100644 --- a/packages/insomnia-test/tests/graphql-request/tls-connection.spec.ts +++ b/packages/insomnia-test/tests/graphql-request/tls-connection.spec.ts @@ -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); diff --git a/packages/insomnia-test/tests/web-socket-request/api-key-authentication.spec.ts b/packages/insomnia-test/tests/web-socket-request/api-key-authentication.spec.ts index 78bdc9bac4..268601d9c7 100644 --- a/packages/insomnia-test/tests/web-socket-request/api-key-authentication.spec.ts +++ b/packages/insomnia-test/tests/web-socket-request/api-key-authentication.spec.ts @@ -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); }); diff --git a/packages/insomnia-test/tests/web-socket-request/basic-authentication.spec.ts b/packages/insomnia-test/tests/web-socket-request/basic-authentication.spec.ts index 0b03914fcc..7ebb987d1d 100644 --- a/packages/insomnia-test/tests/web-socket-request/basic-authentication.spec.ts +++ b/packages/insomnia-test/tests/web-socket-request/basic-authentication.spec.ts @@ -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:'); }); diff --git a/packages/insomnia-test/tests/web-socket-request/bearer-authentication.spec.ts b/packages/insomnia-test/tests/web-socket-request/bearer-authentication.spec.ts index f998ed1db6..b49281bf91 100644 --- a/packages/insomnia-test/tests/web-socket-request/bearer-authentication.spec.ts +++ b/packages/insomnia-test/tests/web-socket-request/bearer-authentication.spec.ts @@ -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:", ); }); diff --git a/packages/insomnia-test/tests/web-socket-request/cookie-sent-with-connection.spec.ts b/packages/insomnia-test/tests/web-socket-request/cookie-sent-with-connection.spec.ts index dc1c473da1..4073f23bf6 100644 --- a/packages/insomnia-test/tests/web-socket-request/cookie-sent-with-connection.spec.ts +++ b/packages/insomnia-test/tests/web-socket-request/cookie-sent-with-connection.spec.ts @@ -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}`); }); diff --git a/packages/insomnia-test/tests/web-socket-request/environment-variable-in-url.spec.ts b/packages/insomnia-test/tests/web-socket-request/environment-variable-in-url.spec.ts index 81803be6a4..186b1c6951 100644 --- a/packages/insomnia-test/tests/web-socket-request/environment-variable-in-url.spec.ts +++ b/packages/insomnia-test/tests/web-socket-request/environment-variable-in-url.spec.ts @@ -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( diff --git a/packages/insomnia-test/tests/web-socket-request/happy-path.spec.ts b/packages/insomnia-test/tests/web-socket-request/happy-path.spec.ts index dd801a469a..c21a402b80 100644 --- a/packages/insomnia-test/tests/web-socket-request/happy-path.spec.ts +++ b/packages/insomnia-test/tests/web-socket-request/happy-path.spec.ts @@ -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( diff --git a/packages/insomnia-test/tests/web-socket-request/import-params-from-url-websocket.spec.ts b/packages/insomnia-test/tests/web-socket-request/import-params-from-url-websocket.spec.ts index f2eb614c35..ab4ac1d7f2 100644 --- a/packages/insomnia-test/tests/web-socket-request/import-params-from-url-websocket.spec.ts +++ b/packages/insomnia-test/tests/web-socket-request/import-params-from-url-websocket.spec.ts @@ -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}`, ); diff --git a/packages/insomnia-test/tests/web-socket-request/proxy-settings.spec.ts b/packages/insomnia-test/tests/web-socket-request/proxy-settings.spec.ts index c13209c893..def1e5a026 100644 --- a/packages/insomnia-test/tests/web-socket-request/proxy-settings.spec.ts +++ b/packages/insomnia-test/tests/web-socket-request/proxy-settings.spec.ts @@ -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 { diff --git a/packages/insomnia-test/tests/web-socket-request/template-tag-in-header-and-message.spec.ts b/packages/insomnia-test/tests/web-socket-request/template-tag-in-header-and-message.spec.ts index 2d372b06b0..c111a2c67a 100644 --- a/packages/insomnia-test/tests/web-socket-request/template-tag-in-header-and-message.spec.ts +++ b/packages/insomnia-test/tests/web-socket-request/template-tag-in-header-and-message.spec.ts @@ -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( diff --git a/packages/insomnia-test/tests/web-socket-request/tls-connection.spec.ts b/packages/insomnia-test/tests/web-socket-request/tls-connection.spec.ts index 2c575c70bd..b8b3b017c9 100644 --- a/packages/insomnia-test/tests/web-socket-request/tls-connection.spec.ts +++ b/packages/insomnia-test/tests/web-socket-request/tls-connection.spec.ts @@ -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(