html-reporter
Advanced tools
Comparing version 2.2.0 to 2.3.0
@@ -5,2 +5,17 @@ # Change Log | ||
<a name="2.3.0"></a> | ||
# [2.3.0](https://github.com/gemini-testing/html-reporter/compare/v2.2.0...v2.3.0) (2018-02-21) | ||
### Bug Fixes | ||
* mark with red tests failed with error ([2b2c05f](https://github.com/gemini-testing/html-reporter/commit/2b2c05f)) | ||
### Features | ||
* add description block ([f7dda9d](https://github.com/gemini-testing/html-reporter/commit/f7dda9d)) | ||
<a name="2.2.0"></a> | ||
@@ -7,0 +22,0 @@ # [2.2.0](https://github.com/gemini-testing/html-reporter/compare/v2.1.0...v2.2.0) (2018-02-20) |
@@ -76,3 +76,3 @@ 'use strict'; | ||
queue = queue.then(() => { | ||
return wrapped.isEqual() | ||
return wrapped.hasDiff() | ||
? saveTestImages(wrapped, reportPath) | ||
@@ -79,0 +79,0 @@ : handleErrorEvent(wrapped); |
@@ -6,5 +6,6 @@ 'use strict'; | ||
const {findNode} = require('../../../../lib/static/modules/utils'); | ||
const {saveTestImages} = require('../../../reporter-helpers'); | ||
const {saveTestImages, saveTestCurrentImage} = require('../../../reporter-helpers'); | ||
module.exports = (gemini, reportBuilder, client, pluginConfig) => { | ||
const {path: reportPath} = pluginConfig; | ||
const proxy = (event) => { | ||
@@ -42,12 +43,27 @@ gemini.on(event, (...data) => { | ||
const {state: {name}, suite, browserId} = data; | ||
const suitePath = suite.path.concat(name); | ||
const test = {name, suitePath, browserId}; | ||
const nodeResult = findNode(reportBuilder.getSuites(), suitePath); | ||
const browserResult = _.find(nodeResult.browsers, {name: browserId}); | ||
const testResult = prepareTestResult(data); | ||
saveTestImages(reportBuilder.format(data), pluginConfig.path) | ||
.then(() => client.emit(gemini.events.TEST_RESULT, Object.assign(test, {browserResult}))); | ||
saveTestImages(reportBuilder.format(data), reportPath) | ||
.then(() => client.emit(gemini.events.TEST_RESULT, testResult)); | ||
}); | ||
gemini.on(gemini.events.ERROR, (error) => { | ||
reportBuilder.addError(error); | ||
const testResult = prepareTestResult(error); | ||
saveTestCurrentImage(reportBuilder.format(error), reportPath) | ||
.then(() => client.emit(gemini.events.ERROR, testResult)); | ||
}); | ||
gemini.on(gemini.events.RETRY, (data) => { | ||
reportBuilder.addRetry(data); | ||
const formattedResult = reportBuilder.format(data); | ||
const actionFn = formattedResult.hasDiff() | ||
? saveTestImages | ||
: saveTestCurrentImage; | ||
actionFn(formattedResult, reportPath); | ||
}); | ||
proxy(gemini.events.SKIP_STATE); | ||
@@ -57,2 +73,11 @@ proxy(gemini.events.END_STATE); | ||
proxy(gemini.events.END); | ||
function prepareTestResult(test) { | ||
const {state: {name}, suite, browserId} = test; | ||
const suitePath = suite.path.concat(name); | ||
const nodeResult = findNode(reportBuilder.getSuites(), suitePath); | ||
const browserResult = _.find(nodeResult.browsers, {name: browserId}); | ||
return {name, suitePath, browserId, browserResult}; | ||
} | ||
}; |
@@ -97,3 +97,3 @@ 'use strict'; | ||
if (formattedResult.isEqual()) { | ||
if (formattedResult.hasDiff()) { | ||
this._addFailResult(result); | ||
@@ -112,3 +112,3 @@ } else { | ||
_createTestResult(result, status) { | ||
const {browserId, suite, sessionId} = result; | ||
const {browserId, suite, sessionId, description} = result; | ||
const {baseHost} = this._pluginConfig; | ||
@@ -118,3 +118,3 @@ const suiteUrl = suite.getUrl({browserId, baseHost}); | ||
return Object.assign({suiteUrl, name: browserId, metaInfo, status}); | ||
return Object.assign({suiteUrl, name: browserId, metaInfo, status, description}); | ||
} | ||
@@ -121,0 +121,0 @@ |
@@ -28,1 +28,12 @@ 'use strict'; | ||
}; | ||
exports.saveTestCurrentImage = function(result, reportPath) { | ||
const actions = []; | ||
const src = result.imagePath || result.currentPath; | ||
if (src) { | ||
actions.push(utils.copyImageAsync(src, utils.getCurrentAbsolutePath(result, reportPath))); | ||
} | ||
return Promise.all(actions); | ||
}; |
@@ -9,2 +9,3 @@ 'use strict'; | ||
import StateFail from './state-fail'; | ||
import Description from './description'; | ||
@@ -23,3 +24,4 @@ export default class State extends Component { | ||
actualPath: PropTypes.string, | ||
diffPath: PropTypes.string | ||
diffPath: PropTypes.string, | ||
description: PropTypes.string | ||
}) | ||
@@ -30,3 +32,3 @@ } | ||
const {suiteUrl, metaInfo, error, success, fail, reason, image, | ||
expectedPath, actualPath, diffPath} = this.props.state; | ||
expectedPath, actualPath, diffPath, description} = this.props.state; | ||
@@ -46,2 +48,3 @@ let elem = null; | ||
<MetaInfo metaInfo={metaInfo} suiteUrl={suiteUrl}/> | ||
{description && <Description content={description} />} | ||
{elem} | ||
@@ -48,0 +51,0 @@ </Fragment> |
'use strict'; | ||
import React, {Component} from 'react'; | ||
import React, {Component, Fragment} from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import classNames from 'classnames'; | ||
import {map} from 'lodash'; | ||
import ToggleOpen from './toggle-open'; | ||
@@ -14,3 +14,3 @@ const mkLinkToUrl = (url, text) => { | ||
return map(metaInfo, (value, key) => { | ||
return <div key = {key} className="meta-info__item"><span className="meta-info__item-key">{key}</span>: {value}</div>; | ||
return <div key = {key} className="toggle-open__item"><span className="toggle-open__item-key">{key}</span>: {value}</div>; | ||
}); | ||
@@ -25,16 +25,4 @@ }; | ||
constructor(props) { | ||
super(props); | ||
this.state = {collapsed: true}; | ||
this._toggleState = this._toggleState.bind(this); | ||
} | ||
render() { | ||
const className = classNames( | ||
'meta-info', | ||
{'meta-info_collapsed': this.state.collapsed} | ||
); | ||
const {url, file, sessionId} = this.props.metaInfo; | ||
const {suiteUrl} = this.props; | ||
const {metaInfo: {url, file, sessionId}, suiteUrl} = this.props; | ||
const metaElements = metaToElements({ | ||
@@ -47,15 +35,7 @@ url: mkLinkToUrl(suiteUrl, url), | ||
return ( | ||
<div className={className}> | ||
<div onClick={this._toggleState} className="meta-info__switcher">Meta-info</div> | ||
<div className="meta-info__content"> | ||
{metaElements} | ||
</div> | ||
</div> | ||
<Fragment> | ||
<ToggleOpen title='Meta-info' content={metaElements}/> | ||
</Fragment> | ||
); | ||
} | ||
_toggleState(event) { | ||
this.setState({collapsed: !this.state.collapsed}); | ||
event.preventDefault(); | ||
} | ||
} |
@@ -26,6 +26,7 @@ 'use strict'; | ||
_subscribeToEvents() { | ||
const {actions} = this.props; | ||
const eventSource = new EventSource('/events'); | ||
eventSource.addEventListener('beginSuite', (e) => { | ||
const data = JSON.parse(e.data); | ||
this.props.actions.suiteBegin(data); | ||
actions.suiteBegin(data); | ||
}); | ||
@@ -35,8 +36,10 @@ | ||
const data = JSON.parse(e.data); | ||
this.props.actions.testBegin(data); | ||
actions.testBegin(data); | ||
}); | ||
eventSource.addEventListener('testResult', (e) => { | ||
const data = JSON.parse(e.data); | ||
this.props.actions.testResult(data); | ||
['testResult', 'err'].forEach((eventName) => { | ||
eventSource.addEventListener(eventName, (e) => { | ||
const data = JSON.parse(e.data); | ||
actions.testResult(data); | ||
}); | ||
}); | ||
@@ -43,0 +46,0 @@ |
@@ -71,6 +71,6 @@ 'use strict'; | ||
const {suitePath, browserResult, browserId} = action.payload; | ||
const node = findNode(suites, suitePath); | ||
const test = findNode(suites, suitePath); | ||
if (node) { | ||
node.browsers.forEach((b) => { | ||
if (test) { | ||
test.browsers.forEach((b) => { | ||
if (b.name === browserId) { | ||
@@ -77,0 +77,0 @@ Object.assign(b, browserResult); |
@@ -54,2 +54,6 @@ 'use strict'; | ||
} | ||
get description() { | ||
return this._testResult.description; | ||
} | ||
}; |
@@ -12,3 +12,3 @@ 'use strict'; | ||
isEqual() { | ||
hasDiff() { | ||
return this._testResult.hasOwnProperty('equal'); | ||
@@ -15,0 +15,0 @@ } |
{ | ||
"name": "html-reporter", | ||
"version": "2.2.0", | ||
"version": "2.3.0", | ||
"description": "Plugin for gemini and hermione which is intended to aggregate the results of tests running into html report", | ||
@@ -13,3 +13,4 @@ "scripts": { | ||
"commitmsg": "conventional-changelog-lint -e", | ||
"release": "standard-version" | ||
"release": "standard-version", | ||
"watch": "webpack --progress -d --config=webpack.dev.js --watch" | ||
}, | ||
@@ -43,2 +44,3 @@ "repository": { | ||
"opener": "^1.4.3", | ||
"react-markdown": "^3.2.0", | ||
"resolve": "^1.5.0", | ||
@@ -45,0 +47,0 @@ "semver": "^5.5.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6323997
81
6647
15
1
+ Addedreact-markdown@^3.2.0
+ Addedbail@1.0.5(transitive)
+ Addedcharacter-entities@1.2.4(transitive)
+ Addedcharacter-entities-legacy@1.1.4(transitive)
+ Addedcharacter-reference-invalid@1.1.4(transitive)
+ Addedcollapse-white-space@1.0.6(transitive)
+ Addedextend@3.0.2(transitive)
+ Addedis-alphabetical@1.0.4(transitive)
+ Addedis-alphanumerical@1.0.4(transitive)
+ Addedis-buffer@1.1.6(transitive)
+ Addedis-decimal@1.0.4(transitive)
+ Addedis-hexadecimal@1.0.4(transitive)
+ Addedis-plain-obj@1.1.0(transitive)
+ Addedis-whitespace-character@1.0.4(transitive)
+ Addedis-word-character@1.0.4(transitive)
+ Addedjs-tokens@4.0.0(transitive)
+ Addedloose-envify@1.4.0(transitive)
+ Addedmarkdown-escapes@1.0.4(transitive)
+ Addedmdast-add-list-metadata@1.0.1(transitive)
+ Addedobject-assign@4.1.1(transitive)
+ Addedparse-entities@1.2.2(transitive)
+ Addedprop-types@15.8.1(transitive)
+ Addedreact@16.14.0(transitive)
+ Addedreact-is@16.13.1(transitive)
+ Addedreact-markdown@3.6.0(transitive)
+ Addedremark-parse@5.0.0(transitive)
+ Addedrepeat-string@1.6.1(transitive)
+ Addedreplace-ext@1.0.0(transitive)
+ Addedstate-toggle@1.0.3(transitive)
+ Addedtrim@0.0.1(transitive)
+ Addedtrim-trailing-lines@1.1.4(transitive)
+ Addedtrough@1.0.5(transitive)
+ Addedunherit@1.1.3(transitive)
+ Addedunified@6.2.0(transitive)
+ Addedunist-util-is@3.0.0(transitive)
+ Addedunist-util-remove-position@1.1.4(transitive)
+ Addedunist-util-stringify-position@1.1.2(transitive)
+ Addedunist-util-visit@1.4.1(transitive)
+ Addedunist-util-visit-parents@1.1.22.1.2(transitive)
+ Addedvfile@2.3.0(transitive)
+ Addedvfile-location@2.0.6(transitive)
+ Addedvfile-message@1.1.1(transitive)
+ Addedx-is-string@0.1.0(transitive)
+ Addedxtend@4.0.2(transitive)