Skip to content

Commit

Permalink
fix(gui): do not disable accept for all retries
Browse files Browse the repository at this point in the history
* occurs when test fails with error in the last retry
  • Loading branch information
DudaGod committed Apr 5, 2018
1 parent 56835b2 commit 7ba44ce
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions lib/static/components/section/body.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,35 +31,31 @@ class SectionBrowserBody extends Component {
color: 1,
retry: this.props.retries.length
};

this.onSwitcherStyleChange = this.onSwitcherStyleChange.bind(this);
this.onSwitcherRetryChange = this.onSwitcherRetryChange.bind(this);
this.onSuiteAccept = this.onSuiteAccept.bind(this);
this.onSuiteRetry = this.onSuiteRetry.bind(this);
}

onSwitcherStyleChange(index) {
onSwitcherStyleChange = (index) => {
this.setState({color: index});
}

onSwitcherRetryChange(index) {
onSwitcherRetryChange = (index) => {
this.setState({retry: index});
}

onSuiteAccept() {
onSuiteAccept = () => {
const {result, suite} = this.props;

this.props.actions.acceptSuite(suite, result.name, this.state.retry);
}

onSuiteRetry() {
onSuiteRetry = () => {
const {result, suite} = this.props;

this.props.actions.retrySuite(suite, result.name);
}

_addExtraButtons() {
const {result: {status, reason}, gui, running} = this.props;
_addExtraButtons(activeResult) {
const {gui, running} = this.props;
const {status, reason} = activeResult;
const stack = reason && reason.stack;
const acceptDisabled = !(isErroredStatus(status) && stack.startsWith(NO_REF_IMAGE_ERROR) || isFailStatus(status));
const retryDisabled = running || isSuccessStatus(status) || (!isFailStatus(status) && !isErroredStatus(status));
Expand All @@ -84,11 +80,15 @@ class SectionBrowserBody extends Component {
: null;
}

render() {
_getActiveResult = () => {
const {result, retries} = this.props;
const active = retries
.concat(result)
.filter((attempt, index) => index === this.state.retry)[0];

return retries.concat(result)[this.state.retry];
}

render() {
const {retries} = this.props;
const activeResult = this._getActiveResult();

return (
<div className="section__body">
Expand All @@ -98,11 +98,11 @@ class SectionBrowserBody extends Component {
<SwitcherStyle onChange={this.onSwitcherStyleChange}/>
<SwitcherRetry onChange={this.onSwitcherRetryChange} retries={retries}/>
</div>
{this._addExtraButtons()}
{this._addExtraButtons(activeResult)}
</div>
<div className="tab">
<div className="tab__item tab__item_active">
<State state={active}/>
<State state={activeResult}/>
</div>
</div>
</div>
Expand Down

0 comments on commit 7ba44ce

Please sign in to comment.