UNPKG

quoad

Version:

Serenity/JS: Next generation acceptance testing library for modern web applications.

36 lines (29 loc) 1.96 kB
import { expect, ifExitCodeIsOtherThan, logOutput, PickEvent, StdOutReporter } from '@integration/testing-tools'; import { Timestamp } from '@serenity-js/core'; import { SceneFinished, SceneStarts, SceneTagged, TestRunFinished, TestRunFinishes, TestRunnerDetected, TestRunStarts } from '@serenity-js/core/lib/events'; import { BrowserTag, ExecutionSuccessful, FeatureTag, Name, PlatformTag } from '@serenity-js/core/lib/model'; import { describe, it } from 'mocha'; import { wdio } from '../src'; describe('@serenity-js/webdriverio with @serenity-js/cucumber', function () { this.timeout(30000); it('recognises a passing scenario', () => wdio( './examples/wdio.conf.ts', '--spec=./examples/features/passing.feature', ) .then(ifExitCodeIsOtherThan(0, logOutput)) .then(result => { expect(result.exitCode).to.equal(0); PickEvent.from(StdOutReporter.parse(result.stdout)) .next(TestRunStarts, event => expect(event.timestamp).to.be.instanceof(Timestamp)) .next(SceneStarts, event => expect(event.details.name).to.equal(new Name('A passing scenario'))) .next(SceneTagged, event => expect(event.tag).to.be.instanceOf(BrowserTag)) .next(SceneTagged, event => expect(event.tag).to.be.instanceOf(PlatformTag)) .next(TestRunnerDetected, event => expect(event.name).to.equal(new Name('Cucumber'))) .next(SceneTagged, event => expect(event.tag).to.equal(new FeatureTag('A passing feature'))) .next(SceneFinished, event => expect(event.outcome).to.equal(new ExecutionSuccessful())) .next(TestRunFinishes, event => expect(event.timestamp).to.be.instanceof(Timestamp)) .next(TestRunFinished, event => expect(event.timestamp).to.be.instanceof(Timestamp)) ; })); });