tagscypresscypress-cucumber-preprocessor

cypress-tags and cypress run both failing to executed only tagged test cases in cypress-cucumber framework


I tried cypress-tags and cypress run commands to execute tagged test cases but both are failing. can someone guide for solution?

dependancy versions: "@badeball/cypress-cucumber-preprocessor": "^21.0.3", "@bahmutov/cypress-esbuild-preprocessor": "^2.2.3", "cypress": "^13.16.0", "cypress-cucumber-preprocessor": "^4.3.1", "cypress-on-fix": "^1.0.3", "cypress-xray-plugin": "^7.4.1"

I have included filterspec and omitfilter in package.json: "cypress-cucumber-preprocessor": { "filterSpecs": true, "omitFiltered": true, "nonGlobalStepdefinitions": false, "stepDefinitions": [ "cypress/e2e/Stepdefinitions/**/*.{js,ts}" ],

I have integrated cypress-xray plugin as well to upload execution results to Jira cloud.

I have 2 features files: Login.feature: Feature: Cucumber test set

@smoke
@TEST_CYP-4 @TESTSET_CYP-9
Scenario: cucumber trial test case
    Given user is on example website
    And user passes valid credentials
    Then user login is successful

@smoke  
@TEST_CYP-10 @TESTSET_CYP-9
Scenario: cucumber test case 2
    Given user is on example website
    And user passes valid credentials
    Then user login is successful
    
@TEST_CYP-11 @TESTSET_CYP-9
Scenario: cucumber test case 3
    Given user is on example website
    And user passes valid credentials
    Then user login is successful

Addcustomer.feature: Feature: Cucumber test set 2

@TEST_CYP-16 @TESTSET_CYP-15
Scenario: cucumber test case 1 - test set 2
    Given user is on example website
    And user passes valid credentials
    Then user login is successful
    
@TEST_CYP-17 @TESTSET_CYP-15
Scenario: cucumber test case 2 - test set 2
    Given user is on example website
    And user passes valid credentials
    Then user login is successful

command using for execution: npx cypress run --record --key --browser chrome --spec cypress/e2e/features/regression --env JIRA_USERNAME=<jira_username>,JIRA_API_TOKEN=<jira_apitoken>,XRAY_CLIENT_ID=<xray_clientid>,XRAY_CLIENT_SECRET=<xray_clientsecret> tags="@smoke"

instead of running only 2 scenarios mentioned with @smoke tag, cypress executes all the scenarios from both feature files.


Solution

  • One thing that's wrong is you have

    "@badeball/cypress-cucumber-preprocessor": "^21.0.3", 
    ...
    "cypress-cucumber-preprocessor": "^4.3.1",
    

    Get rid of the old defunct v4.3.2 as it probably causes problems all over the place. Also make sure it's gone from cypress.config.js.