@wdio/cucumber-framework
Version:
A WebdriverIO plugin. Adapter for Cucumber.js testing framework.
85 lines • 3.98 kB
TypeScript
import { EventEmitter } from 'node:events';
import type { Capabilities } from '@wdio/types';
import type { GherkinDocument } from '@cucumber/messages';
import type Cucumber from '@cucumber/cucumber';
import type { CucumberOptions, HookFunctionExtension as HookFunctionExtensionImport, StepDefinitionOptions } from './types.js';
export declare const FILE_PROTOCOL = "file://";
export declare class CucumberAdapter {
private _cid;
private _config;
private _specs;
private _capabilities;
private _reporter;
private _eventEmitter;
private _generateSkipTags;
private _cucumberFormatter;
private _cwd;
private _newId;
private _cucumberOpts;
private _hasTests;
private gherkinParser;
constructor(_cid: string, _config: WebdriverIO.Config, _specs: string[], _capabilities: Capabilities.ResolvedTestrunnerCapabilities, _reporter: EventEmitter, _eventEmitter: EventEmitter, _generateSkipTags?: boolean, _cucumberFormatter?: string);
readFiles(filePaths?: WebdriverIO.Config['specs']): (string | string[])[];
getGherkinDocuments(files?: WebdriverIO.Config['specs']): (GherkinDocument | GherkinDocument[])[];
generateDynamicSkipTags(): string[];
init(): Promise<this>;
hasTests(): boolean;
run(): Promise<number | undefined>;
/**
* Transpilation https://github.com/cucumber/cucumber-js/blob/master/docs/cli.md#transpilation
* Usage: `['module']`
* we extend it a bit with ability to init and pass configuration to modules.
* Pass an array with path to module and its configuration instead:
* Usage: `[['module', {}]]`
* Or pass your own function
* Usage: `[() => { require('@babel/register')({ ignore: [] }) }]`
*/
registerRequiredModules(): Promise<void[]>;
loadFilesWithType(fileList: string[]): Promise<string[]>;
loadAndRefreshModule(modules: string[]): Promise<any[]>;
loadFiles(): Promise<void>;
/**
* set `beforeFeature`, `afterFeature`, `beforeScenario`, `afterScenario`, 'beforeStep', 'afterStep'
* @param {object} config config
*/
addWdioHooks(config: WebdriverIO.Config, supportCodeLibraryBuilder: typeof Cucumber.supportCodeLibraryBuilder): void;
/**
* wraps step definition code with sync/async runner with a retry option
* @param {object} config
*/
wrapSteps(config: WebdriverIO.Config): void;
/**
* wrap step definition to enable retry ability
* @param {Function} code step definition
* @param {boolean} isStep
* @param {object} config
* @param {string} cid cid
* @param {StepDefinitionOptions} options
* @param {Function} getHookParams step definition
* @param {number} timeout the maximum time (in milliseconds) to wait for
* @return {Function} wrapped step definition for sync WebdriverIO code
*/
wrapStep(code: Function, isStep: boolean, config: WebdriverIO.Config, cid: string, options: StepDefinitionOptions, getHookParams: Function, timeout?: number, hookName?: string | undefined): Function;
}
/**
* Publishes a Cucumber report to a specified URL using NDJSON files from a directory.
* @async
* @param {string} cucumberMessageDir - The directory path that holds Cucumber NDJSON files.
* @returns {Promise<void>} - A Promise that resolves when the report is successfully published.
* @throws {Error} - Throws an error if there are issues with file reading or the publishing process.
*/
export declare const publishCucumberReport: (cucumberMessageDir: string) => Promise<void>;
export declare const adapterFactory: {
init?: Function;
};
export default adapterFactory;
export * from '@cucumber/cucumber';
declare global {
namespace WebdriverIO {
interface CucumberOpts extends CucumberOptions {
}
interface HookFunctionExtension extends HookFunctionExtensionImport {
}
}
}
//# sourceMappingURL=index.d.ts.map