UNPKG

@serenity-js/webdriverio

Version:

Adapter that integrates @serenity-js/web with the latest stable version of WebdriverIO, enabling Serenity/JS reporting and using the Screenplay Pattern to write web and mobile test scenarios

40 lines (36 loc) 1.38 kB
import type { Serenity } from '@serenity-js/core'; import type { ModuleLoader, Path } from '@serenity-js/core/lib/io/index.js'; import type { Capabilities } from '@wdio/types'; import type { EventEmitter } from 'events'; import type { WebdriverIOConfig } from '../config/index.js'; import type { InitialisesReporters, ProvidesWriteStream } from './reporter/index.js'; import { WebdriverIOFrameworkAdapter } from './WebdriverIOFrameworkAdapter.js'; /** * @group Test Runner Adapter */ export class WebdriverIOFrameworkAdapterFactory { constructor( private readonly serenity: Serenity, private readonly loader: ModuleLoader, private readonly cwd: Path, ) { } public init( cid: string, config: WebdriverIOConfig, specs: string[], capabilities: Capabilities.RequestedStandaloneCapabilities | Capabilities.RequestedStandaloneCapabilities[] | Capabilities.RequestedMultiremoteCapabilities | Capabilities.RequestedMultiremoteCapabilities[], reporter: EventEmitter & ProvidesWriteStream & InitialisesReporters ): Promise<WebdriverIOFrameworkAdapter> { return new WebdriverIOFrameworkAdapter( this.serenity, this.loader, this.cwd, cid, config, specs, capabilities, reporter, ).init() } }