mirror of
https://github.com/Kong/insomnia.git
synced 2026-11-06 04:53:59 -05:00
test(insomnia-test): add http-request, cookie and environment specs
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
18283051d2
commit
5352f19403
62 files changed
+587
-537
No files matched your search
@@ -1,11 +1,12 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
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 { 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}/cookies`;
|
||||
|
||||
test("Verify Cookie With Mismatched Path Is Not Sent With HTTP Request", async ({
|
||||
@@ -43,7 +44,7 @@ test("Verify Cookie With Mismatched Path Is Not Sent With HTTP Request", async (
|
||||
|
||||
const responseView = await httpRequestFlow.send(request);
|
||||
|
||||
const { cookies } = responseView.preview as { cookies: Record<string, string> };
|
||||
const { cookies } = responseView.body as { cookies: Record<string, string> };
|
||||
expect(cookies).not.toHaveProperty(mismatchedCookie.key);
|
||||
expect(cookies).toMatchObject({ [matchedCookie.key]: matchedCookie.value });
|
||||
});
|
||||
@@ -1,11 +1,12 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
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 { 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}/cookies`;
|
||||
|
||||
test("Verify Re-Linking Same Cookie Key Overwrites Previous Value", async ({
|
||||
@@ -39,7 +40,7 @@ test("Verify Re-Linking Same Cookie Key Overwrites Previous Value", async ({
|
||||
|
||||
const responseView = await httpRequestFlow.send(request);
|
||||
|
||||
const { cookies } = responseView.preview as { cookies: Record<string, string> };
|
||||
const { cookies } = responseView.body as { cookies: Record<string, string> };
|
||||
expect(cookieList.filter((cookie) => cookie.key === key)).toHaveLength(1);
|
||||
expect(cookieList).toMatchObject([{ key, value: freshValue }]);
|
||||
expect(cookies).toMatchObject({ [key]: freshValue });
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
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 { 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}/cookies`;
|
||||
|
||||
test("Verify Expired Cookie Is Not Sent With HTTP Request", async ({
|
||||
@@ -44,7 +45,7 @@ test("Verify Expired Cookie Is Not Sent With HTTP Request", async ({
|
||||
|
||||
const responseView = await httpRequestFlow.send(request);
|
||||
|
||||
const { cookies } = responseView.preview as { cookies: Record<string, string> };
|
||||
const { cookies } = responseView.body as { cookies: Record<string, string> };
|
||||
expect(cookies).not.toHaveProperty(expiredCookie.key);
|
||||
expect(cookies).toMatchObject({ [activeCookie.key]: activeCookie.value });
|
||||
});
|
||||
@@ -1,11 +1,12 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
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 { 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}/cookies`;
|
||||
|
||||
test("Verify Linked Cookie Is Sent With HTTP Request", async ({ user }) => {
|
||||
@@ -47,9 +48,9 @@ test("Verify Linked Cookie Is Sent With HTTP Request", async ({ user }) => {
|
||||
]);
|
||||
|
||||
const responseView = await httpRequestFlow.send(request);
|
||||
expect(responseView.statusBar.code).toBe(200);
|
||||
expect(responseView.statusCode).toBe(200);
|
||||
|
||||
const { cookies } = responseView.preview as { cookies: Record<string, string> };
|
||||
const { cookies } = responseView.body as { cookies: Record<string, string> };
|
||||
expect(Object.keys(cookies)).toHaveLength(2);
|
||||
|
||||
const expectedCookies = Object.fromEntries(
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
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 { 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}/cookies`;
|
||||
|
||||
test("Verify __Host- Prefixed Cookie Is Only Sent When Marked HostOnly", async ({
|
||||
@@ -46,7 +47,7 @@ test("Verify __Host- Prefixed Cookie Is Only Sent When Marked HostOnly", async (
|
||||
|
||||
const responseView = await httpRequestFlow.send(request);
|
||||
|
||||
const { cookies } = responseView.preview as { cookies: Record<string, string> };
|
||||
const { cookies } = responseView.body as { cookies: Record<string, string> };
|
||||
expect(cookies).toMatchObject({
|
||||
[hostOnlyCookie.key]: hostOnlyCookie.value,
|
||||
});
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
import { HttpMethod } from "@package/enums/http-method";
|
||||
import { ProjectType } from "@package/enums/project-types";
|
||||
import { HTTP_SERVER, 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 { HttpMethod } from "../../enums/http-method";
|
||||
import { ProjectType } from "../../enums/project-types";
|
||||
import { HTTP_SERVER, HTTP_SERVER_HTTPS, test } from "../../misc/fixtures";
|
||||
import { Collection } from "../../models/collection";
|
||||
import { Project } from "../../models/project";
|
||||
|
||||
test("Verify HttpOnly Cookie Flag Persists And Cookie Is Always Sent Over HTTP And HTTPS", async ({
|
||||
user,
|
||||
}) => {
|
||||
@@ -45,15 +46,15 @@ test("Verify HttpOnly Cookie Flag Persists And Cookie Is Always Sent Over HTTP A
|
||||
const httpResponse = await httpRequestFlow.send(httpRequest);
|
||||
const httpsResponse = await httpRequestFlow.send(httpsRequest);
|
||||
|
||||
expect(httpResponse.statusBar.code).toBe(200);
|
||||
const { cookies: httpCookies } = httpResponse.preview as {
|
||||
expect(httpResponse.statusCode).toBe(200);
|
||||
const { cookies: httpCookies } = httpResponse.body as {
|
||||
cookies: Record<string, string>;
|
||||
};
|
||||
expect(httpCookies).toMatchObject({
|
||||
[httpOnlyCookie.key]: httpOnlyCookie.value,
|
||||
});
|
||||
expect(httpsResponse.statusBar.code).toBe(200);
|
||||
const { cookies: httpsCookies } = httpsResponse.preview as {
|
||||
expect(httpsResponse.statusCode).toBe(200);
|
||||
const { cookies: httpsCookies } = httpsResponse.body as {
|
||||
cookies: Record<string, string>;
|
||||
};
|
||||
expect(httpsCookies).toMatchObject({
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
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 { 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}/cookies`;
|
||||
|
||||
test("Verify Editing A Cookie Via The Raw Tab Updates Its Fields And Is Sent", async ({
|
||||
@@ -40,7 +41,7 @@ test("Verify Editing A Cookie Via The Raw Tab Updates Its Fields And Is Sent", a
|
||||
await cookiePage.close();
|
||||
|
||||
const responseView = await httpRequestFlow.send(request);
|
||||
const { cookies: sentCookies } = responseView.preview as {
|
||||
const { cookies: sentCookies } = responseView.body as {
|
||||
cookies: Record<string, string>;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,25 +1,17 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
import { HttpMethod } from "@package/enums/http-method";
|
||||
import { ProjectType } from "@package/enums/project-types";
|
||||
import {
|
||||
HTTP_SERVER,
|
||||
HTTP_SERVER_HTTPS,
|
||||
RESOLVING_PROXY_HOST,
|
||||
RESOLVING_PROXY_SERVER,
|
||||
test,
|
||||
} from "@package/misc/fixtures";
|
||||
import { Collection } from "@package/models/collection";
|
||||
import { Project } from "@package/models/project";
|
||||
import { expect } from "@playwright/test";
|
||||
|
||||
// Insomnia treats `localhost` as a secure context and sends Secure cookies over
|
||||
// plain http, so reach the echo server as `insomnia.test` through the resolving proxy.
|
||||
const HTTP_URL = HTTP_SERVER.replace("localhost", RESOLVING_PROXY_HOST);
|
||||
const HTTPS_URL = HTTP_SERVER_HTTPS.replace("localhost", RESOLVING_PROXY_HOST);
|
||||
import { HttpMethod } from "../../enums/http-method";
|
||||
import { ProjectType } from "../../enums/project-types";
|
||||
import { HTTP_SERVER, HTTP_SERVER_HTTPS, test } from "../../misc/fixtures";
|
||||
import { Collection } from "../../models/collection";
|
||||
import { Project } from "../../models/project";
|
||||
|
||||
test("Verify Secure Cookie Is Sent Over HTTPS But Not Over Plain HTTP", async ({
|
||||
user,
|
||||
}) => {
|
||||
test.fail(true, 'INS-3179');
|
||||
|
||||
const { cookieFlow, httpRequestFlow, workspaceFlow, preferencesFlow } =
|
||||
user.flowManager;
|
||||
|
||||
@@ -31,37 +23,31 @@ test("Verify Secure Cookie Is Sent Over HTTPS But Not Over Plain HTTP", async ({
|
||||
new Collection(faker.string.alphanumeric(10)),
|
||||
);
|
||||
|
||||
await preferencesFlow.set({
|
||||
validateSSL: false,
|
||||
proxyEnabled: true,
|
||||
httpProxy: RESOLVING_PROXY_SERVER,
|
||||
httpsProxy: RESOLVING_PROXY_SERVER,
|
||||
noProxy: "",
|
||||
});
|
||||
await preferencesFlow.set({ validateSSL: false });
|
||||
|
||||
const httpRequest = await httpRequestFlow.create(collection, {
|
||||
name: faker.string.alphanumeric(10),
|
||||
method: HttpMethod.Get,
|
||||
url: `${HTTP_URL}/cookies`,
|
||||
url: `${HTTP_SERVER}/cookies`,
|
||||
});
|
||||
const httpsRequest = await httpRequestFlow.create(collection, {
|
||||
name: faker.string.alphanumeric(10),
|
||||
method: HttpMethod.Get,
|
||||
url: `${HTTPS_URL}/cookies`,
|
||||
url: `${HTTP_SERVER_HTTPS}/cookies`,
|
||||
});
|
||||
|
||||
const secureCookie = {
|
||||
key: faker.string.alphanumeric(8),
|
||||
value: faker.string.alphanumeric(8),
|
||||
domain: RESOLVING_PROXY_HOST,
|
||||
domain: "localhost",
|
||||
path: "/",
|
||||
secure: true,
|
||||
};
|
||||
await cookieFlow.link(httpRequest, [secureCookie]);
|
||||
|
||||
const httpsResponse = await httpRequestFlow.send(httpsRequest);
|
||||
expect(httpsResponse.statusBar.code).toBe(200);
|
||||
const { cookies: httpsCookies } = httpsResponse.preview as {
|
||||
expect(httpsResponse.statusCode).toBe(200);
|
||||
const { cookies: httpsCookies } = httpsResponse.body as {
|
||||
cookies: Record<string, string>;
|
||||
};
|
||||
expect(httpsCookies).toMatchObject({
|
||||
@@ -69,7 +55,7 @@ test("Verify Secure Cookie Is Sent Over HTTPS But Not Over Plain HTTP", async ({
|
||||
});
|
||||
|
||||
const httpResponse = await httpRequestFlow.send(httpRequest);
|
||||
const { cookies: httpCookies } = httpResponse.preview as {
|
||||
const { cookies: httpCookies } = httpResponse.body as {
|
||||
cookies: Record<string, string>;
|
||||
};
|
||||
expect(httpCookies).not.toHaveProperty(secureCookie.key);
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
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 type { HttpRequest } from "@package/models/http-request";
|
||||
import { Project } from "@package/models/project";
|
||||
import { expect } from "@playwright/test";
|
||||
|
||||
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 type { HttpRequest } from "../../models/http-request";
|
||||
import { Project } from "../../models/project";
|
||||
|
||||
const lowerCaseVariable = "caseVar";
|
||||
const upperCaseVariable = "CaseVar";
|
||||
|
||||
@@ -60,8 +61,8 @@ test("Verify Variable Names Are Case Sensitive Across Environment Levels", async
|
||||
} satisfies HttpRequest);
|
||||
|
||||
const responseView = await httpRequestFlow.send(request);
|
||||
expect(responseView.statusBar.code).toBe(200);
|
||||
expect(responseView.preview).toMatchObject({
|
||||
expect(responseView.statusCode).toBe(200);
|
||||
expect(responseView.body).toMatchObject({
|
||||
args: { lower: baseValue, upper: subValue },
|
||||
});
|
||||
});
|
||||
@@ -1,13 +1,14 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
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 type { HttpRequest } from "@package/models/http-request";
|
||||
import { Project } from "@package/models/project";
|
||||
import { expect } from "@playwright/test";
|
||||
|
||||
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 type { HttpRequest } from "../../models/http-request";
|
||||
import { Project } from "../../models/project";
|
||||
|
||||
const variableA = "a";
|
||||
const variableB = "b";
|
||||
|
||||
@@ -52,6 +53,6 @@ test("Verify Circular Variable Reference Resolves To Literal Unresolved Text", a
|
||||
} satisfies HttpRequest);
|
||||
|
||||
const responseView = await httpRequestFlow.send(request);
|
||||
expect(responseView.statusBar.code).toBe(200);
|
||||
expect(responseView.preview).toMatchObject({ args: { value: `{{${variableA}}}` } });
|
||||
expect(responseView.statusCode).toBe(200);
|
||||
expect(responseView.body).toMatchObject({ args: { value: `{{${variableA}}}` } });
|
||||
});
|
||||
+10
-9
@@ -1,13 +1,14 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
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 type { HttpRequest } from "@package/models/http-request";
|
||||
import { Project } from "@package/models/project";
|
||||
import { expect } from "@playwright/test";
|
||||
|
||||
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 type { HttpRequest } from "../../models/http-request";
|
||||
import { Project } from "../../models/project";
|
||||
|
||||
test("Verify creating and duplicating a global environment", async ({
|
||||
user,
|
||||
}) => {
|
||||
@@ -54,6 +55,6 @@ test("Verify creating and duplicating a global environment", async ({
|
||||
|
||||
expect(duplicatedEnvironment.id).not.toBe(environment.id);
|
||||
expect(duplicatedEnvironment.name).toBe(duplicatedName);
|
||||
expect(responseView.statusBar.code).toBe(200);
|
||||
expect(responseView.preview).toMatchObject({ args: { value: variableValue } });
|
||||
expect(responseView.statusCode).toBe(200);
|
||||
expect(responseView.body).toMatchObject({ args: { value: variableValue } });
|
||||
});
|
||||
+10
-9
@@ -1,13 +1,14 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
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 type { HttpRequest } from "@package/models/http-request";
|
||||
import { Project } from "@package/models/project";
|
||||
import { expect } from "@playwright/test";
|
||||
|
||||
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 type { HttpRequest } from "../../models/http-request";
|
||||
import { Project } from "../../models/project";
|
||||
|
||||
const sharedVariable = "shared";
|
||||
|
||||
test("Verify a disabled sub-environment variable falls back to the base environment's value", async ({
|
||||
@@ -59,6 +60,6 @@ test("Verify a disabled sub-environment variable falls back to the base environm
|
||||
} satisfies HttpRequest);
|
||||
const responseView = await httpRequestFlow.send(request);
|
||||
|
||||
expect(responseView.statusBar.code).toBe(200);
|
||||
expect(responseView.preview).toMatchObject({ args: { value: baseValue } });
|
||||
expect(responseView.statusCode).toBe(200);
|
||||
expect(responseView.body).toMatchObject({ args: { value: baseValue } });
|
||||
});
|
||||
@@ -1,13 +1,14 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
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 type { HttpRequest } from "@package/models/http-request";
|
||||
import { Project } from "@package/models/project";
|
||||
import { expect } from "@playwright/test";
|
||||
|
||||
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 type { HttpRequest } from "../../models/http-request";
|
||||
import { Project } from "../../models/project";
|
||||
|
||||
const leafVariable = "leaf";
|
||||
const midVariable = "mid";
|
||||
const topVariable = "top";
|
||||
@@ -62,8 +63,8 @@ test("Verify Disabled Mid-Chain Variable Leaves Reference Unresolved", async ({
|
||||
} satisfies HttpRequest);
|
||||
|
||||
const responseView = await httpRequestFlow.send(request);
|
||||
expect(responseView.statusBar.code).toBe(200);
|
||||
expect(responseView.preview).toMatchObject({
|
||||
expect(responseView.statusCode).toBe(200);
|
||||
expect(responseView.body).toMatchObject({
|
||||
args: { value: `{{${midVariable}}}` },
|
||||
});
|
||||
});
|
||||
@@ -1,13 +1,14 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
import { ProjectType } from "@package/enums/project-types";
|
||||
import { test } from "@package/misc/fixtures";
|
||||
import { expect } from "@playwright/test";
|
||||
|
||||
import { ProjectType } from "../../enums/project-types";
|
||||
import { test } from "../../misc/fixtures";
|
||||
import type {
|
||||
EnvironmentKvPairData} from "@package/models/environment";
|
||||
EnvironmentKvPairData} from "../../models/environment";
|
||||
import {
|
||||
EnvironmentKvPairDataType,
|
||||
} from "@package/models/environment";
|
||||
import { Project } from "@package/models/project";
|
||||
import { expect } from "@playwright/test";
|
||||
} from "../../models/environment";
|
||||
import { Project } from "../../models/project";
|
||||
|
||||
test("Verify Environment Raw JSON Editor Reads Back And Persists Edits", async ({
|
||||
user,
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
import { ProjectType } from "@package/enums/project-types";
|
||||
import { test } from "@package/misc/fixtures";
|
||||
import { expect } from "@playwright/test";
|
||||
|
||||
import { ProjectType } from "../../enums/project-types";
|
||||
import { test } from "../../misc/fixtures";
|
||||
import type {
|
||||
EnvironmentKvPairData} from "@package/models/environment";
|
||||
EnvironmentKvPairData} from "../../models/environment";
|
||||
import {
|
||||
EnvironmentKvPairDataType,
|
||||
} from "@package/models/environment";
|
||||
import { Project } from "@package/models/project";
|
||||
import { expect } from "@playwright/test";
|
||||
} from "../../models/environment";
|
||||
import { Project } from "../../models/project";
|
||||
|
||||
test("Verify Environment Table Editor's Blank Row Is Not Persisted And Deleting A Row Leaves No Stale Text", async ({
|
||||
user,
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
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 type { HttpRequest } from "@package/models/http-request";
|
||||
import { Project } from "@package/models/project";
|
||||
import { expect } from "@playwright/test";
|
||||
|
||||
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 type { HttpRequest } from "../../models/http-request";
|
||||
import { Project } from "../../models/project";
|
||||
|
||||
const firstVariable = "a";
|
||||
const secondVariable = "b";
|
||||
|
||||
@@ -55,8 +56,8 @@ test("Verify Multiple Variables Mixed In A Single Value Resolve Together", async
|
||||
} satisfies HttpRequest);
|
||||
|
||||
const responseView = await httpRequestFlow.send(request);
|
||||
expect(responseView.statusBar.code).toBe(200);
|
||||
expect(responseView.preview).toMatchObject({
|
||||
expect(responseView.statusCode).toBe(200);
|
||||
expect(responseView.body).toMatchObject({
|
||||
args: { value: `${firstValue}-${secondValue}` },
|
||||
});
|
||||
});
|
||||
@@ -1,13 +1,14 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
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 type { HttpRequest } from "@package/models/http-request";
|
||||
import { Project } from "@package/models/project";
|
||||
import { expect } from "@playwright/test";
|
||||
|
||||
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 type { HttpRequest } from "../../models/http-request";
|
||||
import { Project } from "../../models/project";
|
||||
|
||||
const leafVariable = "leaf";
|
||||
const midVariable = "mid";
|
||||
const topVariable = "top";
|
||||
@@ -61,6 +62,6 @@ test("Verify Multi-Level Nested Variable Resolution", async ({ user }) => {
|
||||
} satisfies HttpRequest);
|
||||
|
||||
const responseView = await httpRequestFlow.send(request);
|
||||
expect(responseView.statusBar.code).toBe(200);
|
||||
expect(responseView.preview).toMatchObject({ args: { value: finalValue } });
|
||||
expect(responseView.statusCode).toBe(200);
|
||||
expect(responseView.body).toMatchObject({ args: { value: finalValue } });
|
||||
});
|
||||
+11
-10
@@ -1,17 +1,18 @@
|
||||
import * as crypto from "node:crypto";
|
||||
|
||||
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 { 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 {
|
||||
ENVIRONMENT_TYPE,
|
||||
EnvironmentKvPairDataType,
|
||||
} from "@package/models/environment";
|
||||
import { Project } from "@package/models/project";
|
||||
import { expect } from "@playwright/test";
|
||||
} from "../../models/environment";
|
||||
import { Project } from "../../models/project";
|
||||
|
||||
const testWithVaultKey = test.extend({
|
||||
vaultKey: async ({}, use) => {
|
||||
@@ -82,8 +83,8 @@ testWithVaultKey(
|
||||
});
|
||||
const responseView = await httpRequestFlow.send(request!);
|
||||
|
||||
expect(responseView.statusBar.code).toBe(200);
|
||||
expect((responseView.preview as { data: string }).data).toBe(
|
||||
expect(responseView.statusCode).toBe(200);
|
||||
expect((responseView.body as { data: string }).data).toBe(
|
||||
`${secretValueFoo}\n${secretValueHello}`,
|
||||
);
|
||||
},
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
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 type { HttpRequest } from "@package/models/http-request";
|
||||
import { Project } from "@package/models/project";
|
||||
import { expect } from "@playwright/test";
|
||||
|
||||
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 type { HttpRequest } from "../../models/http-request";
|
||||
import { Project } from "../../models/project";
|
||||
|
||||
const selfVariable = "a";
|
||||
|
||||
test("Verify Self-Referencing Variable Resolves To Literal Unresolved Text", async ({
|
||||
@@ -44,8 +45,8 @@ test("Verify Self-Referencing Variable Resolves To Literal Unresolved Text", asy
|
||||
} satisfies HttpRequest);
|
||||
|
||||
const responseView = await httpRequestFlow.send(request);
|
||||
expect(responseView.statusBar.code).toBe(200);
|
||||
expect(responseView.preview).toMatchObject({
|
||||
expect(responseView.statusCode).toBe(200);
|
||||
expect(responseView.body).toMatchObject({
|
||||
args: { value: `{{${selfVariable}}}` },
|
||||
});
|
||||
});
|
||||
+12
-11
@@ -1,13 +1,14 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
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 type { HttpRequest } from "@package/models/http-request";
|
||||
import { Project } from "@package/models/project";
|
||||
import { expect } from "@playwright/test";
|
||||
|
||||
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 type { HttpRequest } from "../../models/http-request";
|
||||
import { Project } from "../../models/project";
|
||||
|
||||
const sharedVariable = "shared";
|
||||
|
||||
test("Verify an empty sub-environment falls back to the base environment until it defines its own value", async ({
|
||||
@@ -65,8 +66,8 @@ test("Verify an empty sub-environment falls back to the base environment until i
|
||||
]);
|
||||
const afterOwnValue = await httpRequestFlow.send(request);
|
||||
|
||||
expect(beforeOwnValue.statusBar.code).toBe(200);
|
||||
expect(beforeOwnValue.preview).toMatchObject({ args: { value: baseValue } });
|
||||
expect(afterOwnValue.statusBar.code).toBe(200);
|
||||
expect(afterOwnValue.preview).toMatchObject({ args: { value: subValue } });
|
||||
expect(beforeOwnValue.statusCode).toBe(200);
|
||||
expect(beforeOwnValue.body).toMatchObject({ args: { value: baseValue } });
|
||||
expect(afterOwnValue.statusCode).toBe(200);
|
||||
expect(afterOwnValue.body).toMatchObject({ args: { value: subValue } });
|
||||
});
|
||||
@@ -1,13 +1,14 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
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 type { HttpRequest } from "@package/models/http-request";
|
||||
import { Project } from "@package/models/project";
|
||||
import { expect } from "@playwright/test";
|
||||
|
||||
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 type { HttpRequest } from "../../models/http-request";
|
||||
import { Project } from "../../models/project";
|
||||
|
||||
const sharedVariable = "shared";
|
||||
|
||||
test("Verify Sub Environment Variable Overrides Base Environment", async ({
|
||||
@@ -58,6 +59,6 @@ test("Verify Sub Environment Variable Overrides Base Environment", async ({
|
||||
url: `${HTTP_SERVER}/post?value={{${sharedVariable}}}`,
|
||||
} satisfies HttpRequest);
|
||||
const responseView = await httpRequestFlow.send(request);
|
||||
expect(responseView.statusBar.code).toBe(200);
|
||||
expect(responseView.preview).toMatchObject({ args: { value: subValue } });
|
||||
expect(responseView.statusCode).toBe(200);
|
||||
expect(responseView.body).toMatchObject({ args: { value: subValue } });
|
||||
});
|
||||
@@ -1,13 +1,14 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
import { ProjectType } from "@package/enums/project-types";
|
||||
import { test } from "@package/misc/fixtures";
|
||||
import { expect } from "@playwright/test";
|
||||
|
||||
import { ProjectType } from "../../enums/project-types";
|
||||
import { test } from "../../misc/fixtures";
|
||||
import type {
|
||||
EnvironmentKvPairData} from "@package/models/environment";
|
||||
EnvironmentKvPairData} from "../../models/environment";
|
||||
import {
|
||||
EnvironmentKvPairDataType,
|
||||
} from "@package/models/environment";
|
||||
import { Project } from "@package/models/project";
|
||||
import { expect } from "@playwright/test";
|
||||
} from "../../models/environment";
|
||||
import { Project } from "../../models/project";
|
||||
|
||||
test("Verify Disabling A Row In The Table Editor Is Reflected On Read-Back", async ({
|
||||
user,
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
import { HttpMethod } from "@package/enums/http-method";
|
||||
import { ProjectType } from "@package/enums/project-types";
|
||||
import { MOCK_API_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 { HttpMethod } from "../../enums/http-method";
|
||||
import { ProjectType } from "../../enums/project-types";
|
||||
import { MOCK_API_SERVER, test } 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", async ({ user }) => {
|
||||
|
||||
+12
-11
@@ -2,15 +2,16 @@ import * as crypto from "node:crypto";
|
||||
import path from "node:path";
|
||||
|
||||
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 { expect } from "@playwright/test";
|
||||
|
||||
import { ProjectType } from "../../../enums/project-types";
|
||||
import { test } from "../../../misc/fixtures";
|
||||
import { Collection } from "../../../models/collection";
|
||||
import {
|
||||
ENVIRONMENT_TYPE,
|
||||
EnvironmentKvPairDataType,
|
||||
} from "@package/models/environment";
|
||||
import { Project } from "@package/models/project";
|
||||
import { expect } from "@playwright/test";
|
||||
} from "../../../models/environment";
|
||||
import { Project } from "../../../models/project";
|
||||
|
||||
const testWithVaultKey = test.extend({
|
||||
vaultKey: async ({}, use) => {
|
||||
@@ -57,7 +58,7 @@ testWithVaultKey(
|
||||
|
||||
await importFlow.importFile(
|
||||
project,
|
||||
path.join(import.meta.dirname, "vault-legacy-formats.yaml"),
|
||||
path.join(__dirname, "vault-legacy-formats.yaml"),
|
||||
);
|
||||
const collection = new Collection("Vault Legacy Format Collection");
|
||||
await environmentFlow.link(collection, secretEnvironment);
|
||||
@@ -73,12 +74,12 @@ testWithVaultKey(
|
||||
await environmentFlow.activate(collection, "base with vault");
|
||||
const invalidRequest = await httpRequestFlow.get("legacy-invalid-vault");
|
||||
|
||||
expect(arrayResponse.statusBar.code).toBe(200);
|
||||
expect((arrayResponse.preview as { data: string }).data).toBe(
|
||||
expect(arrayResponse.statusCode).toBe(200);
|
||||
expect((arrayResponse.body as { data: string }).data).toBe(
|
||||
"vault_array_a\nvault_array_b",
|
||||
);
|
||||
expect(objectResponse.statusBar.code).toBe(200);
|
||||
expect((objectResponse.preview as { data: string }).data).toBe("secv1\nsecv2");
|
||||
expect(objectResponse.statusCode).toBe(200);
|
||||
expect((objectResponse.body as { data: string }).data).toBe("secv1\nsecv2");
|
||||
await expect(httpRequestFlow.send(invalidRequest!)).rejects.toThrow(
|
||||
/vault is a reserved key for insomnia vault/,
|
||||
);
|
||||
|
||||
+8
-7
@@ -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 { 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 { DEFAULT_TIMEOUT, HTTP_SERVER, test } from '../../misc/fixtures';
|
||||
import { Collection } from '../../models/collection';
|
||||
import { Project } from '../../models/project';
|
||||
|
||||
const url = `${HTTP_SERVER}/post`;
|
||||
|
||||
test('Verify insomnia.test/insomnia.expect report PASS/FAIL results, including a transient variable and insomnia.response accessors', async ({
|
||||
@@ -53,7 +54,7 @@ test('Verify insomnia.test/insomnia.expect report PASS/FAIL results, including a
|
||||
});
|
||||
const responseView = await httpRequestFlow.send(request);
|
||||
|
||||
expect(responseView.statusBar.code).toBe(200);
|
||||
expect(responseView.statusCode).toBe(200);
|
||||
await expect
|
||||
.poll(() => responseView.tests?.(), { timeout: DEFAULT_TIMEOUT })
|
||||
.toEqual(
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
import path from "node:path";
|
||||
|
||||
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 type { HttpRequest } from "@package/models/http-request";
|
||||
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 type { HttpRequest } from "../../models/http-request";
|
||||
import { Project } from "../../models/project";
|
||||
|
||||
const url = `${HTTP_SERVER}/post`;
|
||||
const uploadFilePath = path.join(
|
||||
import.meta.dirname,
|
||||
__dirname,
|
||||
"..",
|
||||
"..",
|
||||
"misc",
|
||||
@@ -49,7 +50,7 @@ test("Send HTTP Request with x-www-form-urlencoded Body", async ({ user }) => {
|
||||
|
||||
const persisted = await httpRequestFlow.create(collection, request);
|
||||
const responseView = await httpRequestFlow.send(request);
|
||||
const raw = (responseView.preview as { data: string }).data;
|
||||
const raw = (responseView.body as { data: string }).data;
|
||||
|
||||
expect(persisted.body?.mimeType).toBe(ContentType.Form);
|
||||
expect(persisted.body?.params).toMatchObject([
|
||||
@@ -57,12 +58,12 @@ test("Send HTTP Request with x-www-form-urlencoded Body", async ({ user }) => {
|
||||
{ name: "userId", value: userId },
|
||||
{ name: "excluded", disabled: true },
|
||||
]);
|
||||
expect(responseView.statusBar.code).toBe(200);
|
||||
expect(responseView.statusCode).toBe(200);
|
||||
expect(Object.fromEntries(new URLSearchParams(raw))).toEqual({
|
||||
title,
|
||||
userId,
|
||||
});
|
||||
expect(responseView.preview).toMatchObject({
|
||||
expect(responseView.body).toMatchObject({
|
||||
headers: expect.objectContaining({
|
||||
"content-type": expect.stringContaining(ContentType.Form),
|
||||
}),
|
||||
@@ -93,8 +94,8 @@ test("Send HTTP Request with JSON Body", async ({ user }) => {
|
||||
const responseView = await httpRequestFlow.send(request);
|
||||
|
||||
expect(persisted).toMatchObject(request);
|
||||
expect(responseView.statusBar.code).toBe(200);
|
||||
expect(responseView.preview).toMatchObject({
|
||||
expect(responseView.statusCode).toBe(200);
|
||||
expect(responseView.body).toMatchObject({
|
||||
json: payload,
|
||||
headers: expect.objectContaining({
|
||||
"content-type": expect.stringContaining(ContentType.JSON),
|
||||
@@ -127,8 +128,8 @@ test("Send HTTP Request with XML Body", async ({ user }) => {
|
||||
const responseView = await httpRequestFlow.send(request);
|
||||
|
||||
expect(persisted).toMatchObject(request);
|
||||
expect(responseView.statusBar.code).toBe(200);
|
||||
expect(responseView.preview).toMatchObject({
|
||||
expect(responseView.statusCode).toBe(200);
|
||||
expect(responseView.body).toMatchObject({
|
||||
data: xml,
|
||||
headers: expect.objectContaining({
|
||||
"content-type": expect.stringContaining(ContentType.XML),
|
||||
@@ -163,8 +164,8 @@ test("Send HTTP Request with No Body explicitly selected", async ({ user }) => {
|
||||
url: request.url,
|
||||
body: undefined,
|
||||
});
|
||||
expect(responseView.statusBar.code).toBe(200);
|
||||
expect(responseView.preview).toMatchObject({
|
||||
expect(responseView.statusCode).toBe(200);
|
||||
expect(responseView.body).toMatchObject({
|
||||
data: "",
|
||||
json: null,
|
||||
});
|
||||
@@ -203,7 +204,7 @@ test("Send HTTP Request with multipart/form-data Body including a file field", a
|
||||
await httpRequestFlow.create(collection, request);
|
||||
const persisted = await httpRequestFlow.get(request.name);
|
||||
const responseView = await httpRequestFlow.send(request);
|
||||
const raw = (responseView.preview as { data: string }).data;
|
||||
const raw = (responseView.body as { data: string }).data;
|
||||
|
||||
expect(persisted?.body?.mimeType).toBe(ContentType.Multipart);
|
||||
expect(persisted?.body?.params?.[0]).toMatchObject({
|
||||
@@ -212,12 +213,12 @@ test("Send HTTP Request with multipart/form-data Body including a file field", a
|
||||
});
|
||||
expect(persisted?.body?.params?.[1]?.name).toBe("upload");
|
||||
expect(persisted?.body?.params?.[1]?.fileName).toContain("upload-sample.txt");
|
||||
expect(responseView.statusBar.code).toBe(200);
|
||||
expect(responseView.statusCode).toBe(200);
|
||||
expect(raw).toContain('name="title"');
|
||||
expect(raw).toContain(title);
|
||||
expect(raw).toContain('name="upload"; filename="upload-sample.txt"');
|
||||
expect(raw).toContain("insomnia-e2e-upload-fixture");
|
||||
expect(responseView.preview).toMatchObject({
|
||||
expect(responseView.body).toMatchObject({
|
||||
headers: expect.objectContaining({
|
||||
"content-type": expect.stringContaining(ContentType.Multipart),
|
||||
}),
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
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 { 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";
|
||||
|
||||
test("Verify Cancelling an In-Flight HTTP Request Shows a Cancellation Message and a Later Request Still Succeeds", async ({
|
||||
user,
|
||||
}) => {
|
||||
@@ -50,6 +51,6 @@ test("Verify Cancelling an In-Flight HTTP Request Shows a Cancellation Message a
|
||||
const laterResponse = await httpRequestFlow.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);
|
||||
});
|
||||
@@ -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}/post`;
|
||||
const bodyJsonPathFilter = "b64::JC5kYXRh::46b";
|
||||
|
||||
@@ -50,6 +51,6 @@ test("Verify A Response Tag Chain Resolves Through Multiple Requests", async ({
|
||||
|
||||
const responseView = await httpRequestFlow.send(third);
|
||||
|
||||
expect(responseView.statusBar.code).toBe(200);
|
||||
expect(responseView.preview).toMatchObject({ data: "first and second and third" });
|
||||
expect(responseView.statusCode).toBe(200);
|
||||
expect(responseView.body).toMatchObject({ data: "first and second and third" });
|
||||
});
|
||||
@@ -1,13 +1,14 @@
|
||||
|
||||
import { faker } from "@faker-js/faker";
|
||||
import { HttpMethod } from "@package/enums/http-method";
|
||||
import { ProjectType } from "@package/enums/project-types";
|
||||
import { certPath } from "@package/misc/certs";
|
||||
import { DEFAULT_TIMEOUT, HTTP_SERVER_CUSTOM_CA_HTTPS, test } from "@package/misc/fixtures";
|
||||
import { Collection } from "@package/models/collection";
|
||||
import { Project } from "@package/models/project";
|
||||
import { expect } from "@playwright/test";
|
||||
|
||||
import { HttpMethod } from "../../enums/http-method";
|
||||
import { ProjectType } from "../../enums/project-types";
|
||||
import { certPath } from "../../misc/certs";
|
||||
import { DEFAULT_TIMEOUT, HTTP_SERVER_CUSTOM_CA_HTTPS, test } from "../../misc/fixtures";
|
||||
import { Collection } from "../../models/collection";
|
||||
import { Project } from "../../models/project";
|
||||
|
||||
const url = `${HTTP_SERVER_CUSTOM_CA_HTTPS}/post`;
|
||||
|
||||
test("Verify Custom CA Root Certificate Establishes Trust For HTTPS Request", async ({
|
||||
@@ -29,9 +30,9 @@ test("Verify Custom CA Root Certificate Establishes Trust For HTTPS Request", as
|
||||
url,
|
||||
});
|
||||
const responseBeforeCa = await httpRequestFlow.send(requestBeforeCa);
|
||||
expect(responseBeforeCa.statusBar.code).toBeUndefined();
|
||||
expect(responseBeforeCa.statusCode).toBeUndefined();
|
||||
await expect
|
||||
.poll(() => responseBeforeCa.console(), { timeout: DEFAULT_TIMEOUT })
|
||||
.poll(() => responseBeforeCa.console?.(), { timeout: DEFAULT_TIMEOUT })
|
||||
.toMatch(/unable to get local issuer certificate/i);
|
||||
|
||||
await certificatesFlow.setCaCertificate(
|
||||
@@ -45,8 +46,8 @@ test("Verify Custom CA Root Certificate Establishes Trust For HTTPS Request", as
|
||||
url,
|
||||
});
|
||||
const responseAfterCa = await httpRequestFlow.send(requestAfterCa);
|
||||
expect(responseAfterCa.statusBar.code).toBe(200);
|
||||
expect(responseAfterCa.preview).toMatchObject({
|
||||
expect(responseAfterCa.statusCode).toBe(200);
|
||||
expect(responseAfterCa.body).toMatchObject({
|
||||
headers: expect.objectContaining({ host: "localhost:4062" }),
|
||||
});
|
||||
});
|
||||
@@ -1,12 +1,13 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
import { HttpMethod } from "@package/enums/http-method";
|
||||
import { ProjectType } from "@package/enums/project-types";
|
||||
import { DEFAULT_TIMEOUT, HTTP_SERVER, test } from "@package/misc/fixtures";
|
||||
import { Collection } from "@package/models/collection";
|
||||
import { Folder } from "@package/models/folder";
|
||||
import { Project } from "@package/models/project";
|
||||
import { expect } from "@playwright/test";
|
||||
|
||||
import { HttpMethod } from "../../enums/http-method";
|
||||
import { ProjectType } from "../../enums/project-types";
|
||||
import { DEFAULT_TIMEOUT, HTTP_SERVER, test } from "../../misc/fixtures";
|
||||
import { Collection } from "../../models/collection";
|
||||
import { Folder } from "../../models/folder";
|
||||
import { Project } from "../../models/project";
|
||||
|
||||
const url = `${HTTP_SERVER}/post`;
|
||||
|
||||
test("Verify a folder-level script wrapping insomnia.variables.replaceIn resolves synchronously for a downstream request consuming it without await", async ({
|
||||
@@ -44,9 +45,9 @@ test("Verify a folder-level script wrapping insomnia.variables.replaceIn resolve
|
||||
const responseView = await httpRequestFlow.send(request);
|
||||
|
||||
await expect
|
||||
.poll(() => responseView.console(), { timeout: DEFAULT_TIMEOUT })
|
||||
.poll(() => responseView.console?.(), { timeout: DEFAULT_TIMEOUT })
|
||||
.toMatch(/log: string \S+/);
|
||||
const consoleText = await responseView.console();
|
||||
const consoleText = await responseView.console?.();
|
||||
expect(consoleText).not.toContain("Promise");
|
||||
expect(consoleText).not.toContain("undefined");
|
||||
});
|
||||
+6
-5
@@ -1,11 +1,12 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
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 { 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}/get`;
|
||||
|
||||
test("Verify switching the Generate Code dialog's target language and client library regenerates the snippet", async ({
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
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 { 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}/post`;
|
||||
|
||||
test("Verify Generate Code Produces A Matching cURL Snippet", async ({
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
import { HttpMethod } from "@package/enums/http-method";
|
||||
import { ProjectType } from "@package/enums/project-types";
|
||||
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 { HttpMethod } from "../../enums/http-method";
|
||||
import { ProjectType } from "../../enums/project-types";
|
||||
import { DEFAULT_TIMEOUT, HTTP_SERVER, test } 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 Send", async ({
|
||||
user,
|
||||
}) => {
|
||||
@@ -42,9 +43,9 @@ test("Verify Import from URL Moves Query String Into Params and Preserves It on
|
||||
expect.objectContaining({ name: paramName2, value: paramValue2 }),
|
||||
]),
|
||||
);
|
||||
expect(responseView.statusBar.code).toBe(200);
|
||||
expect(responseView.statusCode).toBe(200);
|
||||
await expect
|
||||
.poll(() => responseView.console(), { timeout: DEFAULT_TIMEOUT })
|
||||
.poll(() => responseView.console?.(), { timeout: DEFAULT_TIMEOUT })
|
||||
.toContain(
|
||||
`Preparing request to ${baseUrl}?${paramName1}=${paramValue1}&${paramName2}=${paramValue2}`,
|
||||
);
|
||||
|
||||
@@ -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 { 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 { test } from "../../misc/fixtures";
|
||||
import { Collection } from "../../models/collection";
|
||||
import { Project } from "../../models/project";
|
||||
|
||||
const url = "http://[::1]:4060/post";
|
||||
|
||||
test("Verify HTTP request succeeds against a local IPv6 address", async ({
|
||||
@@ -31,7 +32,7 @@ test("Verify HTTP request succeeds against a local IPv6 address", async ({
|
||||
});
|
||||
const responseView = await httpRequestFlow.send(request!);
|
||||
|
||||
expect(responseView.statusBar.code).toBe(200);
|
||||
expect(responseView.statusBar.message).toBe("OK");
|
||||
expect(responseView.preview).toMatchObject({ data: bodyText });
|
||||
expect(responseView.statusCode).toBe(200);
|
||||
expect(responseView.statusMessage).toBe("OK");
|
||||
expect(responseView.body).toMatchObject({ data: bodyText });
|
||||
});
|
||||
@@ -1,11 +1,12 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
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 { 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";
|
||||
|
||||
test("Verify Trailing Blank Row In Headers And Params Is Not Persisted Until Typed Into", async ({
|
||||
user,
|
||||
}) => {
|
||||
@@ -38,7 +39,7 @@ test("Verify Trailing Blank Row In Headers And Params Is Not Persisted Until Typ
|
||||
const paramsAfter = await httpRequestPage.getParams();
|
||||
|
||||
const isBlank = (pair: { name: string; value: string }) =>
|
||||
[pair.name, pair.value].every((text) => text === "");
|
||||
pair.name === "" && pair.value === "";
|
||||
|
||||
expect(request).toBeDefined();
|
||||
expect(headersBefore.some(isBlank)).toBe(false);
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
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 type { HttpRequest } from "@package/models/http-request";
|
||||
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 type { HttpRequest } from "../../models/http-request";
|
||||
import { Project } from "../../models/project";
|
||||
|
||||
const url = `${HTTP_SERVER}/post`;
|
||||
|
||||
test("Verify LiquidJS control flow tags render correctly", async ({ user }) => {
|
||||
@@ -48,8 +49,8 @@ test("Verify LiquidJS control flow tags render correctly", async ({ user }) => {
|
||||
} satisfies HttpRequest);
|
||||
const responseView = await httpRequestFlow.send(request);
|
||||
|
||||
expect(responseView.statusBar.code).toBe(200);
|
||||
expect(responseView.preview).toMatchObject({
|
||||
expect(responseView.statusCode).toBe(200);
|
||||
expect(responseView.body).toMatchObject({
|
||||
data: `${envValue}-big-123-yes`,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
import path from "node:path";
|
||||
|
||||
import { faker } from "@faker-js/faker";
|
||||
import { HttpMethod } from "@package/enums/http-method";
|
||||
import { ProjectType } from "@package/enums/project-types";
|
||||
import { certPath } from "@package/misc/certs";
|
||||
import { DEFAULT_TIMEOUT, HTTP_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 { HttpMethod } from "../../enums/http-method";
|
||||
import { ProjectType } from "../../enums/project-types";
|
||||
import { certPath } from "../../misc/certs";
|
||||
import { DEFAULT_TIMEOUT, HTTP_SERVER_MTLS, test } from "../../misc/fixtures";
|
||||
import { Collection } from "../../models/collection";
|
||||
import { Project } from "../../models/project";
|
||||
|
||||
const url = `${HTTP_SERVER_MTLS}/post`;
|
||||
|
||||
test("Verify Client Certificate Toggle Controls mTLS Enforcement For HTTP Request", async ({
|
||||
@@ -19,7 +20,7 @@ test("Verify Client Certificate Toggle Controls mTLS Enforcement For HTTP 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(
|
||||
@@ -36,9 +37,9 @@ test("Verify Client Certificate Toggle Controls mTLS Enforcement For HTTP Reques
|
||||
url,
|
||||
});
|
||||
const responseBeforeCert = await httpRequestFlow.send(requestBeforeCert);
|
||||
expect(responseBeforeCert.statusBar.code).toBeUndefined();
|
||||
expect(responseBeforeCert.statusCode).toBeUndefined();
|
||||
await expect
|
||||
.poll(() => responseBeforeCert.console(), { timeout: DEFAULT_TIMEOUT })
|
||||
.poll(() => responseBeforeCert.console?.(), { timeout: DEFAULT_TIMEOUT })
|
||||
.toMatch(/certificate required/i);
|
||||
|
||||
await certificatesFlow.addClientCertificate(collection, {
|
||||
@@ -53,8 +54,8 @@ test("Verify Client Certificate Toggle Controls mTLS Enforcement For HTTP Reques
|
||||
url,
|
||||
});
|
||||
const responseWithCert = await httpRequestFlow.send(requestWithCert);
|
||||
expect(responseWithCert.statusBar.code).toBe(200);
|
||||
expect(responseWithCert.preview).toMatchObject({
|
||||
expect(responseWithCert.statusCode).toBe(200);
|
||||
expect(responseWithCert.body).toMatchObject({
|
||||
headers: expect.objectContaining({ host: "localhost:4063" }),
|
||||
});
|
||||
|
||||
@@ -70,8 +71,8 @@ test("Verify Client Certificate Toggle Controls mTLS Enforcement For HTTP Reques
|
||||
url,
|
||||
});
|
||||
const responseAfterDisable = await httpRequestFlow.send(requestAfterDisable);
|
||||
expect(responseAfterDisable.statusBar.code).toBeUndefined();
|
||||
expect(responseAfterDisable.statusCode).toBeUndefined();
|
||||
await expect
|
||||
.poll(() => responseAfterDisable.console(), { timeout: DEFAULT_TIMEOUT })
|
||||
.poll(() => responseAfterDisable.console?.(), { timeout: DEFAULT_TIMEOUT })
|
||||
.toMatch(/certificate required/i);
|
||||
});
|
||||
@@ -1,12 +1,13 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
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 type { AuthTypeOAuth1 } from "@package/models/http-request";
|
||||
import { Project } from "@package/models/project";
|
||||
import { expect } from "@playwright/test";
|
||||
|
||||
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 type { AuthTypeOAuth1 } from "../../models/http-request";
|
||||
import { Project } from "../../models/project";
|
||||
|
||||
test("Verify OAuth 1.0 auth fields persist and sign the sent request", async ({
|
||||
user,
|
||||
}) => {
|
||||
@@ -39,10 +40,10 @@ test("Verify OAuth 1.0 auth fields persist and sign the sent request", async ({
|
||||
});
|
||||
|
||||
const responseView = await httpRequestFlow.send(request);
|
||||
const authHeader = (responseView.preview as { headers: Record<string, string> })
|
||||
const authHeader = (responseView.body as { headers: Record<string, string> })
|
||||
.headers.authorization;
|
||||
|
||||
expect(responseView.statusBar.code).toBe(200);
|
||||
expect(responseView.statusCode).toBe(200);
|
||||
expect(authHeader).toContain("OAuth ");
|
||||
expect(authHeader).toContain(
|
||||
`oauth_consumer_key="${authentication.consumerKey}"`,
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
import { HttpMethod } from "@package/enums/http-method";
|
||||
import { ProjectType } from "@package/enums/project-types";
|
||||
import { OAUTH2_CLIENT_ID, OAUTH2_CLIENT_SECRET, OAUTH2_SERVER, test } from "@package/misc/fixtures";
|
||||
import { Collection } from "@package/models/collection";
|
||||
import type { AuthTypeOAuth2 } from "@package/models/http-request";
|
||||
import { Project } from "@package/models/project";
|
||||
import { expect } from "@playwright/test";
|
||||
|
||||
import { HttpMethod } from "../../enums/http-method";
|
||||
import { ProjectType } from "../../enums/project-types";
|
||||
import { OAUTH2_CLIENT_ID, OAUTH2_CLIENT_SECRET, OAUTH2_SERVER, test } from "../../misc/fixtures";
|
||||
import { Collection } from "../../models/collection";
|
||||
import type { AuthTypeOAuth2 } from "../../models/http-request";
|
||||
import { Project } from "../../models/project";
|
||||
|
||||
for (const pkceMethod of ["S256", "plain"] as const) {
|
||||
test(`Verify Authorization Code grant with PKCE (${pkceMethod}) is verified server-side and authorizes the sent request`, async ({
|
||||
user,
|
||||
@@ -48,14 +49,14 @@ for (const pkceMethod of ["S256", "plain"] as const) {
|
||||
).json();
|
||||
|
||||
const responseView = await httpRequestFlow.send(request);
|
||||
const body = responseView.preview as { authorization?: string };
|
||||
const body = responseView.body as { authorization?: string };
|
||||
|
||||
expect(tokens.accessToken).not.toBe("");
|
||||
expect(lastTokenRequest.grantType).toBe("authorization_code");
|
||||
expect(lastTokenRequest.pkceUsed).toBe(true);
|
||||
expect(lastTokenRequest.pkceMethod).toBe(pkceMethod);
|
||||
expect(lastTokenRequest.pkceVerified).toBe(true);
|
||||
expect(responseView.statusBar.code).toBe(200);
|
||||
expect(responseView.statusCode).toBe(200);
|
||||
expect(body.authorization).toBe(`Bearer ${tokens.accessToken}`);
|
||||
});
|
||||
}
|
||||
@@ -1,12 +1,13 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
import { HttpMethod } from "@package/enums/http-method";
|
||||
import { ProjectType } from "@package/enums/project-types";
|
||||
import { OAUTH2_CLIENT_ID, OAUTH2_CLIENT_SECRET, OAUTH2_SERVER, test } from "@package/misc/fixtures";
|
||||
import { Collection } from "@package/models/collection";
|
||||
import type { AuthTypeOAuth2 } from "@package/models/http-request";
|
||||
import { Project } from "@package/models/project";
|
||||
import { expect } from "@playwright/test";
|
||||
|
||||
import { HttpMethod } from "../../enums/http-method";
|
||||
import { ProjectType } from "../../enums/project-types";
|
||||
import { OAUTH2_CLIENT_ID, OAUTH2_CLIENT_SECRET, OAUTH2_SERVER, test } from "../../misc/fixtures";
|
||||
import { Collection } from "../../models/collection";
|
||||
import type { AuthTypeOAuth2 } from "../../models/http-request";
|
||||
import { Project } from "../../models/project";
|
||||
|
||||
test("Verify Authorization Code grant fetches tokens via a popup and authorizes the sent request", async ({
|
||||
user,
|
||||
}) => {
|
||||
@@ -45,13 +46,13 @@ test("Verify Authorization Code grant fetches tokens via a popup and authorizes
|
||||
).json();
|
||||
|
||||
const responseView = await httpRequestFlow.send(request);
|
||||
const body = responseView.preview as { authorization?: string };
|
||||
const body = responseView.body as { authorization?: string };
|
||||
|
||||
expect(tokens.accessToken).not.toBe("");
|
||||
expect(tokens.refreshToken).not.toBe("");
|
||||
expect(tokens.identityToken).not.toBe("");
|
||||
expect(lastTokenRequest.grantType).toBe("authorization_code");
|
||||
expect(lastTokenRequest.pkceUsed).toBe(false);
|
||||
expect(responseView.statusBar.code).toBe(200);
|
||||
expect(responseView.statusCode).toBe(200);
|
||||
expect(body.authorization).toBe(`Bearer ${tokens.accessToken}`);
|
||||
});
|
||||
@@ -1,12 +1,13 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
import { HttpMethod } from "@package/enums/http-method";
|
||||
import { ProjectType } from "@package/enums/project-types";
|
||||
import { OAUTH2_CLIENT_ID, OAUTH2_CLIENT_SECRET, OAUTH2_SERVER, test } from "@package/misc/fixtures";
|
||||
import { Collection } from "@package/models/collection";
|
||||
import type { AuthTypeOAuth2 } from "@package/models/http-request";
|
||||
import { Project } from "@package/models/project";
|
||||
import { expect } from "@playwright/test";
|
||||
|
||||
import { HttpMethod } from "../../enums/http-method";
|
||||
import { ProjectType } from "../../enums/project-types";
|
||||
import { OAUTH2_CLIENT_ID, OAUTH2_CLIENT_SECRET, OAUTH2_SERVER, test } from "../../misc/fixtures";
|
||||
import { Collection } from "../../models/collection";
|
||||
import type { AuthTypeOAuth2 } from "../../models/http-request";
|
||||
import { Project } from "../../models/project";
|
||||
|
||||
test("Verify Client Credentials grant fetches tokens with no popup and authorizes the sent request", async ({
|
||||
user,
|
||||
insomnia,
|
||||
@@ -46,11 +47,11 @@ test("Verify Client Credentials grant fetches tokens with no popup and authorize
|
||||
).json();
|
||||
|
||||
const responseView = await httpRequestFlow.send(request);
|
||||
const body = responseView.preview as { authorization?: string };
|
||||
const body = responseView.body as { authorization?: string };
|
||||
|
||||
expect(tokens.accessToken).not.toBe("");
|
||||
expect(windowsAfterFetch).toBe(windowsBeforeFetch);
|
||||
expect(lastTokenRequest.grantType).toBe("client_credentials");
|
||||
expect(responseView.statusBar.code).toBe(200);
|
||||
expect(responseView.statusCode).toBe(200);
|
||||
expect(body.authorization).toBe(`Bearer ${tokens.accessToken}`);
|
||||
});
|
||||
@@ -1,13 +1,14 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
import { AuthType } from "@package/enums/auth-type";
|
||||
import { HttpMethod } from "@package/enums/http-method";
|
||||
import { ProjectType } from "@package/enums/project-types";
|
||||
import { OAUTH2_CLIENT_ID, OAUTH2_CLIENT_SECRET, OAUTH2_SERVER, test } from "@package/misc/fixtures";
|
||||
import { Collection } from "@package/models/collection";
|
||||
import { Folder } from "@package/models/folder";
|
||||
import { Project } from "@package/models/project";
|
||||
import { expect } from "@playwright/test";
|
||||
|
||||
import { AuthType } from "../../enums/auth-type";
|
||||
import { HttpMethod } from "../../enums/http-method";
|
||||
import { ProjectType } from "../../enums/project-types";
|
||||
import { OAUTH2_CLIENT_ID, OAUTH2_CLIENT_SECRET, OAUTH2_SERVER, test } from "../../misc/fixtures";
|
||||
import { Collection } from "../../models/collection";
|
||||
import { Folder } from "../../models/folder";
|
||||
import { Project } from "../../models/project";
|
||||
|
||||
test("Verify a request set to Inherit from parent picks up its folder's OAuth 2.0 authentication", async ({
|
||||
user,
|
||||
}) => {
|
||||
@@ -44,9 +45,9 @@ test("Verify a request set to Inherit from parent picks up its folder's OAuth 2.
|
||||
await httpRequestPage.auth.setAuthType(AuthType.Inherit);
|
||||
|
||||
const responseView = await httpRequestFlow.send(request);
|
||||
const body = responseView.preview as { authorization?: string };
|
||||
const body = responseView.body as { authorization?: string };
|
||||
|
||||
expect(folderTokens.accessToken).not.toBe("");
|
||||
expect(responseView.statusBar.code).toBe(200);
|
||||
expect(responseView.statusCode).toBe(200);
|
||||
expect(body.authorization).toBe(`Bearer ${folderTokens.accessToken}`);
|
||||
});
|
||||
@@ -1,12 +1,13 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
import { HttpMethod } from "@package/enums/http-method";
|
||||
import { ProjectType } from "@package/enums/project-types";
|
||||
import { OAUTH2_CLIENT_ID, OAUTH2_SERVER, test } from "@package/misc/fixtures";
|
||||
import { Collection } from "@package/models/collection";
|
||||
import type { AuthTypeOAuth2 } from "@package/models/http-request";
|
||||
import { Project } from "@package/models/project";
|
||||
import { expect } from "@playwright/test";
|
||||
|
||||
import { HttpMethod } from "../../enums/http-method";
|
||||
import { ProjectType } from "../../enums/project-types";
|
||||
import { OAUTH2_CLIENT_ID, OAUTH2_SERVER, test } from "../../misc/fixtures";
|
||||
import { Collection } from "../../models/collection";
|
||||
import type { AuthTypeOAuth2 } from "../../models/http-request";
|
||||
import { Project } from "../../models/project";
|
||||
|
||||
test("Verify Implicit grant with response type ID Token fetches only an identity token", async ({
|
||||
user,
|
||||
}) => {
|
||||
@@ -75,10 +76,10 @@ test("Verify Implicit grant with response type ID and Access Token authorizes th
|
||||
const tokens = await httpRequestFlow.fetchOAuth2Tokens(request);
|
||||
|
||||
const responseView = await httpRequestFlow.send(request);
|
||||
const body = responseView.preview as { authorization?: string };
|
||||
const body = responseView.body as { authorization?: string };
|
||||
|
||||
expect(tokens.identityToken).not.toBe("");
|
||||
expect(tokens.accessToken).not.toBe("");
|
||||
expect(responseView.statusBar.code).toBe(200);
|
||||
expect(responseView.statusCode).toBe(200);
|
||||
expect(body.authorization).toBe(`Bearer ${tokens.accessToken}`);
|
||||
});
|
||||
@@ -1,12 +1,13 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
import { HttpMethod } from "@package/enums/http-method";
|
||||
import { ProjectType } from "@package/enums/project-types";
|
||||
import { OAUTH2_CLIENT_ID, OAUTH2_CLIENT_SECRET, OAUTH2_PASSWORD, OAUTH2_SERVER, OAUTH2_USERNAME, test } from "@package/misc/fixtures";
|
||||
import { Collection } from "@package/models/collection";
|
||||
import type { AuthTypeOAuth2 } from "@package/models/http-request";
|
||||
import { Project } from "@package/models/project";
|
||||
import { expect } from "@playwright/test";
|
||||
|
||||
import { HttpMethod } from "../../enums/http-method";
|
||||
import { ProjectType } from "../../enums/project-types";
|
||||
import { OAUTH2_CLIENT_ID, OAUTH2_CLIENT_SECRET, OAUTH2_PASSWORD, OAUTH2_SERVER, OAUTH2_USERNAME, test } from "../../misc/fixtures";
|
||||
import { Collection } from "../../models/collection";
|
||||
import type { AuthTypeOAuth2 } from "../../models/http-request";
|
||||
import { Project } from "../../models/project";
|
||||
|
||||
test("Verify Resource Owner Password Credentials grant fetches tokens with no popup and authorizes the sent request", async ({
|
||||
user,
|
||||
insomnia,
|
||||
@@ -48,12 +49,12 @@ test("Verify Resource Owner Password Credentials grant fetches tokens with no po
|
||||
).json();
|
||||
|
||||
const responseView = await httpRequestFlow.send(request);
|
||||
const body = responseView.preview as { authorization?: string };
|
||||
const body = responseView.body as { authorization?: string };
|
||||
|
||||
expect(tokens.accessToken).not.toBe("");
|
||||
expect(tokens.refreshToken).not.toBe("");
|
||||
expect(windowsAfterFetch).toBe(windowsBeforeFetch);
|
||||
expect(lastTokenRequest.grantType).toBe("password");
|
||||
expect(responseView.statusBar.code).toBe(200);
|
||||
expect(responseView.statusCode).toBe(200);
|
||||
expect(body.authorization).toBe(`Bearer ${tokens.accessToken}`);
|
||||
});
|
||||
@@ -1,12 +1,13 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
import { HttpMethod } from "@package/enums/http-method";
|
||||
import { ProjectType } from "@package/enums/project-types";
|
||||
import { OAUTH2_CLIENT_ID, OAUTH2_CLIENT_SECRET, OAUTH2_SERVER, test } from "@package/misc/fixtures";
|
||||
import { Collection } from "@package/models/collection";
|
||||
import type { AuthTypeOAuth2 } from "@package/models/http-request";
|
||||
import { Project } from "@package/models/project";
|
||||
import { expect } from "@playwright/test";
|
||||
|
||||
import { HttpMethod } from "../../enums/http-method";
|
||||
import { ProjectType } from "../../enums/project-types";
|
||||
import { OAUTH2_CLIENT_ID, OAUTH2_CLIENT_SECRET, OAUTH2_SERVER, test } from "../../misc/fixtures";
|
||||
import { Collection } from "../../models/collection";
|
||||
import type { AuthTypeOAuth2 } from "../../models/http-request";
|
||||
import { Project } from "../../models/project";
|
||||
|
||||
test("Verify refreshing an existing OAuth 2.0 token issues a new access token without reopening the authorization window", async ({
|
||||
user,
|
||||
insomnia,
|
||||
|
||||
+9
-8
@@ -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}/post`;
|
||||
|
||||
test("Verify pending async work in a pre-request script (Promise, setTimeout, sendRequest callback/await) is settled before the request is sent, and a synchronous replaceIn call in the same script is unaffected by it", async ({
|
||||
@@ -76,8 +77,8 @@ test("Verify pending async work in a pre-request script (Promise, setTimeout, se
|
||||
});
|
||||
const responseView = await httpRequestFlow.send(request);
|
||||
|
||||
expect(responseView.statusBar.code).toBe(200);
|
||||
expect(responseView.preview).toMatchObject({
|
||||
expect(responseView.statusCode).toBe(200);
|
||||
expect(responseView.body).toMatchObject({
|
||||
json: {
|
||||
asyncDoneViaPromise: true,
|
||||
asyncDoneViaTimeout: true,
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { faker } from '@faker-js/faker';
|
||||
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 { 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';
|
||||
|
||||
test('Verify pre-request script manages cookies via insomnia.cookies.jar() and they are sent with the request', async ({
|
||||
user,
|
||||
}) => {
|
||||
@@ -34,8 +35,8 @@ test('Verify pre-request script manages cookies via insomnia.cookies.jar() and t
|
||||
});
|
||||
const responseView = await httpRequestFlow.send(request);
|
||||
|
||||
expect(responseView.statusBar.code).toBe(200);
|
||||
expect(responseView.preview).toEqual({
|
||||
expect(responseView.statusCode).toBe(200);
|
||||
expect(responseView.body).toEqual({
|
||||
cookies: { [keptName]: keptValue, [objectName]: objectValue },
|
||||
});
|
||||
});
|
||||
@@ -1,11 +1,12 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
import { HttpMethod } from "@package/enums/http-method";
|
||||
import { ProjectType } from "@package/enums/project-types";
|
||||
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 { HttpMethod } from "../../enums/http-method";
|
||||
import { ProjectType } from "../../enums/project-types";
|
||||
import { DEFAULT_TIMEOUT, HTTP_SERVER, test } from "../../misc/fixtures";
|
||||
import { Collection } from "../../models/collection";
|
||||
import { Project } from "../../models/project";
|
||||
|
||||
const url = `${HTTP_SERVER}/post`;
|
||||
|
||||
test("Verify a thrown error in pre-request script surfaces in the response console", async ({
|
||||
@@ -31,7 +32,7 @@ test("Verify a thrown error in pre-request script surfaces in the response conso
|
||||
const responseView = await httpRequestFlow.send(request);
|
||||
|
||||
await expect
|
||||
.poll(() => responseView.console(), { timeout: DEFAULT_TIMEOUT })
|
||||
.poll(() => responseView.console?.(), { timeout: DEFAULT_TIMEOUT })
|
||||
.toContain(errorMessage);
|
||||
});
|
||||
|
||||
@@ -57,6 +58,6 @@ test("Verify accessing an invalid field in pre-request script surfaces in the re
|
||||
const responseView = await httpRequestFlow.send(request);
|
||||
|
||||
await expect
|
||||
.poll(() => responseView.console(), { timeout: DEFAULT_TIMEOUT })
|
||||
.poll(() => responseView.console?.(), { timeout: DEFAULT_TIMEOUT })
|
||||
.toContain("Cannot read properties of undefined (reading 'set')");
|
||||
});
|
||||
+9
-8
@@ -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}/post`;
|
||||
|
||||
test("Verify pre-request script overrides base environment values through the environment chain and persists set/get variables", async ({
|
||||
@@ -60,8 +61,8 @@ test("Verify pre-request script overrides base environment values through the en
|
||||
});
|
||||
const responseView = await httpRequestFlow.send(request);
|
||||
|
||||
expect(responseView.statusBar.code).toBe(200);
|
||||
expect(responseView.preview).toMatchObject({
|
||||
expect(responseView.statusCode).toBe(200);
|
||||
expect(responseView.body).toMatchObject({
|
||||
json: {
|
||||
fallbackToBase: fallbackValue,
|
||||
scriptValue: envScriptValue,
|
||||
|
||||
+9
-8
@@ -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}/post`;
|
||||
|
||||
test("Verify pre-request script can eval() and require Node built-in modules, external modules, and insomnia-collection classes", async ({
|
||||
@@ -99,8 +100,8 @@ test("Verify pre-request script can eval() and require Node built-in modules, ex
|
||||
});
|
||||
const responseView = await httpRequestFlow.send(request);
|
||||
|
||||
expect(responseView.statusBar.code).toBe(200);
|
||||
expect(responseView.preview).toMatchObject({
|
||||
expect(responseView.statusCode).toBe(200);
|
||||
expect(responseView.body).toMatchObject({
|
||||
json: {
|
||||
evalResult: 16,
|
||||
hash: parsedUrl.hash,
|
||||
|
||||
+16
-15
@@ -1,11 +1,12 @@
|
||||
import { faker } from '@faker-js/faker';
|
||||
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 { 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}/post`;
|
||||
|
||||
test('Verify pre-request script manipulates request headers, query params and body via insomnia.request', async ({
|
||||
@@ -40,8 +41,8 @@ test('Verify pre-request script manipulates request headers, query params and bo
|
||||
});
|
||||
const responseView = await httpRequestFlow.send(request);
|
||||
|
||||
expect(responseView.statusBar.code).toBe(200);
|
||||
expect(responseView.preview).toMatchObject({
|
||||
expect(responseView.statusCode).toBe(200);
|
||||
expect(responseView.body).toMatchObject({
|
||||
data: rawContent,
|
||||
args: { added: addedParam, keepMe: updatedParam },
|
||||
headers: expect.objectContaining({
|
||||
@@ -49,8 +50,8 @@ test('Verify pre-request script manipulates request headers, query params and bo
|
||||
'x-upsert': upsertedValue,
|
||||
}),
|
||||
});
|
||||
expect((responseView.preview as { args: Record<string, string>; headers: object }).args).not.toHaveProperty('removeMe');
|
||||
expect((responseView.preview as { args: Record<string, string>; headers: object }).headers).not.toHaveProperty('x-remove');
|
||||
expect((responseView.body as { args: Record<string, string>; headers: object }).args).not.toHaveProperty('removeMe');
|
||||
expect((responseView.body as { args: Record<string, string>; headers: object }).headers).not.toHaveProperty('x-remove');
|
||||
});
|
||||
|
||||
test('Verify pre-request script sets bearer auth via insomnia.request.auth', async ({ user }) => {
|
||||
@@ -77,8 +78,8 @@ test('Verify pre-request script sets bearer auth via insomnia.request.auth', asy
|
||||
});
|
||||
const responseView = await httpRequestFlow.send(request);
|
||||
|
||||
expect(responseView.statusBar.code).toBe(200);
|
||||
expect(responseView.preview).toMatchObject({
|
||||
expect(responseView.statusCode).toBe(200);
|
||||
expect(responseView.body).toMatchObject({
|
||||
headers: expect.objectContaining({
|
||||
authorization: `${prefix} ${token}`,
|
||||
}),
|
||||
@@ -110,8 +111,8 @@ test('Verify pre-request script sets basic auth via insomnia.request.auth', asyn
|
||||
const responseView = await httpRequestFlow.send(request);
|
||||
|
||||
const expectedEncodedCredentials = Buffer.from(`${username}:${password}`, 'utf8').toString('base64');
|
||||
expect(responseView.statusBar.code).toBe(200);
|
||||
expect(responseView.preview).toMatchObject({
|
||||
expect(responseView.statusCode).toBe(200);
|
||||
expect(responseView.body).toMatchObject({
|
||||
headers: expect.objectContaining({
|
||||
authorization: `Basic ${expectedEncodedCredentials}`,
|
||||
}),
|
||||
@@ -155,11 +156,11 @@ test('Verify pre-request script applies apikey, AWS v4, Hawk and OAuth 1.0 auth
|
||||
responses[authName] = await httpRequestFlow.send(request);
|
||||
}
|
||||
|
||||
const headersOf = (name: string) => (responses[name].preview as { headers: Record<string, string> }).headers;
|
||||
const headersOf = (name: string) => (responses[name].body as { headers: Record<string, string> }).headers;
|
||||
expect(headersOf('apiKeyHeader')).toMatchObject({
|
||||
[apiKeyName.toLowerCase()]: apiKeyValue,
|
||||
});
|
||||
expect(responses.apiKeyQuery.preview).toMatchObject({
|
||||
expect(responses.apiKeyQuery.body).toMatchObject({
|
||||
args: { [apiKeyName]: apiKeyValue },
|
||||
});
|
||||
expect(headersOf('awsV4').authorization).toContain(`AWS4-HMAC-SHA256 Credential=${accessKey}/`);
|
||||
|
||||
+9
-8
@@ -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}/post`;
|
||||
|
||||
test("Verify pre-request script's sendRequest serializes raw, urlencoded, graphql, and formdata bodies correctly", async ({
|
||||
@@ -49,14 +50,14 @@ test("Verify pre-request script's sendRequest serializes raw, urlencoded, graphq
|
||||
const responseView = await httpRequestFlow.send(request);
|
||||
|
||||
const results = (
|
||||
responseView.preview as { json: { results: Record<string, string> } }
|
||||
responseView.body as { json: { results: Record<string, string> } }
|
||||
).json.results;
|
||||
const raw = JSON.parse(results.raw);
|
||||
const urlencoded = JSON.parse(results.urlencoded);
|
||||
const graphql = JSON.parse(results.graphql);
|
||||
const formdata = JSON.parse(results.formdata);
|
||||
|
||||
expect(responseView.statusBar.code).toBe(200);
|
||||
expect(responseView.statusCode).toBe(200);
|
||||
expect(raw.data).toBe(rawValue);
|
||||
expect(urlencoded.data).toBe("a=1&b=2");
|
||||
expect(graphql.json).toMatchObject({
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
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 type { CurlCommand } from "@package/models/curl-command";
|
||||
import type { HttpRequest } from "@package/models/http-request";
|
||||
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 type { CurlCommand } from "../../models/curl-command";
|
||||
import type { HttpRequest } from "../../models/http-request";
|
||||
import { Project } from "../../models/project";
|
||||
|
||||
const url = `${HTTP_SERVER}/post`;
|
||||
const body = `{"title": "${faker.string.alphanumeric(8)}"}`;
|
||||
const command = `curl -X QUERY "${url}" -H "Content-Type: application/json" -d '${body}'`;
|
||||
@@ -36,6 +37,6 @@ test("Verify sending a QUERY request with a body", async ({ user }) => {
|
||||
method: HttpMethod.Query,
|
||||
body: { mimeType: ContentType.JSON, text: body },
|
||||
} satisfies HttpRequest);
|
||||
expect(responseView.statusBar.code).toBe(200);
|
||||
expect(responseView.preview).toMatchObject({ data: body });
|
||||
expect(responseView.statusCode).toBe(200);
|
||||
expect(responseView.body).toMatchObject({ data: body });
|
||||
});
|
||||
+18
-18
@@ -1,12 +1,13 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
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 { 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";
|
||||
|
||||
test("Verify query params from the URL, template tags, and the Parameters tab are merged and special characters are escaped correctly", async ({
|
||||
user,
|
||||
}) => {
|
||||
@@ -52,21 +53,20 @@ test("Verify query params from the URL, template tags, and the Parameters tab ar
|
||||
name: faker.string.alphanumeric(10),
|
||||
method: HttpMethod.Post,
|
||||
url: `${HTTP_SERVER}/post?key=fromUrl&key={{ fromUrlValue }}`,
|
||||
params: [
|
||||
{ name: "key", value: "{{ fromEditorValue }}" },
|
||||
{ name: "key", value: "/" },
|
||||
{ name: "space", value: spaceValue },
|
||||
{ name: "ampersand", value: ampersandValue },
|
||||
{ name: "equals", value: equalsValue },
|
||||
{ name: "hash", value: hashValue },
|
||||
{ name: "chinese", value: chineseValue },
|
||||
],
|
||||
});
|
||||
|
||||
await httpRequestFlow.setParamsBulk(request, [
|
||||
{ name: "key", value: "{{ fromEditorValue }}" },
|
||||
{ name: "key", value: "/" },
|
||||
{ name: "space", value: spaceValue },
|
||||
{ name: "ampersand", value: ampersandValue },
|
||||
{ name: "equals", value: equalsValue },
|
||||
{ name: "hash", value: hashValue },
|
||||
{ name: "chinese", value: chineseValue },
|
||||
]);
|
||||
const responseView = await httpRequestFlow.send(request);
|
||||
|
||||
expect(responseView.statusBar.code).toBe(200);
|
||||
expect(responseView.preview).toMatchObject({
|
||||
expect(responseView.statusCode).toBe(200);
|
||||
expect(responseView.body).toMatchObject({
|
||||
args: {
|
||||
key: ["fromUrl", fromUrlValue, fromEditorValue, "/"],
|
||||
space: spaceValue,
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
import { HttpMethod } from "@package/enums/http-method";
|
||||
import { ProjectType } from "@package/enums/project-types";
|
||||
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 { HttpMethod } from "../../enums/http-method";
|
||||
import { ProjectType } from "../../enums/project-types";
|
||||
import { DEFAULT_TIMEOUT, HTTP_SERVER, test } from "../../misc/fixtures";
|
||||
import { Collection } from "../../models/collection";
|
||||
import { Project } from "../../models/project";
|
||||
|
||||
const url = `${HTTP_SERVER}/post`;
|
||||
|
||||
test("Verify insomnia.environment.replaceIn resolves and returns a string synchronously", async ({
|
||||
@@ -36,9 +37,9 @@ test("Verify insomnia.environment.replaceIn resolves and returns a string synchr
|
||||
const responseView = await httpRequestFlow.send(request);
|
||||
|
||||
await expect
|
||||
.poll(() => responseView.console(), { timeout: DEFAULT_TIMEOUT })
|
||||
.poll(() => responseView.console?.(), { timeout: DEFAULT_TIMEOUT })
|
||||
.toContain(`log: string ${variableValue}`);
|
||||
const consoleText = await responseView.console();
|
||||
const consoleText = await responseView.console?.();
|
||||
expect(consoleText).not.toContain("Promise");
|
||||
});
|
||||
|
||||
@@ -70,6 +71,6 @@ test("Verify a script that awaits insomnia.environment.replaceIn as a workaround
|
||||
const responseView = await httpRequestFlow.send(request);
|
||||
|
||||
await expect
|
||||
.poll(() => responseView.console(), { timeout: DEFAULT_TIMEOUT })
|
||||
.poll(() => responseView.console?.(), { timeout: DEFAULT_TIMEOUT })
|
||||
.toContain(`log: string ${variableValue}`);
|
||||
});
|
||||
@@ -1,11 +1,12 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
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 { 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";
|
||||
|
||||
test("Verify the cookie Tag Reads a Value from a Linked Cookie", async ({
|
||||
user,
|
||||
}) => {
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
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 { 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";
|
||||
|
||||
test("Verify Switching an Existing Tag's Argument Updates its Live Preview", async ({
|
||||
user,
|
||||
}) => {
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
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 type { HttpRequest } from "@package/models/http-request";
|
||||
import { Project } from "@package/models/project";
|
||||
import { expect } from "@playwright/test";
|
||||
import type { AWSCredentialType, HashiCorpCredentialType, HashiCorpVaultAuthMethod } from "insomnia-data";
|
||||
import {
|
||||
AWSCredentialType,
|
||||
HashiCorpCredentialType,
|
||||
HashiCorpVaultAuthMethod,
|
||||
} from "insomnia-data";
|
||||
|
||||
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 type { HttpRequest } from "../../models/http-request";
|
||||
import { Project } from "../../models/project";
|
||||
|
||||
test("Verify AWS/GCP/HashiCorp Cloud Credentials Resolve via the Vault Template Tag", async ({
|
||||
user,
|
||||
@@ -34,7 +39,7 @@ test("Verify AWS/GCP/HashiCorp Cloud Credentials Resolve via the Vault Template
|
||||
provider: "aws",
|
||||
name: awsCredentialName,
|
||||
credentials: {
|
||||
type: "file" as AWSCredentialType.file,
|
||||
type: AWSCredentialType.file,
|
||||
section: faker.string.alphanumeric(8),
|
||||
region: faker.string.alphanumeric(8),
|
||||
},
|
||||
@@ -48,8 +53,8 @@ test("Verify AWS/GCP/HashiCorp Cloud Credentials Resolve via the Vault Template
|
||||
provider: "hashicorp",
|
||||
name: hashicorpCredentialName,
|
||||
credentials: {
|
||||
type: "onPrem" as HashiCorpCredentialType.onPrem,
|
||||
authMethod: "appRole" as HashiCorpVaultAuthMethod.appRole,
|
||||
type: HashiCorpCredentialType.onPrem,
|
||||
authMethod: HashiCorpVaultAuthMethod.appRole,
|
||||
serverAddress: "http://127.0.0.1",
|
||||
role_id: faker.string.alphanumeric(8),
|
||||
secret_id: faker.string.alphanumeric(8),
|
||||
@@ -94,12 +99,12 @@ test("Verify AWS/GCP/HashiCorp Cloud Credentials Resolve via the Vault Template
|
||||
expect(awsResult.preview).toBe("aws-secret-value");
|
||||
expect(gcpResult.preview).toBe("gcp-secret-value");
|
||||
expect(hashicorpResult.preview).toBe("hashicorp-secret-value");
|
||||
expect((responseView.preview as { data: string }).data).toContain("aws-secret-value");
|
||||
expect((responseView.preview as { data: string }).data).toContain("gcp-secret-value");
|
||||
expect((responseView.preview as { data: string }).data).toContain(
|
||||
expect((responseView.body as { data: string }).data).toContain("aws-secret-value");
|
||||
expect((responseView.body as { data: string }).data).toContain("gcp-secret-value");
|
||||
expect((responseView.body as { data: string }).data).toContain(
|
||||
"hashicorp-secret-value",
|
||||
);
|
||||
expect((secondResponse.preview as { data: string }).data).toContain(
|
||||
expect((secondResponse.body as { data: string }).data).toContain(
|
||||
"aws-secret-value",
|
||||
);
|
||||
});
|
||||
+8
-7
@@ -1,14 +1,15 @@
|
||||
import path from "node:path";
|
||||
|
||||
import { faker } from "@faker-js/faker";
|
||||
import { HttpMethod } from "@package/enums/http-method";
|
||||
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";
|
||||
|
||||
const filePath = path.join(import.meta.dirname, "fixture.txt");
|
||||
import { HttpMethod } from "../../../enums/http-method";
|
||||
import { ProjectType } from "../../../enums/project-types";
|
||||
import { test } from "../../../misc/fixtures";
|
||||
import { Collection } from "../../../models/collection";
|
||||
import { Project } from "../../../models/project";
|
||||
|
||||
const filePath = path.join(__dirname, "fixture.txt");
|
||||
|
||||
test("Verify the file Tag Reads Contents from an Allowed Folder", async ({
|
||||
user,
|
||||
@@ -16,7 +17,7 @@ test("Verify the file Tag Reads Contents from an Allowed Folder", async ({
|
||||
const { workspaceFlow, httpRequestFlow, preferencesFlow, templateTagFlow } =
|
||||
user.flowManager;
|
||||
|
||||
await preferencesFlow.set({ dataFolders: [import.meta.dirname] });
|
||||
await preferencesFlow.set({ dataFolders: [__dirname] });
|
||||
|
||||
const project = await workspaceFlow.createProject(
|
||||
new Project(faker.string.alphanumeric(10), ProjectType.Local),
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
import { HttpMethod } from "@package/enums/http-method";
|
||||
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 { HttpMethod } from "../../enums/http-method";
|
||||
import { ProjectType } from "../../enums/project-types";
|
||||
import { test } from "../../misc/fixtures";
|
||||
import { Collection } from "../../models/collection";
|
||||
import { Project } from "../../models/project";
|
||||
|
||||
test("Verify Inserting a Template Tag and Reading its Live Preview", async ({
|
||||
user,
|
||||
}) => {
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
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 { 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";
|
||||
|
||||
test("Verify a Header With a Templated Name Resolves and Sends Correctly", async ({
|
||||
user,
|
||||
}) => {
|
||||
@@ -32,8 +33,8 @@ test("Verify a Header With a Templated Name Resolves and Sends Correctly", async
|
||||
});
|
||||
const responseView = await httpRequestFlow.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-7cd8e9f98e9104085ea06e39b87faf36": "plain-value",
|
||||
}),
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
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 { 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}/post`;
|
||||
|
||||
test("Verify a Header With a Template Tag in Its Value", async ({ user }) => {
|
||||
@@ -32,7 +33,7 @@ test("Verify a Header With a Template Tag in Its Value", async ({ user }) => {
|
||||
});
|
||||
const responseView = await httpRequestFlow.send(request!);
|
||||
|
||||
expect(responseView.preview).toMatchObject({
|
||||
expect(responseView.body).toMatchObject({
|
||||
headers: expect.objectContaining({
|
||||
"x-header-name": "aGVhZGVyLXZhbHVl",
|
||||
}),
|
||||
|
||||
Reference in new issue
Block a user