Skip to content

[🐛 Bug]: cucumber.js path overrides wdio.conf.js exclude #13562

@jvisco

Description

@jvisco

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

9.0.9

Node.js Version

18.20.4

Mode

Standalone Mode

Which capabilities are you using?

No response

What happened?

I have an API test suite and UI test suite combined within the same repository. I want to use WDIO to execute the UI tests only.

I have the API features in the wdio config exclude array. But they are being picked up from the cucumber.js config's path array.

WDIO is not logging the API feature's path, but the tests are executed. When I comment out the cucumber.js path then the API suite is not executed by WDIO.

What is your expected behavior?

I expect the wdio.conf.js exclude to override the cucumber.js path contents.

How to reproduce the bug.

I have pushed an example to my repository.

https://github.com/jvisco/wdio-example

npm run ui

Will run the UI script.

npx wdio run wdio.conf.mjs --cucumberOpts.tags='(@test and not @ignore)'

There is an API scenario, and UI scenario with @test.

If the line cucumber.js:42 is commented out then only the UI scenario is executed.

Relevant log output

Execution of 1 workers started at 2024-09-13T18:02:41.726Z

2024-09-13T18:02:41.740Z INFO @wdio/cli:launcher: Run onPrepare hook
2024-09-13T18:02:41.741Z INFO @wdio/utils: Setting up browser driver for: chrome@stable
2024-09-13T18:02:41.742Z INFO @wdio/utils: Setting up browser binaries for: chrome@stable
2024-09-13T18:02:41.800Z INFO webdriver: Using Chromedriver v128.0.6613.138 from cache directory /var/folders/lp/2c7xrj6939d00cw1xqq9lkl40000gp/T
2024-09-13T18:02:41.860Z INFO @wdio/cli:launcher: Run onWorkerStart hook
2024-09-13T18:02:41.861Z INFO @wdio/local-runner: Start worker 0-0 with arg: run,wdio.conf.mjs,--cucumberOpts.tags=(@test and not @ignore)
2024-09-13T18:02:41.864Z DEBUG @wdio/local-runner: Send command run to worker with cid "0-0"
[0-0] 2024-09-13T18:02:42.933Z INFO @wdio/local-runner: Run worker command: run
[0-0] 2024-09-13T18:02:42.939Z DEBUG @wdio/runner: init remote session
[0-0] RUNNING in chrome - file:///features/feature_files/ui/suite2/ui_test.feature
[0-0] 2024-09-13T18:02:43.529Z DEBUG @wdio/runner: init remote session
[0-0] 2024-09-13T18:02:43.531Z INFO webdriver: Initiate new session using the WebDriver protocol
[0-0] 2024-09-13T18:02:43.593Z INFO webdriver: Using Chromedriver v128.0.6613.138 from cache directory /var/folders/lp/2c7xrj6939d00cw1xqq9lkl40000gp/T
[0-0] 2024-09-13T18:02:43.632Z INFO chromedriver: Starting ChromeDriver 128.0.6613.138 (d6209c7e65ea9d64ce403e9de18f8915e2f8708a-refs/branch-heads/6613@{#1712}) on port 54788
[0-0] 2024-09-13T18:02:43.632Z INFO chromedriver: Remote connections are allowed by an allowlist (0.0.0.0).
[0-0] 2024-09-13T18:02:43.633Z INFO chromedriver: Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
[0-0] 2024-09-13T18:02:43.663Z INFO chromedriver: ChromeDriver was started successfully on port 54788.
[0-0] 2024-09-13T18:02:44.608Z INFO @wdio/utils: Started Chromedriver v128.0.6613.138 with params --port=54788 --allowed-origins=* --allowed-ips=0.0.0.0 in 1077ms on port 54788
[0-0] 2024-09-13T18:02:44.625Z INFO webdriver: [POST] http://localhost:54788/session
[0-0] 2024-09-13T18:02:44.625Z INFO webdriver: DATA {
[0-0]   capabilities: {
[0-0]     alwaysMatch: {
[0-0]       browserName: 'chrome',
[0-0]       'goog:chromeOptions': [Object],
[0-0]       acceptInsecureCerts: true,
[0-0]       webSocketUrl: true
[0-0]     },
[0-0]     firstMatch: [ {} ]
[0-0]   },
[0-0]   desiredCapabilities: {
[0-0]     browserName: 'chrome',
[0-0]     'goog:chromeOptions': {
[0-0]       binary: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
[0-0]       args: [Array]
[0-0]     },
[0-0]     acceptInsecureCerts: true,
[0-0]     webSocketUrl: true
[0-0]   }
[0-0] }
[0-0] 2024-09-13T18:02:46.069Z INFO webdriver: Register BiDi handler for session with id 4bc84b96d913f727ba194644cca92300
[0-0] 2024-09-13T18:02:46.069Z INFO webdriver: Connect to webSocketUrl ws://127.0.0.1:54788/session/4bc84b96d913f727ba194644cca92300
[0-0] 2024-09-13T18:02:46.084Z INFO webdriver: Connected session to Bidi protocol
[0-0] 2024-09-13T18:02:46.084Z INFO webdriver: Connected session to Bidi protocol
[0-0] 2024-09-13T18:02:46.084Z INFO webdriver: Connected to WebDriver Bidi interface at ws://127.0.0.1:54788/session/4bc84b96d913f727ba194644cca92300
[0-0] 2024-09-13T18:02:46.085Z INFO webdriver: BIDI COMMAND session.subscribe {"events":["browsingContext.navigationStarted"]}
[0-0] 2024-09-13T18:02:46.087Z INFO webdriver: COMMAND getWindowHandle()
[0-0] 2024-09-13T18:02:46.087Z INFO webdriver: BIDI COMMAND session.subscribe {"events":["log.entryAdded"]}
[0-0] 2024-09-13T18:02:46.087Z INFO webdriver: BIDI COMMAND script.addPreloadScript { functionDeclaration: <PreloadScript[1265 bytes]>, contexts: undefined }
[0-0] 2024-09-13T18:02:46.087Z INFO webdriver: BIDI COMMAND session.subscribe {"events":["browsingContext.navigationStarted","network.responseCompleted","network.beforeRequestSent","network.fetchError"]}
[0-0] 2024-09-13T18:02:46.088Z INFO webdriver: BIDI COMMAND session.subscribe {"events":["browsingContext.userPromptOpened"]}
[0-0] 2024-09-13T18:02:46.088Z INFO webdriver: [GET] http://localhost:54788/session/4bc84b96d913f727ba194644cca92300/window
[0-0] 2024-09-13T18:02:46.089Z INFO webdriver: COMMAND getWindowHandle()
[0-0] 2024-09-13T18:02:46.089Z INFO webdriver: [GET] http://localhost:54788/session/4bc84b96d913f727ba194644cca92300/window
[0-0] 2024-09-13T18:02:46.095Z INFO webdriver: RESULT C9201FD227E55555F84D78024453D2E9
[0-0] 2024-09-13T18:02:46.095Z INFO webdriver: BIDI COMMAND script.callFunction {"functionDeclaration":"<Function[374 bytes]>","awaitPromise":true,"arguments":[],"target":{"context":"C9201FD227E55555F84D78024453D2E9"}}
[0-0] 2024-09-13T18:02:46.099Z INFO webdriver: RESULT C9201FD227E55555F84D78024453D2E9
[0-0] 2024-09-13T18:02:46.100Z INFO webdriver: BIDI COMMAND script.addPreloadScript { functionDeclaration: <PreloadScript[343 bytes]>, contexts: ["C9201FD227E55555F84D78024453D2E9"] }
[0-0] 2024-09-13T18:02:46.102Z DEBUG webdriver: BIDI RESULT {"id":1,"result":{},"type":"success"}
[0-0] 2024-09-13T18:02:46.103Z DEBUG webdriver: BIDI RESULT {"id":2,"result":{},"type":"success"}
[0-0] 2024-09-13T18:02:46.103Z DEBUG webdriver: BIDI RESULT {"id":3,"result":{"script":"0416cdbf-81f3-401f-b571-de60a8d0e223"},"type":"success"}
[0-0] 2024-09-13T18:02:46.104Z DEBUG webdriver: BIDI RESULT {"id":5,"result":{},"type":"success"}
[0-0] 2024-09-13T18:02:46.104Z DEBUG webdriver: BIDI RESULT {"id":4,"result":{},"type":"success"}
[0-0] 2024-09-13T18:02:46.107Z DEBUG webdriver: BIDI RESULT {"id":6,"result":{"realm":"-862283768552260756.4187916920636257700","result":{"type":"undefined"},"type":"success"},"type":"success"}
[0-0] 2024-09-13T18:02:46.108Z DEBUG webdriver: BIDI RESULT {"id":7,"result":{"script":"14289ac6-9eda-47f1-bead-8336f3bd00ea"},"type":"success"}
[0-0] 2024-09-13T18:02:46.108Z INFO webdriver: BIDI COMMAND session.subscribe {"events":["script.message"]}
[0-0] 2024-09-13T18:02:46.110Z DEBUG webdriver: BIDI RESULT {"id":8,"result":{},"type":"success"}
[0-0] 2024-09-13T18:02:46.111Z INFO webdriverio:PolyfillManager: polyfill script added
[0-0] 2024-09-13T18:02:46.361Z DEBUG @wdio/utils:shim: Finished to run "beforeScenario" hook in 0ms
[0-0] 2024-09-13T18:02:46.364Z DEBUG @wdio/utils:shim: Finished to run "afterStep" hook in 0ms
[0-0] 2024-09-13T18:02:46.364Z DEBUG @wdio/utils:shim: Finished to run "afterScenario" hook in 0ms
[0-0] Error in "0: Undefined Step"
Error: Scenario with this step should be excluded.
    at CustomWorld.<anonymous> (file:///Users/jvisco/git/wdio-example/features/step_definitions/api/setup.mjs:6:11)
[0-0] 2024-09-13T18:02:46.366Z DEBUG @wdio/utils:shim: Finished to run "beforeScenario" hook in 0ms
[0-0] 2024-09-13T18:02:46.366Z INFO webdriver: BIDI COMMAND browsingContext.navigate {"context":"C9201FD227E55555F84D78024453D2E9","url":"https://webdriver.io/","wait":"complete"}
[0-0] 2024-09-13T18:02:46.373Z INFO webdriver: COMMAND getWindowHandle()
[0-0] 2024-09-13T18:02:46.373Z INFO webdriver: [GET] http://localhost:54788/session/4bc84b96d913f727ba194644cca92300/window
[0-0] 2024-09-13T18:02:46.378Z INFO webdriver: RESULT C9201FD227E55555F84D78024453D2E9
[0-0] 2024-09-13T18:02:46.378Z INFO webdriverio:ContextManager: Update current context: C9201FD227E55555F84D78024453D2E9
[0-0] 2024-09-13T18:02:47.171Z INFO webdriver: COMMAND getWindowHandle()
[0-0] 2024-09-13T18:02:47.173Z INFO webdriver: [GET] http://localhost:54788/session/4bc84b96d913f727ba194644cca92300/window
[0-0] 2024-09-13T18:02:47.183Z INFO webdriver: RESULT C9201FD227E55555F84D78024453D2E9
[0-0] 2024-09-13T18:02:49.492Z INFO webdriver: COMMAND getWindowHandle()
[0-0] 2024-09-13T18:02:49.492Z INFO webdriver: [GET] http://localhost:54788/session/4bc84b96d913f727ba194644cca92300/window
[0-0] 2024-09-13T18:02:49.495Z INFO webdriver: RESULT C9201FD227E55555F84D78024453D2E9
[0-0] 2024-09-13T18:02:49.648Z INFO webdriver: COMMAND getWindowHandle()
[0-0] 2024-09-13T18:02:49.649Z INFO webdriver: [GET] http://localhost:54788/session/4bc84b96d913f727ba194644cca92300/window
[0-0] 2024-09-13T18:02:49.653Z INFO webdriver: RESULT C9201FD227E55555F84D78024453D2E9
[0-0] 2024-09-13T18:02:49.768Z DEBUG webdriver: BIDI RESULT {"id":9,"result":{"navigation":"d4967c4f-b45b-4768-943a-3d7e2dd35ed4","url":"https://webdriver.io/"},"type":"success"}
[0-0] 2024-09-13T18:02:49.769Z DEBUG @wdio/utils:shim: Finished to run "afterStep" hook in 0ms
[0-0] 2024-09-13T18:02:49.772Z INFO webdriver: BIDI COMMAND browsingContext.locateNodes {"locator":{"type":"css","value":".hero__subtitle"},"context":"C9201FD227E55555F84D78024453D2E9"}
[0-0] 2024-09-13T18:02:49.799Z DEBUG webdriver: BIDI RESULT {"id":10,"result":{"nodes":[{"sharedId":"f.C9201FD227E55555F84D78024453D2E9.d.865E989DFBF8A2273490CB0CC283FAFF.e.476","type":"node","value":{"attributes":{"class":"hero__subtitle"},"childNodeCount":1,"localName":"p","namespaceURI":"http://www.w3.org/1999/xhtml","nodeType":1,"shadowRoot":null}}]},"type":"success"}
[0-0] 2024-09-13T18:02:49.807Z INFO webdriver: COMMAND getElementText("f.C9201FD227E55555F84D78024453D2E9.d.865E989DFBF8A2273490CB0CC283FAFF.e.476")
[0-0] 2024-09-13T18:02:49.807Z INFO webdriver: [GET] http://localhost:54788/session/4bc84b96d913f727ba194644cca92300/element/f.C9201FD227E55555F84D78024453D2E9.d.865E989DFBF8A2273490CB0CC283FAFF.e.476/text
[0-0] 2024-09-13T18:02:49.972Z INFO webdriver: RESULT Next-gen browser and mobile automation test framework for Node.js
[0-0] 2024-09-13T18:02:49.973Z DEBUG @wdio/utils:shim: Finished to run "afterStep" hook in 0ms
[0-0] 2024-09-13T18:02:49.974Z DEBUG @wdio/utils:shim: Finished to run "afterScenario" hook in 0ms
[0-0] 2024-09-13T18:02:50.056Z DEBUG @wdio/utils:shim: Finished to run "after" hook in 0ms
[0-0] 2024-09-13T18:02:50.057Z INFO webdriver: COMMAND deleteSession()
[0-0] 2024-09-13T18:02:50.057Z INFO webdriver: [DELETE] http://localhost:54788/session/4bc84b96d913f727ba194644cca92300
[0-0] 2024-09-13T18:02:50.162Z INFO webdriver: RESULT null
[0-0] 2024-09-13T18:02:50.162Z INFO webdriver: Kill driver process with PID 64688
2024-09-13T18:02:50.290Z DEBUG @wdio/local-runner: Runner 0-0 finished with exit code 1
[0-0] FAILED in chrome - file:///features/feature_files/ui/suite2/ui_test.feature
2024-09-13T18:02:50.291Z INFO @wdio/cli:launcher: Run onWorkerEnd hook
2024-09-13T18:02:50.291Z INFO @wdio/cli:launcher: Run onComplete hook

 "spec" Reporter:
------------------------------------------------------------------
[chrome 128.0.6613.138 mac #0-0] Running: chrome (v128.0.6613.138) on mac
[chrome 128.0.6613.138 mac #0-0] Session ID: 4bc84b96d913f727ba194644cca92300
[chrome 128.0.6613.138 mac #0-0]
[chrome 128.0.6613.138 mac #0-0] » /features/feature_files/api/suite1/api_test.feature
[chrome 128.0.6613.138 mac #0-0] Suite 1
[chrome 128.0.6613.138 mac #0-0]     Verify api suite is excluded
[chrome 128.0.6613.138 mac #0-0]
[chrome 128.0.6613.138 mac #0-0] » /features/feature_files/ui/suite2/ui_test.feature
[chrome 128.0.6613.138 mac #0-0] Suite 2
[chrome 128.0.6613.138 mac #0-0]     Successfully load a web page
[chrome 128.0.6613.138 mac #0-0]
[chrome 128.0.6613.138 mac #0-0] 1 passing (4s)
[chrome 128.0.6613.138 mac #0-0] 1 failing
[chrome 128.0.6613.138 mac #0-0]
[chrome 128.0.6613.138 mac #0-0] 1) Suite 1 Verify api suite is excluded
[chrome 128.0.6613.138 mac #0-0] Error: Scenario with this step should be excluded.
[chrome 128.0.6613.138 mac #0-0] Error: Scenario with this step should be excluded.
[chrome 128.0.6613.138 mac #0-0]     at CustomWorld.<anonymous> (file:///Users/jvisco/git/wdio-example/features/step_definitions/api/setup.mjs:6:11)


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

2024-09-13T18:02:50.292Z INFO @wdio/local-runner: Shutting down spawned worker
2024-09-13T18:02:50.543Z INFO @wdio/local-runner: Waiting for 0 to shut down gracefully
2024-09-13T18:02:50.543Z INFO @wdio/local-runner: shutting down

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug 🐛help wantedIssues that are free to take by anyone interested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions