hatchteam / protractor-trx-reporter

1 stars 0 forks source link

Protractor-trx-reporter doesn't create trx file but no errors are shown #4

Open sawpresto opened 8 years ago

sawpresto commented 8 years ago

I'm working with Protractor for the first time and I've installed modules with NPM for protractor, protractor-trx-reporter, jasmine-trx-reporter, and webdriver-manager. Selenium server is running at the default 4444 port, and the tests seem to run fine when I run it locally through command line (opens a browser, test passes) on my Windows machine.

Everything seems to not give any errors, but I can't find the trx file published by the protractor-trx-reporter. When I run protractor conf.js, the test starts, and the command line output says that it's exporting the trx reporter and setting the output file to ProtractorTestResults.trx but a .trx file doesn't show up anywhere so I suspect it's not publishing a file but not throwing errors. I noticed that there's a lot of output that isn't being written in the script, but there aren't any errors showing up.I'm using sample config and spec files, so I wouldn't expect those to be breaking.

Here's what my config and spec files look like (both taken as samples from Protractor and protractor-trx-reporter sites)

 //conf.js
    exports.config = {
      framework: 'jasmine',
      seleniumAddress: 'http://localhost:4444/wd/hub',
      specs: ['spec.js'],
      onPrepare: function () {
           console.log('Adding TRX reporter');
        require('protractor-trx-reporter');
           jasmine.getEnv().addReporter(new jasmine.TrxReporter('ProtractorTestResults.trx'));
      }
}

 //spec.js
 describe('angularjs homepage todo list', function() {
     it('should add a todo', function() {
        browser.get('https://angularjs.org');

        element(by.model('todoList.todoText')).sendKeys('write first protractor test');
        element(by.css('[value="add"]')).click();

        var todoList = element.all(by.repeater('todo in todoList.todos'));
        expect(todoList.count()).toEqual(3);
        expect(todoList.get(2).getText()).toEqual('write first protractor test');

        // You wrote your first test, cross it off the list
        todoList.get(2).element(by.css('input')).click();
        var completedAmount = element.all(by.css('.done-true'));
        expect(completedAmount.count()).toEqual(2);
     });
 });
checkshailendra commented 7 years ago

Hi,

i am also facing the same issue, i am using Protractor 3.3.0 along with protractor-trx-reporter, i have configured the Conf.js like the way its mentioned above.

i could see the below log gets printed but there is no TRX file generated.

Adding TRX reporter protractor-trx-reporter: initializing protractor-trx-reporter: exporting trx reporter protractor-trx-reporter: setting output file to ProtractorTestResults.trx

anybody has any idea if i am missing anything to be added/configured.

Thanks in Advance.

SangameshPH commented 7 years ago

I am facing same issue. With new version of Protractor, Protractor-trx-reporter is broken and doesn't generate trx anymore. I have switched to Jasmine-trx-reporter, currently it serves the purpose but I am still wondering how it generated trx reports, I don't see attributes getting added for generation. I need some custom output for trx so trying to tweak the source (index.js) to get what I want.

Try this https://github.com/papa-pep/jasmine-trx-reporter I will help you.

Cheers, -/Sammi

brtx commented 7 years ago

We haven't done any changes to the protractor-trx-reporter in a while. Might be that protractor changed something in their reporting interface, though I haven't seen any changes in their release note. Our code should be quite easy to understand it's just some 170 lines, you could set a breakpoint and check if it's still called by protractor and done so in the right way. If you file a proper PR, we'll happily merge it.