cucumber-boilerplate icon indicating copy to clipboard operation
cucumber-boilerplate copied to clipboard

Using tagExpression makes the Feature or Scenario to run twice

Open gromanas opened this issue 5 years ago • 9 comments

Issue description

I am using wdio v6.1.12, node v12.13.1, cucumber-js v6.1.13, appium v17.1.0. I have tried to use tags on Feature or Scenario level, and in both tries, the feature or scenario is executed twice.

Steps to reproduce

npx wdio wdio.conf.js --cucumberOpts.tagExpression=@smoke

Expected behavior

Only to run 1 time

Actual behavior

The feature file or scenario is executed twice.

FYI By running the scenarios without tags or using --spec or --suite the tests are executed one time.

gromanas avatar Jul 31 '20 08:07 gromanas

Hey, thanks for filing the issue. This seems indeed like bug. We would appreciate any help on this so please help us out! Have a look at our contributing guidelines and reach out if you have any questions. Cheers!

christian-bromann avatar Jul 31 '20 11:07 christian-bromann

@gromanas can you provide a minimal reproducible example for people interested to pick up this bug to get started?

christian-bromann avatar Jul 31 '20 11:07 christian-bromann

@christian-bromann Of course and I will come back with the exact steps to reproduce

gromanas avatar Jul 31 '20 12:07 gromanas

Steps to reproduce:

1st scenario:

On top of a Feature file, you can add a custom tag such as @smoke

e.g.

@smoke
Feature: Login Show/Hide Functionality
  As a Player I should be able to check Login Button and Show Hide functionality

  Scenario: Player is able to add credentials and verify that the Login button is disabled or enabled according to his actions
    Given The app is loaded
    When I click login header button
    And I enter "[email protected]" into the email input field
    Then I verify that the status of Login button is "disabled"
    When I enter "1234" into the password input field
    Then I verify that the status of Login button is "enabled"
    When I enter "" into the password input field
    Then I verify that the status of Login button is "disabled"
    When I enter "1234" into the password input field
    When I enter "" into the email input field
    Then I verify that the status of Login button is "disabled"
    When I enter "[email protected]" into the email input field
    And I enter "1234" into the password input field
    Then I verify that the status of Login button is "enabled"
    When I click close modal button

2nd scenario:

On top of a Scenario, you can add a custom tag such as @smoke

e.g.

Feature: Login Show/Hide Functionality
  As a Player, I should be able to check Login Button and Show Hide functionality

@smoke
  Scenario: Player is able to add credentials and verify that the Login button is disabled or enabled according to his actions
    Given The app is loaded
    When I click login header button
    And I enter "[email protected]" into the email input field
    Then I verify that the status of Login button is "disabled"
    When I enter "1234" into the password input field
    Then I verify that the status of Login button is "enabled"
    When I enter "" into the password input field
    Then I verify that the status of Login button is "disabled"
    When I enter "1234" into the password input field
    When I enter "" into the email input field
    Then I verify that the status of Login button is "disabled"
    When I enter "[email protected]" into the email input field
    And I enter "1234" into the password input field
    Then I verify that the status of Login button is "enabled"
    When I click close modal button

In order to run the test in both scenarios you have to execute the command below

node_modules/.bin/wdio test/conf/wdio.conf.js --cucumberOpts.tagExpression=@smoke

gromanas avatar Aug 03 '20 08:08 gromanas

Hi, @christian-bromann are there any updates on this one? Facing the same issue when I try to run some scenario or feature using tags.

hiChandravanshi avatar Feb 08 '23 09:02 hiChandravanshi

@hiChandravanshi as you can see, no updates. I am not actively working on this issue so please get involved and help use find a solution.

christian-bromann avatar Feb 08 '23 18:02 christian-bromann

@christian-bromann @gromanas For me it is working fine now. I removed the extra path pattern from the specs and it started working for me. The new code looks like specs: ["./features/*.feature"], image

hiChandravanshi avatar Feb 08 '23 18:02 hiChandravanshi

I do have same issue when i array the specs.

  specs: [
      ['./test/specs/features/login/*.feature',
      './test/specs/features/landing/*.feature',
      './test/specs/features/account/*.feature',
    ]
]

This runs each feature file twice.

MahadevMG avatar Mar 06 '23 05:03 MahadevMG

@MahadevMG Can you try this? It may resolve the issue for you

  specs: ["./test/specs/features/**/*.feature"]

hiChandravanshi avatar Mar 06 '23 10:03 hiChandravanshi