test: bump timeout

Specify timeout at the CLI e2e test suite level.
This commit is contained in:
jamesgeorge007
2024-11-06 18:53:39 +05:30
parent ecf5d9f6d2
commit 3fc43cc9b9

View File

@@ -6,7 +6,7 @@ import path from "path";
import { HoppErrorCode } from "../../../types/errors"; import { HoppErrorCode } from "../../../types/errors";
import { getErrorCode, getTestJsonFilePath, runCLI } from "../../utils"; import { getErrorCode, getTestJsonFilePath, runCLI } from "../../utils";
describe("hopp test [options] <file_path_or_id>", () => { describe("hopp test [options] <file_path_or_id>", { timeout: 100000 }, () => {
const VALID_TEST_ARGS = `test ${getTestJsonFilePath("passes-coll.json", "collection")}`; const VALID_TEST_ARGS = `test ${getTestJsonFilePath("passes-coll.json", "collection")}`;
describe("Test `hopp test <file_path_or_id>` command:", () => { describe("Test `hopp test <file_path_or_id>` command:", () => {
@@ -126,19 +126,15 @@ describe("hopp test [options] <file_path_or_id>", () => {
expect(error).toBeNull(); expect(error).toBeNull();
}); });
test( test("Successfully inherits/overrides authorization and headers at each level with multiple child collections", async () => {
"Successfully inherits/overrides authorization and headers at each level with multiple child collections", const args = `test ${getTestJsonFilePath(
async () => { "multiple-child-collections-auth-headers-coll.json",
const args = `test ${getTestJsonFilePath( "collection"
"multiple-child-collections-auth-headers-coll.json", )}`;
"collection" const { error } = await runCLI(args);
)}`;
const { error } = await runCLI(args);
expect(error).toBeNull(); expect(error).toBeNull();
}, });
{ timeout: 100000 }
);
test("Persists environment variables set in the pre-request script for consumption in the test script", async () => { test("Persists environment variables set in the pre-request script for consumption in the test script", async () => {
const args = `test ${getTestJsonFilePath( const args = `test ${getTestJsonFilePath(
@@ -277,97 +273,93 @@ describe("hopp test [options] <file_path_or_id>", () => {
expect(error).toBeNull(); expect(error).toBeNull();
}); });
describe( describe("Secret environment variables", () => {
"Secret environment variables", // Reads secret environment values from system environment
() => { test("Successfully picks the values for secret environment variables from `process.env` and persists the variables set from the pre-request script", async () => {
// Reads secret environment values from system environment const env = {
test("Successfully picks the values for secret environment variables from `process.env` and persists the variables set from the pre-request script", async () => { ...process.env,
const env = { secretBearerToken: "test-token",
...process.env, secretBasicAuthUsername: "test-user",
secretBearerToken: "test-token", secretBasicAuthPassword: "test-pass",
secretBasicAuthUsername: "test-user", secretQueryParamValue: "secret-query-param-value",
secretBasicAuthPassword: "test-pass", secretBodyValue: "secret-body-value",
secretQueryParamValue: "secret-query-param-value", secretHeaderValue: "secret-header-value",
secretBodyValue: "secret-body-value", };
secretHeaderValue: "secret-header-value",
};
const COLL_PATH = getTestJsonFilePath( const COLL_PATH = getTestJsonFilePath(
"secret-envs-coll.json", "secret-envs-coll.json",
"collection" "collection"
); );
const ENVS_PATH = getTestJsonFilePath( const ENVS_PATH = getTestJsonFilePath(
"secret-envs.json", "secret-envs.json",
"environment" "environment"
); );
const args = `test ${COLL_PATH} --env ${ENVS_PATH}`; const args = `test ${COLL_PATH} --env ${ENVS_PATH}`;
const { error, stdout } = await runCLI(args, { env }); const { error, stdout } = await runCLI(args, { env });
expect(stdout).toContain( expect(stdout).toContain(
"https://httpbin.org/basic-auth/*********/*********" "https://httpbin.org/basic-auth/*********/*********"
); );
expect(error).toBeNull(); expect(error).toBeNull();
}); });
// Prefers values specified in the environment export file over values set in the system environment // Prefers values specified in the environment export file over values set in the system environment
test("Successfully picks the values for secret environment variables set directly in the environment export file and persists the environment variables set from the pre-request script", async () => { test("Successfully picks the values for secret environment variables set directly in the environment export file and persists the environment variables set from the pre-request script", async () => {
const COLL_PATH = getTestJsonFilePath( const COLL_PATH = getTestJsonFilePath(
"secret-envs-coll.json", "secret-envs-coll.json",
"collection" "collection"
); );
const ENVS_PATH = getTestJsonFilePath( const ENVS_PATH = getTestJsonFilePath(
"secret-supplied-values-envs.json", "secret-supplied-values-envs.json",
"environment" "environment"
); );
const args = `test ${COLL_PATH} --env ${ENVS_PATH}`; const args = `test ${COLL_PATH} --env ${ENVS_PATH}`;
const { error, stdout } = await runCLI(args); const { error, stdout } = await runCLI(args);
expect(stdout).toContain( expect(stdout).toContain(
"https://httpbin.org/basic-auth/*********/*********" "https://httpbin.org/basic-auth/*********/*********"
); );
expect(error).toBeNull(); expect(error).toBeNull();
}); });
// Values set from the scripting context takes the highest precedence // Values set from the scripting context takes the highest precedence
test("Setting values for secret environment variables from the pre-request script overrides values set at the supplied environment export file", async () => { test("Setting values for secret environment variables from the pre-request script overrides values set at the supplied environment export file", async () => {
const COLL_PATH = getTestJsonFilePath( const COLL_PATH = getTestJsonFilePath(
"secret-envs-persistence-coll.json", "secret-envs-persistence-coll.json",
"collection" "collection"
); );
const ENVS_PATH = getTestJsonFilePath( const ENVS_PATH = getTestJsonFilePath(
"secret-supplied-values-envs.json", "secret-supplied-values-envs.json",
"environment" "environment"
); );
const args = `test ${COLL_PATH} --env ${ENVS_PATH}`; const args = `test ${COLL_PATH} --env ${ENVS_PATH}`;
const { error, stdout } = await runCLI(args); const { error, stdout } = await runCLI(args);
expect(stdout).toContain( expect(stdout).toContain(
"https://httpbin.org/basic-auth/*********/*********" "https://httpbin.org/basic-auth/*********/*********"
); );
expect(error).toBeNull(); expect(error).toBeNull();
}); });
test("Persists secret environment variable values set from the pre-request script for consumption in the request and post-request script context", async () => { test("Persists secret environment variable values set from the pre-request script for consumption in the request and post-request script context", async () => {
const COLL_PATH = getTestJsonFilePath( const COLL_PATH = getTestJsonFilePath(
"secret-envs-persistence-scripting-coll.json", "secret-envs-persistence-scripting-coll.json",
"collection" "collection"
); );
const ENVS_PATH = getTestJsonFilePath( const ENVS_PATH = getTestJsonFilePath(
"secret-envs-persistence-scripting-envs.json", "secret-envs-persistence-scripting-envs.json",
"environment" "environment"
); );
const args = `test ${COLL_PATH} --env ${ENVS_PATH}`; const args = `test ${COLL_PATH} --env ${ENVS_PATH}`;
const { error } = await runCLI(args); const { error } = await runCLI(args);
expect(error).toBeNull(); expect(error).toBeNull();
}); });
}, });
{ timeout: 50000 }
);
describe("Request variables", () => { describe("Request variables", () => {
test("Picks active request variables and ignores inactive entries alongside the usage of environment variables", async () => { test("Picks active request variables and ignores inactive entries alongside the usage of environment variables", async () => {