Skip to content

Commit

Permalink
fix: don't show error-details for assertView failures
Browse files Browse the repository at this point in the history
  • Loading branch information
Rashid Ksirov committed Oct 2, 2019
1 parent e532d83 commit ef1bac9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ directory.
```
const err = new Error('some error');
err.details = {title: 'description, will be used as url title', data: {} | [] | 'some additional info'};
throw err;
```
* **defaultView** (optional) `String` - default view mode. Available values are:
* `all` - show all tests. Default value.
Expand Down
14 changes: 8 additions & 6 deletions lib/static/components/section/body/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,27 +131,29 @@ class Body extends Component {

_getTabs() {
const activeResult = this._getActiveResult();
const {errorDetails} = activeResult;
const retryIndex = this.state.retry;

if (isEmpty(activeResult.imagesInfo)) {
return isSuccessStatus(activeResult.status) ? null : this._drawTab(activeResult);
return isSuccessStatus(activeResult.status) ? null : this._drawTab(activeResult, {errorDetails});
}

const tabs = activeResult.imagesInfo.map((imageInfo, idx) => {
const {stateName} = imageInfo;
const error = imageInfo.error || activeResult.error;

return this._drawTab(imageInfo, `${stateName || idx}_${retryIndex}`, {image: true, error});
const options = imageInfo.stateName ? {} : {errorDetails};

return this._drawTab(imageInfo, {...options, image: true, error}, `${stateName || idx}_${retryIndex}`);
});

return this._shouldAddErrorTab(activeResult)
? tabs.concat(this._drawTab(activeResult))
? tabs.concat(this._drawTab(activeResult, {errorDetails}))
: tabs;
}

_drawTab(state, key = '', opts = {}) {
_drawTab(state, opts = {}, key = '') {
const {result: {name: browserId}, suite: {suitePath}} = this.props;
const {errorDetails} = this._getActiveResult();

opts = defaults({error: state.error}, opts);

Expand All @@ -161,7 +163,7 @@ class Body extends Component {
<State
state={state} suitePath={suitePath} browserId={browserId}
acceptHandler={this.onTestAccept} toggleHandler={this.onToggleStateResult}
findSameDiffsHandler={this.onTestFindSameDiffs} {...opts} errorDetails={errorDetails}
findSameDiffsHandler={this.onTestFindSameDiffs} {...opts}
/>
</div>
</div>
Expand Down

0 comments on commit ef1bac9

Please sign in to comment.