Socket
Socket
Sign inDemoInstall

html-reporter

Package Overview
Dependencies
147
Maintainers
7
Versions
295
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.3.0 to 2.4.0

10

CHANGELOG.md

@@ -5,2 +5,12 @@ # Change Log

<a name="2.4.0"></a>
# [2.4.0](https://github.com/gemini-testing/html-reporter/compare/v2.3.0...v2.4.0) (2018-02-27)
### Features
* add retry logic for gui ([#50](https://github.com/gemini-testing/html-reporter/issues/50)) ([3f2c3be](https://github.com/gemini-testing/html-reporter/commit/3f2c3be))
<a name="2.3.0"></a>

@@ -7,0 +17,0 @@ # [2.3.0](https://github.com/gemini-testing/html-reporter/compare/v2.2.0...v2.3.0) (2018-02-21)

2

lib/gui/server.js

@@ -8,2 +8,3 @@ 'use strict';

const App = require('./app');
const bodyParser = require('body-parser');

@@ -14,2 +15,3 @@ exports.start = (paths, tool, configs) => {

server.use(bodyParser.json());
server.use(express.static(path.join(__dirname, '../static'), {index: 'gui.html'}));

@@ -16,0 +18,0 @@ server.use('/images', express.static(path.join(process.cwd(), configs.pluginConfig.path, 'images')));

@@ -35,3 +35,5 @@ 'use strict';

run(tests = []) {
return Runner.create(this._collection, tests)
const formattedTests = _.flatMap([].concat(tests), formatTests);
return Runner.create(this._collection, formattedTests)
.run((collection) => this._gemini.test(collection, {reporters: ['vflat']}));

@@ -98,1 +100,19 @@ }

}
function formatTests(test) {
if (test.children) {
return _.flatMap(test.children, formatTests);
}
if (test.browserId) {
test.browsers = _.filter(test.browsers, {name: test.browserId});
}
return _.flatMap(test.browsers, (browser) => {
return {
suite: {path: test.suitePath.slice(0, -1)},
state: {name: test.name},
browserId: browser.name
};
});
}

2

lib/gui/tool-runner-factory/gemini/runner/specific-suites-runner.js

@@ -20,3 +20,3 @@ 'use strict';

return {
suite: test.suite.path.replace(/,/g, ' '), // converting path to suite fullName
suite: test.suite.path.join(' ').replace(/,/g, ' '), // converting path to suite fullName
state: test.state.name,

@@ -23,0 +23,0 @@ browserId: test.browserId

@@ -17,5 +17,6 @@ 'use strict';

render() {
const {label, handler, isActive, isAction, isDisabled = false} = this.props;
const {label, handler, isActive, isAction, isSuiteControl, isDisabled = false} = this.props;
const className = classNames(
'button',
{'button_type_suite-controls': isSuiteControl},
{'button_checked': isActive},

@@ -22,0 +23,0 @@ {'button_type_action': isAction}

@@ -11,4 +11,10 @@ 'use strict';

class ControlButtons extends Component {
_runFailedTests = () => {
const {actions, failed} = this.props;
return actions.runFailedTests(failed);
}
render() {
const {actions} = this.props;
const {actions, running, failed} = this.props;

@@ -21,7 +27,8 @@ return (

handler={actions.runAllTests}
isDisabled={running}
/>
<ControlButton
label="Retry failed tests"
isDisabled={true}
handler={actions.runFailed}
isDisabled={running || !failed.length}
handler={this._runFailedTests}
/>

@@ -31,2 +38,3 @@ <ControlButton

handler={actions.acceptAll}
isDisabled={running || !failed.length}
/>

@@ -40,4 +48,8 @@ <CommonControls/>

export default connect(
(state) => ({view: state.view}),
(state) => ({
view: state.view,
failed: state.suites.failed,
running: state.running
}),
(dispatch) => ({actions: bindActionCreators(actions, dispatch)})
)(ControlButtons);

@@ -50,16 +50,24 @@ 'use strict';

onSuiteRetry() {
actions.retrySuite(this.props.suite);
const {result, suite} = this.props;
this.props.actions.retrySuite(suite, result.name);
}
_addExtraButtons() {
const {result, gui} = this.props;
const {result, gui, running} = this.props;
const retryDisabled = running || result.success || (!result.fail && !result.error);
return gui
? (
<div className="controls__item">
<ControlButton label="✔ Accept"
<ControlButton
label="✔ Accept"
isSuiteControl={true}
isDisabled={!result.fail}
handler={this.onSuiteAccept}
/>
<ControlButton label="↻ Retry"
isDisabled={!result.fail || !result.error || result.success}
<ControlButton
label="↻ Retry"
isSuiteControl={true}
isDisabled={retryDisabled}
handler={this.onSuiteRetry}

@@ -100,4 +108,4 @@ />

export default connect(
(state) => ({gui: state.gui}),
(state) => ({gui: state.gui, running: state.running}),
(dispatch) => ({actions: bindActionCreators(actions, dispatch)})
)(SectionBrowserBody);

@@ -9,3 +9,3 @@ 'use strict';

import {bindActionCreators} from 'redux';
import {initial, suiteBegin, testBegin, testResult} from '../modules/actions';
import {initial, suiteBegin, testBegin, testResult, testsEnd} from '../modules/actions';

@@ -46,2 +46,6 @@ class Suites extends Component {

eventSource.addEventListener('end', () => {
this.props.actions.testsEnd();
});
eventSource.onerror = () => {

@@ -67,3 +71,3 @@ console.error('Seems like servers went down. Closing connection...');

const actions = {initial, testBegin, suiteBegin, testResult};
const actions = {initial, testBegin, suiteBegin, testResult, testsEnd};

@@ -70,0 +74,0 @@ export default connect(

@@ -9,2 +9,3 @@ 'use strict';

TEST_RESULT: 'TEST_RESULT',
TESTS_END: 'TEST_END',
ACCEPT_ALL: 'ACCEPT_ALL',

@@ -11,0 +12,0 @@ ACCEPT_SUITE: 'ACCEPT_SUITE',

@@ -5,2 +5,3 @@ 'use strict';

import axios from 'axios';
import {assign, cloneDeep} from 'lodash';
import testStatuses from '../../constants/test-statuses';

@@ -38,9 +39,23 @@

export const runFailedTests = (fails) => {
return async (dispatch) => {
try {
await axios.post('/run', fails);
dispatch({type: actionNames.RUN_FAILED_TESTS});
} catch (e) {
console.error('Error while running failed tests:', e);
}
};
};
export const retrySuite = (suite, browserId) => {
return runFailedTests(assign({browserId}, cloneDeep(suite)));
};
export const suiteBegin = (suite) => ({type: actionNames.SUITE_BEGIN, payload: suite});
export const testBegin = (test) => ({type: actionNames.TEST_BEGIN, payload: test});
export const testResult = (result) => ({type: actionNames.TEST_RESULT, payload: result});
export const runFailed = () => ({type: actionNames.RUN_FAILED_TESTS});
export const testsEnd = () =>({type: actionNames.TESTS_END});
export const acceptAll = () => ({type: actionNames.ACCEPT_ALL});
export const acceptSuite = () => ({type: actionNames.ACCEPT_SUITE});
export const retrySuite = () => ({type: actionNames.RETRY_SUITE});
export const expandAll = () => ({type: actionNames.VIEW_EXPAND_ALL});

@@ -47,0 +62,0 @@ export const expandErrors = () => ({type: actionNames.VIEW_EXPAND_ERRORS});

@@ -5,2 +5,3 @@ 'use strict';

gui: true,
running: false,
skips: [],

@@ -7,0 +8,0 @@ suites: {

@@ -6,4 +6,4 @@ 'use strict';

import defaultState from './default-state';
import {merge, filter, cloneDeep} from 'lodash';
import {hasFails, setStatusToAll, findNode, setStatusForBranch} from './utils';
import {assign, merge, filter, flatMap, cloneDeep, set} from 'lodash';
import {hasFails, isSuiteFailed, setStatusToAll, findNode, setStatusForBranch} from './utils';

@@ -39,4 +39,7 @@ const compiledData = window.data || defaultState;

return merge({}, state, {suites: {all: suites}});
return merge({}, state, {running: true, suites: {all: suites}});
}
case actionNames.RUN_FAILED_TESTS: {
return merge({}, state, {running: true});
}
case actionNames.VIEW_INITIAL: {

@@ -84,4 +87,9 @@ const {gui, suites} = action.payload;

return merge({}, state, {suites: {all: suites}});
const failed = filterFailedSuites(cloneDeep(suites));
return assign({}, state, {suites: {all: suites, failed}});
}
case actionNames.TESTS_END: {
return merge({}, state, {running: false});
}
case actionNames.VIEW_EXPAND_ALL: {

@@ -147,1 +155,11 @@ return merge({}, state, {view: {expand: 'all'}});

}
function filterFailedSuites(suites = []) {
const modifySuite = (suite) => {
return suite.children
? flatMap(suite.children, modifySuite)
: set(suite, 'browsers', filter(suite.browsers, ({result}) => isSuiteFailed(result)));
};
return flatMap(suites, modifySuite).filter(hasFails);
}

@@ -8,5 +8,10 @@ 'use strict';

const isFailed = node.result && (node.result.error || node.result.fail);
return isFailed || walk(node, hasFails);
}
function isSuiteFailed(suite) {
return suite.status === testStatuses.FAIL || suite.status === testStatuses.ERROR;
}
function hasRetries(node) {

@@ -77,2 +82,3 @@ const isRetried = node.retries && node.retries.length;

hasFails,
isSuiteFailed,
hasRetries,

@@ -79,0 +85,0 @@ allSkipped,

{
"name": "html-reporter",
"version": "2.3.0",
"version": "2.4.0",
"description": "Plugin for gemini and hermione which is intended to aggregate the results of tests running into html report",

@@ -36,2 +36,3 @@ "scripts": {

"bluebird": "^3.4.7",
"body-parser": "^1.18.2",
"chalk": "^1.1.3",

@@ -38,0 +39,0 @@ "express": "^4.16.2",

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 too big to display

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc