-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BREAKING CHANGE: Migrate your Gemini test to Hermine or use html-reporter@4.
- Loading branch information
1 parent
e96a8c0
commit 90e88eb
Showing
50 changed files
with
786 additions
and
1,877 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,5 @@ | ||
'use strict'; | ||
|
||
const Promise = require('bluebird'); | ||
const PluginAdapter = require('./lib/plugin-adapter'); | ||
const utils = require('./lib/server-utils'); | ||
|
||
module.exports = (gemini, opts) => { | ||
const plugin = PluginAdapter.create(gemini, opts, 'gemini'); | ||
|
||
if (!plugin.isEnabled()) { | ||
return; | ||
} | ||
|
||
plugin | ||
.addApi() | ||
.addCliCommands() | ||
.init(prepareData, prepareImages); | ||
module.exports = () => { | ||
throw new Error('html-reporter: Gemini support is removed. Migrate your Gemini test to Hermione (https://github.com/gemini-testing/hermione) or use html-reporter@4'); | ||
}; | ||
|
||
function prepareData(gemini, reportBuilder) { | ||
return new Promise((resolve) => { | ||
gemini.on(gemini.events.SKIP_STATE, (result) => reportBuilder.addSkipped(result)); | ||
|
||
gemini.on(gemini.events.TEST_RESULT, (result) => { | ||
return result.equal ? reportBuilder.addSuccess(result) : reportBuilder.addFail(result); | ||
}); | ||
|
||
gemini.on(gemini.events.UPDATE_RESULT, (result) => reportBuilder.addSuccess(result)); | ||
|
||
gemini.on(gemini.events.RETRY, (result) => reportBuilder.addRetry(result)); | ||
|
||
gemini.on(gemini.events.ERROR, (result) => reportBuilder.addError(result)); | ||
|
||
gemini.on(gemini.events.END, (stats) => resolve( | ||
reportBuilder | ||
.setStats(stats) | ||
.setApiValues(gemini.htmlReporter.values) | ||
)); | ||
}); | ||
} | ||
|
||
function prepareImages(gemini, reportBuilder, pluginConfig) { | ||
const {path: reportPath} = pluginConfig; | ||
|
||
function handleErrorEvent(result) { | ||
const src = result.getCurrImg().path || result.getErrImg().path; | ||
|
||
return src && utils.copyImageAsync(src, utils.getCurrentAbsolutePath(result, reportPath)); | ||
} | ||
|
||
return new Promise((resolve, reject) => { | ||
let queue = Promise.resolve(); | ||
|
||
gemini.on(gemini.events.ERROR, (testResult) => { | ||
queue = queue.then(() => handleErrorEvent(reportBuilder.format(testResult))); | ||
}); | ||
|
||
gemini.on(gemini.events.RETRY, (testResult) => { | ||
const formattedResult = reportBuilder.format(testResult); | ||
|
||
queue = queue.then(() => { | ||
return formattedResult.hasDiff() | ||
? formattedResult.saveTestImages(reportPath) | ||
: handleErrorEvent(formattedResult); | ||
}); | ||
}); | ||
|
||
gemini.on(gemini.events.TEST_RESULT, (testResult) => { | ||
queue = queue.then(() => reportBuilder.format(testResult).saveTestImages(reportPath)); | ||
}); | ||
|
||
gemini.on(gemini.events.UPDATE_RESULT, (testResult) => { | ||
queue = queue.then(() => reportBuilder.format(testResult).saveTestImages(reportPath)); | ||
}); | ||
|
||
gemini.on(gemini.events.END, () => queue.then(resolve, reject)); | ||
}); | ||
} |
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
Oops, something went wrong.