Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(jasmine): support for nested requirements reporting
- Loading branch information
Showing
11 changed files
with
140 additions
and
13 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
integration/jasmine/examples/my_super_theme/my_theme/my_capability/my_feature.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
describe('My feature', () => { | ||
|
||
describe('A scenario', () => { | ||
|
||
it('passes', () => { | ||
// no-op, passing | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
const path = require('path'); | ||
const { default: reporter } = require('@serenity-js/jasmine'); | ||
|
||
jasmine.getEnv().addReporter(reporter(jasmine, { specDirectory: path.resolve(__dirname, '../examples') })); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
integration/jasmine/spec/requirement_tag_reporting.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { expect, ifExitCodeIsOtherThan, logOutput, PickEvent, SpawnResult } from '@integration/testing-tools'; | ||
import { Timestamp } from '@serenity-js/core'; | ||
import { SceneFinished, SceneFinishes, SceneStarts, SceneTagged, TestRunFinished, TestRunFinishes, TestRunnerDetected, TestRunStarts } from '@serenity-js/core/lib/events'; | ||
import { CapabilityTag, CorrelationId, ExecutionSuccessful, FeatureTag, Name,ThemeTag } from '@serenity-js/core/lib/model'; | ||
import { describe, it } from 'mocha'; | ||
import path from 'path'; | ||
|
||
import { jasmineSpawner } from '../src/jasmine'; | ||
|
||
describe('@serenity-js/jasmine', function () { | ||
|
||
this.timeout(30000); | ||
|
||
it('recognises a passing scenario', () => jasmine('examples/my_super_theme/my_theme/my_capability/my_feature.spec.js') | ||
.then(ifExitCodeIsOtherThan(0, logOutput)) | ||
.then(result => { | ||
|
||
expect(result.exitCode).to.equal(0); | ||
|
||
let currentSceneId: CorrelationId; | ||
|
||
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')); | ||
currentSceneId = event.sceneId; | ||
}) | ||
.next(SceneTagged, event => expect(event.tag).to.equal(new ThemeTag('My super theme'))) | ||
.next(SceneTagged, event => expect(event.tag).to.equal(new ThemeTag('My theme'))) | ||
.next(SceneTagged, event => expect(event.tag).to.equal(new CapabilityTag('My capability'))) | ||
.next(SceneTagged, event => expect(event.tag).to.equal(new FeatureTag('My feature'))) | ||
.next(TestRunnerDetected, event => expect(event.name).to.equal(new Name('Jasmine'))) | ||
.next(SceneFinishes, event => { | ||
expect(event.sceneId).to.equal(currentSceneId); | ||
}) | ||
.next(SceneFinished, event => { | ||
expect(event.sceneId).to.equal(currentSceneId); | ||
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)) | ||
; | ||
})); | ||
}); | ||
|
||
function jasmine(...params: string[]): Promise<SpawnResult> { | ||
return jasmineSpawner( | ||
...params, | ||
'--random=false', | ||
`--require=${ path.resolve(__dirname, '../examples/programmatic-reporter.js') }`, | ||
`--require=${ path.resolve(__dirname, '../examples/setup.js') }`, | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.