Skip to content

Commit

Permalink
Merge 6741eb5 into 5798fbe
Browse files Browse the repository at this point in the history
  • Loading branch information
DesHorsley committed Oct 13, 2019
2 parents 5798fbe + 6741eb5 commit 6428f31
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 8 deletions.
2 changes: 1 addition & 1 deletion e2e/step_definitions/view-feature-tags.steps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ Then(`Ira will see the tag '@GH-30' in the tile bar of the 'View Feature tag' fe
const pageText = $('html').text();

// ([.\n\s]*)1/ Match all spaces and new line chars
const passedFeatures = /@GH-30/;
const passedFeatures = /@GH-30([.\n\s]*)Ability: View tags in report/;
expect(passedFeatures.test(pageText)).eql(true);
});
34 changes: 30 additions & 4 deletions e2e/step_definitions/view-summary-tags.steps.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,35 @@
// tslint:disable-next-line: file-name-casing
import { expect } from 'chai';
import * as cherrio from 'cheerio';
import { Given, Then, When } from 'cucumber';
import * as fs from 'fs';
import { IReportOptions } from '../../dist/src/models/reportOptions';

import { Reporter } from '../../dist/src/reporter';
const reportLocation = 'e2e/reportOutput/report-summary-tags.html';
const jsonOutput = 'e2e/resources/tagsOnScenariosAndFunctions.json';

let reporter: Reporter;
let reportOptions: IReportOptions;
// tslint:disable-next-line: max-line-length
Given(`Jon has results from a cucumber test containing the tag '@GH-30' against the scenario 'View scenario tag'`, () => 'pending');
Given(`Jon has results from a cucumber test containing the tag '@GH-30' against the scenario 'View scenario tag'`, () => {
reportOptions = <IReportOptions>{
jsonFile: jsonOutput,
output: reportLocation,
};
});

When(`Jon runs yachr against the result`, () => {
reporter = new Reporter();
reporter.generate(reportOptions);
});

When(`Jon runs yachr against the result`, () => 'pending');
// tslint:disable-next-line: max-line-length
Then(`Jon will see the tag '@GH-30' in the title bar of the scenario 'View Scenario tag' in the generated report`, () => {
const $ = cherrio.load(fs.readFileSync(reportLocation, 'utf8'));
const pageText = $('html').text();

Then(`Jon will see the tag '@GH-30' in the title bar of the scenario 'View Scenario tag' in the generated report`, () =>
'pending');
// ([.\n\s]*)1/ Match all spaces and new line chars
const passedFeatures = /@GH-30([.\n\s]*)Scenario: View Feature tag/;
expect(passedFeatures.test(pageText)).eql(true);
});
3 changes: 3 additions & 0 deletions src/models/aggregator/scenarioSummary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ export class ScenarioSummary {
public scenarioDescription: string = '';
public scenarioKeyword: string = '';

/** All tags on the scenario as a comma separated list */
public tags: string = '';

/** All steps in the scenario */
get total(): number {
return this.passed + this.failed + this.undefined +
Expand Down
2 changes: 2 additions & 0 deletions src/reportAggregator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ describe('report-aggregator', () => {
scenarioName: 'Login via login page',
skipped: 0,
steps,
tags: '',
totalDuration: 5,
undefined: 0
} as ScenarioSummary;
Expand Down Expand Up @@ -260,6 +261,7 @@ describe('report-aggregator', () => {
scenarioName: 'Login via login page',
skipped: 1,
steps,
tags: '',
totalDuration: 40,
undefined: 0,
};
Expand Down
2 changes: 1 addition & 1 deletion src/reportAggregator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ export class ReportAggregator {
summary.scenarioName = scenario.name;
summary.scenarioDescription = scenario.description || '';
summary.scenarioKeyword = scenario.keyword;
summary.tags = scenario.tags.map((tag => tag.name)).join(', ');

return summary;
}

}
2 changes: 1 addition & 1 deletion src/reporter.manual.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// import { IReportOptions } from './models/reportOptions';
// import { Reporter } from './reporter';

// describe('reporter manual', () => {
// describe.only('reporter manual', () => {
// let reporter: Reporter;
// beforeEach(() => {
// reporter = new Reporter();
Expand Down
5 changes: 4 additions & 1 deletion src/templates/scenario.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<details class="{{getScenarioCss this}}">
<summary>
Scenario: {{this.scenarioName}}
{{#if this.tags }}
<div><strong><small>{{ this.tags }}</small></strong></div>
{{/if}}
{{this.scenarioKeyword}}: {{this.scenarioName}}
<span class="feature-rollup-summary">
{{#if this.failed}}
<i class="material-icons" title="Failing">clear</i>{{this.failed}}
Expand Down

0 comments on commit 6428f31

Please sign in to comment.