mirror of
https://github.com/Kong/insomnia.git
synced 2026-11-04 12:03:53 -05:00
fix(insomnia-test): make specs loadable under ESM so playwright --list works
Replace __dirname with import.meta.dirname and import insomnia-data enums as types only (the package is ESM-only at runtime), which made `playwright test --list` fail in the shard matrix job. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
dd9b6d589d
commit
2b9a3e2b5e
10 files changed
+20
-24
No files matched your search
+3
-3
@@ -10,9 +10,9 @@ import { test } from "../../../misc/fixtures";
|
||||
import { Collection } from "../../../models/collection";
|
||||
import { Project } from "../../../models/project";
|
||||
|
||||
const cascadeFixture = path.join(__dirname, "environment-cascade-collection.yaml");
|
||||
const globalCollectionFixture = path.join(__dirname, "collection-for-global-environments.yaml");
|
||||
const globalEnvironmentFixture = path.join(__dirname, "global-environment.yaml");
|
||||
const cascadeFixture = path.join(import.meta.dirname, "environment-cascade-collection.yaml");
|
||||
const globalCollectionFixture = path.join(import.meta.dirname, "collection-for-global-environments.yaml");
|
||||
const globalEnvironmentFixture = path.join(import.meta.dirname, "global-environment.yaml");
|
||||
|
||||
interface Scenario {
|
||||
id: string;
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ test("Verify the tag modal's source follows the edited template and hides for no
|
||||
);
|
||||
await importFlow.importFile(
|
||||
project,
|
||||
path.join(__dirname, "environment-cascade-collection.yaml"),
|
||||
path.join(import.meta.dirname, "environment-cascade-collection.yaml"),
|
||||
);
|
||||
const collection = new Collection("Environment Cascade");
|
||||
await environmentFlow.activate(collection, "Base Environment");
|
||||
|
||||
+2
-2
@@ -19,7 +19,7 @@ test("Verify hovering an undefined variable swaps the tooltip to the render erro
|
||||
);
|
||||
await importFlow.importFile(
|
||||
project,
|
||||
path.join(__dirname, "collection-for-global-environments.yaml"),
|
||||
path.join(import.meta.dirname, "collection-for-global-environments.yaml"),
|
||||
);
|
||||
const collection = new Collection("collection-for-global-environments");
|
||||
await environmentFlow.activate(collection, "ExampleA");
|
||||
@@ -45,7 +45,7 @@ test("Verify hovering the tooltip's own content keeps it visible", async ({ user
|
||||
);
|
||||
await importFlow.importFile(
|
||||
project,
|
||||
path.join(__dirname, "environment-cascade-collection.yaml"),
|
||||
path.join(import.meta.dirname, "environment-cascade-collection.yaml"),
|
||||
);
|
||||
const collection = new Collection("Environment Cascade");
|
||||
await environmentFlow.activate(collection, "Base Environment");
|
||||
|
||||
+4
-4
@@ -8,10 +8,10 @@ import { test } from "../../../misc/fixtures";
|
||||
import { Collection } from "../../../models/collection";
|
||||
import { Project } from "../../../models/project";
|
||||
|
||||
const cascadeFixture = path.join(__dirname, "environment-cascade-collection.yaml");
|
||||
const globalCollectionFixture = path.join(__dirname, "collection-for-global-environments.yaml");
|
||||
const globalEnvironmentFixture = path.join(__dirname, "global-environment.yaml");
|
||||
const projectEnvironmentSourceFixture = path.join(__dirname, "project-environment-source.yaml");
|
||||
const cascadeFixture = path.join(import.meta.dirname, "environment-cascade-collection.yaml");
|
||||
const globalCollectionFixture = path.join(import.meta.dirname, "collection-for-global-environments.yaml");
|
||||
const globalEnvironmentFixture = path.join(import.meta.dirname, "global-environment.yaml");
|
||||
const projectEnvironmentSourceFixture = path.join(import.meta.dirname, "project-environment-source.yaml");
|
||||
|
||||
test("Verify the tooltip's Open inside the Manage Environments modal selects the source environment, and works again after selecting another", async ({
|
||||
user,
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ testWithVaultKey(
|
||||
|
||||
await importFlow.importFile(
|
||||
project,
|
||||
path.join(__dirname, "vault-legacy-formats.yaml"),
|
||||
path.join(import.meta.dirname, "vault-legacy-formats.yaml"),
|
||||
);
|
||||
const collection = new Collection("Vault Legacy Format Collection");
|
||||
await environmentFlow.link(collection, secretEnvironment);
|
||||
|
||||
@@ -13,7 +13,7 @@ import { Project } from "../../models/project";
|
||||
|
||||
const url = `${HTTP_SERVER}/post`;
|
||||
const uploadFilePath = path.join(
|
||||
__dirname,
|
||||
import.meta.dirname,
|
||||
"..",
|
||||
"..",
|
||||
"misc",
|
||||
|
||||
@@ -20,7 +20,7 @@ test("Verify Client Certificate Toggle Controls mTLS Enforcement For HTTP Reques
|
||||
|
||||
await preferencesFlow.set({
|
||||
validateSSL: false,
|
||||
dataFolders: [path.join(__dirname, "../../misc/fixtures")],
|
||||
dataFolders: [path.join(import.meta.dirname, "../../misc/fixtures")],
|
||||
});
|
||||
|
||||
const project = await workspaceFlow.createProject(
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ test("Verify pre-request script reads and replaces the client certificate via in
|
||||
|
||||
await preferencesFlow.set({
|
||||
validateSSL: false,
|
||||
dataFolders: [path.join(__dirname, "../../misc/fixtures")],
|
||||
dataFolders: [path.join(import.meta.dirname, "../../misc/fixtures")],
|
||||
});
|
||||
|
||||
const project = await workspaceFlow.createProject(
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
import { expect } from "@playwright/test";
|
||||
import {
|
||||
AWSCredentialType,
|
||||
HashiCorpCredentialType,
|
||||
HashiCorpVaultAuthMethod,
|
||||
} from "insomnia-data";
|
||||
import type { AWSCredentialType, HashiCorpCredentialType, HashiCorpVaultAuthMethod } from "insomnia-data";
|
||||
|
||||
import { ContentType } from "../../enums/content-type";
|
||||
import { HttpMethod } from "../../enums/http-method";
|
||||
@@ -39,7 +35,7 @@ test("Verify AWS/GCP/HashiCorp Cloud Credentials Resolve via the Vault Template
|
||||
provider: "aws",
|
||||
name: awsCredentialName,
|
||||
credentials: {
|
||||
type: AWSCredentialType.file,
|
||||
type: "file" as AWSCredentialType.file,
|
||||
section: faker.string.alphanumeric(8),
|
||||
region: faker.string.alphanumeric(8),
|
||||
},
|
||||
@@ -53,8 +49,8 @@ test("Verify AWS/GCP/HashiCorp Cloud Credentials Resolve via the Vault Template
|
||||
provider: "hashicorp",
|
||||
name: hashicorpCredentialName,
|
||||
credentials: {
|
||||
type: HashiCorpCredentialType.onPrem,
|
||||
authMethod: HashiCorpVaultAuthMethod.appRole,
|
||||
type: "onPrem" as HashiCorpCredentialType.onPrem,
|
||||
authMethod: "appRole" as HashiCorpVaultAuthMethod.appRole,
|
||||
serverAddress: "http://127.0.0.1",
|
||||
role_id: faker.string.alphanumeric(8),
|
||||
secret_id: faker.string.alphanumeric(8),
|
||||
|
||||
+2
-2
@@ -9,7 +9,7 @@ import { test } from "../../../misc/fixtures";
|
||||
import { Collection } from "../../../models/collection";
|
||||
import { Project } from "../../../models/project";
|
||||
|
||||
const filePath = path.join(__dirname, "fixture.txt");
|
||||
const filePath = path.join(import.meta.dirname, "fixture.txt");
|
||||
|
||||
test("Verify the file Tag Reads Contents from an Allowed Folder", async ({
|
||||
user,
|
||||
@@ -17,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: [__dirname] });
|
||||
await preferencesFlow.set({ dataFolders: [import.meta.dirname] });
|
||||
|
||||
const project = await workspaceFlow.createProject(
|
||||
new Project(faker.string.alphanumeric(10), ProjectType.Local),
|
||||
|
||||
Reference in new issue
Block a user