gemini-testing / gemini

💀💀💀[DEPRECATED] Use hermione
https://github.com/gemini-testing/hermione
MIT License
1.5k stars 149 forks source link

gemini test and gemini gui CL errors when html-reports already exist #915

Closed goesbysteve closed 6 years ago

goesbysteve commented 6 years ago

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:

1.

// delete gemini/screens & genmini/gemini-reports
gemini update
gemini test

or

2.

// delete gemini/screens & genmini/gemini-reports
gemini update
gemini gui

Publically accessible URL of the page you are testing against:

Result:

  1. 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.

  1. 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.

goesbysteve commented 6 years ago

I am using node 8.11.1

goesbysteve commented 6 years ago

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.

sipayRT commented 6 years ago

hi

it looks like a bug. I'll check it

goesbysteve commented 6 years ago

Thanks @sipayRT

generalov commented 6 years ago

@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.

goesbysteve commented 6 years ago

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?

Kreozot commented 5 years ago

Any progress on this? Why is it closed? I reproduce it on gemini 7.0.1 and html-reporter 3.1.1

Kreozot commented 5 years ago

Okay, looks like I solved it. Thanks to this issue: https://github.com/gemini-testing/gemini/issues/102 In my case the solution is to move report folder from gemini tests folder.