Skip to content
Permalink
Browse files
fix(core): refactored the internal domain events so that they're easi…
…er to aggregate and correlate
  • Loading branch information
jan-molak committed Oct 10, 2020
1 parent 755e75e commit 943c016ed3e404c9c1aacf8342e42626d4d85d04
Show file tree
Hide file tree
Showing 100 changed files with 866 additions and 752 deletions.
@@ -37,10 +37,10 @@ describe('@serenity-js/cucumber', function () {
expect(res.exitCode).to.equal(1);

PickEvent.from(res.events)
.next(SceneStarts, event => expect(event.value.name).to.equal(new Name('A passing scenario')))
.next(SceneStarts, event => expect(event.details.name).to.equal(new Name('A passing scenario')))
.next(TestRunnerDetected, event => expect(event.value).to.equal(new Name('Cucumber')))
.next(SceneTagged, event => expect(event.tag).to.equal(new FeatureTag('Serenity/JS recognises a passing scenario')))
.next(ActivityStarts, event => expect(event.value.name).to.equal(new Name('Given a step that passes')))
.next(ActivityStarts, event => expect(event.details.name).to.equal(new Name('Given a step that passes')))
.next(ActivityFinished, event => {
expect(event.outcome).to.be.instanceOf(ExecutionFailedWithError);

@@ -41,10 +41,10 @@ describe('@serenity-js/cucumber', function () {
expect(res.exitCode).to.equal(1);

PickEvent.from(res.events)
.next(SceneStarts, event => expect(event.value.name).to.equal(new Name('An assertion failure scenario')))
.next(SceneStarts, event => expect(event.details.name).to.equal(new Name('An assertion failure scenario')))
.next(TestRunnerDetected, event => expect(event.value).to.equal(new Name('Cucumber')))
.next(SceneTagged, event => expect(event.tag).to.equal(new FeatureTag('Serenity/JS recognises a scenario failing due to an assertion error')))
.next(ActivityStarts, event => expect(event.value.name).to.equal(new Name('Given a step that fails with assertion error')))
.next(ActivityStarts, event => expect(event.details.name).to.equal(new Name('Given a step that fails with assertion error')))
.next(ActivityFinished, event => {
expect(event.outcome).to.be.instanceOf(ExecutionFailedWithAssertionError);
expect((event.outcome as ExecutionFailedWithAssertionError).error).to.be.instanceOf(AssertionError);
@@ -33,7 +33,7 @@ describe('@serenity-js/cucumber', function () {
expect(res.exitCode).to.equal(0);

PickEvent.from(res.events)
.next(ActivityStarts, event => expect(event.value.name).to.equal(new Name(
.next(ActivityStarts, event => expect(event.details.name).to.equal(new Name(
'Given a step that receives a table:\n' +
'| Developer | Website |\n' +
'| Jan Molak | janmolak.com |',
@@ -33,7 +33,7 @@ describe('@serenity-js/cucumber', function () {
expect(res.exitCode).to.equal(0);

PickEvent.from(res.events)
.next(SceneStarts, event => expect(event.value.name).to.equal(new Name('First scenario')))
.next(SceneStarts, event => expect(event.details.name).to.equal(new Name('First scenario')))
.next(FeatureNarrativeDetected, event => {
expect(event.description).to.equal(new Description(
'In order to accurately report the scenario\n' +
@@ -33,7 +33,7 @@ describe('@serenity-js/cucumber', function () {
expect(res.exitCode).to.equal(0);

PickEvent.from(res.events)
.next(ActivityStarts, event => expect(event.value.name).to.equal(new Name(
.next(ActivityStarts, event => expect(event.details.name).to.equal(new Name(
'Given a step that receives a doc string:\n' +
'Dear customer,\n' +
'\n' +
@@ -40,10 +40,10 @@ describe('@serenity-js/cucumber', function () {
expect(res.exitCode).to.equal(1);

PickEvent.from(res.events)
.next(SceneStarts, event => expect(event.value.name).to.equal(new Name('A failing scenario')))
.next(SceneStarts, event => expect(event.details.name).to.equal(new Name('A failing scenario')))
.next(TestRunnerDetected, event => expect(event.value).to.equal(new Name('Cucumber')))
.next(SceneTagged, event => expect(event.tag).to.equal(new FeatureTag('Serenity/JS recognises a failing scenario')))
.next(ActivityStarts, event => expect(event.value.name).to.equal(new Name('Given a step that fails with generic error')))
.next(ActivityStarts, event => expect(event.details.name).to.equal(new Name('Given a step that fails with generic error')))
.next(ActivityFinished, event => expect(event.outcome).to.be.instanceOf(ExecutionFailedWithError))
.next(SceneFinished, event => expect(event.outcome).to.be.instanceOf(ExecutionFailedWithError))
;
@@ -40,10 +40,10 @@ describe('@serenity-js/cucumber', function () {
expect(res.exitCode).to.equal(0);

PickEvent.from(res.events)
.next(SceneStarts, event => expect(event.value.name).to.equal(new Name('A passing scenario')))
.next(SceneStarts, event => expect(event.details.name).to.equal(new Name('A passing scenario')))
.next(TestRunnerDetected, event => expect(event.value).to.equal(new Name('Cucumber')))
.next(SceneTagged, event => expect(event.tag).to.equal(new FeatureTag('Serenity/JS recognises a passing scenario')))
.next(ActivityStarts, event => expect(event.value.name).to.equal(new Name('Given a step that passes')))
.next(ActivityStarts, event => expect(event.details.name).to.equal(new Name('Given a step that passes')))
.next(ActivityFinished, event => expect(event.outcome).to.equal(new ExecutionSuccessful()))
.next(SceneFinished, event => expect(event.outcome).to.equal(new ExecutionSuccessful()))
;
@@ -53,10 +53,10 @@ describe('@serenity-js/cucumber', function () {
// expect(res.exitCode).to.equal(0);

PickEvent.from(res.events)
.next(SceneStarts, event => expect(event.value.name).to.equal(new Name('A scenario with steps marked as pending')))
.next(SceneStarts, event => expect(event.details.name).to.equal(new Name('A scenario with steps marked as pending')))
.next(TestRunnerDetected, event => expect(event.value).to.equal(new Name('Cucumber')))
.next(SceneTagged, event => expect(event.tag).to.equal(new FeatureTag('Serenity/JS recognises pending scenarios')))
.next(ActivityStarts, event => expect(event.value.name).to.equal(new Name(`Given a step that's marked as pending`)))
.next(ActivityStarts, event => expect(event.details.name).to.equal(new Name(`Given a step that's marked as pending`)))
.next(ActivityFinished, event => expect(event.outcome.constructor).to.equal(ImplementationPending))
.next(SceneFinished, event => expect(event.outcome.constructor).to.equal(ImplementationPending))
;
@@ -97,10 +97,10 @@ describe('@serenity-js/cucumber', function () {
// expect(res.exitCode).to.equal(0); // cucumber 3 ignores the --no-strict mode

PickEvent.from(res.events)
.next(SceneStarts, event => expect(event.value.name).to.equal(new Name('A scenario with steps that have not been implemented yet')))
.next(SceneStarts, event => expect(event.details.name).to.equal(new Name('A scenario with steps that have not been implemented yet')))
.next(TestRunnerDetected, event => expect(event.value).to.equal(new Name('Cucumber')))
.next(SceneTagged, event => expect(event.tag).to.equal(new FeatureTag('Serenity/JS recognises pending scenarios')))
.next(ActivityStarts, event => expect(event.value.name).to.equal(new Name(`Given a step that hasn't been implemented yet`)))
.next(ActivityStarts, event => expect(event.details.name).to.equal(new Name(`Given a step that hasn't been implemented yet`)))
.next(ActivityFinished, event => expect(event.outcome.constructor).to.equal(ImplementationPending))
.next(SceneFinished, event => expect(event.outcome.constructor).to.equal(ImplementationPending))
;
@@ -133,14 +133,14 @@ describe('@serenity-js/cucumber', function () {
// expect(res.exitCode).to.equal(0);

PickEvent.from(res.events)
.next(SceneStarts, event => expect(event.value.name).to.equal(new Name('A scenario which tag marks it as pending')))
.next(SceneStarts, event => expect(event.details.name).to.equal(new Name('A scenario which tag marks it as pending')))
.next(TestRunnerDetected, event => expect(event.value).to.equal(new Name('Cucumber')))
.next(SceneTagged, event => expect(event.tag).to.equal(new FeatureTag('Serenity/JS recognises pending scenarios')))
.next(ActivityStarts, event => expect(event.value.name).to.equal(new Name(`Given step number one that passes`)))
.next(ActivityStarts, event => expect(event.details.name).to.equal(new Name(`Given step number one that passes`)))
.next(ActivityFinished, event => expect(event.outcome).to.equal(new ExecutionSkipped()))
.next(ActivityStarts, event => expect(event.value.name).to.equal(new Name(`And step number two that is marked as pending`)))
.next(ActivityStarts, event => expect(event.details.name).to.equal(new Name(`And step number two that is marked as pending`)))
.next(ActivityFinished, event => expect(event.outcome).to.equal(new ExecutionSkipped()))
.next(ActivityStarts, event => expect(event.value.name).to.equal(new Name(`And step number three that fails with generic error`)))
.next(ActivityStarts, event => expect(event.details.name).to.equal(new Name(`And step number three that fails with generic error`)))
.next(ActivityFinished, event => expect(event.outcome).to.equal(new ExecutionSkipped()))
.next(SceneFinished, event => expect(event.outcome.constructor).to.equal(ImplementationPending))
;
@@ -166,14 +166,14 @@ describe('@serenity-js/cucumber', function () {
expect(res.exitCode).to.equal(1);

PickEvent.from(res.events)
.next(SceneStarts, event => expect(event.value.name).to.equal(new Name('A scenario which tag marks it as pending')))
.next(SceneStarts, event => expect(event.details.name).to.equal(new Name('A scenario which tag marks it as pending')))
.next(TestRunnerDetected, event => expect(event.value).to.equal(new Name('Cucumber')))
.next(SceneTagged, event => expect(event.tag).to.equal(new FeatureTag('Serenity/JS recognises pending scenarios')))
.next(ActivityStarts, event => expect(event.value.name).to.equal(new Name(`Given step number one that passes`)))
.next(ActivityStarts, event => expect(event.details.name).to.equal(new Name(`Given step number one that passes`)))
.next(ActivityFinished, event => expect(event.outcome).to.equal(new ExecutionSkipped()))
.next(ActivityStarts, event => expect(event.value.name).to.equal(new Name(`And step number two that is marked as pending`)))
.next(ActivityStarts, event => expect(event.details.name).to.equal(new Name(`And step number two that is marked as pending`)))
.next(ActivityFinished, event => expect(event.outcome).to.equal(new ExecutionSkipped()))
.next(ActivityStarts, event => expect(event.value.name).to.equal(new Name(`And step number three that fails with generic error`)))
.next(ActivityStarts, event => expect(event.details.name).to.equal(new Name(`And step number three that fails with generic error`)))
.next(ActivityFinished, event => expect(event.outcome).to.equal(new ExecutionSkipped()))
.next(SceneFinished, event => expect(event.outcome.constructor).to.equal(ImplementationPending))
;
@@ -60,14 +60,14 @@ describe('@serenity-js/cucumber', function () {
expect(event.value.values).to.deep.equal({ result: 'passes' });
})
.next(SceneStarts, event => {
expect(event.value.name).to.equal(expectedScenarioName);
expect(event.value.category).to.equal(expectedScenarioCategory);
expect(event.value.location.line).to.equal(firstScenarioLine);
expect(event.details.name).to.equal(expectedScenarioName);
expect(event.details.category).to.equal(expectedScenarioCategory);
expect(event.details.location.line).to.equal(firstScenarioLine);
})
.next(SceneFinished, event => {
expect(event.value.name).to.equal(expectedScenarioName);
expect(event.value.category).to.equal(expectedScenarioCategory);
expect(event.value.location.line).to.equal(firstScenarioLine);
expect(event.details.name).to.equal(expectedScenarioName);
expect(event.details.category).to.equal(expectedScenarioCategory);
expect(event.details.location.line).to.equal(firstScenarioLine);
})
.next(SceneSequenceDetected, event => {
expect(event.value.name).to.equal(expectedScenarioName);
@@ -82,14 +82,14 @@ describe('@serenity-js/cucumber', function () {
expect(event.value.values).to.deep.equal({ result: 'fails with generic error' });
})
.next(SceneStarts, event => {
expect(event.value.name).to.equal(expectedScenarioName);
expect(event.value.category).to.equal(expectedScenarioCategory);
expect(event.value.location.line).to.equal(secondScenarioLine);
expect(event.details.name).to.equal(expectedScenarioName);
expect(event.details.category).to.equal(expectedScenarioCategory);
expect(event.details.location.line).to.equal(secondScenarioLine);
})
.next(SceneFinished, event => {
expect(event.value.name).to.equal(expectedScenarioName);
expect(event.value.category).to.equal(expectedScenarioCategory);
expect(event.value.location.line).to.equal(secondScenarioLine);
expect(event.details.name).to.equal(expectedScenarioName);
expect(event.details.category).to.equal(expectedScenarioCategory);
expect(event.details.location.line).to.equal(secondScenarioLine);
})
;
}));
@@ -40,27 +40,27 @@ describe('@serenity-js/cucumber', function () {
expect(res.exitCode).to.equal(0);

PickEvent.from(res.events)
.next(SceneStarts, event => expect(event.value.name).to.equal(new Name('A screenplay scenario')))
.next(SceneStarts, event => expect(event.details.name).to.equal(new Name('A screenplay scenario')))
.next(TestRunnerDetected, event => expect(event.value).to.equal(new Name('Cucumber')))
.next(SceneTagged, event => expect(event.tag).to.equal(new FeatureTag('Serenity/JS recognises Screenplay activities')))
// before step
.next(ActivityStarts, event => expect(event.value.name).to.equal(new Name('Lara makes an arrow')))
.next(ActivityFinished, event => expect(event.value.name).to.equal(new Name('Lara makes an arrow')))
.next(ActivityStarts, event => expect(event.details.name).to.equal(new Name('Lara makes an arrow')))
.next(ActivityFinished, event => expect(event.details.name).to.equal(new Name('Lara makes an arrow')))
// when step
.next(ActivityStarts, event => expect(event.value.name).to.equal(new Name('When Lara shoots an arrow')))
.next(ActivityStarts, event => expect(event.value.name).to.equal(new Name('Lara fits an arrow to the bowstring')))
.next(ActivityFinished, event => expect(event.value.name).to.equal(new Name('Lara fits an arrow to the bowstring')))
.next(ActivityStarts, event => expect(event.value.name).to.equal(new Name('Lara draws the bow')))
.next(ActivityFinished, event => expect(event.value.name).to.equal(new Name('Lara draws the bow')))
.next(ActivityStarts, event => expect(event.value.name).to.equal(new Name('Lara releases the bowstring')))
.next(ActivityFinished, event => expect(event.value.name).to.equal(new Name('Lara releases the bowstring')))
.next(ActivityFinished, event => expect(event.value.name).to.equal(new Name('When Lara shoots an arrow')))
.next(ActivityStarts, event => expect(event.details.name).to.equal(new Name('When Lara shoots an arrow')))
.next(ActivityStarts, event => expect(event.details.name).to.equal(new Name('Lara fits an arrow to the bowstring')))
.next(ActivityFinished, event => expect(event.details.name).to.equal(new Name('Lara fits an arrow to the bowstring')))
.next(ActivityStarts, event => expect(event.details.name).to.equal(new Name('Lara draws the bow')))
.next(ActivityFinished, event => expect(event.details.name).to.equal(new Name('Lara draws the bow')))
.next(ActivityStarts, event => expect(event.details.name).to.equal(new Name('Lara releases the bowstring')))
.next(ActivityFinished, event => expect(event.details.name).to.equal(new Name('Lara releases the bowstring')))
.next(ActivityFinished, event => expect(event.details.name).to.equal(new Name('When Lara shoots an arrow')))
// then step
.next(ActivityStarts, event => expect(event.value.name).to.equal(new Name('Then she should hit a target')))
.next(ActivityFinished, event => expect(event.value.name).to.equal(new Name('Then she should hit a target')))
.next(ActivityStarts, event => expect(event.details.name).to.equal(new Name('Then she should hit a target')))
.next(ActivityFinished, event => expect(event.details.name).to.equal(new Name('Then she should hit a target')))
// after
.next(ActivityStarts, event => expect(event.value.name).to.equal(new Name('Lara retrieves the arrow from the target')))
.next(ActivityFinished, event => expect(event.value.name).to.equal(new Name('Lara retrieves the arrow from the target')))
.next(ActivityStarts, event => expect(event.details.name).to.equal(new Name('Lara retrieves the arrow from the target')))
.next(ActivityFinished, event => expect(event.details.name).to.equal(new Name('Lara retrieves the arrow from the target')))
.next(SceneFinished, event => expect(event.outcome).to.equal(new ExecutionSuccessful()))
;
}));

0 comments on commit 943c016

Please sign in to comment.