UNPKG

@mmisty/cypress-allure-adapter

Version:

cypress allure adapter to generate allure results during tests execution (Allure TestOps compatible)

251 lines (250 loc) 5.57 kB
import type { ContentType } from '../common/types'; import type { TaskManager } from './task-manager'; export type StatusDetails = { message?: string; trace?: string; }; export interface AutoScreen { screenshotId?: string; specName?: string; testId: string | undefined; testAttemptIndex?: number; takenAt?: string; path: string; height?: number; width?: number; testFailure?: boolean; } export type AfterSpecScreenshots = { screenshots: AutoScreen[]; }; export type LinkType = 'issue' | 'tms'; type AllureTask = { specStarted: { spec: Cypress.Spec; }; writeEnvironmentInfo: { info: EnvironmentInfo; }; addEnvironmentInfo: { info: EnvironmentInfo; }; writeExecutorInfo: { info: ExecutorInfo; }; writeCategoriesDefinitions: { categories: Category[] | string; }; testEnded: { result: Status; details?: StatusDetails; }; testStarted: { title: string; fullTitle: string; id: string; currentRetry?: number; }; suiteStarted: { title: string; fullTitle: string; file?: string; }; hookStarted: { title: string; file?: string; hookId?: string; date?: number; }; hookEnded: { title: string; date?: number; result: Status; details?: StatusDetails; }; suiteEnded: undefined; deleteResults: undefined; stepEnded: { status: Status; date?: number; details?: StatusDetails; }; endAllSteps: { status: Status; date?: number; details?: StatusDetails; }; mergeStepMaybe: { name: string; }; stepStarted: { name: string; date?: number; }; step: { name: string; status?: string; date?: number; details?: StatusDetails; }; parameter: { name: string; value: string; }; fullName: { value: string; }; historyId: { value: string; }; link: { url: string; name?: string; type?: LinkType; }; testParameter: { name: string; value: string; }; testStatus: { result: Status; details?: StatusDetails; }; testDetails: { details?: StatusDetails; }; testAttachment: { name: string; content: string | Buffer; type: string; }; testFileAttachment: { name: string; file: string; type: ContentType; }; fileAttachment: { name: string; file: string; type: ContentType; }; attachment: { name: string; content: string | Buffer; type: string; }; addDescriptionHtml: { value: string; }; label: { name: string; value: string; }; message: { name: string; }; suite: { name?: string; }; subSuite: { name?: string; }; parentSuite: { name?: string; }; testMessage: { path: string; message: string; }; delete: { path: string; }; screenshotOne: { name: string | undefined; forStep?: boolean; }; screenshotAttachment: AutoScreen; testResult: { title?: string; id: string; result: Status; details?: StatusDetails; }; endAll: undefined; afterSpec: { results: CypressCommandLine.RunResult & AfterSpecScreenshots; }; waitAllFinished: undefined; }; export type RequestTask = keyof AllureTask; export type AllureTaskArgs<T extends RequestTask> = AllureTask[T] extends undefined ? {} : AllureTask[T]; export type AllureTasks = { [key in RequestTask]: (args: AllureTaskArgs<key>) => void | Promise<void>; } & { taskManager: TaskManager; }; export type AllureTransfer<T extends RequestTask> = { task: T; arg: AllureTaskArgs<T>; }; export declare enum Status { PASSED = "passed", FAILED = "failed", BROKEN = "broken", SKIPPED = "skipped" } export declare enum Stage { SCHEDULED = "scheduled", RUNNING = "running", FINISHED = "finished", PENDING = "pending", INTERRUPTED = "interrupted" } export declare enum LabelName { ALLURE_ID = "ALLURE_ID", AS_ID = "ALLURE_ID", SUITE = "suite", PARENT_SUITE = "parentSuite", SUB_SUITE = "subSuite", EPIC = "epic", FEATURE = "feature", STORY = "story", SEVERITY = "severity", TAG = "tag", OWNER = "owner", LEAD = "lead", HOST = "host", THREAD = "thread", TEST_METHOD = "testMethod", TEST_CLASS = "testClass", PACKAGE = "package", FRAMEWORK = "framework", LANGUAGE = "language", LAYER = "layer" } type KeysStage = keyof typeof Stage; export type StageType = (typeof Stage)[KeysStage]; type KeysStatus = keyof typeof Status; export type StatusType = (typeof Status)[KeysStatus]; export declare const UNKNOWN: Status; export type ExecutorInfo = { name?: string; type?: string; url?: string; buildOrder?: number; buildName?: string; buildUrl?: string; reportUrl?: string; reportName?: string; }; export interface Category { name?: string; description?: string; descriptionHtml?: string; messageRegex?: string; traceRegex?: string; matchedStatuses?: Status[]; flaky?: boolean; } export type EnvironmentInfo = Record<string, string>; export {};