Skip to content
Permalink
Browse files
feat(core): Serenity/JS reports are compatible with Serenity BDD CLI …
…2.1.8
  • Loading branch information
jan-molak committed Apr 4, 2019
1 parent 1e89aab commit aea17de65b052dd1a700010a1863667b84b25aec
@@ -18,9 +18,9 @@
"scripts": {
"clean": "rimraf target",
"lint": "tslint --project tsconfig-lint.json --config ../../tslint.json --format stylish",
"test:update-serenity": "serenity update --artifact net.serenity-bdd:serenity-cli:jar:all:2.1.5 --repository https://jcenter.bintray.com/ --ignoreSSL",
"test:update-serenity": "serenity update --artifact net.serenity-bdd:serenity-cli:jar:all:2.1.8 --repository https://jcenter.bintray.com/ --ignoreSSL",
"test:acceptance": "cucumber-js --require-module ts-node/register --format node_modules/@serenity-js/cucumber/register.js --require ./features/step_definitions/domain-level.steps.ts --require ./features/support/configure_serenity.ts",
"test:report": "serenity run --artifact net.serenity-bdd:serenity-cli:jar:all:2.1.5",
"test:report": "serenity run --artifact net.serenity-bdd:serenity-cli:jar:all:2.1.8",
"test": "failsafe clean test:update-serenity test:acceptance test:report",
"verify": "npm test"
},
@@ -18,9 +18,9 @@
"scripts": {
"clean": "rimraf target",
"lint": "tslint --project tsconfig-lint.json --config ../../tslint.json --format stylish",
"test:update-serenity": "serenity update --artifact net.serenity-bdd:serenity-cli:jar:all:2.1.5 --repository https://jcenter.bintray.com/ --ignoreSSL",
"test:update-serenity": "serenity update --artifact net.serenity-bdd:serenity-cli:jar:all:2.1.8 --repository https://jcenter.bintray.com/ --ignoreSSL",
"test:acceptance": "cucumber-js --require-module ts-node/register --format node_modules/@serenity-js/cucumber/register.js --require ./features/step_definitions/sample.steps.ts --require ./features/support/configure_serenity.ts",
"test:report": "serenity run --artifact net.serenity-bdd:serenity-cli:jar:all:2.1.5",
"test:report": "serenity run --artifact net.serenity-bdd:serenity-cli:jar:all:2.1.8",
"test": "failsafe clean test:update-serenity test:acceptance test:report",
"verify": "npm test || true"
},
@@ -1,8 +1,8 @@
import { Ensure, equals, Expectation } from '@serenity-js/assertions';
import { KnowableUnknown, Task } from '@serenity-js/core';
import { Answerable, Task } from '@serenity-js/core';
import { GetRequest, LastResponse, Send } from '@serenity-js/rest';

export const VerifyResultAt = (url: KnowableUnknown<string>, expectation: Expectation<KnowableUnknown<any>>) =>
export const VerifyResultAt = (url: Answerable<string>, expectation: Expectation<Answerable<any>>) =>
Task.where(`#actor verifies result at ${ url }`,
Send.a(GetRequest.to(url)),
Ensure.that(LastResponse.status(), equals(200)),
@@ -18,9 +18,9 @@
"scripts": {
"clean": "rimraf target",
"lint": "tslint --project tsconfig-lint.json --config ../../tslint.json --format stylish",
"test:update-serenity": "serenity update --artifact net.serenity-bdd:serenity-cli:jar:all:2.1.5 --repository https://jcenter.bintray.com/ --ignoreSSL",
"test:update-serenity": "serenity update --artifact net.serenity-bdd:serenity-cli:jar:all:2.1.8 --repository https://jcenter.bintray.com/ --ignoreSSL",
"test:acceptance": "cucumber-js --require-module ts-node/register --format node_modules/@serenity-js/cucumber/register.js --require ./features/step_definitions/api-level.steps.ts --require ./features/support/configure_serenity.ts",
"test:report": "serenity run --artifact net.serenity-bdd:serenity-cli:jar:all:2.1.5",
"test:report": "serenity run --artifact net.serenity-bdd:serenity-cli:jar:all:2.1.8",
"test": "failsafe clean test:update-serenity test:acceptance test:report",
"verify": "npm test"
},
@@ -14,7 +14,7 @@ import {
TestRunFinished,
} from '../../../../../src/events';
import { Path } from '../../../../../src/io';
import { ActivityDetails, ExecutionSuccessful, JSONData, Name, Photo } from '../../../../../src/model';
import { ActivityDetails, ExecutionSuccessful, JSONData, Name, Photo, TextData } from '../../../../../src/model';
import { SerenityBDDReporter, StageManager } from '../../../../../src/stage';
import { SerenityBDDReport } from '../../../../../src/stage/crew/serenity-bdd-reporter/SerenityBDDJsonSchema';
import { expect } from '../../../../expect';
@@ -186,6 +186,7 @@ describe('SerenityBDDReporter', () => {
new TaskStarts(makePayment),
new ArtifactGenerated(new Name('make a payment message'), JSONData.fromJSON({ amount: '£42' })),
new ArtifactArchived(new Name('make a payment message'), JSONData, new Path('target/site/serenity/make-a-payment-message-md5hash.json')),
new ArtifactGenerated(new Name('server log'), TextData.fromJSON({ contentType: 'text/plain', data: 'received payment request' })),
new TaskFinished(makePayment, new ExecutionSuccessful()),
new SceneFinished(defaultCardScenario, new ExecutionSuccessful()),
new TestRunFinished(),
@@ -195,12 +196,16 @@ describe('SerenityBDDReporter', () => {

expect(report.testSteps).to.have.lengthOf(2);
expect(report.testSteps[0].number).to.equal(1);
expect(report.testSteps[0].reportData.title).to.equal('pick a card message');
expect(report.testSteps[0].reportData.contents).to.equal('{\n "card": "default"\n}');
expect(report.testSteps[0].reportData[0].title).to.equal('pick a card message');
expect(report.testSteps[0].reportData[0].contents).to.equal('{\n "card": "default"\n}');

expect(report.testSteps[1].number).to.equal(2);
expect(report.testSteps[1].reportData.title).to.equal('make a payment message');
expect(report.testSteps[1].reportData.contents).to.deep.equal('{\n \"amount\": \"£42\"\n}');

expect(report.testSteps[1].reportData[0].title).to.equal('make a payment message');
expect(report.testSteps[1].reportData[0].contents).to.deep.equal('{\n \"amount\": \"£42\"\n}');

expect(report.testSteps[1].reportData[1].title).to.equal('server log');
expect(report.testSteps[1].reportData[1].contents).to.deep.equal('received payment request');
});
});

@@ -34,16 +34,16 @@ export interface SerenityBDDReport extends JSONObject {
}

export interface TestStep extends JSONObject {
number: number; // done [x]
description: string; // done [x]
duration: number; // done [x]
startTime: number; // done [x]
result: string; // done [x]
children?: TestStep[]; // done [x]
screenshots?: Screenshot[]; // done [x]
reportData?: ReportData; // done [x]
restQuery?: RESTQuery; // done [x]
exception?: ErrorDetails; // done [X]
number: number;
description: string;
duration: number;
startTime: number;
result: string;
children?: TestStep[];
screenshots?: Screenshot[];
reportData: ReportData[];
restQuery?: RESTQuery;
exception?: ErrorDetails;
// precondition: false; // not needed?
}

@@ -140,6 +140,7 @@ export class SceneReport {
description: activity.name.value,
startTime: time.toMillisecondTimestamp(),
children: [],
reportData: [],
screenshots: [],
};

@@ -236,13 +237,13 @@ export class SceneReport {

arbitraryDataCaptured(name: Name, contents: string) {
return this.withMutated(report => {
this.activities.mostRecentlyAccessedItem().reportData = {
this.activities.mostRecentlyAccessedItem().reportData.push({
id: `report-data-${ cuid() }`,
isEvidence: false,
path: '',
title: name.value,
contents,
};
});
});
}

0 comments on commit aea17de

Please sign in to comment.