Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Cucumber-JS] The type and the nameTemplate links format options are not applied in the report #1156

Open
Zychkov opened this issue Sep 26, 2024 · 5 comments
Labels
theme:cucumberjs CucumberJS related issue type:bug Something isn't working

Comments

@Zychkov
Copy link

Zychkov commented Sep 26, 2024

To Reproduce
Dependencies:

    "@cucumber/cucumber": "^10.9.0",
    "@cucumber/messages": "^24.1.0",
    "allure-commandline": "^2.30.0",
    "allure-cucumberjs": "^3.0.2",
    "allure-js-commons": "^3.0.2"

In cucumber config.js add

        formatOptions: {
            links: [
                {
                    pattern: [/@issue=(.*)/],
                    type: "issue",
                    urlTemplate: "https://example.com/issues/%s",
                    nameTemplate: "Issue: %s"
                },
                {
                    pattern: [/@tms=(.*)/],
                    type: "tms",
                    urlTemplate: "https://example.com/tasks/%s",
                    nameTemplate: "TMS: %s"
                },
            ],
        },

add tags to test scenarios:

Feature: Allure
  Feature's description

  @example @tms=ABC-222 @issue=ABC-333
  Scenario Outline: Allure Tests
    Given The sum of the numbers <a> and <b> must be equal to <c>

    Examples:
      | a | b | c |
      | 1 | 2 | 3 |
      | 2 | 2 | 4 |

Actual behavior
I get a links array in allure result.json in the following format:

  "links": [
    {
      "url": "https://example.com/issues/ABC-333",
      "type": "0"
    },
    {
      "url": "https://example.com/tasks/ABC-222",
      "type": "1"
    }
  ],

image

Expected behavior
In allure result.json, the “links” array must contain the following format entities:

  "links": [
    {
      "url": "https://example.com/issues/ABC-333",
      "type": "issue",
      "name": "Issue: ABC-333"
    },
    {
      "url": "https://example.com/tasks/ABC-222",
      "type": "tms",
      "name": "TMS: ABC-222"
    }
  ],

image

@baev
Copy link
Member

baev commented Sep 26, 2024

Since the 3.0.0 links configuration has been changed:

links: {
     issue: {
         pattern: [/@issue=(.*)/],
         urlTemplate: "https://example.com/issues/%s",
     },
     tms: {
         pattern: [/@tms=(.*)/],
         urlTemplate: "https://example.com/tasks/%s",
     },
},

@Zychkov
Copy link
Author

Zychkov commented Sep 26, 2024

@baev, please update the documentation.

In the current implementation (with updated configuration according to the comment) the full URL is displayed.
image

Is it possible to apply nameTemplate? Or do it by analogy with how it works in Java?
image

@baev
Copy link
Member

baev commented Sep 26, 2024

You can apply a name template as well:

links: {
     issue: {
         pattern: [/@issue=(.*)/],
         urlTemplate: "https://example.com/issues/%s",
         nameTemplate: "ABC-%s"
     },
},

@baev, please update the documentation.

👍

@Zychkov
Copy link
Author

Zychkov commented Sep 26, 2024

I tried adding the nameTemplate

        formatOptions: {
            links: {
                issue: {
                    pattern: [/@issue=(.*)/],
                    urlTemplate: "https://example.com/issues/%s",
                    nameTemplate: "ABC-%s"
                },
                tms: {
                    pattern: [/@tms=(.*)/],
                    urlTemplate: "https://example.com/tasks/%s",
                    nameTemplate: "ABC-%s",
                },
            },
        },

the result is as in my comment above
image

@baev baev added theme:cucumberjs CucumberJS related issue type:bug Something isn't working labels Sep 27, 2024
@baev
Copy link
Member

baev commented Sep 27, 2024

I confirm that name templates are not supported for cucumber-js at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme:cucumberjs CucumberJS related issue type:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants