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

Add way to disambiguate multiple tags in feature files #79

Closed
alexviz7 opened this issue Jun 22, 2023 · 20 comments
Closed

Add way to disambiguate multiple tags in feature files #79

alexviz7 opened this issue Jun 22, 2023 · 20 comments
Assignees
Labels
feature New feature or request rejected A new feature or request has been rejected

Comments

@alexviz7
Copy link

alexviz7 commented Jun 22, 2023

Hello,

I have already implemented a Cypress Cucumber Test Automation Framework running with all test scenarios each of them have one or more tags. Some Scenarios have the same Ticket Tag because I test them on different languages. On Bamboo I had solved this issue with a language Tag, so therefore I had 2 separate builds running one for each tag/language. Now I want to do the same with the cypress-xray-plugin, but I get a fail when running the command npx cypress run --env tags="@EN" JIRA_API_TOKEN="PATToken" with the error: Error: Failed to configure Xray uploader: no viable Xray configuration was found or the configuration you provided is not supported.

What did I do wrong?

If I leave the tag out I get an error that I have multiple tests with same tag. Also I have an issue with another plugin cy-verify-downloads which works perfectly in open mode.

@alexviz7 alexviz7 changed the title Command with Cucumber Tag and PAT Authenication Command with Cucumber Tag and PAT Authentication Jun 22, 2023
@csvtuda csvtuda added the under investigation The issue is being investigated label Jun 22, 2023
@csvtuda
Copy link
Contributor

csvtuda commented Jun 22, 2023

Hey @alexviz7,

thanks for creating the issue. I don't think I fully understand it yet. Would you mind providing a minimal reproducible example containing your tag configuration? You don't have to include step definitions or your real steps. I'm just a little bit confused still, especially about the tags="@EN" parameter. I assume this is a custom thing for choosing the subset of tags/language to include in a run? Without the example it's difficult for me to deduce why the plugin would be complaining about identical tags.


Error: Failed to configure Xray uploader: no viable Xray configuration was found or the configuration you provided is not supported

This error indicates that Xray wasn't properly configured. You seem to be using a server instance, which requires the JIRA_API_TOKEN environment variable (which you've set up) and the jira.url (see here). Can you double check if you've set up the URL?

Please keep in mind that the Cucumber integration isn't fully fleshed out yet, I haven't had the time to investigate all the corner cases out there. But I'm very grateful for the issue already!

@csvtuda csvtuda self-assigned this Jun 22, 2023
@alexviz7
Copy link
Author

alexviz7 commented Jun 22, 2023

My e2e.ts:

require('cy-verify-downloads').addCustomCommand();
import 'cypress-real-events';
import 'cypress-fail-fast';
import 'cypress-xray-plugin/register';
import './commands';

My cypress config:

async function setupNodeEvents(
  on: Cypress.PluginEvents,
  config: Cypress.PluginConfigOptions
): Promise<Cypress.PluginConfigOptions> {
  await addCucumberPreprocessorPlugin(on, config);
  const bundler = createBundler({
    plugins: [nodepolyfills(), createEsbuildPlugin(config)],
  });

  await configureXrayPlugin({
    jira: {
      projectKey: 'PRJ',
      url: 'https://devstack.jira.com/'
    },
    cucumber: {
      featureFileExtension: '.feature',
      uploadFeatures: true,
    },
    xray: {
      statusPassed: 'PASS',
      statusFailed: 'FAIL',
      statusSkipped: 'ABORTED',
      testType: 'Cucumber',
      uploadResults: true
    },
    plugin: {
      overwriteIssueSummary: true
  },
  });
  await addXrayResultUpload(on);

  require('cypress-fail-fast/plugin')(on, config);
  on('file:preprocessor',bundler);
  on('file:preprocessor', async (file) => {
    await syncFeatureFile(file);
    const cucumberPlugin = createBundler({
      plugins: [createEsbuildPlugin(config)],
    });
    return cucumberPlugin(file);
  });
  on('task', {
    verifyDownloadTasks,
    isFileExist,
    findFiles,
    getClipboard: () => {
      return clipboardy.readSync();
    },
  });

  // Make sure to return the config object as it might have been modified by the plugin.
  return config;
}

A scenario example:

Feature: Language

  Background: Login
    Given user opens login page
    When user fills username with "user"
    And user fills password with "psw"
    And user clicks on login

  @PRJ-2451 @happypath @DE
  Scenario: Change Language to German
    When user checks if language is set to German
    Then the page shows values in "de"

So my cypress command prior the cypress-xray-plugin was npm run cypress:run -- --env tags="@EN"
Now I tried either npx cypress run --env tags="@EN" JIRA_API_TOKEN="token" or npx cypress run --env JIRA_API_TOKEN="token"

Both commands failed but with different fails. The first has the following error:

Error: Failed to configure Xray uploader: no viable Xray configuration was found or the configuration you provided is not supported.
You can find all configurations currently supported at https://qytera-gmbh.github.io/projects/cypress-xray-plugin/section/configuration/authentication/
    at initXrayClient (C:\Projects\node_modules\cypress-xray-plugin\src\util\config.js:110:15)
    at beforeRunHook (C:\Projects\node_modules\cypress-xray-plugin\src\hooks.js:53:33)
    at Object.handler (C:\Projectsnode_modules\cypress-xray-plugin\plugin.js:12:41)
    at invoke (C:\Users\AppData\Local\Cypress\Cache\12.8.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\child\run_plugins.js:183:18)
    at C:\UsersAppData\Local\Cypress\Cache\12.8.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\util.js:59:14
    at tryCatcher (C:\Users\AppData\Local\Cypress\Cache\12.8.1\Cypress\resources\app\node_modules\bluebird\js\release\util.js:16:23)
    at Function.Promise.attempt.Promise.try (C:\Users\AppData\Local\Cypress\Cache\12.8.1\Cypress\resources\app\node_modules\bluebird\js\release\method.js:39:29)
    at Object.wrapChildPromise (C:\Users\AppData\Local\Cypress\Cache\12.8.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\util.js:58:23)
    at RunPlugins.execute (C:\Users\AppData\Local\Cypress\Cache\12.8.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\child\run_plugins.js:164:21)
    at EventEmitter.<anonymous> (C:\Users\AppData\Local\Cypress\Cache\12.8.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\child\run_plugins.js:56:12)
    at EventEmitter.emit (node:events:511:28)
    at EventEmitter.emit (node:domain:489:12)
    at process.<anonymous> (C:\Users\AppData\Local\Cypress\Cache\12.8.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\util.js:33:22)
    at process.emit (node:events:511:28)

The second command without the tag has the following error:

| Cypress Xray Plugin | INFO    | Jira PAT found. Setting up Xray PAT credentials.
| Cypress Xray Plugin | ERROR   | Multiple issue keys found in tags of scenario "View page footer and header": PRJ-2441, PRJ-2747

And beneath that the error:

  Running:  downloadUploadFiles.feature                                                    (1 of 82)
| Cypress Xray Plugin | INFO    | Synchronizing upstream Cucumber tests (cypress\e2e\features\downloadUploadFiles.feature)
| Cypress Xray Plugin | INFO    | Importing cucumber feature files...
X [ERROR] Could not resolve "path"

    node_modules/cy-verify-downloads/src/index.js:1:25:
      1 │ const { join } = require('path');
        ╵                          ~~~~~~

  The package "path" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

X [ERROR] Could not resolve "fs"

    node_modules/cy-verify-downloads/src/index.js:2:44:
      2 │ const { existsSync, readdirSync } = require('fs');
        ╵                                             ~~~~

  The package "fs" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

at C:\Projects\node_modules\esbuild\lib\main.js:1075:16
    at responseCallbacks.<computed> (C:\Projects\\node_modules\esbuild\lib\main.js:697:9)
    at handleIncomingPacket (C:\Projects\node_modules\esbuild\lib\main.js:752:9)
    at Socket.readFromStdout (C:\Projects\node_modules\esbuild\lib\main.js:673:7)
    at Socket.emit (node:events:511:28)
    at Socket.emit (node:domain:489:12)
    at addChunk (node:internal/streams/readable:332:12)
    at readableAddChunk (node:internal/streams/readable:305:9)
    at Socket.Readable.push (node:internal/streams/readable:242:10)
    at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)

This occurred while Cypress was compiling and bundling your test code. This is usually caused by:

- A missing file or dependency
- A syntax error in the file or one of its dependencies

Fix the error in your code and re-run your tests.
| Cypress Xray Plugin | ERROR   | Feature file "[object Object]" invalid, skipping synchronization: AxiosError: Request failed with status code 405
An error was thrown in your plugins file while executing the handler for the after:spec event.

The error we received was:

TypeError: Cannot read properties of null (reading 'some')
    at afterSpecHandler (C:\Projects\node_modules\@badeball\cypress-cucumber-preprocessor\lib\add-cucumber-preprocessor-plugin.js:166:47)       
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

Did I make the issue more clear to you?

@csvtuda
Copy link
Contributor

csvtuda commented Jun 22, 2023

Yes, thank you very much for the detailed example! I managed to set up a corresponding project myself.

[npx cypress run --env tags="@EN" JIRA_API_TOKEN="token"] has the following error:
Error: Failed to configure Xray uploader: no viable Xray configuration was found or the configuration you provided is not supported.

You've really set up everything properly. I think the issue is that you're separating the environment variables with a space, not a comma: https://docs.cypress.io/guides/guides/environment-variables#Option-4---env. Cypress/the plugin then never get to see the trailing options.

[npx cypress run --env JIRA_API_TOKEN="token"] has the following error:
Multiple issue keys found in tags of scenario "View page footer and header": PRJ-2441, PRJ-2747

Multiple tags are pretty problematic, true. But what should the plugin do? In such a situation, the plugin is facing a difficult choice:

  • upload the results to the issue of the first tag?
  • upload the results to the issue of the last tag?
  • upload the results to issues of both tags?

Right now there's no way to tell it which tag to use. Simply throwing the above error is currently the user-friendliest way, I think. But maybe you've got an alternative solution/proposal? I'm definitely open for it.

Regarding the errors of cy-verify-downloads: I'm not quite firm in bundling topics, but have you tried adding nodepolyfills() to this bundler as well?

on('file:preprocessor', async (file) => {
  await syncFeatureFile(file);
  const cucumberPlugin = createBundler({
    plugins: [nodepolyfills(), createEsbuildPlugin(config)],
    //        ^^^^^^^^^^^^^^^
  });
  return cucumberPlugin(file);
});

This fixed the error for me, although I used a different polyfill package I think (I could not figure out which one you're using).

@alexviz7
Copy link
Author

alexviz7 commented Jun 22, 2023

Wow, thank you it solved the issues with the cy-verify-downloads and the run command with the comma.
I still get the error of the multiple tags but the test run nevertheless.
However I get another issue now after the first feature tested the run stops with status code 405, most likely because i still have the cypress cucumber reporter configured:

`Running:  downloadUploadFiles.feature                                                    (1 of 42)
| Cypress Xray Plugin | INFO    | Synchronizing upstream Cucumber tests (cypress\e2e\features\downloadUploadFiles.feature)
| Cypress Xray Plugin | INFO    | Importing cucumber feature files...
| Cypress Xray Plugin | ERROR   | Feature file "[object Object]" invalid, skipping synchronization: AxiosError: Request failed with status code 405


  Download & Upload Files
    √ Download Effective Root Certificate (7801ms)


  1 passing (8s)

[mochawesome] Report JSON saved to C:\Projects\cypress\results\mochawesome_003.json

An error was thrown in your plugins file while executing the handler for the after:spec event.

The error we received was:

Error: ENOENT: no such file or directory, open 'C:\Projects\cypress\cucumber-json\cucumber-messages.ndjson'

If its an issue of the multiple tags though, then the only solution is to create separate tickets and tags for the other language.

@csvtuda
Copy link
Contributor

csvtuda commented Jun 22, 2023

Yeah, the multiple tags found error is not going to disappear, I'm afraid. The plugin just can't decide for you which tag to use.
The only thing I could think of right now is to provide a tag prefix in the configuration. Something like this:

await configureXrayPlugin({
  cucumber: {
    featureFileExtension: '.feature',
    uploadFeatures: true,
    tagPrefix: "PRJ"
  }

Would this help you? After changing your tags, you would then be able to provide/switch tags through npx run --env CUCUMBER_TAG_PREFIX="PRJ-EN":

Feature: Language

  Background: Login
    Given user opens login page
    When user fills username with "user"
    And user fills password with "psw"
    And user clicks on login

  @PRJ-2451 @PRJ-EN-6472
  Scenario: Change Language to German
    When user checks if language is set to German
    Then the page shows values in "de"

Regarding the upload: I cannot reproduce the error, unfortunately. I don't think the reporter is at fault, it should not influence the plugin. The 405 response is interesting, Xray's documentation states that it only returns the following codes on import:

  • 400 BAD_REQUEST
  • 401 UNAUTHORIZED
  • 500 INTERNAL SERVER ERROR

Can you set plugin.debug to true in the configuration? This should create JSON files containing request data, such as the URL that was used to import the Cucumber file. In the POST_https_xyz_import_feature_12345.json, it should look something like this in your setting:

https://devstack.jira.com/rest/raven/latest/import/feature?projectKey=PRJ

If this is correct, can you try replacing latest with 1.0 in the plugin's source code?

https://devstack.jira.com/rest/raven/1.0/import/feature?projectKey=PRJ

You can do it directly in the node_modules folder. Just change it in the following line in
node_modules/cypress-xray-plugin/src/client/xray/xrayClientServer.js:
grafik

You can always roll back any such changes by running npm ci.

Maybe this helps already (not a permanent solution, obviously - only for investigative purposes). Otherwise I would need to add better debugging/logging output, I think.


⚠ Do not simply copy and paste entire debug payloads here for further analysis, as they will contain your credentials! ⚠

@alexviz7
Copy link
Author

alexviz7 commented Jun 23, 2023

Hi I didnt try the debugging( maybe you can explain me where to set it),
however i managed to fix the issue of the stopping test run by removing the cypress-cucumber json creation from the package.json:
2023-06-23 11_18_44-package json - Visual Studio Code  Administrator

Now all test scenarios run even if they have same tags. This of course means I cannot use the cypress cucumber reporter..
After the test execution is finished i see following info:

| Cypress Xray Plugin | INFO    | Uploading test results to https://devstack.com/jira/projects/PRJ/...
| Cypress Xray Plugin | DEBUG   | Writing POST request data to POST_https_devstack.com_jira_projects_PRJ_rest_raven_latest_api_import_execution_1687507965699_request.json.
| Cypress Xray Plugin | ERROR   | Failed to upload results to Xray: "AxiosError: Request failed with status code 405"
| Cypress Xray Plugin | ERROR   | Complete error logs have been written to "importExecutionResultsError.json"
| Cypress Xray Plugin | WARNING | Execution results import failed. Skipping remaining tasks.

Update:
I fixed the issue with the linking to jira it was the url that had to be changed.
Also I found out if a ticket is closed then no result is shown. So I had some old tests that i had closed, now I had to reopen them.

@alexviz7
Copy link
Author

alexviz7 commented Jun 23, 2023

Another issue i found out, that when I run the test with tag=EN I have new test tickets created even though all the scenarios have ticket numbers taged on them. Now i have to delete duzen dublicates from jira.

@csvtuda
Copy link
Contributor

csvtuda commented Jun 23, 2023

I'm glad to hear it was just the URL that required changing.

Also I found out if a ticket is closed then no result is shown. So I had some old tests that i had closed, now I had to reopen them.

Would you mind elaborating on this problem? I've never had to reopen issues before. Ideally, please provide steps to reproduce the problem.

Another issue i found out, that when I run the test with tag=EN I have new test tickets created even though all the scenarios have ticket numbers taged on them. Now i have to delete duzen dublicates from jira.

Yes, this is what I was trying to explain earlier in the comments (#79 (comment), #79 (comment)). There's just no way currently for the plugin to know which issue you would like to reuse when providing multiple tags. Please consider the proposal I made in the last comment and if it would be an adequate solution for you.

@csvtuda
Copy link
Contributor

csvtuda commented Jun 23, 2023

Could you please check why the cypress cucumber json creation has to be deleted in order that the test run does not stop?

I investigated it. The situation is as follows:

The big issue is that Cypress does not allow multiple hooks. The last function that hooks into the event will replace all the other ones: cypress-io/cypress#22428. In your case, the cypress-xray-plugin hook won, preventing the cypress-cucumber-preprocessor from creating the output directory, resulting in your
Error: ENOENT: no such file or directory: 'C:\Projects\cypress\cucumber-json\cucumber-messages.ndjson' error.

Unless I (or Cypress) come up with a solution to this problem, you will need to decide between:

  • the JSON report of the cypress-cucumber-preprocessor
  • the upload of the cypress-xray-plugin

Both at the sime time is not possible, unless you create the output directory manually. But it's possible that there's other stuff happening inside the cypress-cucumber-preprocessor hooks, which we don't yet know about. Maybe some other features will also stop working as intended.

If you don't want to keep using the cypress-xray-plugin without running into errors or deleting your JSON configuration, make sure to omit the cucumber-preprocessor-plugin event handlers as described here: https://qytera-gmbh.github.io/projects/cypress-xray-plugin/section/setup/installation/#cucumber-support. This will reduce the cucumber-preprocessor-plugin to running Cucumber tests only. No reports whatsoever will be generated anymore.


This is also an issue for the scenarios with examples (Scenario Outline). When I have 5 examples 5 tickets are created. Can the ticket generation not be stopped in the xray or jira configuration?

This problem was fixed in v3.3.1. If exactly one tag is configured for a scenario, the examples won't result in superfluous Jira issue creation. However, the plugin does not yet support combining examples into a single data-driven test execution issue (as described here). I currently don't have the time for such a big undertaking, unfortunately. But it's definitely a necessary feature which will be included in a future version.

Can you check if you're on v3.3.1 or above?

@alexviz7
Copy link
Author

The big issue is that Cypress does not allow multiple hooks. The last function that hooks into the event will replace all the other ones: cypress-io/cypress#22428. In your case, the cypress-xray-plugin hook won, preventing the cypress-cucumber-preprocessor from creating the output directory, resulting in your Error: ENOENT: no such file or directory: 'C:\Projects\cypress\cucumber-json\cucumber-messages.ndjson' error.

Unless I (or Cypress) come up with a solution to this problem, you will need to decide between:

* the JSON report of the `cypress-cucumber-preprocessor`

* the upload of the `cypress-xray-plugin`

Ok thanks, I ll take it in consideration which is more useful for reporting.

This problem was fixed in v3.3.1. If exactly one tag is configured for a scenario, the examples won't result in superfluous Jira issue creation. However, the plugin does not yet support combining examples into a single data-driven test execution issue (as described here). I currently don't have the time for such a big undertaking, unfortunately. But it's definitely a necessary feature which will be included in a future version.

Can you check if you're on v3.3.1 or above?

Yes i have this installed: "cypress-xray-plugin": "^3.3.1",

2023-06-23 17_08_58-cypress config ts - Visual Studio Code  Administrator

Also the tagPrefix is not recognized.

@csvtuda
Copy link
Contributor

csvtuda commented Jun 23, 2023

Yes i have this installed: "cypress-xray-plugin": "^3.3.1"

Are the scenarios which result in multiple issues complaining about multiple tags? If not, could you provide a set of scenarios which result in multiple issue creation? I just need something to recreate your problem, the description is not enough, sorry.

Also the tagPrefix is not recognized.

Yes, the option does not exist yet. It was just something I came up with to discuss with you if it could be a solution to your problem.

@alexviz7
Copy link
Author

Sorry I cannot give you right now test examples from my project cause they have sensitive data of the project which I do not have time to alter right now. But on both languages I had this issue with multiple tickets with examples, so its not about the language tag.

I wanted to ask you, the reports in xray will show the failed test step or just the failed code snippet and screenshot?
Its an important aspect since the cucumber reporter is deactivated now.

@csvtuda
Copy link
Contributor

csvtuda commented Jun 23, 2023

The plugin does not retrieve Cucumber step information as of now. It will only upload screenshots/videos and set the corresponding status in Xray.

@alexviz7
Copy link
Author

The plugin does not retrieve Cucumber step information as of now. It will only upload screenshots/videos and set the corresponding status in Xray.

That is a pitty because in the xray documentation I found that this is possible https://docs.getxray.app/display/XRAYCLOUD/Testing+using+Cypress+and+Cucumber+in+JavaScript

@csvtuda
Copy link
Contributor

csvtuda commented Jun 26, 2023

Thank you for the link, I actually did not know about that. This is very useful and highly interesting. I will report my findings in #87.

I will leave this PR open for some time, so that you can provide more examples whenever you find the time.

Apart from that, I'm sorry that the Cucumber integration isn't as fleshed out as the other parts of the plugin. The plugin was created more or less out of necessity, and Cucumber has not really been the main focus of the project which kickstarted the plugin.

@badeball
Copy link

badeball commented Jul 5, 2023

Unless I (or Cypress) come up with a solution to this problem, you will need to decide between:

This is not true and can be achieved using cypress-on-fix.

If you don't want to keep using the cypress-xray-plugin without running into errors or deleting your JSON configuration, make sure to omit the cucumber-preprocessor-plugin event handlers as described here: https://qytera-gmbh.github.io/projects/cypress-xray-plugin/section/setup/installation/#cucumber-support. This will reduce the cucumber-preprocessor-plugin to running Cucumber tests only. No reports whatsoever will be generated anymore.

This documentation is misleading, for reason mention above.

@csvtuda
Copy link
Contributor

csvtuda commented Jul 5, 2023

Thank you @badeball, I did not know about cypress-on-fix. I will try it out and adapt the documentation accordingly! Sorry for any inconveniences or headaches the current setup has caused.

@csvtuda csvtuda changed the title Command with Cucumber Tag and PAT Authentication Add way to disambiguate multiple tags in feature files Jul 5, 2023
@badeball
Copy link

badeball commented Jul 6, 2023

Sorry for any inconveniences or headaches the current setup has caused.

No inconvenience at all, I just want everyone to have the best experience.

@alexviz7
Copy link
Author

alexviz7 commented Jul 6, 2023

This is not true and can be achieved using cypress-on-fix.

So according to this plugin it is possible to create a cucumber report and work with the xray plugin.
I haven't managed to make it work though.

@csvtuda
Copy link
Contributor

csvtuda commented Aug 28, 2023

@alexviz7 I think I'm going to close this issue, things like handling multiple Cucumber tags are out of this plugin's scope because everybody is probably requiring a different kind of solution to disambiguate the correct tag.

If you (or future readers) still have issues, you should try to handle multiple tags manually as you see fit, for example by writing custom feature file parsers/preprocessors: #86 (comment).

Something like this:

import { AstBuilder, GherkinClassicTokenMatcher, Parser } from "@cucumber/gherkin";
import { pretty } from "@cucumber/gherkin-utils";
import { IdGenerator, Tag } from "@cucumber/messages";
import path from "path";
import fs from "fs";

/**
 * This function does three things basically:
 * 1. Parse the feature file
 * 2. Apply tag handling logic
 * 3. Create new feature file in temporary directory
 *
 * @param featurePath - path to the original feature file
 * @param config - the Cypress configuration
 * @returns the path to a feature file with updated tags
 */
function removeUnnecessaryTags(featurePath: string, config: Cypress.PluginConfigOptions): string {
  if (!featurePath.endsWith(".feature")) {
    return featurePath;
  }

  // 1. Parse feature file
  // See: https://github.com/cucumber/gherkin#library
  const uuidFn = IdGenerator.uuid();
  const builder = new AstBuilder(uuidFn);
  const matcher = new GherkinClassicTokenMatcher();
  const parser = new Parser(builder, matcher);
  const gherkinDocument = parser.parse(fs.readFileSync(featurePath, { encoding: "utf-8" }));

  if (!gherkinDocument.feature) {
    return featurePath;
  }

  // 2. Apply tag handling logic
  // Children can be: background, scenarios, ...
  const children = gherkinDocument.feature.children;
  for (const child of children) {
    if (child.scenario) {
      child.scenario.tags = child.scenario.tags.filter((tag: Tag) => {
        // Add tag filtering logic here.
      });
    }
  }

  // 3. Create new feature file in temporary directory
  const root = path.join(projectRoot, "cypress", "e2e");
  const filedir = path.basename(path.dirname(featurePath));
  const filename = path.basename(featurePath);
  const tmpFilepath = path.join(root, filedir, "generated", filename);
  fs.mkdirSync(path.dirname(tmpFilepath), { recursive: true });
  fs.writeFileSync(tmpFilepath, pretty(gherkinDocument, "gherkin"));
  return tmpFilepath;
}

@csvtuda csvtuda closed this as completed Aug 28, 2023
@csvtuda csvtuda added rejected A new feature or request has been rejected and removed under investigation The issue is being investigated labels Aug 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request rejected A new feature or request has been rejected
Projects
None yet
Development

No branches or pull requests

3 participants