UNPKG

regressify

Version:
74 lines (73 loc) 3.97 kB
import { Config, Scenario, ViewportNext } from 'backstopjs'; import { TestSuiteModel, ScenarioModel, WorkspaceConfig, BasicAuthModel, BasicAuthConfig } from './types.js'; export type ArgConfig = { testSuite: string; isRef: boolean; globalRequiredLogin: boolean; }; export declare const DEFAULT_VIEWPORTS_PATH = "common/_viewports.yaml"; export declare const DEFAULT_SCENARIO_DELAY = 1000; export declare const DEFAULT_MISMATCH_THRESHOLD = 0.1; export declare const DEFAULT_POST_INTERACTION_WAIT = 1; export declare const DEFAULT_ASYNC_CAPTURE_LIMIT = 5; export declare const DEFAULT_ASYNC_COMPARE_LIMIT = 50; export declare class ConfigValidationError extends Error { constructor(message: string); } export declare function getRequiredTestSuiteArg(args: string[]): string; export declare function getArgConfigs(args: string[]): ArgConfig[]; export declare function getScriptPath(scriptPath: string, engine: 'puppeteer' | 'playwright'): string; /** * Load workspace-level defaults from `regressify.yaml` (or `.yml`) * at the workspace root. The file is optional; when absent an empty * object is returned so the cascade always falls back cleanly. */ export declare function getWorkspaceConfig(): WorkspaceConfig; export declare function getData(testSuite: string): TestSuiteModel | undefined; export declare function resolveStrictBoolean(...values: Array<boolean | undefined>): boolean | undefined; /** * Expand `${VAR}` and `$VAR` references in a string using `env`. * Unset variables expand to an empty string. Strings without any * reference are returned unchanged. A bare `$VAR` is only treated as a * reference when the `$` starts the string or follows a non-word * character, so literals such as `pa$ssword` are preserved. */ export declare function expandEnvReferences(value: string, env?: NodeJS.ProcessEnv): string; export declare function normalizeHttpOrigin(value: string): string | undefined; /** * Resolve `basicAuth` across scenario -> suite -> workspace, expanding any * environment-variable references in the credentials. Each level may declare * a single entry or an array of entries (one per protected origin). Entries * from more specific levels override less specific ones with the same * normalized origin, so a scenario can override one origin's credentials * while still inheriting the rest from the suite or workspace. Invalid * entries are dropped; returns `undefined` when no valid entry remains. */ export declare function resolveBasicAuth(scenario?: BasicAuthConfig, suite?: BasicAuthConfig, workspace?: BasicAuthConfig, env?: NodeJS.ProcessEnv): BasicAuthModel[] | undefined; export declare function expandScenarios(model: ScenarioModel, scenarios: ScenarioModel[], level: number, trail?: string[]): void; /** * Resolve `viewportNames` across scenario → suite → workspace, then * filter the loaded viewport definitions accordingly. */ export declare function resolveViewports(s: ScenarioModel, data: TestSuiteModel, ws: WorkspaceConfig, viewports?: ViewportNext[]): ViewportNext[] | undefined; type ResolveScenarioOptionsInput = { args: string[]; scenario: ScenarioModel; suite: TestSuiteModel; workspace: WorkspaceConfig; testSuite: string; isRef: boolean; globalRequiredLogin: boolean; index: number; total: number; viewports?: ViewportNext[]; }; export declare function resolveScenarioOptions({ args, scenario, suite, workspace, testSuite, isRef, globalRequiredLogin, index, total, viewports, }: ResolveScenarioOptionsInput): ScenarioModel; export declare function getScenarios(args: string[], testSuite: string, isRef: boolean, globalRequiredLogin: boolean, ws: WorkspaceConfig): { scenarios: Scenario[]; data: TestSuiteModel | undefined; viewports: ViewportNext[]; }; export declare function isCIEnvironment(env?: NodeJS.ProcessEnv): boolean; export declare function getConfigs(args: string[], backstopDirName: string): Config[]; export {};