Socket
Socket
Sign inDemoInstall

html-reporter

Package Overview
Dependencies
Maintainers
7
Versions
309
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-reporter - npm Package Compare versions

Comparing version 2.2.0 to 2.3.0

lib/static/components/state/description.js

15

CHANGELOG.md

@@ -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)

2

gemini.js

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc