Skip to content
This repository has been archived by the owner on Sep 21, 2022. It is now read-only.

Commit

Permalink
fix: Make clickable reason-links for skipped results in html report
Browse files Browse the repository at this point in the history
  • Loading branch information
up73k committed Jan 23, 2017
1 parent 5adb3b9 commit d266665
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 14 deletions.
1 change: 0 additions & 1 deletion lib/reporters/html/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ var _ = require('lodash'),

absolutePath = _.partial(path.resolve, REPORT_OUT_DIR);


/**
* @param {String} kind - одно из значение 'ref', 'current', 'diff'
* @param {StateResult} result
Expand Down
10 changes: 10 additions & 0 deletions lib/reporters/html/static/report.css
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,16 @@
user-select: none;
}

.section__title_skipped {
color: #ccc;
cursor: default;

-moz-user-select: text;
-webkit-user-select: text;
-ms-user-select: text;
user-select: text;
}

.section__title:before, .meta-info__switcher:before {
display: inline-block;
margin-right: 2px;
Expand Down
14 changes: 8 additions & 6 deletions lib/reporters/html/templates/suite.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@
{{#each browsers}}
<div class="section section_collapsed {{section-status}} {{has-retries}}">
{{#if result.skipped}}
{{#if result.reason}}
<div class="section__title">[skipped] {{result.name}}, reason: {{result.reason}}</div>
{{/if}}
{{#unless result.reason}}
<div class="section__title">[skipped] {{result.name}}</div>
{{/unless}}
<div class="section__title section__title_skipped">
{{#if result.reason}}
[skipped] {{result.name}}, reason: {{{result.reason}}}
{{/if}}
{{#unless result.reason}}
[skipped] {{result.name}}
{{/unless}}
</div>
{{/if}}
{{#unless result.skipped}}
<div class="section__title">
Expand Down
18 changes: 11 additions & 7 deletions lib/reporters/html/view-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,15 @@ module.exports = class ViewModel {
* @param {StateResult} result
*/
addSkipped(result) {
const comment = result.suite.skipComment && wrapLinkByTag(result.suite.skipComment);

this._skips.push({suite: result.suite.fullName, browser: result.browserId, comment});

this._addTestResult(result, {
skipped: true,
reason: result.suite.skipComment
reason: comment
});

const comment = result.suite.skipComment
&& result.suite.skipComment.replace(/https?:\/\/[^\s]*/g, (url) => {
return `<a target="_blank" href="${url}">${url}</a>`;
});
this._skips.push({suite: result.suite.fullName, browser: result.browserId, comment});

this._counter.onSkipped(result);
}

Expand Down Expand Up @@ -208,3 +206,9 @@ function findOrCreate(node, statePath) {

return findOrCreate(child, statePath);
}

function wrapLinkByTag(text) {
return text.replace(/https?:\/\/[^\s]*/g, (url) => {
return `<a target="_blank" href="${url}">${url}</a>`;
});
}

0 comments on commit d266665

Please sign in to comment.