UNPKG

@wdio/cucumber-framework

Version:
105 lines 3.88 kB
import type { supportCodeLibraryBuilder } from '@cucumber/cucumber'; import type { PickleStep, TestStep, Feature, Pickle, TestStepResultStatus } from '@cucumber/messages'; import type { Capabilities } from '@wdio/types'; import type { ReporterStep, Payload } from './types.js'; /** * NOTE: this function is exported for testing only */ export declare function createStepArgument({ argument }: PickleStep): string | { rows: { cells: string[]; }[]; } | undefined; /** * format message * @param {object} message { type: string, payload: object } */ export declare function formatMessage({ payload }: { payload: Payload; }): Payload; declare enum StepType { hook = "hook", test = "test" } /** * Get step type * @param {string} type `Step` or `Hook` */ export declare function getStepType(step: TestStep): StepType; export declare function getFeatureId(uri: string, feature: Feature): string; /** * Builds test title from step keyword and text * @param {string} keyword * @param {string} text * @param {string} type */ export declare function getTestStepTitle(keyword: string | undefined, text: string | undefined, type: string): string; /** * build payload for test/hook event */ export declare function buildStepPayload(uri: string, feature: Feature, scenario: Pickle, step: ReporterStep, params: { type: string; state?: TestStepResultStatus | string | null; error?: Error; duration?: number; title?: string | null; passed?: boolean; file?: string; }): { uid: string; title: string; parent: string; argument: string | { rows: { cells: string[]; }[]; } | undefined; file: string; tags: readonly import("@cucumber/messages").PickleTag[]; featureName: string; scenarioName: string; type: string; state?: TestStepResultStatus | string | null; error?: Error; duration?: number; passed?: boolean; }; /** * The reporters need to have the rule. * They are NOT available on the scenario, they ARE on the feature. * This will add them to it */ export declare function getRule(feature: Feature, scenarioId: string): string | undefined; /** * The reporters need to have the keywords, like `Given|When|Then`. They are NOT available * on the scenario, they ARE on the feature. * This will aad them */ export declare function addKeywordToStep(steps: ReporterStep[], feature: Feature): ReporterStep[]; /** * Generates skip tags based on capabilities and provided tags. * * @param {Capabilities.RemoteCapability} capabilities - The capabilities for which skip tags will be generated. * @param {string[][]} tags - The original tags of scenarios. * @returns {string[]} - An array of generated skip tags in Cucumber tag expression format. */ export declare function generateSkipTagsFromCapabilities(capabilities: Capabilities.ResolvedTestrunnerCapabilities, tags: string[][]): string[]; /** * Retrives scenario description if available. */ export declare function getScenarioDescription(feature: Feature, scenarioId: string): string; /** * wrap every user defined hook with function named `userHookFn` * to identify later on is function a step, user hook or wdio hook. * @param {object} options `Cucumber.supportCodeLibraryBuilder.options` */ export declare function setUserHookNames(options: typeof supportCodeLibraryBuilder): void; /** * Convert Cucumber status to WebdriverIO test status for reporting. * Maps statuses like PASSED, PENDING, etc., to WebdriverIO's shorthand test status values. * @param {TestStepResultStatus} status - The Cucumber status (e.g., 'PENDING') * @returns {'pass' | 'fail' | 'skip' | 'pending'} - The corresponding WebdriverIO test status */ export declare function convertStatus(status: TestStepResultStatus): 'pass' | 'fail' | 'skip' | 'pending'; export {}; //# sourceMappingURL=utils.d.ts.map