cypress-allure-plugin icon indicating copy to clipboard operation
cypress-allure-plugin copied to clipboard

Would it be possible to go back to generating test historyId based on fullTitle?

Open JessefSpecialisterren opened this issue 1 year ago • 1 comments

Starting with https://github.com/Shelex/cypress-allure-plugin/commit/9ba39f3c192b1f11af27fca4a64f7713b2f5b2ac, cypress-allure-plugin bases the historyId of a test on its title instead of its fullTitle. This causes several tests to disappear from our report because they have identical titles. Their fullTitles are different because they are in different suites

I know cypress-allure-plugin v2.40.0 allows specifying your own string to be hashed into historyId, but we have several instances of equal test titles within the same spec file, and I don't see a way to determine the fullTitle with the information available there

We have currently opted to revert to an older version of cypress-allure-plugin where things just work, but we would like to be able to upgrade in the future

We could of course try to manually ensure that all test titles are unique, but since there are no warnings/error messages/indications about clashing titles it would be very easy to miss a few, especially since our test suite has become rather large at this point

If the historyId could be generated based on fullTitle again, that would solve our problem neatly. Perhaps even the relative path of the spec file could be included by default, so that disappearing tests because of title clashes shouldn't happen at all under normal circumstances. That last part is more of a feature request than a bug report, but I thought I'd include it 🙂. Thanks so much for building and maintaining this plugin, it's an important part of our test pipeline and much appreciated!

JessefSpecialisterren avatar Jun 20 '23 12:06 JessefSpecialisterren

Hi.

That was implemented exactly as an attempt to fix "disappearing" tests due to names duplication https://github.com/Shelex/cypress-allure-plugin?tab=readme-ov-file#test-name-duplicates

In case full title is still required for some reason, it could be used in combination with relative spec path or just as a fullTitle:

Cypress.Allure.reporter.getInterface().defineHistoryId((title, fullTitle) => {
    //return `${Cypress.spec.relative}${fullTitle}`;
    return fullTitle
});

Shelex avatar Feb 29 '24 13:02 Shelex