-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c9fe3c5
commit 7a566a3
Showing
24 changed files
with
980 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
'use strict'; | ||
|
||
import React, {Component} from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import classNames from 'classnames'; | ||
|
||
import Suites from '../suites'; | ||
|
||
export default class ErrorGroupsItem extends Component { | ||
state = { | ||
collapsed: true | ||
}; | ||
|
||
static propTypes = { | ||
group: PropTypes.object.isRequired | ||
} | ||
|
||
_toggleState = () => { | ||
this.setState({collapsed: !this.state.collapsed}); | ||
} | ||
|
||
render() { | ||
const {name, pattern, count, tests} = this.props.group; | ||
|
||
const body = this.state.collapsed | ||
? null | ||
: <div className="error-group__body error-group__body_guided"> | ||
<Suites errorGroupTests={tests}/> | ||
<hr/> | ||
</div>; | ||
|
||
const className = classNames( | ||
'error-group', | ||
{'error-group_collapsed': this.state.collapsed} | ||
); | ||
|
||
return ( | ||
<div className={className}> | ||
<div className="error-group__title" onClick={this._toggleState} title={pattern}> | ||
<div className="error-group__name">{name}</div> | ||
<i> ({count})</i> | ||
</div> | ||
{body} | ||
</div> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
'use strict'; | ||
|
||
import React, {Component} from 'react'; | ||
import {connect} from 'react-redux'; | ||
import PropTypes from 'prop-types'; | ||
|
||
import ErrorGroupsItem from './item'; | ||
|
||
class ErrorGroupsList extends Component { | ||
static propTypes = { | ||
groupedErrors: PropTypes.array.isRequired | ||
}; | ||
|
||
render() { | ||
const {groupedErrors} = this.props; | ||
|
||
return groupedErrors.length === 0 | ||
? <div>There is no test failure to be displayed.</div> | ||
: ( | ||
<div className="groupedErrors"> | ||
{groupedErrors.map(group => { | ||
return <ErrorGroupsItem key={group.name} group={group} />; | ||
})} | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default connect(({groupedErrors}) => ({groupedErrors}))(ErrorGroupsList); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
'use strict'; | ||
|
||
import React, {Component} from 'react'; | ||
import {connect} from 'react-redux'; | ||
import PropTypes from 'prop-types'; | ||
import {bindActionCreators} from 'redux'; | ||
|
||
import ErrorGroupsList from './error-groups/list'; | ||
import Suites from './suites'; | ||
import clientEvents from '../../gui/constants/client-events'; | ||
import {suiteBegin, testBegin, testResult, testsEnd} from '../modules/actions'; | ||
|
||
class MainTree extends Component { | ||
static propTypes = { | ||
gui: PropTypes.bool, | ||
groupByError: PropTypes.bool.isRequired | ||
} | ||
|
||
componentDidMount() { | ||
this.props.gui && this._subscribeToEvents(); | ||
} | ||
|
||
_subscribeToEvents() { | ||
const {actions} = this.props; | ||
const eventSource = new EventSource('/events'); | ||
eventSource.addEventListener(clientEvents.BEGIN_SUITE, (e) => { | ||
const data = JSON.parse(e.data); | ||
actions.suiteBegin(data); | ||
}); | ||
|
||
eventSource.addEventListener(clientEvents.BEGIN_STATE, (e) => { | ||
const data = JSON.parse(e.data); | ||
actions.testBegin(data); | ||
}); | ||
|
||
[clientEvents.TEST_RESULT, clientEvents.ERROR].forEach((eventName) => { | ||
eventSource.addEventListener(eventName, (e) => { | ||
const data = JSON.parse(e.data); | ||
actions.testResult(data); | ||
}); | ||
}); | ||
|
||
eventSource.addEventListener(clientEvents.END, () => { | ||
this.props.actions.testsEnd(); | ||
}); | ||
} | ||
|
||
render() { | ||
const {groupByError} = this.props; | ||
|
||
return groupByError | ||
? <ErrorGroupsList/> | ||
: <Suites/>; | ||
} | ||
} | ||
|
||
const actions = {testBegin, suiteBegin, testResult, testsEnd}; | ||
|
||
export default connect( | ||
({gui, view: {groupByError}}) => ({gui, groupByError}), | ||
(dispatch) => ({actions: bindActionCreators(actions, dispatch)}) | ||
)(MainTree); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.