gemini test and gemini gui CL errors when html-reports already exist
Closed this issue · 8 comments
My issue is not so much how the gemini update/test cycle works but when gemini creates the html reports it seems that a further command causes a critical error that can be solved by deleting the previously created reports.
What is the correct way to run gemini with the gui when the html-reporter plugin is enabled?
Output of gemini --version
:
5.7.1
Contents of .gemini.yml
file:
module.exports = {
rootUrl: 'http://slate.local.wcp.imdserve.com/',
gridUrl: 'http://127.0.0.1:4444/wd/hub',
windowSize: '600x1080',
browsers: {
chrome: {
desiredCapabilities: {
browserName: 'chrome',
chromeOptions: {
args: ['--headless'],
}
}
}
},
system: {
plugins: {
'html-reporter/gemini': {
enabled: true,
path: 'gemini/gemini-reports',
defaultView: 'all',
scaleImages: false
}
}
}
}
Test source code:
const fs = require('fs');
const yaml = require('js-yaml');
const getFiles = require('./getFilesRecursively.js');
this.baseDirectory = __dirname + '/../../../themes/im-fabric/views/partials';
this.gemini = gemini;
const yamlFiles = getFiles(this.baseDirectory)
.filter(name => name.includes('.yaml'));
yamlFiles.forEach(file => {
const fileContents = fs.readFileSync(file, 'utf8');
const parsedFile = yaml.safeLoad(fileContents);
this.gemini.suite(parsedFile.id, (suite) => {
suite.setUrl('/styleguide/components/')
.setCaptureElements('#' + parsedFile.id)
.capture('plain');
});
});
Command used to run the test:
// delete gemini/screens & genmini/gemini-reports
gemini update
gemini test
or
// delete gemini/screens & genmini/gemini-reports
gemini update
gemini gui
Publically accessible URL of the page you are testing against:
- can't deployed yet but I don't think that will make any different to my problem *
Result:
- gemini update works, but on running
gemini test
I get a critical error
Critical error:
ReferenceError: window is not defined
at Object.<anonymous> (/Users/steve.gibbings/WebstormProjects/wcp-core/wordpress/plugins/im-styleguide/gemini/gemini-reports/report.min.js:39:58902)
at t (/Users/steve.gibbings/WebstormProjects/wcp-core/wordpress/plugins/im-styleguide/gemini/gemini-reports/report.min.js:1:163)
at Object.t.__esModule (/Users/steve.gibbings/WebstormProjects/wcp-core/wordpress/plugins/im-styleguide/gemini/gemini-reports/report.min.js:39:44716)
at t (/Users/steve.gibbings/WebstormProjects/wcp-core/wordpress/plugins/im-styleguide/gemini/gemini-reports/report.min.js:1:163)
at Object.defineProperty.value (/Users/steve.gibbings/WebstormProjects/wcp-core/wordpress/plugins/im-styleguide/gemini/gemini-reports/report.min.js:54:77084)
at t (/Users/steve.gibbings/WebstormProjects/wcp-core/wordpress/plugins/im-styleguide/gemini/gemini-reports/report.min.js:1:163)
at Object.<anonymous> (/Users/steve.gibbings/WebstormProjects/wcp-core/wordpress/plugins/im-styleguide/gemini/gemini-reports/report.min.js:54:76937)
at t (/Users/steve.gibbings/WebstormProjects/wcp-core/wordpress/plugins/im-styleguide/gemini/gemini-reports/report.min.js:1:163)
at /Users/steve.gibbings/WebstormProjects/wcp-core/wordpress/plugins/im-styleguide/gemini/gemini-reports/report.min.js:1:513
at Object.<anonymous> (/Users/steve.gibbings/WebstormProjects/wcp-core/wordpress/plugins/im-styleguide/gemini/gemini-reports/report.min.js:1:524)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
If the gemini/gemini-reports is deleted after it was created by gemini update
then the command gemini test
succeeds with correct results.
- gemini update works, but on running
gemini gui
I get the same critical error as above which can be solved in the same way by deleting gemini/gemini-reports.
Expected behaviour:
In either case the second gemini command works without having to delete the gemini/gemini-reports folders.
I am using node 8.11.1
Seems using gemini test --html-reporter-enabled false
stops the errors but should that be necessary? I just feel I am missing information on how it was intended to run gemini gui alongside gemini test.
hi
it looks like a bug. I'll check it
Thanks @sipayRT
@stevegibbings It would be nice if test/update
and gui
commands work with reports interchangeably. I've dug a little in html-reporter
plugins source code. The plugin implements two different strategies to produce reports. The first one for test/update
and the second one for gui
. Although they are quite similar, they are not quite compatible by implementation.
Thanks @generalov. Does that mean it’s intended that I should use either update/test or gui but not both? I want to use test for automation in GitHub but the gui is nice for devs locally. As I noted above passing an argument on the test command can disable it and I don’t intend on commiting the html reports to git. Currently trying to automate chromedriver and gemini in node anyway as I can’t see a way to combine the chromedriver in an npm script as it never exits. I really like gemini though. Thanks for sharing it.
I’ve noticed a few points in the readme that could do with updating. Mind if I offer a PR for those?
Any progress on this? Why is it closed? I reproduce it on gemini 7.0.1 and html-reporter 3.1.1