@wdio/allure-reporter
Version:
A WebdriverIO reporter plugin to create Allure Test Reports
192 lines • 6.29 kB
TypeScript
import type { AfterCommandArgs, BeforeCommandArgs, HookStats, RunnerStats, SuiteStats, TestStats } from '@wdio/reporter';
import WDIOReporter from '@wdio/reporter';
import type { Status as AllureStatus } from 'allure-js-commons';
import { AllureReportState } from './state.js';
import type { AllureReporterOptions } from './types.js';
import * as AllureApi from './common/api.js';
type StepAttachment = {
content: string | Buffer;
name?: string;
type?: string;
};
type StepPayload = {
title?: string;
attachment?: StepAttachment;
status?: AllureStatus;
};
type StepWrapper = {
step: StepPayload;
};
export default class AllureReporter extends WDIOReporter {
private _allureRuntime;
private _capabilities;
private _isMultiremote?;
private _config?;
private _options;
private _consoleOutput;
private _originalStdoutWrite;
private _isFlushing;
private _cid?;
private _testPlan;
private _suiteStartedDepthByCid;
private _currentLeafTitleByCid;
private _tpSkipByCid;
private _linkTemplates?;
private _suiteStackByCid;
private _suiteStack;
private _pkgByCid;
private _cukeScenarioActiveByCid;
allureStatesByCid: Map<string, AllureReportState>;
private static getTimeOrNow;
get isSynchronised(): boolean;
constructor(options: AllureReporterOptions);
private _ensureState;
private _pushRuntimeMessage;
private _attachFile;
private _currentCid;
private _attachLogs;
private _attachJSON;
private _attachScreenshot;
private _handleCucumberStepStart;
private _handleCucumberStepEnd;
private _startSuite;
private _endSuite;
private _startTest;
private _endTest;
private _skipTest;
private _startStep;
private _endStep;
private _startHook;
private _endHook;
/**
* Stable key from current capabilities (browser/device + version) for hash.
* Must NOT include cid. Used to make historyId unique per environment.
*/
private _getCapabilityKey;
/**
* Emits historyId (and testCaseId) from full title and capability key (browser/device from test run).
* Must NOT include cid or file path: cid varies between runs; user asked for no filesystem.
*/
private _emitHistoryIdsFrom;
private _setTestParameters;
private _registerListeners;
onRunnerStart(runner: RunnerStats): void;
onRunnerEnd(_runner: RunnerStats): Promise<void>;
onSuiteStart(suite: SuiteStats & {
start: Date;
}): void;
onSuiteEnd(suite: SuiteStats & {
end: Date;
}): void;
onSuiteRetry(_suite: SuiteStats): void;
private _inCucumberStepMode;
onTestStart(test: TestStats | HookStats): void;
onTestPass(test: TestStats | HookStats): void;
onTestRetry(test: TestStats): void;
onTestFail(test: TestStats | HookStats): void;
onTestPending(test: TestStats): void;
onTestSkip(test: TestStats): void;
onBeforeCommand(command: BeforeCommandArgs): void;
onAfterCommand(command: AfterCommandArgs): void;
onHookStart(hook: HookStats): void;
onHookEnd(hook: HookStats): void;
private get _hasPendingSuite();
private get _hasPendingTest();
private get _hasPendingHook();
private _tpActive;
private _ensureSuitesStarted;
private _emitBaseLabels;
private _isCucumberSuiteLike;
private _isCucumberHook;
private _decideCucumberSkipForHook;
private _tpSkipActive;
private _decideCucumberSkip;
private _mochaFullTitle;
private _deriveHookType;
private _isGlobalHook;
private _formatLink;
private _md5;
addLabel({ name, value }: {
name: string;
value: string;
}): void;
addStory({ storyName }: {
storyName: string;
}): void;
addFeature({ featureName }: {
featureName: string;
}): void;
addSeverity({ severity }: {
severity: string;
}): void;
addEpic({ epicName }: {
epicName: string;
}): void;
addOwner({ owner }: {
owner: string;
}): void;
addSuite({ suiteName }: {
suiteName: string;
}): void;
addParentSuite({ suiteName }: {
suiteName: string;
}): void;
addSubSuite({ suiteName }: {
suiteName: string;
}): void;
addTag({ tag }: {
tag: string;
}): void;
addIssue({ issue }: {
issue: string;
}): void;
addTestId({ testId }: {
testId: string;
}): void;
addAllureId({ id }: {
id: string;
}): void;
addDescription(args: {
description: string;
descriptionType?: number | 'html' | 'markdown';
}): void;
addAttachment(args: {
name: string;
content: string | Buffer | object;
type?: string;
}): void;
addArgument({ name, value, mode, excluded }: {
name: string;
value: string;
mode?: 'masked' | 'hidden' | 'default';
excluded?: boolean;
}): void;
startStep(title: string): void;
endStep(status: AllureStatus): void;
addStep(title: string, payload: StepWrapper): void;
addStep(payload: StepPayload): void;
addStep(payload: StepWrapper): void;
static addFeature: typeof AllureApi.addFeature;
static addLink: typeof AllureApi.addLink;
static addEpic: typeof AllureApi.addEpic;
static addOwner: typeof AllureApi.addOwner;
static addTag: typeof AllureApi.addTag;
static addLabel: typeof AllureApi.addLabel;
static addSeverity: typeof AllureApi.addSeverity;
static addIssue: typeof AllureApi.addIssue;
static addSuite: typeof AllureApi.addSuite;
static addSubSuite: typeof AllureApi.addSubSuite;
static addParentSuite: typeof AllureApi.addParentSuite;
static addTestId: typeof AllureApi.addTestId;
static addStory: typeof AllureApi.addStory;
static addDescription: typeof AllureApi.addDescription;
static addAttachment: typeof AllureApi.addAttachment;
static startStep: typeof AllureApi.startStep;
static endStep: typeof AllureApi.endStep;
static addStep: typeof AllureApi.addStep;
static addArgument: typeof AllureApi.addArgument;
static addAllureId: typeof AllureApi.addAllureId;
static step: typeof AllureApi.step;
}
export {};
//# sourceMappingURL=reporter.d.ts.map