UNPKG

cumulocity-cypress

Version:
70 lines (69 loc) 2.6 kB
import { C8yTestHierarchyTree } from "../../shared/types"; import { C8yPact, C8yPactInfo, C8yPactRecord } from "../../shared/c8ypact"; /** * Configuration options for C8yPactRunner. */ export interface C8yPactRunnerOptions { /** * Filter for consumer name. */ consumer?: string; /** * Filter for producer name. */ producer?: string; /** * Filter for methods. */ methods?: string[]; /** * Authentication type for the runner. Supported values are `CookieAuth` and `BasicAuth`. */ authType?: "CookieAuth" | "BasicAuth"; /** * Path prefix filter for the runner. */ paths?: string[]; } /** * Runtime for C8yPact objects. A runner will create the tests dynamically based on * the pact objects information and rerun recorded requests. */ export interface C8yPactRunner { /** * Runs all pact objects. Will create the tests dynamically for each pact object. * * @param pacts Pact objects to run. * @param options Runner options. */ run: (pacts: C8yPact[], options?: C8yPactRunnerOptions) => void; /** * Runs a single pact object. Needs to run within a test-case. * * @param pact Pact object to run. */ runTest: (pact: C8yPact, options?: C8yPactRunnerOptions) => void; } /** * Default implementation of C8yPactRunner. Runtime for C8yPact objects that will * create the tests dynamically and rerun recorded requests. Supports Basic and Cookie based * authentication, id mapping, consumer and producer filtering and URL replacement. * * Use `C8Y_PACT_RUNNER_AUTH` to set the authentication type for the runner and overwrite * the authentication type detected in the pact records. Supported values are `CookieAuth` and `BasicAuth`. */ export declare class C8yDefaultPactRunner implements C8yPactRunner { constructor(); protected idMapper: { [key: string]: string; }; run(pacts: C8yPact[], options?: C8yPactRunnerOptions): void; protected createTestsFromHierarchy(hierarchy: C8yTestHierarchyTree<C8yPact>, options: C8yPactRunnerOptions): void; runTest(pact: C8yPact, options?: C8yPactRunnerOptions): void; protected createHeader(pact: C8yPactRecord): any; protected createFetchOptions(pact: C8yPactRecord, info: C8yPactInfo): any; protected createURL(pact: C8yPactRecord, info: C8yPactInfo): string | undefined; protected updateURLs(value: string, info: C8yPactInfo): string; protected updateIds(value: string): string; } export declare function getOptionsFromEnvironment(): C8yPactRunnerOptions;