webdriverio-community / wdio-html-reporter

Fork of wdio-html-format-reporter
MIT License
18 stars 27 forks source link

Test Suite blocks (`describeAndIt`) are repeated in the report #74

Closed mayankshukla94 closed 2 years ago

mayankshukla94 commented 2 years ago

Description

When I'm executing nesting describeAndIt blocks then in the master report, Test Suite blocks are repeated.

For e.g.

describe('Suite 1', () => {
  describe('Suite 2', () => {
    it('test 1', async () => {
      utility.logMessage('test 1 block');
    });

    it('test 2', async () => {
      utility.logMessage('test 2 block');
    });
  });

  describe('Suite 3', () => {
    it('test 3', async () => {
      utility.logMessage('test 3 block');
    });
  });
});

Spec Reporter

image

Master Report (wdio-html-nice-reporter)

rpii commented 2 years ago

what version? that was fixed in wdio-html-nice-reporter

On Fri, Sep 24, 2021 at 6:11 AM Mayank Shukla @.***> wrote:

Description

When I'm executing nesting describeAndIt blocks then in the report Test Suite blocks are repeated.

For e.g.

describe('Suite 1', () => { describe('Suite 2', () => { it('test 1', async () => { utility.logMessage('test 1 block'); });

it('test 2', async () => {
  utility.logMessage('test 2 block');
});

});

describe('Suite 3', () => { it('test 3', async () => { utility.logMessage('test 3 block'); }); }); });

Spec Reporter

[image: image] https://user-images.githubusercontent.com/40030809/134679025-8ef7b5e9-82a9-4782-80dc-1f96489bf053.png Master Report (wdio-html-nice-reporter)

html-reports.zip https://github.com/rpii/wdio-html-reporter/files/7225816/html-reports.zip

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rpii/wdio-html-reporter/issues/74, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEABIEKZSCOA5CYK5HQWLWLUDR2GLANCNFSM5EV5ZISA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

mayankshukla94 commented 2 years ago

"wdio-html-nice-reporter": "^7.8.5", "@rpii/wdio-report-events" : "^0.1.4"

rpii commented 2 years ago

can you post the json file that was generated?

On Sat, Sep 25, 2021 at 9:20 AM Mayank Shukla @.***> wrote:

what version? that was fixed in wdio-html-nice-reporter

On Fri, Sep 24, 2021 at 6:11 AM Mayank Shukla @.***> wrote:

Description

When I'm executing nesting describeAndIt blocks then in the report Test Suite blocks are repeated.

For e.g.

describe('Suite 1', () => { describe('Suite 2', () => { it('test 1', async () => { utility.logMessage('test 1 block'); });

it('test 2', async () => {

utility.logMessage('test 2 block');

});

});

describe('Suite 3', () => { it('test 3', async () => { utility.logMessage('test 3 block'); }); }); });

Spec Reporter

[image: image]

https://user-images.githubusercontent.com/40030809/134679025-8ef7b5e9-82a9-4782-80dc-1f96489bf053.png Master Report (wdio-html-nice-reporter)

html-reports.zip https://github.com/rpii/wdio-html-reporter/files/7225816/html-reports.zip

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub

74 https://github.com/rpii/wdio-html-reporter/issues/74, or unsubscribe

https://github.com/notifications/unsubscribe-auth/AEABIEKZSCOA5CYK5HQWLWLUDR2GLANCNFSM5EV5ZISA . Triage notifications on the go with GitHub Mobile for iOS

https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android

https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub .

"wdio-html-nice-reporter": "^7.8.5", @.***/wdio-report-events" : "^0.1.4"

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rpii/wdio-html-reporter/issues/74#issuecomment-927144056, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEABIEJISSBJUXZGNOWHO2TUDXZCVANCNFSM5EV5ZISA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

mayankshukla94 commented 2 years ago

master-report.zip Please find the json report

mayankshukla94 commented 2 years ago

Hello @rpii Did you get a chance to check this json report?

rpii commented 2 years ago

Thanks for providing it. I havent had a chance and wont be able to look at it probably until later this week.

Rich

On Tue, Sep 28, 2021 at 11:13 AM Mayank Shukla @.***> wrote:

Hello @rpii https://github.com/rpii Did you get a chance to check this json report?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rpii/wdio-html-reporter/issues/74#issuecomment-929504313, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEABIEI2CUYXSNYWGIQPT2DUEIAR7ANCNFSM5EV5ZISA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

mayankshukla94 commented 2 years ago

Sure thanks!

arun04arun95 commented 2 years ago

Having the same issue, test results are repeating in the reports.

rpii commented 2 years ago

Well I am not sure what is going on at the moment. I see replicated tests in the json, which the reporter doesnt generate, it comes for the test executor

line 192

            "uid": "test-10-0",
            "cid": "0-0",
            "title": "test 1",
            "fullTitle": "Suite 1 Suite 2 test 1",

line 490

        "uid": "test-10-0",
        "cid": "0-0",
        "title": "test 1",
        "fullTitle": "Suite 1 Suite 2 test 1",

So, the report is showing what its supposed to.

should not have replicated uid or cid in any test.

I will look further at this...

Fri, Sep 24, 2021 at 6:11 AM Mayank Shukla @.***> wrote:

Description

When I'm executing nesting describeAndIt blocks then in the report Test Suite blocks are repeated.

For e.g.

describe('Suite 1', () => { describe('Suite 2', () => { it('test 1', async () => { utility.logMessage('test 1 block'); });

it('test 2', async () => {
  utility.logMessage('test 2 block');
});

});

describe('Suite 3', () => { it('test 3', async () => { utility.logMessage('test 3 block'); }); }); });

Spec Reporter

[image: image] https://user-images.githubusercontent.com/40030809/134679025-8ef7b5e9-82a9-4782-80dc-1f96489bf053.png Master Report (wdio-html-nice-reporter)

html-reports.zip https://github.com/rpii/wdio-html-reporter/files/7225816/html-reports.zip

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rpii/wdio-html-reporter/issues/74, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEABIEKZSCOA5CYK5HQWLWLUDR2GLANCNFSM5EV5ZISA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

mayankshukla94 commented 2 years ago

Hello @rpii ,

We debugged the code to find the root cause of this issue and noticed that even for nested suites (describe block inside describe block), the code was adding a separate entry into the reports.suites array. Hence, duplicate entries for nested suites were getting generated in the master-report.

We added a condition in createReport() function of reportAggregator.ts to check if the suite does not have any parent then only proceed further. And this worked absolutely fine.

I have raised a PR Fix duplicate suites in the Master report. Could you please check the PR

cc: @abime

rpii commented 2 years ago

Thank you. I will look at this

On Sat, Dec 4, 2021 at 7:52 AM Mayank Shukla @.***> wrote:

Hello @rpii https://github.com/rpii ,

We debugged the code to find the root cause of this issue and noticed that even for nested suites (describe block inside describe block), the code was adding a separate entry into the reports.suites array. Hence, duplicate entries for nested suites were getting generated in the master-report.

We added a condition in createReport() function of reportAggregator.ts to check if the suite does not have any parent then only proceed further. And this worked absolutely fine.

I have raised a PR Fix duplicate suites in the Master report https://github.com/rpii/wdio-html-reporter/pull/76. Could you please check the PR

cc: @abime https://github.com/abime

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rpii/wdio-html-reporter/issues/74#issuecomment-986048620, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEABIEIMNIGLXBJSZDGK3MTUPI2IVANCNFSM5EV5ZISA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

rpii commented 2 years ago

HI,

I have looked at this and it works for cases without nested suites but fails for the cucumber test I have. Cucumber has nested suites and tests. do you have a small test case I can use to get with to look at further?

Rich

On Sat, Dec 4, 2021 at 7:52 AM Mayank Shukla @.***> wrote:

Hello @rpii https://github.com/rpii ,

We debugged the code to find the root cause of this issue and noticed that even for nested suites (describe block inside describe block), the code was adding a separate entry into the reports.suites array. Hence, duplicate entries for nested suites were getting generated in the master-report.

We added a condition in createReport() function of reportAggregator.ts to check if the suite does not have any parent then only proceed further. And this worked absolutely fine.

I have raised a PR Fix duplicate suites in the Master report https://github.com/rpii/wdio-html-reporter/pull/76. Could you please check the PR

cc: @abime https://github.com/abime

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rpii/wdio-html-reporter/issues/74#issuecomment-986048620, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEABIEIMNIGLXBJSZDGK3MTUPI2IVANCNFSM5EV5ZISA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

mayankshukla94 commented 2 years ago

Hi @rpii ,

Thanks for checking the code.

I ran below spec file to fix this issue:

describe('Suite 1', () => {
  describe('Suite 2', () => {
    it('test 1', async () => {
      console.log('test 1 block');
    });

    it('test 2', async () => {
      console.log('test 2 block');
    });
  });

  describe('Suite 3', () => {
    it('test 3', async () => {
      console.log('test 3 block');
    });

    describe('Suite 4', () => {
        describe('Suite 5', () => {
            it('test 5', async() => {
                console.log('test 5 block');
            });
        });
    });
  });
});
rpii commented 2 years ago

Thanks I will look at it

On Sun, Dec 5, 2021 at 2:20 AM Mayank Shukla @.***> wrote:

Hi @rpii https://github.com/rpii ,

Thanks for checking the code.

I used below code to fix this issue:

describe('Suite 1', () => { describe('Suite 2', () => { it('test 1', async () => { console.log('test 1 block'); });

it('test 2', async () => {
  console.log('test 2 block');
});

});

describe('Suite 3', () => { it('test 3', async () => { console.log('test 3 block'); });

describe('Suite 4', () => {
    describe('Suite 5', () => {
        it('test 5', async() => {
            console.log('test 5 block');
        });
    });
});

}); });

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rpii/wdio-html-reporter/issues/74#issuecomment-986202999, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEABIEI52TB4OPNR4VXINFDUPM4DNANCNFSM5EV5ZISA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

rpii commented 2 years ago

do you mind sending me the mocharc.json that has the setup of the reporter? Or whatever way you are using thanks Rich

On Sun, Dec 5, 2021 at 8:32 AM Rich Peters @.***> wrote:

Thanks I will look at it

On Sun, Dec 5, 2021 at 2:20 AM Mayank Shukla @.***> wrote:

Hi @rpii https://github.com/rpii ,

Thanks for checking the code.

I used below code to fix this issue:

describe('Suite 1', () => { describe('Suite 2', () => { it('test 1', async () => { console.log('test 1 block'); });

it('test 2', async () => {
  console.log('test 2 block');
});

});

describe('Suite 3', () => { it('test 3', async () => { console.log('test 3 block'); });

describe('Suite 4', () => {
    describe('Suite 5', () => {
        it('test 5', async() => {
            console.log('test 5 block');
        });
    });
});

}); });

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rpii/wdio-html-reporter/issues/74#issuecomment-986202999, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEABIEI52TB4OPNR4VXINFDUPM4DNANCNFSM5EV5ZISA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

mayankshukla94 commented 2 years ago

Hi @rpii ,

We do not use mocharc.json. Instead we use package.json.

Let us know if you need any further information on analyzing the issue.

{
  "name": "test-automation",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "prepare": "husky install"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "imports": {
    "#lib": "./lib/index.js",
    "#testdata": "./testdata/index.js"
  },
  "dependencies": {
    "@rpii/wdio-report-events": "^0.1.4",
    "@wdio/cli": "^7.7.4",
    "@wdio/reporter": "^7.7.5",
    "moment": "^2.29.1",
    "properties-reader": "^2.2.0",
    "string-format": "^2.0.0",
    "wdio-html-nice-reporter": "^7.8.5"
  },
  "devDependencies": {
    "@babel/cli": "^7.14.5",
    "@babel/core": "^7.14.6",
    "@babel/preset-env": "^7.14.7",
    "@babel/register": "^7.14.5",
    "@wdio/local-runner": "^7.7.4",
    "@wdio/mocha-framework": "^7.7.4",
    "@wdio/spec-reporter": "^7.7.3",
    "chai": "^4.3.4",
    "chromedriver": "^96.0.0",
    "husky": "^7.0.1",
    "lint-staged": "^12.0.2",
    "prettier": "2.3.2",
    "wdio-chromedriver-service": "^7.2.0"
  },
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  },
  "lint-staged": {
    "**/*": "prettier --write --ignore-unknown"
  }
}
rpii commented 2 years ago

Ok, i now see what the issue is. it take a little work to fix but needs to be done.

thanks Rich

On Sun, Dec 5, 2021 at 11:06 PM Mayank Shukla @.***> wrote:

Hi @rpii https://github.com/rpii ,

We do not use mocharc.json. Instead we use package.json.

{ "name": "test-automation", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "prepare": "husky install" }, "keywords": [], "author": "", "license": "ISC", "imports": { "#lib": "./lib/index.js", "#testdata": "./testdata/index.js" }, "dependencies": { @./wdio-report-events": "^0.1.4", @./cli": "^7.7.4", @./reporter": "^7.7.5", "moment": "^2.29.1", "properties-reader": "^2.2.0", "string-format": "^2.0.0", "wdio-html-nice-reporter": "^7.8.5" }, "devDependencies": { @./cli": "^7.14.5", @./core": "^7.14.6", @./preset-env": "^7.14.7", @./register": "^7.14.5", @./local-runner": "^7.7.4", @./mocha-framework": "^7.7.4", @./spec-reporter": "^7.7.3", "chai": "^4.3.4", "chromedriver": "^96.0.0", "husky": "^7.0.1", "lint-staged": "^12.0.2", "prettier": "2.3.2", "wdio-chromedriver-service": "^7.2.0" }, "husky": { "hooks": { "pre-commit": "lint-staged" } }, "lint-staged": { "*/": "prettier --write --ignore-unknown" } }

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rpii/wdio-html-reporter/issues/74#issuecomment-986494962, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEABIEJKLE6EUIQBANNFQ6DUPROGFANCNFSM5EV5ZISA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

rpii commented 2 years ago

I published a fix for this issue for you to test. It is npm version 7.9.0 Could you please try it?

thanks Rich

On Mon, Dec 6, 2021 at 2:34 PM Rich Peters @.***> wrote:

Ok, i now see what the issue is. it take a little work to fix but needs to be done.

thanks Rich

On Sun, Dec 5, 2021 at 11:06 PM Mayank Shukla @.***> wrote:

Hi @rpii https://github.com/rpii ,

We do not use mocharc.json. Instead we use package.json.

{ "name": "test-automation", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "prepare": "husky install" }, "keywords": [], "author": "", "license": "ISC", "imports": { "#lib": "./lib/index.js", "#testdata": "./testdata/index.js" }, "dependencies": { @./wdio-report-events": "^0.1.4", @./cli": "^7.7.4", @./reporter": "^7.7.5", "moment": "^2.29.1", "properties-reader": "^2.2.0", "string-format": "^2.0.0", "wdio-html-nice-reporter": "^7.8.5" }, "devDependencies": { @./cli": "^7.14.5", @./core": "^7.14.6", @./preset-env": "^7.14.7", @./register": "^7.14.5", @./local-runner": "^7.7.4", @./mocha-framework": "^7.7.4", @./spec-reporter": "^7.7.3", "chai": "^4.3.4", "chromedriver": "^96.0.0", "husky": "^7.0.1", "lint-staged": "^12.0.2", "prettier": "2.3.2", "wdio-chromedriver-service": "^7.2.0" }, "husky": { "hooks": { "pre-commit": "lint-staged" } }, "lint-staged": { "*/": "prettier --write --ignore-unknown" } }

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rpii/wdio-html-reporter/issues/74#issuecomment-986494962, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEABIEJKLE6EUIQBANNFQ6DUPROGFANCNFSM5EV5ZISA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

abime commented 2 years ago

Thanks @rpii , @mayankshukla94 and I can collaborate for this and check if the issue is fixed.

mayankshukla94 commented 2 years ago

Hi @rpii

It is working fine.

Thanks for your help!

You can consider closing this PR https://github.com/rpii/wdio-html-reporter/pull/76 as the issue is already fixed.

cc: @abime

rpii commented 2 years ago

Ok great. thanks for all the collaboratio.