Click here to Skip to main content
15,885,244 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi I have following feature file in cucumber webdriver test project:

# language: en
Feature: Simple Test, Int and Prod Origin vs non origin checks

  Simple cloud environment Checks

  @javascript @EnvCheck
  Scenario: Check Env TEST Origin
    Given I open the url "some_url"
    When nothing
    Then I expect that element ".b-stage" is displayed

  @javascript @EnvCheck
  Scenario: Check Env TEST non Origin
    Given I open the url "some_url"
    When nothing
    Then I expect that element ".b-stage" is displayed

  @javascript @EnvCheck
  Scenario: Check Env INT Origin
    Given I open the url "some_url"
    When nothing
    Then I expect that element ".b-stage" is displayed

  @javascript @EnvCheck
  Scenario: Check Env INT non Origin
    Given I open the url "some_url"
    When nothing
    Then I expect that element ".b-stage" is displayed

  @javascript @EnvCheck
  Scenario: Check Env PROD Origin
    Given I open the url "some_url"
    When nothing
    Then I expect that element ".b-stage" is displayed

  @javascript @EnvCheck
  Scenario: Check Env PROD non Origin
    Given I open the url "some_url"
    When nothing
    Then I expect that element ".b-stage" is displayed


And I have the following Step for the Then test case:

JavaScript
import { Then } from "@cucumber/cucumber";

Then(/^I expect that element "(.*)" is displayed$/, (element) => {

    console.log(element);
    
})


I'm implementing exactly the same structure for my "Then" step as for my "Given" test, but it still happens that when I include any argument as ".b-stage" as an element to the "Then" step, Given and When steps successfully pass as always, but the Then step is skipped for no evident reason.

I'm following exactly the same steps as in this video tutorial Chapter 4.3 - Step Definitions[^] but still becoming same issue of skipped "Then" tests cases when passing an element as argument to the step with following debug logs showing up:

Execution of 1 workers started at 2022-03-10T12:07:43.392Z

2022-03-10T12:07:43.394Z DEBUG @wdio/utils:initialiseServices: initialise service "selenium-standalone" as NPM package
2022-03-10T12:07:43.525Z DEBUG @wdio/utils:initialiseServices: initialise service "chromedriver" as NPM package
2022-03-10T12:07:43.616Z INFO @wdio/cli:launcher: Run onPrepare hook
2022-03-10T12:07:43.622Z INFO chromedriver: Start Chromedriver (/Users/arcolet/Armandres/Work_Arma/gitlab/test_wdio_repo/fitness-functions/chromedriver.exe) with args --port=9515 --url-base=/
2022-03-10T12:07:57.676Z DEBUG @wdio/cli:utils: Finished to run "onPrepare" hook in 14060ms
2022-03-10T12:07:57.678Z INFO @wdio/cli:launcher: Run onWorkerStart hook
2022-03-10T12:07:57.678Z DEBUG @wdio/cli:utils: Finished to run "onWorkerStart" hook in 0ms
2022-03-10T12:07:57.679Z INFO @wdio/local-runner: Start worker 0-0 with arg: run,./wdio.conf.js,--spec,.src/cucumber/features/www/originCheck.feature,-x
[0-0] 2022-03-10T12:07:58.171Z INFO @wdio/local-runner: Run worker command: run
[0-0] 2022-03-10T12:07:58.316Z DEBUG @wdio/config:utils: Found '@babel/register' package, auto-compiling files with Babel
[0-0] 2022-03-10T12:07:58.754Z DEBUG @wdio/local-runner:utils: init remote session
[0-0] 2022-03-10T12:07:58.760Z DEBUG @wdio/utils:initialiseServices: initialise service "selenium-standalone" as NPM package
[0-0] 2022-03-10T12:07:58.831Z DEBUG @wdio/utils:initialiseServices: initialise service "chromedriver" as NPM package
[0-0] 2022-03-10T12:07:58.866Z DEBUG @wdio/utils:shim: Finished to run "beforeSession" hook in 0ms
[0-0] RUNNING in chrome - /src/cucumber/features/www/originCheck.feature
[0-0] 2022-03-10T12:07:59.689Z DEBUG @wdio/local-runner:utils: init remote session
[0-0] 2022-03-10T12:07:59.695Z INFO webdriver: Initiate new session using the WebDriver protocol
[0-0] 2022-03-10T12:07:59.704Z INFO webdriver: [POST] http://localhost:9515/session
[0-0] 2022-03-10T12:07:59.705Z INFO webdriver: DATA {
[0-0]   capabilities: {
[0-0]     alwaysMatch: { browserName: 'chrome', acceptInsecureCerts: true },
[0-0]     firstMatch: [ {} ]
[0-0]   },
[0-0]   desiredCapabilities: { browserName: 'chrome', acceptInsecureCerts: true }
[0-0] }
[0-0] https://cloud-test-www-origin.exozet.zdf.de/
[0-0] 2022-03-10T12:08:02.594Z INFO webdriver: COMMAND navigateTo("some_url")
[0-0] 2022-03-10T12:08:02.595Z INFO webdriver: [POST] http://localhost:9515/session/969d019c8f8421f95031518783b66c25/url
[0-0] 2022-03-10T12:08:02.595Z INFO webdriver: DATA { url: 'some_url' }
[0-0] Joooder
[0-0] https://cloud-test-www.exozet.zdf.de/
[0-0] 2022-03-10T12:08:02.614Z INFO webdriver: COMMAND navigateTo("some_url")
[0-0] 2022-03-10T12:08:02.614Z INFO webdriver: [POST] http://localhost:9515/session/969d019c8f8421f95031518783b66c25/url
[0-0] 2022-03-10T12:08:02.614Z INFO webdriver: DATA { url: 'some_url' }
[0-0] Joooder
[0-0] https://cloud-int-www-origin.exozet.zdf.de/
[0-0] 2022-03-10T12:08:02.620Z INFO webdriver: COMMAND navigateTo("some_url")
[0-0] 2022-03-10T12:08:02.620Z INFO webdriver: [POST] http://localhost:9515/session/969d019c8f8421f95031518783b66c25/url
[0-0] 2022-03-10T12:08:02.621Z INFO webdriver: DATA { url: 'some_url' }
[0-0] Joooder
[0-0] https://zdf-int-www.zdf.de/
[0-0] 2022-03-10T12:08:02.629Z INFO webdriver: COMMAND navigateTo("some_url")
[0-0] 2022-03-10T12:08:02.629Z INFO webdriver: [POST] http://localhost:9515/session/969d019c8f8421f95031518783b66c25/url
[0-0] 2022-03-10T12:08:02.630Z INFO webdriver: DATA { url: 'some_url' }
[0-0] Joooder
[0-0] https://cloud-prod-www-origin.exozet.zdf.de/
[0-0] 2022-03-10T12:08:02.639Z INFO webdriver: COMMAND navigateTo("some_url")
[0-0] 2022-03-10T12:08:02.639Z INFO webdriver: [POST] http://localhost:9515/session/969d019c8f8421f95031518783b66c25/url
[0-0] 2022-03-10T12:08:02.639Z INFO webdriver: DATA { url: 'some_url' }
[0-0] Joooder
[0-0] https://www.zdf.de/
[0-0] 2022-03-10T12:08:02.646Z INFO webdriver: COMMAND navigateTo("https://www.zdf.de/")
[0-0] 2022-03-10T12:08:02.646Z INFO webdriver: [POST] http://localhost:9515/session/969d019c8f8421f95031518783b66c25/url
[0-0] 2022-03-10T12:08:02.647Z INFO webdriver: DATA { url: 'some_url' }
[0-0] Joooder
[0-0] 2022-03-10T12:08:02.651Z INFO webdriver: COMMAND deleteSession()
[0-0] 2022-03-10T12:08:02.651Z INFO webdriver: [DELETE] http://localhost:9515/session/969d019c8f8421f95031518783b66c25
2022-03-10T12:08:04.871Z DEBUG @wdio/local-runner: Runner 0-0 finished with exit code 1
[0-0] FAILED in chrome - /src/cucumber/features/www/originCheck.feature
2022-03-10T12:08:04.873Z INFO @wdio/cli:launcher: Run onComplete hook
2022-03-10T12:08:04.873Z INFO @wdio/selenium-standalone-service: shutting down all browsers
2022-03-10T12:08:04.874Z DEBUG @wdio/cli:utils: Finished to run "onComplete" hook in 1ms

 "dot" Reporter:
..................

 "spec" Reporter:
------------------------------------------------------------------
[chrome 99.0.4844.51 mac os x #0-0] Running: chrome (v99.0.4844.51) on mac os x
[chrome 99.0.4844.51 mac os x #0-0] Session ID: 969d019c8f8421f95031518783b66c25
[chrome 99.0.4844.51 mac os x #0-0]
[chrome 99.0.4844.51 mac os x #0-0] » /src/cucumber/features/www/originCheck.feature
[chrome 99.0.4844.51 mac os x #0-0] Simple Test, Int and Prod Origin vs non origin checks
[chrome 99.0.4844.51 mac os x #0-0] Simple cloud environment Checks
[chrome 99.0.4844.51 mac os x #0-0]
[chrome 99.0.4844.51 mac os x #0-0] Check Env TEST Origin
[chrome 99.0.4844.51 mac os x #0-0]    ✓ Given I open the url "some_url"
[chrome 99.0.4844.51 mac os x #0-0]    ✓ When nothing
[chrome 99.0.4844.51 mac os x #0-0]    - Then I expect that element "bee" is displayed
[chrome 99.0.4844.51 mac os x #0-0]
[chrome 99.0.4844.51 mac os x #0-0] Check Env TEST non Origin
[chrome 99.0.4844.51 mac os x #0-0]    ✓ Given I open the url "some_url"
[chrome 99.0.4844.51 mac os x #0-0]    ✓ When nothing
[chrome 99.0.4844.51 mac os x #0-0]    - Then I expect that element "bee" is displayed
[chrome 99.0.4844.51 mac os x #0-0]
[chrome 99.0.4844.51 mac os x #0-0] Check Env INT Origin
[chrome 99.0.4844.51 mac os x #0-0]    ✓ Given I open the url "some_url"
[chrome 99.0.4844.51 mac os x #0-0]    ✓ When nothing
[chrome 99.0.4844.51 mac os x #0-0]    - Then I expect that element "bee" is displayed
[chrome 99.0.4844.51 mac os x #0-0]
[chrome 99.0.4844.51 mac os x #0-0] Check Env INT non Origin
[chrome 99.0.4844.51 mac os x #0-0]    ✓ Given I open the url "some_url"
[chrome 99.0.4844.51 mac os x #0-0]    ✓ When nothing
[chrome 99.0.4844.51 mac os x #0-0]    - Then I expect that element "bee" is displayed
[chrome 99.0.4844.51 mac os x #0-0]
[chrome 99.0.4844.51 mac os x #0-0] Check Env PROD Origin
[chrome 99.0.4844.51 mac os x #0-0]    ✓ Given I open the url "some_url"
[chrome 99.0.4844.51 mac os x #0-0]    ✓ When nothing
[chrome 99.0.4844.51 mac os x #0-0]    - Then I expect that element "bee" is displayed
[chrome 99.0.4844.51 mac os x #0-0]
[chrome 99.0.4844.51 mac os x #0-0] Check Env PROD non Origin
[chrome 99.0.4844.51 mac os x #0-0]    ✓ Given I open the url "some_url"
[chrome 99.0.4844.51 mac os x #0-0]    ✓ When nothing
[chrome 99.0.4844.51 mac os x #0-0]    - Then I expect that element "bee" is displayed
[chrome 99.0.4844.51 mac os x #0-0]
[chrome 99.0.4844.51 mac os x #0-0] 12 passing (2.5s)
[chrome 99.0.4844.51 mac os x #0-0] 6 skipped


Spec Files:	 0 passed, 1 failed, 1 total (100% completed) in 00:00:21


What I have tried:

I have tried removing the argument element from Then Case and the "Then" step have worked and passed, but as soon as I add element argument in the Step definition and the any argument as ".b-stage" in the feature file it stops working and skips "Then " test case. Even though with "Given" test case works perfectly without errors and passing.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900