abhishekswain / jasmine2-protractor-utils

Utilities for Protractor with jasmine2 [HTML Reports, Screenshot, Browser Console log]
MIT License
18 stars 31 forks source link

Screenshot fileName has a period in the name when test suite is nested within another #26

Open JaxxAnik opened 6 years ago

JaxxAnik commented 6 years ago

Steps: -Write a sample test and nest one describe within the other -Write the nested test so it fails EG:

describe('Suite1', () => {
  it('Random sample test', () => {
    expect(element(by.binding('latest')).getText()).toEqual('5');
  });
  describe('Suite2', () => {
    it('should fail', () => {
      expect(true).toBe(false);
    });
  });
});

In the test report, the suite name reads as "Suite1.Suite2". And the screenshot file reference is: ./screenshots/chrome-Suite1.Suite2 should fail.png. How can I stop the xml report being created from being produced without using a period in the name? Because this is what the xml report looks like: <testcase classname="Suite1.Suite2" name="should fail" time="0.181">. Thanks!

JaxxAnik commented 6 years ago

Worked around this by changing the generated test suite name like so:

jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter({
      consolidateAll: true,
      savePath: './reports/',
      filePrefix: 'xmlresults',
      modifySuiteName: function(generatedSuiteName, suite) {
        return generatedSuiteName.replace('.',' ');}
    }));

Note: I'm also using jasmine-reporters to write my test report into xml report

azachar commented 6 years ago

Hello @JaxxAnik, use my fork of this repo (https://github.com/azachar/protractor-screenshoter-plugin) that handle files differently and has no issues like this one. Also, it creates nicer reports and comes with more tested features :)

JaxxAnik commented 6 years ago

Thank you @azachar.I like your reporter. Question for you: If I shard the tests, let's say only on chrome, the report will still be consolidated into one HTML report, right?

azachar commented 6 years ago

If I understood you right, the answer is yes:)

On 29 May 2018, at 17:36, jaxxAnik notifications@github.com wrote:

Thank you @azachar.I like your reporter. Question for you: If I shard the tests, let's say only on chrome, the report will still be consolidated into one HTML report, right?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/abhishekswain/jasmine2-protractor-utils/issues/26#issuecomment-392823111, or mute the thread https://github.com/notifications/unsubscribe-auth/AEcXSxxUo4NnZMTK0m3AagxPCTwxELOCks5t3WsKgaJpZM4UK-Zb.