UNPKG

quoad

Version:

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

28 lines (22 loc) 1.55 kB
import { expect, ifExitCodeIsOtherThan, logOutput, PickEvent } 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 { ExecutionSuccessful, FeatureTag, Name } from '@serenity-js/core/lib/model'; import { describe, it } from 'mocha'; import { jasmine } from '../src/jasmine'; describe('@serenity-js/jasmine', function () { it('recognises a passing scenario', () => jasmine('examples/passing.spec.js') .then(ifExitCodeIsOtherThan(0, logOutput)) .then(result => { expect(result.exitCode).to.equal(0); PickEvent.from(result.events) .next(TestRunStarts, event => expect(event.timestamp).to.be.instanceof(Timestamp)) .next(SceneStarts, event => expect(event.details.name).to.equal(new Name('A scenario passes'))) .next(SceneTagged, event => expect(event.tag).to.equal(new FeatureTag('Jasmine'))) .next(TestRunnerDetected, event => expect(event.name).to.equal(new Name('Jasmine'))) .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)) ; })); });