From 56d762408ade117cecd3fbca109ac96cd6c2b1df Mon Sep 17 00:00:00 2001 From: Bob Qiu Date: Wed, 28 Oct 2026 16:23:49 +0800 Subject: [PATCH] test(insomnia-test): add graphql, grpc, websocket, socket.io, event-stream and mcp specs Co-Authored-By: Claude Sonnet 5.5 --- .../api-key-authentication.spec.ts | 17 ++++++++------- .../basic-authentication.spec.ts | 17 ++++++++------- .../bearer-authentication.spec.ts | 17 ++++++++------- .../cancel-open-stream.spec.ts | 13 ++++++------ .../cookie-sent-with-request.spec.ts | 13 ++++++------ .../duplicate-request.spec.ts | 13 ++++++------ .../event-stream-request/happy-path.spec.ts | 15 ++++++------- ...-client-credentials-authentication.spec.ts | 17 ++++++++------- .../proxy-settings.spec.ts | 13 ++++++------ .../template-tag-in-header.spec.ts | 13 ++++++------ .../tls-connection.spec.ts | 13 ++++++------ .../unresolved-environment-variable.spec.ts | 13 ++++++------ .../api-key-authentication.spec.ts | 21 ++++++++++--------- .../basic-authentication.spec.ts | 21 ++++++++++--------- .../bearer-authentication.spec.ts | 21 ++++++++++--------- .../cancel-in-flight-request.spec.ts | 19 +++++++++-------- .../cookie-sent-with-request.spec.ts | 17 ++++++++------- .../graphql-request/duplicate-request.spec.ts | 15 ++++++------- .../graphql-request/generate-code.spec.ts | 13 ++++++------ .../tests/graphql-request/happy-path.spec.ts | 19 +++++++++-------- .../numeric-environment-variable.spec.ts | 19 +++++++++-------- ...-client-credentials-authentication.spec.ts | 21 ++++++++++--------- .../graphql-request/object-variables.spec.ts | 17 ++++++++------- .../pre-request-script-header.spec.ts | 17 ++++++++------- .../graphql-request/proxy-settings.spec.ts | 13 ++++++------ .../schema-documentation.spec.ts | 17 ++++++++------- .../template-tag-in-header.spec.ts | 17 ++++++++------- .../graphql-request/tls-connection.spec.ts | 17 ++++++++------- .../unlinked-environment-variable.spec.ts | 15 ++++++------- ...environment-variable-interpolation.spec.ts | 11 +++++----- ...el-in-flight-server-streaming-call.spec.ts | 9 ++++---- .../cancel-open-client-streaming-call.spec.ts | 9 ++++---- .../grpc-request/commit-empty-stream.spec.ts | 9 ++++---- .../custom-metadata-headers.spec.ts | 9 ++++---- ...grpc-request-with-streaming-method.spec.ts | 9 ++++---- .../tests/grpc-request/happy-path.spec.ts | 11 +++++----- .../mtls-client-certificate.spec.ts | 13 ++++++------ .../tests/grpc-request/proxy-settings.spec.ts | 9 ++++---- ...ection-fails-on-unreachable-server.spec.ts | 9 ++++---- .../resend-after-completion.spec.ts | 9 ++++---- ...rver-returns-business-error-status.spec.ts | 9 ++++---- .../switch-method-resets-response.spec.ts | 9 ++++---- .../grpc-request/template-tag-in-body.spec.ts | 9 ++++---- .../tests/grpc-request/tls-connection.spec.ts | 9 ++++---- .../mcp-client/api-key-authentication.spec.ts | 9 ++++---- .../mcp-client/basic-authentication.spec.ts | 9 ++++---- .../mcp-client/bearer-authentication.spec.ts | 9 ++++---- .../disconnect-and-reconnect.spec.ts | 9 ++++---- .../environment-variable-in-url.spec.ts | 11 +++++----- .../tests/mcp-client/happy-path.spec.ts | 9 ++++---- ...-client-credentials-authentication.spec.ts | 9 ++++---- .../tests/mcp-client/proxy-settings.spec.ts | 9 ++++---- .../tests/mcp-client/tls-connection.spec.ts | 11 +++++----- .../mcp-client/unreachable-server.spec.ts | 9 ++++---- .../disconnect-before-server-reply.spec.ts | 9 ++++---- .../duplicate-request.spec.ts | 9 ++++---- .../socket-io-request/happy-path.spec.ts | 11 +++++----- .../socket-io-request/proxy-settings.spec.ts | 9 ++++---- .../template-tag-in-message.spec.ts | 9 ++++---- .../socket-io-request/tls-connection.spec.ts | 11 +++++----- .../token-authentication.spec.ts | 9 ++++---- .../unreachable-server.spec.ts | 9 ++++---- .../api-key-authentication.spec.ts | 15 ++++++------- .../basic-authentication.spec.ts | 15 ++++++------- .../bearer-authentication.spec.ts | 15 ++++++------- .../cookie-sent-with-connection.spec.ts | 11 +++++----- .../disconnect-before-server-reply.spec.ts | 11 +++++----- .../environment-variable-in-url.spec.ts | 13 ++++++------ .../web-socket-request/happy-path.spec.ts | 11 +++++----- .../import-params-from-url-websocket.spec.ts | 13 ++++++------ .../web-socket-request/proxy-settings.spec.ts | 11 +++++----- .../send-multiple-message-types.spec.ts | 11 +++++----- ...template-tag-in-header-and-message.spec.ts | 13 ++++++------ .../web-socket-request/tls-connection.spec.ts | 11 +++++----- .../unresolved-environment-variable.spec.ts | 11 +++++----- 75 files changed, 511 insertions(+), 436 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 f0d4fe6426..4abad21f37 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 @@ -1,11 +1,12 @@ import { faker } from '@faker-js/faker'; -import { ProjectType } from '@package/enums/project-types'; -import { DEFAULT_TIMEOUT, EVENT_STREAM_SERVER, test } from '@package/misc/fixtures'; -import { Collection } from '@package/models/collection'; -import { EventStreamMethod } from '@package/models/event-stream-request'; -import { Project } from '@package/models/project'; import { expect } from "@playwright/test"; +import { ProjectType } from '../../enums/project-types'; +import { DEFAULT_TIMEOUT, EVENT_STREAM_SERVER, test } from '../../misc/fixtures'; +import { Collection } from '../../models/collection'; +import { EventStreamMethod } from '../../models/event-stream-request'; +import { Project } from '../../models/project'; + test('Verify Event Stream Request Sends the API Key Header Until Authentication Is Set to None', async ({ user }) => { const { eventStreamRequestFlow, workspaceFlow } = user.flowManager; @@ -23,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}`); @@ -32,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 c4ba8d8f6f..0e02d18ce1 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 @@ -1,11 +1,12 @@ import { faker } from '@faker-js/faker'; -import { ProjectType } from '@package/enums/project-types'; -import { DEFAULT_TIMEOUT, EVENT_STREAM_SERVER, test } from '@package/misc/fixtures'; -import { Collection } from '@package/models/collection'; -import { EventStreamMethod } from '@package/models/event-stream-request'; -import { Project } from '@package/models/project'; import { expect } from "@playwright/test"; +import { ProjectType } from '../../enums/project-types'; +import { DEFAULT_TIMEOUT, EVENT_STREAM_SERVER, test } from '../../misc/fixtures'; +import { Collection } from '../../models/collection'; +import { EventStreamMethod } from '../../models/event-stream-request'; +import { Project } from '../../models/project'; + test('Verify Event Stream Request Sends the Basic Authentication Header Until Authentication Is Set to None', async ({ user, }) => { @@ -25,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')}`); @@ -34,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 e33ac32667..b8792ce572 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 @@ -1,11 +1,12 @@ import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { DEFAULT_TIMEOUT, EVENT_STREAM_SERVER, test } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { EventStreamMethod } from "@package/models/event-stream-request"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { DEFAULT_TIMEOUT, EVENT_STREAM_SERVER, test } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { EventStreamMethod } from "../../models/event-stream-request"; +import { Project } from "../../models/project"; + test("Verify Event Stream Request Sends the Bearer Token Header Until Authentication Is Set to None", async ({ user, }) => { @@ -29,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}`); @@ -38,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/cancel-open-stream.spec.ts b/packages/insomnia-test/tests/event-stream-request/cancel-open-stream.spec.ts index 3c7f585ebf..066b6adcfa 100644 --- a/packages/insomnia-test/tests/event-stream-request/cancel-open-stream.spec.ts +++ b/packages/insomnia-test/tests/event-stream-request/cancel-open-stream.spec.ts @@ -1,12 +1,13 @@ import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { RequestState } from "@package/enums/request-state"; -import { DEFAULT_TIMEOUT, EVENT_STREAM_SERVER, test } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { EventStreamMethod } from "@package/models/event-stream-request"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { RequestState } from "../../enums/request-state"; +import { DEFAULT_TIMEOUT, EVENT_STREAM_SERVER, test } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { EventStreamMethod } from "../../models/event-stream-request"; +import { Project } from "../../models/project"; + const eventCount = 20; test("Verify Disconnecting an Open Event Stream Stops It Early", async ({ 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 31d2ef307f..193f09fe32 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 @@ -1,11 +1,12 @@ import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { DEFAULT_TIMEOUT, EVENT_STREAM_SERVER, test } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { EventStreamMethod } from "@package/models/event-stream-request"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { DEFAULT_TIMEOUT, EVENT_STREAM_SERVER, test } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { EventStreamMethod } from "../../models/event-stream-request"; +import { Project } from "../../models/project"; + test("Verify Linked Cookie Is Sent With Event Stream Request", async ({ user, }) => { @@ -37,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 794ce213de..c3568721f4 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 @@ -1,11 +1,12 @@ import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { DEFAULT_TIMEOUT, EVENT_STREAM_SERVER, test } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { EventStreamMethod } from "@package/models/event-stream-request"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { DEFAULT_TIMEOUT, EVENT_STREAM_SERVER, test } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { EventStreamMethod } from "../../models/event-stream-request"; +import { Project } from "../../models/project"; + test("Verify Duplicated Event Stream Request Keeps Url, Method and Headers", async ({ user, }) => { @@ -36,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/happy-path.spec.ts b/packages/insomnia-test/tests/event-stream-request/happy-path.spec.ts index 8e8f1d5af4..05d032081b 100644 --- a/packages/insomnia-test/tests/event-stream-request/happy-path.spec.ts +++ b/packages/insomnia-test/tests/event-stream-request/happy-path.spec.ts @@ -1,13 +1,14 @@ import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { RequestState } from "@package/enums/request-state"; -import { EVENT_STREAM_SERVER, test } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { EnvironmentKvPairDataType } from "@package/models/environment"; -import { EventStreamMethod } from "@package/models/event-stream-request"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { RequestState } from "../../enums/request-state"; +import { EVENT_STREAM_SERVER, test } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { EnvironmentKvPairDataType } from "../../models/environment"; +import { EventStreamMethod } from "../../models/event-stream-request"; +import { Project } from "../../models/project"; + const eventStreamUrl = "http://{{url}}/sse-events/5"; test("Verify Create Event Stream Request", async ({ user }) => { 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 c7a7d174d2..e8630c7f8c 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 @@ -1,11 +1,12 @@ import { faker } from '@faker-js/faker'; -import { ProjectType } from '@package/enums/project-types'; -import { DEFAULT_TIMEOUT, EVENT_STREAM_SERVER, OAUTH2_CLIENT_ID, OAUTH2_CLIENT_SECRET, OAUTH2_SERVER, test } from '@package/misc/fixtures'; -import { Collection } from '@package/models/collection'; -import { EventStreamMethod } from '@package/models/event-stream-request'; -import { Project } from '@package/models/project'; import { expect } from "@playwright/test"; +import { ProjectType } from '../../enums/project-types'; +import { DEFAULT_TIMEOUT, EVENT_STREAM_SERVER, OAUTH2_CLIENT_ID, OAUTH2_CLIENT_SECRET, OAUTH2_SERVER, test } from '../../misc/fixtures'; +import { Collection } from '../../models/collection'; +import { EventStreamMethod } from '../../models/event-stream-request'; +import { Project } from '../../models/project'; + test('Verify Event Stream Request Sends the OAuth 2.0 Header Until Authentication Is Set to None', async ({ user }) => { const { eventStreamRequestFlow, workspaceFlow } = user.flowManager; @@ -28,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}`); @@ -37,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 a4f95d49b7..f580f8c856 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 @@ -1,11 +1,12 @@ import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { DEFAULT_TIMEOUT, EVENT_STREAM_SERVER, test } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { EventStreamMethod } from "@package/models/event-stream-request"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { DEFAULT_TIMEOUT, EVENT_STREAM_SERVER, test } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { EventStreamMethod } from "../../models/event-stream-request"; +import { Project } from "../../models/project"; + test("Verify Enabling a Proxy Routes Event Stream Requests Through It", async ({ user, }) => { @@ -38,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 37ded9d7cf..544db654e1 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 @@ -1,11 +1,12 @@ import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { DEFAULT_TIMEOUT, EVENT_STREAM_SERVER, test } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { EventStreamMethod } from "@package/models/event-stream-request"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { DEFAULT_TIMEOUT, EVENT_STREAM_SERVER, test } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { EventStreamMethod } from "../../models/event-stream-request"; +import { Project } from "../../models/project"; + test("Verify Template Tag in Event Stream Request Header Is Resolved", async ({ user, }) => { @@ -33,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 e8f1f86b14..84422da43f 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 @@ -1,11 +1,12 @@ import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { DEFAULT_TIMEOUT, EVENT_STREAM_SERVER_HTTPS, test } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { EventStreamMethod } from "@package/models/event-stream-request"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { DEFAULT_TIMEOUT, EVENT_STREAM_SERVER_HTTPS, test } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { EventStreamMethod } from "../../models/event-stream-request"; +import { Project } from "../../models/project"; + test("Verify Event Stream Request Over a TLS Connection", async ({ user }) => { const { eventStreamRequestFlow, preferencesFlow, workspaceFlow } = user.flowManager; @@ -28,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/event-stream-request/unresolved-environment-variable.spec.ts b/packages/insomnia-test/tests/event-stream-request/unresolved-environment-variable.spec.ts index 3034d0fb44..c467800105 100644 --- a/packages/insomnia-test/tests/event-stream-request/unresolved-environment-variable.spec.ts +++ b/packages/insomnia-test/tests/event-stream-request/unresolved-environment-variable.spec.ts @@ -1,12 +1,13 @@ import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { EVENT_STREAM_SERVER, test } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { EnvironmentKvPairDataType } from "@package/models/environment"; -import { EventStreamMethod } from "@package/models/event-stream-request"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { EVENT_STREAM_SERVER, test } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { EnvironmentKvPairDataType } from "../../models/environment"; +import { EventStreamMethod } from "../../models/event-stream-request"; +import { Project } from "../../models/project"; + const variableName = "unlinked"; test("Verify Unlinked Environment Variable Causes Error in Event Stream Request", async ({ 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 8224dd9e7c..e525f3b8ee 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 @@ -1,12 +1,13 @@ import { faker } from '@faker-js/faker'; -import { ContentType } from '@package/enums/content-type'; -import { HttpMethod } from '@package/enums/http-method'; -import { ProjectType } from '@package/enums/project-types'; -import { HTTP_SERVER, test } from '@package/misc/fixtures'; -import { Collection } from '@package/models/collection'; -import { Project } from '@package/models/project'; import { expect } from "@playwright/test"; +import { ContentType } from '../../enums/content-type'; +import { HttpMethod } from '../../enums/http-method'; +import { ProjectType } from '../../enums/project-types'; +import { HTTP_SERVER, test } from '../../misc/fixtures'; +import { Collection } from '../../models/collection'; +import { Project } from '../../models/project'; + const query = '{ characters { results { name } } }'; const body = { mimeType: ContentType.JSON, text: JSON.stringify({ query }) }; @@ -29,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.statusBar.code).toBe(200); - expect(authenticatedResponse.preview).toMatchObject({ + expect(authenticatedResponse.statusCode).toBe(200); + expect(authenticatedResponse.body).toMatchObject({ headers: expect.objectContaining({ [apiKeyName.toLowerCase()]: apiKeyValue, }), }); - expect(unauthenticatedResponse.statusBar.code).toBe(200); - expect((unauthenticatedResponse.preview as { headers: Record }).headers).not.toHaveProperty( + expect(unauthenticatedResponse.statusCode).toBe(200); + expect((unauthenticatedResponse.body 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 583d557543..0be82051f8 100644 --- a/packages/insomnia-test/tests/graphql-request/basic-authentication.spec.ts +++ b/packages/insomnia-test/tests/graphql-request/basic-authentication.spec.ts @@ -1,12 +1,13 @@ import { faker } from '@faker-js/faker'; -import { ContentType } from '@package/enums/content-type'; -import { HttpMethod } from '@package/enums/http-method'; -import { ProjectType } from '@package/enums/project-types'; -import { HTTP_SERVER, test } from '@package/misc/fixtures'; -import { Collection } from '@package/models/collection'; -import { Project } from '@package/models/project'; import { expect } from "@playwright/test"; +import { ContentType } from '../../enums/content-type'; +import { HttpMethod } from '../../enums/http-method'; +import { ProjectType } from '../../enums/project-types'; +import { HTTP_SERVER, test } from '../../misc/fixtures'; +import { Collection } from '../../models/collection'; +import { Project } from '../../models/project'; + const query = '{ characters { results { name } } }'; const body = { mimeType: ContentType.JSON, text: JSON.stringify({ query }) }; @@ -31,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.statusBar.code).toBe(200); - expect(authenticatedResponse.preview).toMatchObject({ + expect(authenticatedResponse.statusCode).toBe(200); + expect(authenticatedResponse.body).toMatchObject({ headers: expect.objectContaining({ authorization: `Basic ${Buffer.from(`${username}:${password}`).toString('base64')}`, }), }); - expect(unauthenticatedResponse.statusBar.code).toBe(200); - expect((unauthenticatedResponse.preview as { headers: Record }).headers).not.toHaveProperty( + expect(unauthenticatedResponse.statusCode).toBe(200); + expect((unauthenticatedResponse.body 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 3e6c5f62df..cb6ed93b1c 100644 --- a/packages/insomnia-test/tests/graphql-request/bearer-authentication.spec.ts +++ b/packages/insomnia-test/tests/graphql-request/bearer-authentication.spec.ts @@ -1,12 +1,13 @@ import { faker } from "@faker-js/faker"; -import { ContentType } from "@package/enums/content-type"; -import { HttpMethod } from "@package/enums/http-method"; -import { ProjectType } from "@package/enums/project-types"; -import { HTTP_SERVER, test } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ContentType } from "../../enums/content-type"; +import { HttpMethod } from "../../enums/http-method"; +import { ProjectType } from "../../enums/project-types"; +import { HTTP_SERVER, test } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { Project } from "../../models/project"; + const query = "{ characters { results { name } } }"; const body = { mimeType: ContentType.JSON, text: JSON.stringify({ query }) }; @@ -35,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.statusBar.code).toBe(200); - expect(authenticatedResponse.preview).toMatchObject({ + expect(authenticatedResponse.statusCode).toBe(200); + expect(authenticatedResponse.body).toMatchObject({ headers: expect.objectContaining({ authorization: `Bearer ${token}` }), }); - expect(unauthenticatedResponse.statusBar.code).toBe(200); + expect(unauthenticatedResponse.statusCode).toBe(200); expect( - (unauthenticatedResponse.preview as { headers: Record }) + (unauthenticatedResponse.body 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 05e0b803b7..646195343f 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 @@ -1,13 +1,14 @@ import { faker } from '@faker-js/faker'; -import { ContentType } from '@package/enums/content-type'; -import { HttpMethod } from '@package/enums/http-method'; -import { ProjectType } from '@package/enums/project-types'; -import { RequestState } from '@package/enums/request-state'; -import { DEFAULT_TIMEOUT, HTTP_SERVER, test } from '@package/misc/fixtures'; -import { Collection } from '@package/models/collection'; -import { Project } from '@package/models/project'; import { expect } from "@playwright/test"; +import { ContentType } from '../../enums/content-type'; +import { HttpMethod } from '../../enums/http-method'; +import { ProjectType } from '../../enums/project-types'; +import { RequestState } from '../../enums/request-state'; +import { DEFAULT_TIMEOUT, HTTP_SERVER, test } from '../../misc/fixtures'; +import { Collection } from '../../models/collection'; +import { Project } from '../../models/project'; + const query = '{ characters { results { name } } }'; const body = { mimeType: ContentType.JSON, text: JSON.stringify({ query }) }; @@ -49,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.statusBar.code).toBeUndefined(); - expect(laterResponse.statusBar.code).toBe(200); + expect(cancelledResponse.statusCode).toBeUndefined(); + expect(laterResponse.statusCode).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 ff4a768461..2eec111b22 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 @@ -1,12 +1,13 @@ import { faker } from "@faker-js/faker"; -import { ContentType } from "@package/enums/content-type"; -import { HttpMethod } from "@package/enums/http-method"; -import { ProjectType } from "@package/enums/project-types"; -import { HTTP_SERVER, test } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ContentType } from "../../enums/content-type"; +import { HttpMethod } from "../../enums/http-method"; +import { ProjectType } from "../../enums/project-types"; +import { HTTP_SERVER, test } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { Project } from "../../models/project"; + const query = "{ characters { results { name } } }"; const body = { mimeType: ContentType.JSON, text: JSON.stringify({ query }) }; @@ -36,8 +37,8 @@ test("Verify Linked Cookie Is Sent With GraphQL Request", async ({ user }) => { const responseView = await graphqlRequestFlow.send(request); - expect(responseView.statusBar.code).toBe(200); - expect(responseView.preview).toMatchObject({ + expect(responseView.statusCode).toBe(200); + expect(responseView.body).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 663adf41aa..8399107d1b 100644 --- a/packages/insomnia-test/tests/graphql-request/duplicate-request.spec.ts +++ b/packages/insomnia-test/tests/graphql-request/duplicate-request.spec.ts @@ -1,12 +1,13 @@ import { faker } from "@faker-js/faker"; -import { ContentType } from "@package/enums/content-type"; -import { HttpMethod } from "@package/enums/http-method"; -import { ProjectType } from "@package/enums/project-types"; -import { HTTP_SERVER, test } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ContentType } from "../../enums/content-type"; +import { HttpMethod } from "../../enums/http-method"; +import { ProjectType } from "../../enums/project-types"; +import { HTTP_SERVER, test } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { Project } from "../../models/project"; + const query = "{ characters { results { name } } }"; const body = { mimeType: ContentType.JSON, text: JSON.stringify({ query }) }; @@ -40,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.preview).toMatchObject({ + expect(responseView.body).toMatchObject({ headers: expect.objectContaining({ "x-custom": headerValue }), }); }); diff --git a/packages/insomnia-test/tests/graphql-request/generate-code.spec.ts b/packages/insomnia-test/tests/graphql-request/generate-code.spec.ts index 3d928be1c2..eacbb52d06 100644 --- a/packages/insomnia-test/tests/graphql-request/generate-code.spec.ts +++ b/packages/insomnia-test/tests/graphql-request/generate-code.spec.ts @@ -1,12 +1,13 @@ import { faker } from "@faker-js/faker"; -import { ContentType } from "@package/enums/content-type"; -import { HttpMethod } from "@package/enums/http-method"; -import { ProjectType } from "@package/enums/project-types"; -import { HTTP_SERVER, test } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ContentType } from "../../enums/content-type"; +import { HttpMethod } from "../../enums/http-method"; +import { ProjectType } from "../../enums/project-types"; +import { HTTP_SERVER, test } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { Project } from "../../models/project"; + const query = "{ characters { results { name } } }"; const body = { mimeType: ContentType.JSON, text: JSON.stringify({ query }) }; 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 8bf8418fca..6709002440 100644 --- a/packages/insomnia-test/tests/graphql-request/happy-path.spec.ts +++ b/packages/insomnia-test/tests/graphql-request/happy-path.spec.ts @@ -1,12 +1,13 @@ import { faker } from "@faker-js/faker"; -import { ContentType } from "@package/enums/content-type"; -import { HttpMethod } from "@package/enums/http-method"; -import { ProjectType } from "@package/enums/project-types"; -import { HTTP_SERVER, test } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ContentType } from "../../enums/content-type"; +import { HttpMethod } from "../../enums/http-method"; +import { ProjectType } from "../../enums/project-types"; +import { HTTP_SERVER, test } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { Project } from "../../models/project"; + const url = `${HTTP_SERVER}/graphql`; const query = '{ characters(filter: {status: "Alive"}) { results { name } } }'; const body = { @@ -34,8 +35,8 @@ test("Verify Create GraphQL Request", async ({ user }) => { body: body, }); const responseView = await graphqlRequestFlow.send(request); - expect(responseView.statusBar.code).toBe(200); - expect(responseView.statusBar.message).toBe("OK"); + expect(responseView.statusCode).toBe(200); + expect(responseView.statusMessage).toBe("OK"); expect(responseView.headers).toEqual( expect.arrayContaining([ expect.objectContaining({ @@ -44,7 +45,7 @@ test("Verify Create GraphQL Request", async ({ user }) => { }), ]), ); - expect(responseView.preview).toMatchObject({ + expect(responseView.body).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 13e7a8866a..68074efd46 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 @@ -1,13 +1,14 @@ import { faker } from "@faker-js/faker"; -import { ContentType } from "@package/enums/content-type"; -import { HttpMethod } from "@package/enums/http-method"; -import { ProjectType } from "@package/enums/project-types"; -import { HTTP_SERVER, test } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { EnvironmentKvPairDataType } from "@package/models/environment"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ContentType } from "../../enums/content-type"; +import { HttpMethod } from "../../enums/http-method"; +import { ProjectType } from "../../enums/project-types"; +import { HTTP_SERVER, test } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { EnvironmentKvPairDataType } from "../../models/environment"; +import { Project } from "../../models/project"; + const url = `${HTTP_SERVER}/graphql`; const query = "query Ep($id: Int!) { episode(id: $id) { id name } }"; @@ -50,8 +51,8 @@ test("Verify GraphQL Request Renders a Numeric Environment Variable", async ({ }); const responseView = await graphqlRequestFlow.send(request); - expect(responseView.statusBar.code).toBe(200); - expect(responseView.preview).toMatchObject({ + expect(responseView.statusCode).toBe(200); + expect(responseView.body).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 84ed569dbf..e1b13ed485 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 @@ -1,12 +1,13 @@ import { faker } from '@faker-js/faker'; -import { ContentType } from '@package/enums/content-type'; -import { HttpMethod } from '@package/enums/http-method'; -import { ProjectType } from '@package/enums/project-types'; -import { HTTP_SERVER, OAUTH2_CLIENT_ID, OAUTH2_CLIENT_SECRET, OAUTH2_SERVER, test } from '@package/misc/fixtures'; -import { Collection } from '@package/models/collection'; -import { Project } from '@package/models/project'; import { expect } from "@playwright/test"; +import { ContentType } from '../../enums/content-type'; +import { HttpMethod } from '../../enums/http-method'; +import { ProjectType } from '../../enums/project-types'; +import { HTTP_SERVER, OAUTH2_CLIENT_ID, OAUTH2_CLIENT_SECRET, OAUTH2_SERVER, test } from '../../misc/fixtures'; +import { Collection } from '../../models/collection'; +import { Project } from '../../models/project'; + const query = '{ characters { results { name } } }'; const body = { mimeType: ContentType.JSON, text: JSON.stringify({ query }) }; @@ -34,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.statusBar.code).toBe(200); - expect(authenticatedResponse.preview).toMatchObject({ + expect(authenticatedResponse.statusCode).toBe(200); + expect(authenticatedResponse.body).toMatchObject({ headers: expect.objectContaining({ authorization: `Bearer ${tokens.accessToken}`, }), }); - expect(unauthenticatedResponse.statusBar.code).toBe(200); - expect((unauthenticatedResponse.preview as { headers: Record }).headers).not.toHaveProperty( + expect(unauthenticatedResponse.statusCode).toBe(200); + expect((unauthenticatedResponse.body 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 c0f0ff972e..837a43bd0c 100644 --- a/packages/insomnia-test/tests/graphql-request/object-variables.spec.ts +++ b/packages/insomnia-test/tests/graphql-request/object-variables.spec.ts @@ -1,12 +1,13 @@ import { faker } from "@faker-js/faker"; -import { ContentType } from "@package/enums/content-type"; -import { HttpMethod } from "@package/enums/http-method"; -import { ProjectType } from "@package/enums/project-types"; -import { HTTP_SERVER, test } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ContentType } from "../../enums/content-type"; +import { HttpMethod } from "../../enums/http-method"; +import { ProjectType } from "../../enums/project-types"; +import { HTTP_SERVER, test } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { Project } from "../../models/project"; + const url = `${HTTP_SERVER}/graphql`; const query = "query Characters($filter: CharacterFilter) { characters(filter: $filter) { results { name status } } }"; @@ -36,8 +37,8 @@ test("Verify GraphQL Request With Object Variables", async ({ user }) => { }); const responseView = await graphqlRequestFlow.send(request); - expect(responseView.statusBar.code).toBe(200); - expect(responseView.preview).toMatchObject({ + expect(responseView.statusCode).toBe(200); + expect(responseView.body).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 975af41845..f212d9a714 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 @@ -1,12 +1,13 @@ import { faker } from "@faker-js/faker"; -import { ContentType } from "@package/enums/content-type"; -import { HttpMethod } from "@package/enums/http-method"; -import { ProjectType } from "@package/enums/project-types"; -import { HTTP_SERVER, test } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ContentType } from "../../enums/content-type"; +import { HttpMethod } from "../../enums/http-method"; +import { ProjectType } from "../../enums/project-types"; +import { HTTP_SERVER, test } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { Project } from "../../models/project"; + const query = "{ characters { results { name } } }"; const body = { mimeType: ContentType.JSON, text: JSON.stringify({ query }) }; @@ -36,8 +37,8 @@ test("Verify Pre-Request Script Adds a Header to GraphQL Request", async ({ }); const responseView = await graphqlRequestFlow.send(request); - expect(responseView.statusBar.code).toBe(200); - expect(responseView.preview).toMatchObject({ + expect(responseView.statusCode).toBe(200); + expect(responseView.body).toMatchObject({ headers: expect.objectContaining({ "x-hello": headerValue }), }); }); diff --git a/packages/insomnia-test/tests/graphql-request/proxy-settings.spec.ts b/packages/insomnia-test/tests/graphql-request/proxy-settings.spec.ts index 32755b4696..2fa7d0e94f 100644 --- a/packages/insomnia-test/tests/graphql-request/proxy-settings.spec.ts +++ b/packages/insomnia-test/tests/graphql-request/proxy-settings.spec.ts @@ -1,12 +1,13 @@ import { faker } from "@faker-js/faker"; -import { ContentType } from "@package/enums/content-type"; -import { HttpMethod } from "@package/enums/http-method"; -import { ProjectType } from "@package/enums/project-types"; -import { HTTP_SERVER, test } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ContentType } from "../../enums/content-type"; +import { HttpMethod } from "../../enums/http-method"; +import { ProjectType } from "../../enums/project-types"; +import { HTTP_SERVER, test } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { Project } from "../../models/project"; + const query = "{ characters { results { name } } }"; const body = { mimeType: ContentType.JSON, text: JSON.stringify({ query }) }; 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 4e95816a07..330c9234ec 100644 --- a/packages/insomnia-test/tests/graphql-request/schema-documentation.spec.ts +++ b/packages/insomnia-test/tests/graphql-request/schema-documentation.spec.ts @@ -1,12 +1,13 @@ import { faker } from "@faker-js/faker"; -import { ContentType } from "@package/enums/content-type"; -import { HttpMethod } from "@package/enums/http-method"; -import { ProjectType } from "@package/enums/project-types"; -import { HTTP_SERVER, test } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ContentType } from "../../enums/content-type"; +import { HttpMethod } from "../../enums/http-method"; +import { ProjectType } from "../../enums/project-types"; +import { HTTP_SERVER, test } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { Project } from "../../models/project"; + const url = `${HTTP_SERVER}/graphql`; const query = "{ characters { results { name } } }"; @@ -46,8 +47,8 @@ test("Verify GraphQL Schema Documentation Shows Field Descriptions", async ({ }), ]), }); - expect(responseView.statusBar.code).toBe(200); - expect(responseView.preview).toMatchObject({ + expect(responseView.statusCode).toBe(200); + expect(responseView.body).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 8fae1513e2..656dbfaaa1 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 @@ -1,12 +1,13 @@ import { faker } from "@faker-js/faker"; -import { ContentType } from "@package/enums/content-type"; -import { HttpMethod } from "@package/enums/http-method"; -import { ProjectType } from "@package/enums/project-types"; -import { HTTP_SERVER, test } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ContentType } from "../../enums/content-type"; +import { HttpMethod } from "../../enums/http-method"; +import { ProjectType } from "../../enums/project-types"; +import { HTTP_SERVER, test } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { Project } from "../../models/project"; + const query = "{ characters { results { name } } }"; const body = { mimeType: ContentType.JSON, text: JSON.stringify({ query }) }; @@ -37,8 +38,8 @@ test("Verify GraphQL Request Header With a Template Tag Is Resolved", async ({ }); const responseView = await graphqlRequestFlow.send(request); - expect(responseView.statusBar.code).toBe(200); - expect(responseView.preview).toMatchObject({ + expect(responseView.statusCode).toBe(200); + expect(responseView.body).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 4a981e93ba..56428a6f9c 100644 --- a/packages/insomnia-test/tests/graphql-request/tls-connection.spec.ts +++ b/packages/insomnia-test/tests/graphql-request/tls-connection.spec.ts @@ -1,12 +1,13 @@ import { faker } from "@faker-js/faker"; -import { ContentType } from "@package/enums/content-type"; -import { HttpMethod } from "@package/enums/http-method"; -import { ProjectType } from "@package/enums/project-types"; -import { HTTP_SERVER_HTTPS, test } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ContentType } from "../../enums/content-type"; +import { HttpMethod } from "../../enums/http-method"; +import { ProjectType } from "../../enums/project-types"; +import { HTTP_SERVER_HTTPS, test } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { Project } from "../../models/project"; + const query = "{ characters { results { name } } }"; const body = { mimeType: ContentType.JSON, text: JSON.stringify({ query }) }; @@ -32,8 +33,8 @@ test("Verify GraphQL Request Over a TLS Connection", async ({ user }) => { }); const responseView = await graphqlRequestFlow.send(request); - expect(responseView.statusBar.code).toBe(200); - const sent = JSON.parse((responseView.preview as { data: string }).data) as { + expect(responseView.statusCode).toBe(200); + const sent = JSON.parse((responseView.body as { data: string }).data) as { query: string; }; expect(sent.query.replace(/\s+/g, " ").trim()).toBe(query); diff --git a/packages/insomnia-test/tests/graphql-request/unlinked-environment-variable.spec.ts b/packages/insomnia-test/tests/graphql-request/unlinked-environment-variable.spec.ts index 218e11da58..2dd85e4ebe 100644 --- a/packages/insomnia-test/tests/graphql-request/unlinked-environment-variable.spec.ts +++ b/packages/insomnia-test/tests/graphql-request/unlinked-environment-variable.spec.ts @@ -1,13 +1,14 @@ import { faker } from "@faker-js/faker"; -import { ContentType } from "@package/enums/content-type"; -import { HttpMethod } from "@package/enums/http-method"; -import { ProjectType } from "@package/enums/project-types"; -import { HTTP_SERVER, test } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { EnvironmentKvPairDataType } from "@package/models/environment"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ContentType } from "../../enums/content-type"; +import { HttpMethod } from "../../enums/http-method"; +import { ProjectType } from "../../enums/project-types"; +import { HTTP_SERVER, test } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { EnvironmentKvPairDataType } from "../../models/environment"; +import { Project } from "../../models/project"; + const query = "{ characters { results { name } } }"; const body = { mimeType: ContentType.JSON, text: JSON.stringify({ query }) }; diff --git a/packages/insomnia-test/tests/grpc-request/body-environment-variable-interpolation.spec.ts b/packages/insomnia-test/tests/grpc-request/body-environment-variable-interpolation.spec.ts index 417239cf03..47a3563267 100644 --- a/packages/insomnia-test/tests/grpc-request/body-environment-variable-interpolation.spec.ts +++ b/packages/insomnia-test/tests/grpc-request/body-environment-variable-interpolation.spec.ts @@ -1,11 +1,12 @@ import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { GRPC_SERVER, test } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { EnvironmentKvPairDataType } from "@package/models/environment"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { GRPC_SERVER, test } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { EnvironmentKvPairDataType } from "../../models/environment"; +import { Project } from "../../models/project"; + test("Verify Environment Variable Interpolation Inside a gRPC Request Body", async ({ user, }) => { diff --git a/packages/insomnia-test/tests/grpc-request/cancel-in-flight-server-streaming-call.spec.ts b/packages/insomnia-test/tests/grpc-request/cancel-in-flight-server-streaming-call.spec.ts index b6f18f31e9..392db6401a 100644 --- a/packages/insomnia-test/tests/grpc-request/cancel-in-flight-server-streaming-call.spec.ts +++ b/packages/insomnia-test/tests/grpc-request/cancel-in-flight-server-streaming-call.spec.ts @@ -1,10 +1,11 @@ import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { GRPC_SERVER, test } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { GRPC_SERVER, test } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { Project } from "../../models/project"; + test("Verify Cancelling an In-Flight gRPC Server Streaming Call", async ({ user, }) => { diff --git a/packages/insomnia-test/tests/grpc-request/cancel-open-client-streaming-call.spec.ts b/packages/insomnia-test/tests/grpc-request/cancel-open-client-streaming-call.spec.ts index a8ffd7bf57..43458e60be 100644 --- a/packages/insomnia-test/tests/grpc-request/cancel-open-client-streaming-call.spec.ts +++ b/packages/insomnia-test/tests/grpc-request/cancel-open-client-streaming-call.spec.ts @@ -1,10 +1,11 @@ import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { GRPC_SERVER, test } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { GRPC_SERVER, test } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { Project } from "../../models/project"; + test("Verify Cancelling an Open gRPC Client Streaming Call", async ({ user, }) => { diff --git a/packages/insomnia-test/tests/grpc-request/commit-empty-stream.spec.ts b/packages/insomnia-test/tests/grpc-request/commit-empty-stream.spec.ts index 12748a12df..763982d59c 100644 --- a/packages/insomnia-test/tests/grpc-request/commit-empty-stream.spec.ts +++ b/packages/insomnia-test/tests/grpc-request/commit-empty-stream.spec.ts @@ -1,10 +1,11 @@ import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { GRPC_SERVER, test } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { GRPC_SERVER, test } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { Project } from "../../models/project"; + test("Verify Committing a gRPC Client Streaming Call With No Messages Sent", async ({ user, }) => { diff --git a/packages/insomnia-test/tests/grpc-request/custom-metadata-headers.spec.ts b/packages/insomnia-test/tests/grpc-request/custom-metadata-headers.spec.ts index 4cf0ba9d17..b674336d65 100644 --- a/packages/insomnia-test/tests/grpc-request/custom-metadata-headers.spec.ts +++ b/packages/insomnia-test/tests/grpc-request/custom-metadata-headers.spec.ts @@ -1,10 +1,11 @@ import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { GRPC_SERVER, test } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { GRPC_SERVER, test } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { Project } from "../../models/project"; + test("Verify Custom gRPC Metadata Headers Are Sent to the Server", async ({ user, }) => { diff --git a/packages/insomnia-test/tests/grpc-request/duplicate-grpc-request-with-streaming-method.spec.ts b/packages/insomnia-test/tests/grpc-request/duplicate-grpc-request-with-streaming-method.spec.ts index 545b92013f..ca59560eff 100644 --- a/packages/insomnia-test/tests/grpc-request/duplicate-grpc-request-with-streaming-method.spec.ts +++ b/packages/insomnia-test/tests/grpc-request/duplicate-grpc-request-with-streaming-method.spec.ts @@ -1,10 +1,11 @@ import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { GRPC_SERVER, test } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { GRPC_SERVER, test } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { Project } from "../../models/project"; + test("Verify Duplicating a gRPC Request With a Bidirectional Streaming Method Selected", async ({ user, }) => { diff --git a/packages/insomnia-test/tests/grpc-request/happy-path.spec.ts b/packages/insomnia-test/tests/grpc-request/happy-path.spec.ts index 1b01c42d5c..1c4ded0bbe 100644 --- a/packages/insomnia-test/tests/grpc-request/happy-path.spec.ts +++ b/packages/insomnia-test/tests/grpc-request/happy-path.spec.ts @@ -1,11 +1,12 @@ import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { GRPC_SERVER, test } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { EnvironmentKvPairDataType } from "@package/models/environment"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { GRPC_SERVER, test } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { EnvironmentKvPairDataType } from "../../models/environment"; +import { Project } from "../../models/project"; + test("Verify Create gRPC Request", async ({ user }) => { const { environmentFlow, grpcRequestFlow, workspaceFlow } = user.flowManager; const { workspacePage } = user.pageManager; diff --git a/packages/insomnia-test/tests/grpc-request/mtls-client-certificate.spec.ts b/packages/insomnia-test/tests/grpc-request/mtls-client-certificate.spec.ts index 98c0bdc75e..4f66544cab 100644 --- a/packages/insomnia-test/tests/grpc-request/mtls-client-certificate.spec.ts +++ b/packages/insomnia-test/tests/grpc-request/mtls-client-certificate.spec.ts @@ -1,13 +1,14 @@ import path from "node:path"; import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { certPath } from "@package/misc/certs"; -import { GRPC_SERVER_MTLS, test } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { certPath } from "../../misc/certs"; +import { GRPC_SERVER_MTLS, test } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { Project } from "../../models/project"; + test("Verify Client Certificate Toggle Controls mTLS Enforcement For gRPC Request", async ({ user, }) => { @@ -16,7 +17,7 @@ test("Verify Client Certificate Toggle Controls mTLS Enforcement For gRPC Reques await preferencesFlow.set({ validateSSL: false, - dataFolders: [path.join(import.meta.dirname, "../../misc/fixtures")], + dataFolders: [path.join(__dirname, "../../misc/fixtures")], }); const project = await workspaceFlow.createProject( diff --git a/packages/insomnia-test/tests/grpc-request/proxy-settings.spec.ts b/packages/insomnia-test/tests/grpc-request/proxy-settings.spec.ts index aeff716209..b4d5a55995 100644 --- a/packages/insomnia-test/tests/grpc-request/proxy-settings.spec.ts +++ b/packages/insomnia-test/tests/grpc-request/proxy-settings.spec.ts @@ -4,12 +4,13 @@ import * as net from "node:net"; import type { Duplex } from "node:stream"; import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { GRPC_SERVER, test } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { GRPC_SERVER, test } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { Project } from "../../models/project"; + const startRecordingProxy = async () => { const targets: string[] = []; const sockets = new Set(); diff --git a/packages/insomnia-test/tests/grpc-request/reflection-fails-on-unreachable-server.spec.ts b/packages/insomnia-test/tests/grpc-request/reflection-fails-on-unreachable-server.spec.ts index 56ce9010e5..c260f5e120 100644 --- a/packages/insomnia-test/tests/grpc-request/reflection-fails-on-unreachable-server.spec.ts +++ b/packages/insomnia-test/tests/grpc-request/reflection-fails-on-unreachable-server.spec.ts @@ -1,10 +1,11 @@ import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { test } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { test } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { Project } from "../../models/project"; + const unreachableGrpcUrl = "localhost:19999"; test("Verify gRPC Server Reflection Fails Against an Unreachable Server", async ({ diff --git a/packages/insomnia-test/tests/grpc-request/resend-after-completion.spec.ts b/packages/insomnia-test/tests/grpc-request/resend-after-completion.spec.ts index 2d6d9df192..d654dbff3e 100644 --- a/packages/insomnia-test/tests/grpc-request/resend-after-completion.spec.ts +++ b/packages/insomnia-test/tests/grpc-request/resend-after-completion.spec.ts @@ -1,10 +1,11 @@ import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { GRPC_SERVER, test } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { GRPC_SERVER, test } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { Project } from "../../models/project"; + test("Verify Re-sending a Completed gRPC Unary Request Reflects the New Body", async ({ user, }) => { diff --git a/packages/insomnia-test/tests/grpc-request/server-returns-business-error-status.spec.ts b/packages/insomnia-test/tests/grpc-request/server-returns-business-error-status.spec.ts index 6a1da8fead..2314f63a4e 100644 --- a/packages/insomnia-test/tests/grpc-request/server-returns-business-error-status.spec.ts +++ b/packages/insomnia-test/tests/grpc-request/server-returns-business-error-status.spec.ts @@ -1,10 +1,11 @@ import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { GRPC_SERVER, test } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { GRPC_SERVER, test } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { Project } from "../../models/project"; + test("Verify a gRPC Server-Side Business Error Status Is Surfaced", async ({ user, }) => { diff --git a/packages/insomnia-test/tests/grpc-request/switch-method-resets-response.spec.ts b/packages/insomnia-test/tests/grpc-request/switch-method-resets-response.spec.ts index 2f0106d8c4..b150c8e5c9 100644 --- a/packages/insomnia-test/tests/grpc-request/switch-method-resets-response.spec.ts +++ b/packages/insomnia-test/tests/grpc-request/switch-method-resets-response.spec.ts @@ -1,10 +1,11 @@ import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { GRPC_SERVER, test } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { GRPC_SERVER, test } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { Project } from "../../models/project"; + test("Verify Switching gRPC Methods Resets the Response Pane", async ({ user, }) => { diff --git a/packages/insomnia-test/tests/grpc-request/template-tag-in-body.spec.ts b/packages/insomnia-test/tests/grpc-request/template-tag-in-body.spec.ts index e85716b4bf..0cbff08afe 100644 --- a/packages/insomnia-test/tests/grpc-request/template-tag-in-body.spec.ts +++ b/packages/insomnia-test/tests/grpc-request/template-tag-in-body.spec.ts @@ -1,10 +1,11 @@ import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { GRPC_SERVER, test } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { GRPC_SERVER, test } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { Project } from "../../models/project"; + test("Verify Template Tag in gRPC Request Body Is Resolved", async ({ user, }) => { diff --git a/packages/insomnia-test/tests/grpc-request/tls-connection.spec.ts b/packages/insomnia-test/tests/grpc-request/tls-connection.spec.ts index 5dc6306d53..22dfa0fb6f 100644 --- a/packages/insomnia-test/tests/grpc-request/tls-connection.spec.ts +++ b/packages/insomnia-test/tests/grpc-request/tls-connection.spec.ts @@ -1,10 +1,11 @@ import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { GRPC_SERVER_TLS, test } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { GRPC_SERVER_TLS, test } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { Project } from "../../models/project"; + test("Verify gRPC Request Over a TLS Connection", async ({ user }) => { const { grpcRequestFlow, preferencesFlow, workspaceFlow } = user.flowManager; diff --git a/packages/insomnia-test/tests/mcp-client/api-key-authentication.spec.ts b/packages/insomnia-test/tests/mcp-client/api-key-authentication.spec.ts index 3d55d32787..03c2f83acb 100644 --- a/packages/insomnia-test/tests/mcp-client/api-key-authentication.spec.ts +++ b/packages/insomnia-test/tests/mcp-client/api-key-authentication.spec.ts @@ -1,10 +1,11 @@ import { faker } from '@faker-js/faker'; -import { ProjectType } from '@package/enums/project-types'; -import { DEFAULT_TIMEOUT, MCP_SERVER, test } from '@package/misc/fixtures'; -import { McpClient } from '@package/models/mcp-client'; -import { Project } from '@package/models/project'; import { expect } from "@playwright/test"; +import { ProjectType } from '../../enums/project-types'; +import { DEFAULT_TIMEOUT, MCP_SERVER, test } from '../../misc/fixtures'; +import { McpClient } from '../../models/mcp-client'; +import { Project } from '../../models/project'; + test('Verify MCP Client Sends the API Key Header Only When Authentication Is Configured', async ({ user }) => { const { mcpClientFlow, workspaceFlow } = user.flowManager; const { responsePage } = user.pageManager; diff --git a/packages/insomnia-test/tests/mcp-client/basic-authentication.spec.ts b/packages/insomnia-test/tests/mcp-client/basic-authentication.spec.ts index d18e7279eb..217cf59ca1 100644 --- a/packages/insomnia-test/tests/mcp-client/basic-authentication.spec.ts +++ b/packages/insomnia-test/tests/mcp-client/basic-authentication.spec.ts @@ -1,10 +1,11 @@ import { faker } from '@faker-js/faker'; -import { ProjectType } from '@package/enums/project-types'; -import { DEFAULT_TIMEOUT, MCP_SERVER, test } from '@package/misc/fixtures'; -import { McpClient } from '@package/models/mcp-client'; -import { Project } from '@package/models/project'; import { expect } from "@playwright/test"; +import { ProjectType } from '../../enums/project-types'; +import { DEFAULT_TIMEOUT, MCP_SERVER, test } from '../../misc/fixtures'; +import { McpClient } from '../../models/mcp-client'; +import { Project } from '../../models/project'; + test('Verify MCP Client Sends the Basic Authentication Header Only When Authentication Is Configured', async ({ user, }) => { diff --git a/packages/insomnia-test/tests/mcp-client/bearer-authentication.spec.ts b/packages/insomnia-test/tests/mcp-client/bearer-authentication.spec.ts index f4bf479d35..8a9411021d 100644 --- a/packages/insomnia-test/tests/mcp-client/bearer-authentication.spec.ts +++ b/packages/insomnia-test/tests/mcp-client/bearer-authentication.spec.ts @@ -1,10 +1,11 @@ import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { DEFAULT_TIMEOUT, MCP_SERVER, test } from "@package/misc/fixtures"; -import { McpClient } from "@package/models/mcp-client"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { DEFAULT_TIMEOUT, MCP_SERVER, test } from "../../misc/fixtures"; +import { McpClient } from "../../models/mcp-client"; +import { Project } from "../../models/project"; + test("Verify MCP Client Sends the Bearer Token Header Only When Authentication Is Configured", async ({ user, }) => { diff --git a/packages/insomnia-test/tests/mcp-client/disconnect-and-reconnect.spec.ts b/packages/insomnia-test/tests/mcp-client/disconnect-and-reconnect.spec.ts index e317137bf4..65be519d85 100644 --- a/packages/insomnia-test/tests/mcp-client/disconnect-and-reconnect.spec.ts +++ b/packages/insomnia-test/tests/mcp-client/disconnect-and-reconnect.spec.ts @@ -1,10 +1,11 @@ import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { DEFAULT_TIMEOUT, MCP_SERVER, test } from "@package/misc/fixtures"; -import { McpClient } from "@package/models/mcp-client"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { DEFAULT_TIMEOUT, MCP_SERVER, test } from "../../misc/fixtures"; +import { McpClient } from "../../models/mcp-client"; +import { Project } from "../../models/project"; + test("Verify Disconnecting an MCP Client Closes the Connection and It Can Reconnect", async ({ user, }) => { diff --git a/packages/insomnia-test/tests/mcp-client/environment-variable-in-url.spec.ts b/packages/insomnia-test/tests/mcp-client/environment-variable-in-url.spec.ts index e49759aef9..9f31ff4fb6 100644 --- a/packages/insomnia-test/tests/mcp-client/environment-variable-in-url.spec.ts +++ b/packages/insomnia-test/tests/mcp-client/environment-variable-in-url.spec.ts @@ -1,11 +1,12 @@ import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { DEFAULT_TIMEOUT, MCP_SERVER, test } from "@package/misc/fixtures"; -import { EnvironmentKvPairDataType } from "@package/models/environment"; -import { McpClient } from "@package/models/mcp-client"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { DEFAULT_TIMEOUT, MCP_SERVER, test } from "../../misc/fixtures"; +import { EnvironmentKvPairDataType } from "../../models/environment"; +import { McpClient } from "../../models/mcp-client"; +import { Project } from "../../models/project"; + test("Verify Environment Variable in MCP Client URL Is Resolved", async ({ user, }) => { diff --git a/packages/insomnia-test/tests/mcp-client/happy-path.spec.ts b/packages/insomnia-test/tests/mcp-client/happy-path.spec.ts index 62ed04bddd..1f736ec945 100644 --- a/packages/insomnia-test/tests/mcp-client/happy-path.spec.ts +++ b/packages/insomnia-test/tests/mcp-client/happy-path.spec.ts @@ -1,10 +1,11 @@ import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { DEFAULT_TIMEOUT, MCP_SERVER, test } from "@package/misc/fixtures"; -import { McpClient } from "@package/models/mcp-client"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { DEFAULT_TIMEOUT, MCP_SERVER, test } from "../../misc/fixtures"; +import { McpClient } from "../../models/mcp-client"; +import { Project } from "../../models/project"; + const mcpUrl = MCP_SERVER; const tool = "read_wiki_structure"; const args = { repoName: "Kong/insomnia" }; diff --git a/packages/insomnia-test/tests/mcp-client/oauth2-client-credentials-authentication.spec.ts b/packages/insomnia-test/tests/mcp-client/oauth2-client-credentials-authentication.spec.ts index 5b587653ca..897db101a5 100644 --- a/packages/insomnia-test/tests/mcp-client/oauth2-client-credentials-authentication.spec.ts +++ b/packages/insomnia-test/tests/mcp-client/oauth2-client-credentials-authentication.spec.ts @@ -1,10 +1,11 @@ import { faker } from '@faker-js/faker'; -import { ProjectType } from '@package/enums/project-types'; -import { DEFAULT_TIMEOUT, MCP_SERVER, OAUTH2_CLIENT_ID, OAUTH2_CLIENT_SECRET, OAUTH2_SERVER, test } from '@package/misc/fixtures'; -import { McpClient } from '@package/models/mcp-client'; -import { Project } from '@package/models/project'; import { expect } from "@playwright/test"; +import { ProjectType } from '../../enums/project-types'; +import { DEFAULT_TIMEOUT, MCP_SERVER, OAUTH2_CLIENT_ID, OAUTH2_CLIENT_SECRET, OAUTH2_SERVER, test } from '../../misc/fixtures'; +import { McpClient } from '../../models/mcp-client'; +import { Project } from '../../models/project'; + test('Verify MCP Client Sends the OAuth 2.0 Header Only When Authentication Is Configured', async ({ user }) => { const { mcpClientFlow, workspaceFlow } = user.flowManager; const { responsePage } = user.pageManager; diff --git a/packages/insomnia-test/tests/mcp-client/proxy-settings.spec.ts b/packages/insomnia-test/tests/mcp-client/proxy-settings.spec.ts index 56fc7522dd..629d841d30 100644 --- a/packages/insomnia-test/tests/mcp-client/proxy-settings.spec.ts +++ b/packages/insomnia-test/tests/mcp-client/proxy-settings.spec.ts @@ -4,12 +4,13 @@ import * as net from "node:net"; import type { Duplex } from "node:stream"; import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { MCP_SERVER, test } from "@package/misc/fixtures"; -import { McpClient } from "@package/models/mcp-client"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { MCP_SERVER, test } from "../../misc/fixtures"; +import { McpClient } from "../../models/mcp-client"; +import { Project } from "../../models/project"; + const startRecordingProxy = async () => { const targets: string[] = []; const sockets = new Set(); diff --git a/packages/insomnia-test/tests/mcp-client/tls-connection.spec.ts b/packages/insomnia-test/tests/mcp-client/tls-connection.spec.ts index 94fbd6f5bf..48eb8d69fe 100644 --- a/packages/insomnia-test/tests/mcp-client/tls-connection.spec.ts +++ b/packages/insomnia-test/tests/mcp-client/tls-connection.spec.ts @@ -1,11 +1,12 @@ import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { certPath } from "@package/misc/certs"; -import { MCP_SERVER_HTTPS, test } from "@package/misc/fixtures"; -import { McpClient } from "@package/models/mcp-client"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { certPath } from "../../misc/certs"; +import { MCP_SERVER_HTTPS, test } from "../../misc/fixtures"; +import { McpClient } from "../../models/mcp-client"; +import { Project } from "../../models/project"; + test("Verify MCP Client Over a TLS Connection", async ({ user }) => { const { certificatesFlow, mcpClientFlow, workspaceFlow } = user.flowManager; diff --git a/packages/insomnia-test/tests/mcp-client/unreachable-server.spec.ts b/packages/insomnia-test/tests/mcp-client/unreachable-server.spec.ts index 6c695fe391..6191ec8351 100644 --- a/packages/insomnia-test/tests/mcp-client/unreachable-server.spec.ts +++ b/packages/insomnia-test/tests/mcp-client/unreachable-server.spec.ts @@ -1,10 +1,11 @@ import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { DEFAULT_TIMEOUT, test } from "@package/misc/fixtures"; -import { McpClient } from "@package/models/mcp-client"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { DEFAULT_TIMEOUT, test } from "../../misc/fixtures"; +import { McpClient } from "../../models/mcp-client"; +import { Project } from "../../models/project"; + const unreachableUrl = "http://localhost:1/mcp"; test("Verify Connecting to an Unreachable MCP Server Lists No Tools", async ({ diff --git a/packages/insomnia-test/tests/socket-io-request/disconnect-before-server-reply.spec.ts b/packages/insomnia-test/tests/socket-io-request/disconnect-before-server-reply.spec.ts index c9f1378c20..156943f4bd 100644 --- a/packages/insomnia-test/tests/socket-io-request/disconnect-before-server-reply.spec.ts +++ b/packages/insomnia-test/tests/socket-io-request/disconnect-before-server-reply.spec.ts @@ -1,10 +1,11 @@ import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { DEFAULT_TIMEOUT, SOCKET_SERVER, test } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { DEFAULT_TIMEOUT, SOCKET_SERVER, test } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { Project } from "../../models/project"; + test("Verify Disconnecting a Socket.IO Request Before the Server Replies Delivers No Echo", async ({ user, }) => { diff --git a/packages/insomnia-test/tests/socket-io-request/duplicate-request.spec.ts b/packages/insomnia-test/tests/socket-io-request/duplicate-request.spec.ts index 748128b8e7..3b3036c8f4 100644 --- a/packages/insomnia-test/tests/socket-io-request/duplicate-request.spec.ts +++ b/packages/insomnia-test/tests/socket-io-request/duplicate-request.spec.ts @@ -1,10 +1,11 @@ import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { SOCKET_SERVER, test } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { SOCKET_SERVER, test } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { Project } from "../../models/project"; + const message = { eventName: "hello", payload: '"world"' }; test("Verify Duplicated Socket.IO Request Keeps Url and Message", async ({ diff --git a/packages/insomnia-test/tests/socket-io-request/happy-path.spec.ts b/packages/insomnia-test/tests/socket-io-request/happy-path.spec.ts index 99fed7e0e4..a182b1a5b7 100644 --- a/packages/insomnia-test/tests/socket-io-request/happy-path.spec.ts +++ b/packages/insomnia-test/tests/socket-io-request/happy-path.spec.ts @@ -1,11 +1,12 @@ import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { DEFAULT_TIMEOUT, SOCKET_SERVER, test } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { Project } from "@package/models/project"; -import type { SocketIORequest } from "@package/models/socket-io-request"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { DEFAULT_TIMEOUT, SOCKET_SERVER, test } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { Project } from "../../models/project"; +import type { SocketIORequest } from "../../models/socket-io-request"; + const socketIoUrl = SOCKET_SERVER; const message = { eventName: "hello", payload: '"world"' }; diff --git a/packages/insomnia-test/tests/socket-io-request/proxy-settings.spec.ts b/packages/insomnia-test/tests/socket-io-request/proxy-settings.spec.ts index 08b5f09ace..fe02f61296 100644 --- a/packages/insomnia-test/tests/socket-io-request/proxy-settings.spec.ts +++ b/packages/insomnia-test/tests/socket-io-request/proxy-settings.spec.ts @@ -1,10 +1,11 @@ import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { DEFAULT_TIMEOUT, SOCKET_SERVER, test } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { DEFAULT_TIMEOUT, SOCKET_SERVER, test } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { Project } from "../../models/project"; + test("Verify Enabling an Unreachable Proxy Fails the Socket.IO Connection", async ({ user, }) => { diff --git a/packages/insomnia-test/tests/socket-io-request/template-tag-in-message.spec.ts b/packages/insomnia-test/tests/socket-io-request/template-tag-in-message.spec.ts index 6c7c1b9791..b55b82034a 100644 --- a/packages/insomnia-test/tests/socket-io-request/template-tag-in-message.spec.ts +++ b/packages/insomnia-test/tests/socket-io-request/template-tag-in-message.spec.ts @@ -1,10 +1,11 @@ import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { DEFAULT_TIMEOUT, SOCKET_SERVER, test } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { DEFAULT_TIMEOUT, SOCKET_SERVER, test } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { Project } from "../../models/project"; + test("Verify Template Tag in Socket.IO Message Payload Is Resolved", async ({ user, }) => { diff --git a/packages/insomnia-test/tests/socket-io-request/tls-connection.spec.ts b/packages/insomnia-test/tests/socket-io-request/tls-connection.spec.ts index 6450be91bd..062a25e68c 100644 --- a/packages/insomnia-test/tests/socket-io-request/tls-connection.spec.ts +++ b/packages/insomnia-test/tests/socket-io-request/tls-connection.spec.ts @@ -1,11 +1,12 @@ import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { certPath } from "@package/misc/certs"; -import { DEFAULT_TIMEOUT, SOCKET_SERVER_WSS, test } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { certPath } from "../../misc/certs"; +import { DEFAULT_TIMEOUT, SOCKET_SERVER_WSS, test } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { Project } from "../../models/project"; + test("Verify Socket.IO Request Over a TLS Connection", async ({ user }) => { const { certificatesFlow, socketIoRequestFlow, workspaceFlow } = user.flowManager; diff --git a/packages/insomnia-test/tests/socket-io-request/token-authentication.spec.ts b/packages/insomnia-test/tests/socket-io-request/token-authentication.spec.ts index 7540f8dcf4..0f20369804 100644 --- a/packages/insomnia-test/tests/socket-io-request/token-authentication.spec.ts +++ b/packages/insomnia-test/tests/socket-io-request/token-authentication.spec.ts @@ -1,10 +1,11 @@ import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { DEFAULT_TIMEOUT, SOCKET_SERVER_AUTH_TOKEN, SOCKET_SERVER_PROTECTED, test } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { DEFAULT_TIMEOUT, SOCKET_SERVER_AUTH_TOKEN, SOCKET_SERVER_PROTECTED, test } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { Project } from "../../models/project"; + test("Verify Socket.IO Handshake Is Accepted With the Token and Rejected Without It", async ({ user, }) => { diff --git a/packages/insomnia-test/tests/socket-io-request/unreachable-server.spec.ts b/packages/insomnia-test/tests/socket-io-request/unreachable-server.spec.ts index b93c648663..06c62e42d9 100644 --- a/packages/insomnia-test/tests/socket-io-request/unreachable-server.spec.ts +++ b/packages/insomnia-test/tests/socket-io-request/unreachable-server.spec.ts @@ -1,10 +1,11 @@ import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { DEFAULT_TIMEOUT, test } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { DEFAULT_TIMEOUT, test } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { Project } from "../../models/project"; + test("Verify Connecting to an Unreachable Socket.IO Server Fails", async ({ user, }) => { 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 e01dd0eded..78bdc9bac4 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 @@ -1,10 +1,11 @@ import { faker } from '@faker-js/faker'; -import { ProjectType } from '@package/enums/project-types'; -import { DEFAULT_TIMEOUT, test, WS_SERVER } from '@package/misc/fixtures'; -import { Collection } from '@package/models/collection'; -import { Project } from '@package/models/project'; import { expect } from "@playwright/test"; +import { ProjectType } from '../../enums/project-types'; +import { DEFAULT_TIMEOUT, test, WS_SERVER } from '../../misc/fixtures'; +import { Collection } from '../../models/collection'; +import { Project } from '../../models/project'; + test('Verify WebSocket Connection Sends the API Key Header Until Authentication Is Set to None', async ({ user }) => { const { webSocketRequestFlow, workspaceFlow } = user.flowManager; @@ -22,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}`); @@ -32,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 ffc2a26033..0b03914fcc 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 @@ -1,10 +1,11 @@ import { faker } from '@faker-js/faker'; -import { ProjectType } from '@package/enums/project-types'; -import { DEFAULT_TIMEOUT, test, WS_SERVER } from '@package/misc/fixtures'; -import { Collection } from '@package/models/collection'; -import { Project } from '@package/models/project'; import { expect } from "@playwright/test"; +import { ProjectType } from '../../enums/project-types'; +import { DEFAULT_TIMEOUT, test, WS_SERVER } from '../../misc/fixtures'; +import { Collection } from '../../models/collection'; +import { Project } from '../../models/project'; + test('Verify WebSocket Connection Sends the Basic Authentication Header Until Authentication Is Set to None', async ({ user, }) => { @@ -24,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')}`); @@ -34,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 a5c28f71e5..f998ed1db6 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 @@ -1,10 +1,11 @@ import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { DEFAULT_TIMEOUT, test, WS_SERVER } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { DEFAULT_TIMEOUT, test, WS_SERVER } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { Project } from "../../models/project"; + test("Verify WebSocket Connection Sends the Bearer Token Header Until Authentication Is Set to None", async ({ user, }) => { @@ -28,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}`); @@ -39,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 cf45107e66..dc1c473da1 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 @@ -1,10 +1,11 @@ import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { DEFAULT_TIMEOUT, test, WS_SERVER } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { DEFAULT_TIMEOUT, test, WS_SERVER } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { Project } from "../../models/project"; + test("Verify Linked Cookie Is Sent With WebSocket Connection", async ({ user, }) => { @@ -33,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/disconnect-before-server-reply.spec.ts b/packages/insomnia-test/tests/web-socket-request/disconnect-before-server-reply.spec.ts index d53a5d32b6..efa98e7c8a 100644 --- a/packages/insomnia-test/tests/web-socket-request/disconnect-before-server-reply.spec.ts +++ b/packages/insomnia-test/tests/web-socket-request/disconnect-before-server-reply.spec.ts @@ -1,11 +1,12 @@ import { faker } from "@faker-js/faker"; -import { ContentType } from "@package/enums/content-type"; -import { ProjectType } from "@package/enums/project-types"; -import { DEFAULT_TIMEOUT, test, WS_SERVER } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ContentType } from "../../enums/content-type"; +import { ProjectType } from "../../enums/project-types"; +import { DEFAULT_TIMEOUT, test, WS_SERVER } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { Project } from "../../models/project"; + test("Verify Disconnecting a WebSocket Request Before the Server Replies Delivers No Echo", async ({ user, }) => { 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 c6445bcaed..81803be6a4 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 @@ -1,11 +1,12 @@ import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { DEFAULT_TIMEOUT, test, WS_SERVER } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { EnvironmentKvPairDataType } from "@package/models/environment"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { DEFAULT_TIMEOUT, test, WS_SERVER } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { EnvironmentKvPairDataType } from "../../models/environment"; +import { Project } from "../../models/project"; + test("Verify Environment Variable in WebSocket Request URL Is Resolved", async ({ user, }) => { @@ -43,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 8e5cf0d4f4..dd801a469a 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 @@ -1,10 +1,11 @@ import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { DEFAULT_TIMEOUT, test, WS_SERVER } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { DEFAULT_TIMEOUT, test, WS_SERVER } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { Project } from "../../models/project"; + const webSocketUrl = WS_SERVER; test("Verify Create WebSocket Request", async ({ user }) => { @@ -38,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 3e32bae9cd..f2eb614c35 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 @@ -1,10 +1,11 @@ import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { DEFAULT_TIMEOUT, test, WS_SERVER } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { DEFAULT_TIMEOUT, test, WS_SERVER } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { Project } from "../../models/project"; + test("Verify Import from URL Moves Query String Into Params and Preserves It on Connect", async ({ user, }) => { @@ -42,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 5b2779ea1e..c13209c893 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 @@ -4,12 +4,13 @@ import * as net from "node:net"; import type { Duplex } from "node:stream"; import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { DEFAULT_TIMEOUT, test, WS_SERVER } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { DEFAULT_TIMEOUT, test, WS_SERVER } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { Project } from "../../models/project"; + const startRecordingProxy = async () => { const targets: string[] = []; const sockets = new Set(); @@ -103,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/send-multiple-message-types.spec.ts b/packages/insomnia-test/tests/web-socket-request/send-multiple-message-types.spec.ts index d7318fb1e2..efc3e130ad 100644 --- a/packages/insomnia-test/tests/web-socket-request/send-multiple-message-types.spec.ts +++ b/packages/insomnia-test/tests/web-socket-request/send-multiple-message-types.spec.ts @@ -1,11 +1,12 @@ import { faker } from "@faker-js/faker"; -import { ContentType } from "@package/enums/content-type"; -import { ProjectType } from "@package/enums/project-types"; -import { DEFAULT_TIMEOUT, test, WS_SERVER } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ContentType } from "../../enums/content-type"; +import { ProjectType } from "../../enums/project-types"; +import { DEFAULT_TIMEOUT, test, WS_SERVER } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { Project } from "../../models/project"; + const webSocketUrl = WS_SERVER; test("Send Multiple Messages of Different Body Types Over an Open WebSocket Connection", async ({ 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 4b80cbf457..2d372b06b0 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 @@ -1,11 +1,12 @@ import { faker } from "@faker-js/faker"; -import { ContentType } from "@package/enums/content-type"; -import { ProjectType } from "@package/enums/project-types"; -import { DEFAULT_TIMEOUT, test, WS_SERVER } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ContentType } from "../../enums/content-type"; +import { ProjectType } from "../../enums/project-types"; +import { DEFAULT_TIMEOUT, test, WS_SERVER } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { Project } from "../../models/project"; + const tag = "{% base64 'encode', 'normal', 'abc' %}"; test("Verify Template Tags in WebSocket Header and Message Are Resolved", async ({ @@ -34,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 7707b3b976..2c575c70bd 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 @@ -1,10 +1,11 @@ import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { DEFAULT_TIMEOUT, test, WS_SERVER_WSS } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { DEFAULT_TIMEOUT, test, WS_SERVER_WSS } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { Project } from "../../models/project"; + test("Verify WebSocket Request Over a TLS Connection", async ({ user }) => { const { preferencesFlow, webSocketRequestFlow, workspaceFlow } = user.flowManager; @@ -27,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( diff --git a/packages/insomnia-test/tests/web-socket-request/unresolved-environment-variable.spec.ts b/packages/insomnia-test/tests/web-socket-request/unresolved-environment-variable.spec.ts index 11bae147d1..cbbe36fae6 100644 --- a/packages/insomnia-test/tests/web-socket-request/unresolved-environment-variable.spec.ts +++ b/packages/insomnia-test/tests/web-socket-request/unresolved-environment-variable.spec.ts @@ -1,11 +1,12 @@ import { faker } from "@faker-js/faker"; -import { ProjectType } from "@package/enums/project-types"; -import { test, WS_SERVER } from "@package/misc/fixtures"; -import { Collection } from "@package/models/collection"; -import { EnvironmentKvPairDataType } from "@package/models/environment"; -import { Project } from "@package/models/project"; import { expect } from "@playwright/test"; +import { ProjectType } from "../../enums/project-types"; +import { test, WS_SERVER } from "../../misc/fixtures"; +import { Collection } from "../../models/collection"; +import { EnvironmentKvPairDataType } from "../../models/environment"; +import { Project } from "../../models/project"; + const variableName = "unlinked"; test("Verify Unlinked Environment Variable Causes Error in WebSocket Request", async ({