import type { TestCase } from '@playwright/test/reporter'; import type { JobManifestEntry } from './types'; /** * Derived path components for test identification */ export interface DerivedPaths { folderPath: string; fileName: string; suitePath: string[]; testName: string; } export interface TestInfoLike { file: string; title: string; titlePath?: () => string[]; project?: { name?: string; use?: unknown; }; } /** * Canonicalize folderPath to match scriptservice manifest convention: * - normalize separators to '/' * - trim duplicate slashes * - strip leading './' * - strip leading 'tests/' (or 'tests') * - map '.' to '' */ export declare function normalizeManifestFolderPath(folderPath: string): string; /** * Resolve a manifest jobId using robust fallback candidates for folderPath/suitePath. * Exact candidates are attempted first, then normalized variants. */ export declare function resolveJobIdFromManifest(manifest: JobManifestEntry[], key: { folderPath: string; fileName: string; suitePath: string[]; testName: string; }): string | undefined; export interface ManifestResolutionResult { entry: JobManifestEntry; strategy: 'exact_path_tuple' | 'normalized_path_tuple' | 'suitepath_empty_fallback' | 'stable_identity_unique'; } /** * Resolve full manifest entry with deterministic strategy metadata. * Stable identity (`fileName + suitePath + testName`) is preferred over path-only * when it uniquely identifies a single manifest entry. */ export declare function resolveManifestEntryFromRuntime(manifest: JobManifestEntry[], key: { folderPath: string; fileName: string; suitePath: string[]; testName: string; }): ManifestResolutionResult | undefined; /** * Derive path components from a Playwright TestInfo (runtime context). * * Note: This intentionally avoids reporter-only types like TestCase/Suite, since this * is used in `@playwright/test` runtime hooks. */ export declare function derivePathsFromTestInfo(testInfo: TestInfoLike, testsFolder: string, rootDir: string, verbose?: boolean): DerivedPaths; /** * Derive path components from a Playwright TestCase * * @param test The Playwright TestCase * @param testsFolder Base folder for relative path calculation (optional) * @param rootDir Playwright root directory * @param verbose Whether to log path resolution details * @returns Derived path components for test identification */ export declare function derivePaths(test: TestCase, testsFolder: string, rootDir: string, verbose?: boolean): DerivedPaths; /** * Derive the tests folder name/path used for relative path calculation. * Uses TESTCHIMP_TESTS_FOLDER env if set, otherwise default "tests". */ export declare function deriveTestsFolder(_projectRootDir: string): string; /** * Current git branch name from env / CI (TrueCoverage ci-test-info, SmartTest execution reports, ExploreChimp * `branchName` on `analyze_explorechimp_data_sources`). */ export declare function getBranchName(): string | undefined; /** Absolute path to the batch-invocation id file (same rules as {@link readTestChimpBatchInvocationId}). */ export declare function getTestChimpBatchInvocationFilePath(projectRootDir?: string): string; /** * Batch / exploration id used by TrueCoverage and ExploreChimp local runs. * Prefer env TESTCHIMP_BATCH_INVOCATION_ID, else `.testchimp-batch-invocation-id` under project root. */ export declare function readTestChimpBatchInvocationId(projectRootDir?: string): string | undefined; /** * Same path rules as {@link TestChimpReporter} platform manifest (jobId ↔ test identity). */ export declare function loadJobManifestEntries(projectRootDir?: string): JobManifestEntry[]; /** * Stable step id for ExploreChimp analytics Playwright steps so {@link TestChimpReporter} `SmartTestExecutionStep.step_id` * matches `AnalyzeDataSourcesRequest.step_id` / persisted bugs (journey viewer merge). */ export declare function stableExploreChimpAnalyticsStepId(testId: string, retry: number, stepTitle: string): string; /** * Stable journey execution id for local ExploreChimp (no platform manifest). * Matches {@link applyExploreChimpPageFixture}: manifest jobId wins when present. */ export declare function stableJourneyExecutionId(journeyId: string, batchInvocationId: string, retry: number): string; /** * Generate a simple unique ID for steps */ export declare function generateStepId(stepNumber: number): string; /** * Safely get an environment variable with optional default */ export declare function getEnvVar(name: string, defaultValue?: string): string | undefined; /** * Generate a UUID v4 * Simple implementation without external dependency */ export declare function generateUUID(): string; //# sourceMappingURL=utils.d.ts.map