protractor icon indicating copy to clipboard operation
protractor copied to clipboard

Run protractor from Jenkins cannot generate report

Open chun2014 opened this issue 12 years ago • 13 comments

I'm trying to run protractor from Jenkins, my spec run successfully, however it cannot generate html and/or xml report, I got following issue:

Warning: writing junit report failed for 'xmloutput', 'testresults.e2e.ApricotAppToolBar.xml'. Reasons: Rhino attempt: java is not defined PhantomJs attempt: window is not defined NodeJS attempt: EPERM, operation not permitted 'C:\cygwin64\home\juneh\git\vmw\iup-platform-client\clients\software_manager\test\xmloutput\testresults.e2e.ApricotAppToolBar.xml'

If I run the same specs from command line, then reports can be generated. Why it is prohibiting reports generated from Jenkins? Any advice is greatly appreciated

chun2014 avatar Aug 01 '14 21:08 chun2014

I don't think this problem is coming from Protractor. It looks like the error is maybe coming from the jasmine reporters? Are you using the jasmine-reporters module?

juliemr avatar Aug 01 '14 22:08 juliemr

Had a similar issue recently, PhantomJS seemed to be related. Targeting Chrome instead seemed to help, otherwise wasn't able to resolve.

j-c-t avatar Aug 01 '14 23:08 j-c-t

I tried targeting chrome only by:   capabilities: {     browserName: 'chrome'   },   but still report is not generated through jenkins, did I miss any other set up?

On Friday, August 1, 2014 4:23 PM, JT [email protected] wrote:

Had a similar issue recently, PhantomJS seemed to be related. Targeting Chrome instead seemed to help, otherwise wasn't able to resolve. — Reply to this email directly or view it on GitHub.

chun2014 avatar Aug 01 '14 23:08 chun2014

I noticed when I run protractor from Jenkins, the browser is not launched, yet tests are run successfully. If I run from cmd line, browser is launched. Is protractor supposed to work that way with Jenkins?

chun2014 avatar Aug 02 '14 16:08 chun2014

@chun2014,

I am running Protractor successfully from Jenkins and it opens up browser successfully.

mohit-excelindia avatar Aug 03 '14 15:08 mohit-excelindia

If I delete the existing reporter folder, create new folder from scratch and then run it will launch the browser, but if I already have reporting folder and suppose to append results under it, then browser will not launch, and report cannot be generated. Looks like a bug.

chun2014 avatar Aug 03 '14 17:08 chun2014

Same issue here. My config:

exports.config = {
    seleniumAddress: 'http://localhost:4444/wd/hub',
    specs: ['spec.js'],
    jasmineNodeOpts: {
        isVerbose: true
    },
    onPrepare: function () {
        require('jasmine-reporters');
        jasmine.getEnv().addReporter(
            new jasmine.JUnitXmlReporter('test', true, true)
        );
    }
}

After a succesful protractor run:

Rhino attempt: java is not defined
PhantomJs attempt: window is not defined
NodeJS attempt: ENOENT, no such file or directory: '[path]\test\TEST-app.xml'

motiejuss avatar Aug 19 '14 09:08 motiejuss

The same problem

iljapavlovs avatar Aug 29 '14 07:08 iljapavlovs

I am hitting the same problem:

Rhino attempt: java is not defined
PhantomJs attempt: window is not defined
NodeJS attempt: ENOENT, no such file or directory

I am using gulp-protractor with multiCapabilities and the protractor-html-screenshot-reporter provides a great report, but the JUnit one fails. I need JUnit for Jenkins.

Anubis-Black avatar Aug 29 '14 12:08 Anubis-Black

Same issue here

Rhino attempt: java is not defined
PhantomJs attempt: window is not defined
NodeJS attempt: ENOENT, no such file or directory

lightsaway avatar Sep 04 '14 12:09 lightsaway

Dunno what happend, but that began to work, after cleaning npm modules, and using 1.0.0 version of jasmine reporters and creating tmp folder.

 onPrepare: function () {
        browser.get(browser.baseUrl);

        var reporters = require('jasmine-reporters');
        jasmine.getEnv().addReporter( new jasmine.JUnitXmlReporter("tmp", true, true, "alt-prepend-"));
    }

Seems to me that folder for reports should be precreated before run

lightsaway avatar Sep 04 '14 15:09 lightsaway

Same issue. Not only under Jenkins but in my local develop environment too.

As @AntonSerhiienko says, it is solved by pre-creating the reports folder. However unlike @chun2014, I could make repeated runs without having to delete and re-create the reports folder.

The output error message is confusing, though.

jmasramon avatar Sep 10 '14 09:09 jmasramon

I just published [email protected] which uses node-mkdirp to create the output directory before writing. The jasmine2.x branch of jasmine-reporters has been doing this since it was first published, but the logic had never been added to the 1.x branch.

This should help clear up this type of issue in the future.

putermancer avatar Sep 26 '14 16:09 putermancer