import { type AxiosInstance } from 'axios'; import { GitInformation } from '../services/util.js'; import { RetryStrategy, SharedFile } from '../constructs/index.js'; import { SequenceId } from '../services/abstract-check-runner.js'; import type { CheckResult } from './check-results.js'; type RunTestSessionRequest = { name: string; checkRunJobs: any[]; project: { logicalId: string; }; sharedFiles?: SharedFile[]; runLocation: string | { type: 'PUBLIC'; region: string; } | { type: 'PRIVATE'; slugName: string; id: string; }; repoInfo?: GitInformation | null; environment?: string | null; shouldRecord: boolean; streamLogs?: boolean; refreshCache?: boolean; }; type TriggerTestSessionRequest = { name: string; runLocation: string | { type: 'PUBLIC'; region: string; } | { type: 'PRIVATE'; slugName: string; id: string; }; shouldRecord: boolean; targetTags: string[][]; checkId?: string[]; checkRunSuiteId: string; environmentVariables: Array<{ key: string; value: string; }>; repoInfo: GitInformation | null; environment: string | null; testRetryStrategy: RetryStrategy | null; refreshCache?: boolean; }; export type TestResultsShortLinks = { testResultLink: string; testTraceLinks: string[]; videoLinks: string[]; screenshotLinks: string[]; }; export type TriggerTestSessionResponse = { checks: Array; testSessionId: string; testResultIds: Record; sequenceIds: Record; }; export type TestSessionMetadata = { environment?: string; repoUrl?: string; commitId?: string; commitOwner?: string; commitMessage?: string; branchName?: string; }; export type TestSessionStatus = 'RUNNING' | 'FAILED' | 'PASSED' | 'CANCELLED'; export type TestSessionProvider = 'GITHUB' | 'VERCEL' | 'API' | 'TRIGGER' | 'PW_REPORTER'; export type TestSessionResult = { testSessionResultId: string; testSessionResultLink: string; checkId?: string | null; checkType: string; name?: string; runLocation?: string; resultType?: string; status: TestSessionStatus; hasErrors: boolean; hasFailures: boolean; isDegraded: boolean; aborted: boolean; errorGroupIds?: string[]; }; export type TestSessionDetail = { testSessionId: string; testSessionLink: string; name: string; status: TestSessionStatus; startedAt: string; stoppedAt: string | null; timeElapsed: number; metadata?: TestSessionMetadata; errorGroupIds?: string[]; results?: TestSessionResult[]; }; type TestSessionListEntryInvoker = { name: string; picture?: string | null; } | null; export type TestSessionListEntry = { id: string; accountId: string; projectId?: string | null; name: string; provider: string; running?: string[] | null; passed?: string[] | null; failed?: string[] | null; cancelled?: string[] | null; status?: TestSessionStatus; region: string; privateLocationId?: string | null; invoker?: TestSessionListEntryInvoker; repoUrl?: string | null; commitId?: string | null; commitOwner?: string | null; commitMessage?: string | null; branchName?: string | null; environment?: string | null; startedAt: string; stoppedAt?: string | null; created_at: string; updated_at?: string | null; }; export type ListTestSessionsParams = { from?: number; to?: number; limit?: number; statuses?: TestSessionStatus[]; branches?: string[]; users?: string[]; providers?: TestSessionProvider[]; noUsers?: boolean; nextId?: string; textSearch?: string; errorGroupId?: string; }; export type TestSessionsListResponse = { length: number; entries: TestSessionListEntry[]; nextId?: string | null; }; export declare class NoMatchingChecksError extends Error { constructor(options?: ErrorOptions); } declare class TestSessions { api: AxiosInstance; constructor(api: AxiosInstance); run(payload: RunTestSessionRequest): Promise>; /** * @throws {NoMatchingChecksError} If no checks matched the request. */ trigger(payload: TriggerTestSessionRequest): Promise>; get(id: string): Promise>; getResult(id: string, resultId: string): Promise>; getCompletion(id: string, maxWaitSeconds?: number): Promise>; pollUntilComplete(id: string): Promise; list(params?: ListTestSessionsParams): Promise>; getShortLink(id: string): Promise>; getResultShortLinks(testSessionId: string, testResultId: string): Promise>; } export default TestSessions;