diff --git a/CHANGELOG.md b/CHANGELOG.md index e93d259af..94ca1e4b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,18 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +## [2.20.1](https://github.com/gemini-testing/html-reporter/compare/v2.20.0...v2.20.1) (2018-07-04) + + +### Bug Fixes + +* display error state if state images does not exist ([1240276](https://github.com/gemini-testing/html-reporter/commit/1240276)) +* **hermione gui:** pass grep to readTests ([13251ab](https://github.com/gemini-testing/html-reporter/commit/13251ab)) +* **scaleImages:** diff images can be higher than actual and expected ([51bf7e0](https://github.com/gemini-testing/html-reporter/commit/51bf7e0)) + + + # [2.20.0](https://github.com/gemini-testing/html-reporter/compare/v2.19.2...v2.20.0) (2018-06-26) diff --git a/lib/gui/tool-runner-factory/base-tool-runner.js b/lib/gui/tool-runner-factory/base-tool-runner.js index ee6373551..4e7d0199d 100644 --- a/lib/gui/tool-runner-factory/base-tool-runner.js +++ b/lib/gui/tool-runner-factory/base-tool-runner.js @@ -22,6 +22,7 @@ module.exports = class ToolRunner { this._testFiles = [].concat(paths); this._tool = tool; this._tree = null; + this._collection = null; this._globalOpts = globalOpts; this._guiOpts = guiOpts; @@ -41,7 +42,18 @@ module.exports = class ToolRunner { initialize() { return this._readTests() - .then(() => this._subscribeOnEvents()); + .then((collection) => { + this._collection = collection; + + this._handleRunnableCollection(); + this._subscribeOnEvents(); + }); + } + + _readTests() { + const {grep, set: sets, browser: browsers} = this._globalOpts; + + return this._tool.readTests(this._testFiles, {grep, sets, browsers}); } finalize() { @@ -81,13 +93,11 @@ module.exports = class ToolRunner { }); } - _loadReuseData() { - try { - return utils.require(path.resolve(this._reportPath, 'data')); - } catch (e) { - utils.logger.warn(chalk.yellow(`Nothing to reuse in ${this._reportPath}`)); - return {}; - } + _fillTestsTree() { + const {autoRun} = this._guiOpts; + + this._tree = Object.assign(this._reportBuilder.getResult(), {gui: true, autoRun}); + this._tree.suites = this._applyReuseData(this._tree.suites); } _applyReuseData(testSuites) { @@ -103,6 +113,15 @@ module.exports = class ToolRunner { return testSuites.map((suite) => applyReuse(reuseData)(suite)); } + + _loadReuseData() { + try { + return utils.require(path.resolve(this._reportPath, 'data')); + } catch (e) { + utils.logger.warn(chalk.yellow(`Nothing to reuse in ${this._reportPath}`)); + return {}; + } + } }; function applyReuse(reuseData) { diff --git a/lib/gui/tool-runner-factory/gemini/index.js b/lib/gui/tool-runner-factory/gemini/index.js index d3037df2f..9b4279e2c 100644 --- a/lib/gui/tool-runner-factory/gemini/index.js +++ b/lib/gui/tool-runner-factory/gemini/index.js @@ -11,7 +11,6 @@ module.exports = class GeminiRunner extends BaseToolRunner { constructor(paths, tool, configs) { super(paths, tool, configs); - this._collection = null; this._collectionStates = null; } @@ -22,36 +21,29 @@ module.exports = class GeminiRunner extends BaseToolRunner { .run((collection) => this._tool.test(collection, {reporters: ['vflat']})); } - _readTests() { - const {grep, set, browser} = this._globalOpts; - const {autoRun} = this._guiOpts; + _handleRunnableCollection() { + const {browser: browsers} = this._globalOpts; + const suites = this._collection.topLevelSuites(); - return this._tool.readTests(this._testFiles, {grep, sets: set}) - .then((collection) => { - this._collection = collection; - const suites = this._collection.topLevelSuites(); - - if (browser) { - suites.forEach((suite) => { - suite.browsers = _.intersection(suite.browsers, browser); - }); - } + if (browsers) { + suites.forEach((suite) => { + suite.browsers = _.intersection(suite.browsers, browsers); + }); + } - this._collectionStates = getAllStates(this._collection.clone().allSuites()); + this._collectionStates = getAllStates(this._collection.clone().allSuites()); - this._collectionStates.forEach((state) => { - if (state.state.shouldSkip(state.browserId)) { - return this._reportBuilder.addSkipped(state); - } + this._collectionStates.forEach((state) => { + if (state.state.shouldSkip(state.browserId)) { + return this._reportBuilder.addSkipped(state); + } - const referencePath = this._tool.getScreenshotPath(state.suite, state.state.name, state.browserId); - state.referencePath = path.relative(process.cwd(), referencePath); - return this._reportBuilder.addIdle(state); - }); + const referencePath = this._tool.getScreenshotPath(state.suite, state.state.name, state.browserId); + state.referencePath = path.relative(process.cwd(), referencePath); + return this._reportBuilder.addIdle(state); + }); - this._tree = Object.assign(this._reportBuilder.getResult(), {gui: true, autoRun}); - this._tree.suites = this._applyReuseData(this._tree.suites); - }); + this._fillTestsTree(); } _subscribeOnEvents() { diff --git a/lib/gui/tool-runner-factory/hermione/index.js b/lib/gui/tool-runner-factory/hermione/index.js index 18981742e..9fac13844 100644 --- a/lib/gui/tool-runner-factory/hermione/index.js +++ b/lib/gui/tool-runner-factory/hermione/index.js @@ -11,7 +11,6 @@ module.exports = class HermioneRunner extends BaseToolRunner { constructor(paths, tool, configs) { super(paths, tool, configs); - this._collection = null; this._tests = {}; } @@ -23,26 +22,17 @@ module.exports = class HermioneRunner extends BaseToolRunner { .run((collection) => this._tool.run(collection, {grep, sets, browsers})); } - _readTests() { - const {browser: browsers} = this._globalOpts; - const {autoRun} = this._guiOpts; + _handleRunnableCollection() { + this._collection.eachTest((test, browserId) => { + const testId = formatId(test.id(), browserId); + this._tests[testId] = _.extend(test, {browserId}); - return this._tool.readTests(this._testFiles, {browsers}) - .then((collection) => { - this._collection = collection; - - this._collection.eachTest((test, browserId) => { - const testId = formatId(test.id(), browserId); - this._tests[testId] = _.extend(test, {browserId}); - - test.pending - ? this._reportBuilder.addSkipped(test) - : this._reportBuilder.addIdle(test); - }); + test.pending + ? this._reportBuilder.addSkipped(test) + : this._reportBuilder.addIdle(test); + }); - this._tree = Object.assign(this._reportBuilder.getResult(), {gui: true, autoRun}); - this._tree.suites = this._applyReuseData(this._tree.suites); - }); + this._fillTestsTree(); } _subscribeOnEvents() { diff --git a/lib/static/components/section/body/index.js b/lib/static/components/section/body/index.js index 65865f59d..e6f34732b 100644 --- a/lib/static/components/section/body/index.js +++ b/lib/static/components/section/body/index.js @@ -1,5 +1,6 @@ 'use strict'; +import {isEmpty} from 'lodash'; import React, {Component} from 'react'; import {connect} from 'react-redux'; import {bindActionCreators} from 'redux'; @@ -11,6 +12,7 @@ import State from '../../state'; import MetaInfo from './meta-info'; import Description from './description'; import * as actions from '../../../modules/actions'; +import {isSuccessStatus} from '../../../../common-utils'; class Body extends Component { static propTypes = { @@ -78,21 +80,29 @@ class Body extends Component { _getTabs() { const activeResult = this._getActiveResult(); + if (isEmpty(activeResult.imagesInfo)) { + return isSuccessStatus(activeResult.status) ? null : this._drawTab(activeResult); + } + return activeResult.imagesInfo.map((imageInfo, idx) => { const {stateName} = imageInfo; const reason = imageInfo.reason || activeResult.reason; const state = Object.assign({image: true, reason}, imageInfo); - return ( -