webdriverio / expect-webdriverio

WebdriverIO Assertion Library
https://webdriver.io
MIT License
75 stars 52 forks source link

[๐Ÿ› Bug]: Default example project - error in toHaveText #933

Closed psstoyanov closed 1 year ago

psstoyanov commented 1 year ago

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

v7.25.4

Node.js Version

v19.0.0

Mode

WDIO Testrunner

Which capabilities are you using?

{
        maxInstances: 5,
        browserName: 'chrome',
        acceptInsecureCerts: true
}

What happened?

Followed the Get Started tutorial: https://webdriver.io/docs/gettingstarted

However when running:

$ npx wdio run ./wdio.conf.js

The following error is thrown:

TypeError: browser.call is not a function at Object.toHaveTextFn

What is your expected behavior?

The test completes successfully

How to reproduce the bug.

https://github.com/psstoyanov/minimal_wdio_element_error

Relevant log output

Execution of 1 workers started at 2022-11-11T13:13:54.029Z

2022-11-11T13:13:54.063Z INFO @wdio/cli:launcher: Run onPrepare hook
2022-11-11T13:13:57.530Z INFO @wdio/cli:launcher: Run onWorkerStart hook
2022-11-11T13:13:57.531Z INFO @wdio/local-runner: Start worker 0-0 with arg: run,./wdio.conf.js
[0-0] 2022-11-11T13:13:57.804Z INFO @wdio/local-runner: Run worker command: run
[0-0] RUNNING in chrome - /features/login.feature
[0-0] 2022-11-11T13:13:58.033Z INFO webdriver: Initiate new session using the WebDriver protocol
[0-0] 2022-11-11T13:13:58.035Z INFO webdriver: [POST] http://localhost:4444/wd/hub/session
[0-0] 2022-11-11T13:13:58.035Z 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] 2022-11-11T13:14:02.230Z INFO webdriver: COMMAND navigateTo("https://the-internet.herokuapp.com/login")
[0-0] 2022-11-11T13:14:02.230Z INFO webdriver: [POST] http://localhost:4444/wd/hub/session/f7a9dba0322c591476cce10841a3b871/url
[0-0] 2022-11-11T13:14:02.230Z INFO webdriver: DATA { url: 'https://the-internet.herokuapp.com/login' }
[0-0] 2022-11-11T13:14:30.941Z INFO webdriver: COMMAND findElement("css selector", "#username")
[0-0] 2022-11-11T13:14:30.941Z INFO webdriver: [POST] http://localhost:4444/wd/hub/session/f7a9dba0322c591476cce10841a3b871/element
[0-0] 2022-11-11T13:14:30.942Z INFO webdriver: DATA { using: 'css selector', value: '#username' }
[0-0] 2022-11-11T13:14:30.958Z INFO webdriver: RESULT {
[0-0]   'element-6066-11e4-a52e-4f735466cecf': '76e9844f-09b8-42cf-bd61-ac610c8101c2'
[0-0] }
[0-0] 2022-11-11T13:14:30.961Z INFO webdriver: COMMAND elementClear("76e9844f-09b8-42cf-bd61-ac610c8101c2")
[0-0] 2022-11-11T13:14:30.962Z INFO webdriver: [POST] http://localhost:4444/wd/hub/session/f7a9dba0322c591476cce10841a3b871/element/76e9844f-09b8-42cf-bd61-ac610c8101c2/clear
[0-0] 2022-11-11T13:14:30.988Z INFO webdriver: COMMAND elementSendKeys("76e9844f-09b8-42cf-bd61-ac610c8101c2", "<Screenshot[base64]>")
[0-0] 2022-11-11T13:14:30.988Z INFO webdriver: [POST] http://localhost:4444/wd/hub/session/f7a9dba0322c591476cce10841a3b871/element/76e9844f-09b8-42cf-bd61-ac610c8101c2/value
[0-0] 2022-11-11T13:14:30.988Z INFO webdriver: DATA { text: 'tomsmith' }
[0-0] 2022-11-11T13:14:31.015Z INFO webdriver: COMMAND findElement("css selector", "#password")
[0-0] 2022-11-11T13:14:31.015Z INFO webdriver: [POST] http://localhost:4444/wd/hub/session/f7a9dba0322c591476cce10841a3b871/element
[0-0] 2022-11-11T13:14:31.015Z INFO webdriver: DATA { using: 'css selector', value: '#password' }
[0-0] 2022-11-11T13:14:31.027Z INFO webdriver: RESULT {
[0-0]   'element-6066-11e4-a52e-4f735466cecf': '161747f0-3a61-49b5-830c-7759362e172d'
[0-0] }
[0-0] 2022-11-11T13:14:31.029Z INFO webdriver: COMMAND elementClear("161747f0-3a61-49b5-830c-7759362e172d")
[0-0] 2022-11-11T13:14:31.029Z INFO webdriver: [POST] http://localhost:4444/wd/hub/session/f7a9dba0322c591476cce10841a3b871/element/161747f0-3a61-49b5-830c-7759362e172d/clear
[0-0] 2022-11-11T13:14:31.057Z INFO webdriver: COMMAND elementSendKeys("161747f0-3a61-49b5-830c-7759362e172d", "SuperSecretPassword!")
[0-0] 2022-11-11T13:14:31.057Z INFO webdriver: [POST] http://localhost:4444/wd/hub/session/f7a9dba0322c591476cce10841a3b871/element/161747f0-3a61-49b5-830c-7759362e172d/value
[0-0] 2022-11-11T13:14:31.057Z INFO webdriver: DATA { text: 'SuperSecretPassword!' }
[0-0] 2022-11-11T13:14:31.087Z INFO webdriver: COMMAND findElement("css selector", "button[type="submit"]")
[0-0] 2022-11-11T13:14:31.087Z INFO webdriver: [POST] http://localhost:4444/wd/hub/session/f7a9dba0322c591476cce10841a3b871/element
[0-0] 2022-11-11T13:14:31.087Z INFO webdriver: DATA { using: 'css selector', value: 'button[type="submit"]' }
[0-0] 2022-11-11T13:14:31.106Z INFO webdriver: RESULT {
[0-0]   'element-6066-11e4-a52e-4f735466cecf': 'c4714fcd-71a8-4c36-ae4d-a9707368c588'
[0-0] }
[0-0] 2022-11-11T13:14:31.108Z INFO webdriver: COMMAND elementClick("c4714fcd-71a8-4c36-ae4d-a9707368c588")
[0-0] 2022-11-11T13:14:31.108Z INFO webdriver: [POST] http://localhost:4444/wd/hub/session/f7a9dba0322c591476cce10841a3b871/element/c4714fcd-71a8-4c36-ae4d-a9707368c588/click
[0-0] 2022-11-11T13:14:31.751Z INFO webdriver: COMMAND findElement("css selector", "#flash")
[0-0] 2022-11-11T13:14:31.751Z INFO webdriver: [POST] http://localhost:4444/wd/hub/session/f7a9dba0322c591476cce10841a3b871/element
[0-0] 2022-11-11T13:14:31.751Z INFO webdriver: DATA { using: 'css selector', value: '#flash' }
[0-0] 2022-11-11T13:14:31.765Z INFO webdriver: RESULT {
[0-0]   'element-6066-11e4-a52e-4f735466cecf': '1c7e1ad8-d7ff-46d4-b151-2e38f096c17e'
[0-0] }
[0-0] 2022-11-11T13:14:31.768Z INFO webdriver: COMMAND findElements("css selector", "#flash")
[0-0] 2022-11-11T13:14:31.769Z INFO webdriver: [POST] http://localhost:4444/wd/hub/session/f7a9dba0322c591476cce10841a3b871/elements
[0-0] 2022-11-11T13:14:31.769Z INFO webdriver: DATA { using: 'css selector', value: '#flash' }
[0-0] 2022-11-11T13:14:31.781Z INFO webdriver: RESULT [
[0-0]   {
[0-0]     'element-6066-11e4-a52e-4f735466cecf': '1c7e1ad8-d7ff-46d4-b151-2e38f096c17e'
[0-0]   }
[0-0] ]
[0-0] 2022-11-11T13:14:31.785Z INFO webdriver: COMMAND findElement("css selector", "#flash")
[0-0] 2022-11-11T13:14:31.785Z INFO webdriver: [POST] http://localhost:4444/wd/hub/session/f7a9dba0322c591476cce10841a3b871/element
[0-0] 2022-11-11T13:14:31.785Z INFO webdriver: DATA { using: 'css selector', value: '#flash' }
[0-0] Error in "0: Then I should see a flash message saying You logged into a secure area!"
TypeError: browser.call is not a function
    at Object.toHaveTextFn (/home/pak0stpc/Projects/EasyFundraising/WebDriverIO_Cucumber_EasyFundraising/node_modules/expect-webdriverio/lib/matchers/element/toHaveText.js:17:20)
    at Object.toHaveTextContainingFn (/home/pak0stpc/Projects/EasyFundraising/WebDriverIO_Cucumber_EasyFundraising/node_modules/expect-webdriverio/lib/matchers/element/toHaveTextContaining.js:7:38)
    at Object.runJestExpect (/home/pak0stpc/Projects/EasyFundraising/WebDriverIO_Cucumber_EasyFundraising/node_modules/expect-webdriverio/lib/util/expectAdapter.js:10:15)
    at Object.toHaveTextContaining (/home/pak0stpc/Projects/EasyFundraising/WebDriverIO_Cucumber_EasyFundraising/node_modules/expect-webdriverio/lib/matchers/element/toHaveTextContaining.js:13:38)
    at __EXTERNAL_MATCHER_TRAP__ (/home/pak0stpc/Projects/EasyFundraising/WebDriverIO_Cucumber_EasyFundraising/node_modules/expect/build/index.js:346:30)
    at Object.throwingMatcher [as toHaveTextContaining] (/home/pak0stpc/Projects/EasyFundraising/WebDriverIO_Cucumber_EasyFundraising/node_modules/expect/build/index.js:347:15)
    at World.<anonymous> (/home/pak0stpc/Projects/EasyFundraising/WebDriverIO_Cucumber_EasyFundraising/features/step-definitions/steps.js:20:41)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[0-0] 2022-11-11T13:14:31.788Z INFO webdriver: COMMAND navigateTo("https://the-internet.herokuapp.com/login")
[0-0] 2022-11-11T13:14:31.788Z INFO webdriver: [POST] http://localhost:4444/wd/hub/session/f7a9dba0322c591476cce10841a3b871/url
[0-0] 2022-11-11T13:14:31.788Z INFO webdriver: DATA { url: 'https://the-internet.herokuapp.com/login' }
[0-0] 2022-11-11T13:14:31.806Z INFO webdriver: RESULT {
[0-0]   'element-6066-11e4-a52e-4f735466cecf': '1c7e1ad8-d7ff-46d4-b151-2e38f096c17e'
[0-0] }
[0-0] 2022-11-11T13:14:32.122Z INFO webdriver: COMMAND findElement("css selector", "#username")
[0-0] 2022-11-11T13:14:32.122Z INFO webdriver: [POST] http://localhost:4444/wd/hub/session/f7a9dba0322c591476cce10841a3b871/element
[0-0] 2022-11-11T13:14:32.122Z INFO webdriver: DATA { using: 'css selector', value: '#username' }
[0-0] 2022-11-11T13:14:32.130Z INFO webdriver: RESULT {
[0-0]   'element-6066-11e4-a52e-4f735466cecf': '7c8bf704-6862-4fe9-9f93-abfe40a650c6'
[0-0] }
[0-0] 2022-11-11T13:14:32.131Z INFO webdriver: COMMAND elementClear("7c8bf704-6862-4fe9-9f93-abfe40a650c6")
[0-0] 2022-11-11T13:14:32.132Z INFO webdriver: [POST] http://localhost:4444/wd/hub/session/f7a9dba0322c591476cce10841a3b871/element/7c8bf704-6862-4fe9-9f93-abfe40a650c6/clear
[0-0] 2022-11-11T13:14:32.159Z INFO webdriver: COMMAND elementSendKeys("7c8bf704-6862-4fe9-9f93-abfe40a650c6", "foobar")
[0-0] 2022-11-11T13:14:32.159Z INFO webdriver: [POST] http://localhost:4444/wd/hub/session/f7a9dba0322c591476cce10841a3b871/element/7c8bf704-6862-4fe9-9f93-abfe40a650c6/value
[0-0] 2022-11-11T13:14:32.159Z INFO webdriver: DATA { text: 'foobar' }
[0-0] 2022-11-11T13:14:32.184Z INFO webdriver: COMMAND findElement("css selector", "#password")
[0-0] 2022-11-11T13:14:32.184Z INFO webdriver: [POST] http://localhost:4444/wd/hub/session/f7a9dba0322c591476cce10841a3b871/element
[0-0] 2022-11-11T13:14:32.184Z INFO webdriver: DATA { using: 'css selector', value: '#password' }
[0-0] 2022-11-11T13:14:32.191Z INFO webdriver: RESULT {
[0-0]   'element-6066-11e4-a52e-4f735466cecf': '89f080a9-3174-48c1-b5bc-a3e8dd9820cc'
[0-0] }
[0-0] 2022-11-11T13:14:32.193Z INFO webdriver: COMMAND elementClear("89f080a9-3174-48c1-b5bc-a3e8dd9820cc")
[0-0] 2022-11-11T13:14:32.193Z INFO webdriver: [POST] http://localhost:4444/wd/hub/session/f7a9dba0322c591476cce10841a3b871/element/89f080a9-3174-48c1-b5bc-a3e8dd9820cc/clear
[0-0] 2022-11-11T13:14:32.213Z INFO webdriver: COMMAND elementSendKeys("89f080a9-3174-48c1-b5bc-a3e8dd9820cc", "barfoo")
[0-0] 2022-11-11T13:14:32.214Z INFO webdriver: [POST] http://localhost:4444/wd/hub/session/f7a9dba0322c591476cce10841a3b871/element/89f080a9-3174-48c1-b5bc-a3e8dd9820cc/value
[0-0] 2022-11-11T13:14:32.214Z INFO webdriver: DATA { text: 'barfoo' }
[0-0] 2022-11-11T13:14:32.238Z INFO webdriver: COMMAND findElement("css selector", "button[type="submit"]")
[0-0] 2022-11-11T13:14:32.238Z INFO webdriver: [POST] http://localhost:4444/wd/hub/session/f7a9dba0322c591476cce10841a3b871/element
[0-0] 2022-11-11T13:14:32.239Z INFO webdriver: DATA { using: 'css selector', value: 'button[type="submit"]' }
[0-0] 2022-11-11T13:14:32.246Z INFO webdriver: RESULT {
[0-0]   'element-6066-11e4-a52e-4f735466cecf': '191fd4c2-025a-4973-80d0-bb64e9d4846e'
[0-0] }
[0-0] 2022-11-11T13:14:32.248Z INFO webdriver: COMMAND elementClick("191fd4c2-025a-4973-80d0-bb64e9d4846e")
[0-0] 2022-11-11T13:14:32.248Z INFO webdriver: [POST] http://localhost:4444/wd/hub/session/f7a9dba0322c591476cce10841a3b871/element/191fd4c2-025a-4973-80d0-bb64e9d4846e/click
[0-0] 2022-11-11T13:14:33.950Z INFO webdriver: COMMAND findElement("css selector", "#flash")
[0-0] 2022-11-11T13:14:33.951Z INFO webdriver: [POST] http://localhost:4444/wd/hub/session/f7a9dba0322c591476cce10841a3b871/element
[0-0] 2022-11-11T13:14:33.951Z INFO webdriver: DATA { using: 'css selector', value: '#flash' }
[0-0] 2022-11-11T13:14:33.958Z INFO webdriver: RESULT {
[0-0]   'element-6066-11e4-a52e-4f735466cecf': 'd2066ae3-eb1e-43ae-bfe8-bd7ae88002fc'
[0-0] }
[0-0] 2022-11-11T13:14:33.960Z INFO webdriver: COMMAND findElements("css selector", "#flash")
[0-0] 2022-11-11T13:14:33.960Z INFO webdriver: [POST] http://localhost:4444/wd/hub/session/f7a9dba0322c591476cce10841a3b871/elements
[0-0] 2022-11-11T13:14:33.960Z INFO webdriver: DATA { using: 'css selector', value: '#flash' }
[0-0] 2022-11-11T13:14:33.966Z INFO webdriver: RESULT [
[0-0]   {
[0-0]     'element-6066-11e4-a52e-4f735466cecf': 'd2066ae3-eb1e-43ae-bfe8-bd7ae88002fc'
[0-0]   }
[0-0] ]
[0-0] 2022-11-11T13:14:33.968Z INFO webdriver: COMMAND findElement("css selector", "#flash")
[0-0] 2022-11-11T13:14:33.968Z INFO webdriver: [POST] http://localhost:4444/wd/hub/session/f7a9dba0322c591476cce10841a3b871/element
[0-0] 2022-11-11T13:14:33.968Z INFO webdriver: DATA { using: 'css selector', value: '#flash' }
[0-0] Error in "1: Then I should see a flash message saying Your username is invalid!"
TypeError: browser.call is not a function
    at Object.toHaveTextFn (/home/pak0stpc/Projects/EasyFundraising/WebDriverIO_Cucumber_EasyFundraising/node_modules/expect-webdriverio/lib/matchers/element/toHaveText.js:17:20)
    at Object.toHaveTextContainingFn (/home/pak0stpc/Projects/EasyFundraising/WebDriverIO_Cucumber_EasyFundraising/node_modules/expect-webdriverio/lib/matchers/element/toHaveTextContaining.js:7:38)
    at Object.runJestExpect (/home/pak0stpc/Projects/EasyFundraising/WebDriverIO_Cucumber_EasyFundraising/node_modules/expect-webdriverio/lib/util/expectAdapter.js:10:15)
    at Object.toHaveTextContaining (/home/pak0stpc/Projects/EasyFundraising/WebDriverIO_Cucumber_EasyFundraising/node_modules/expect-webdriverio/lib/matchers/element/toHaveTextContaining.js:13:38)
    at __EXTERNAL_MATCHER_TRAP__ (/home/pak0stpc/Projects/EasyFundraising/WebDriverIO_Cucumber_EasyFundraising/node_modules/expect/build/index.js:346:30)
    at Object.throwingMatcher [as toHaveTextContaining] (/home/pak0stpc/Projects/EasyFundraising/WebDriverIO_Cucumber_EasyFundraising/node_modules/expect/build/index.js:347:15)
    at World.<anonymous> (/home/pak0stpc/Projects/EasyFundraising/WebDriverIO_Cucumber_EasyFundraising/features/step-definitions/steps.js:20:41)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[0-0] 2022-11-11T13:14:33.970Z INFO webdriver: COMMAND deleteSession()
[0-0] 2022-11-11T13:14:33.970Z INFO webdriver: [DELETE] http://localhost:4444/wd/hub/session/f7a9dba0322c591476cce10841a3b871
[0-0] 2022-11-11T13:14:33.977Z INFO webdriver: RESULT {
[0-0]   'element-6066-11e4-a52e-4f735466cecf': 'd2066ae3-eb1e-43ae-bfe8-bd7ae88002fc'
[0-0] }
[0-0] FAILED in chrome - /features/login.feature
2022-11-11T13:14:34.198Z INFO @wdio/cli:launcher: Run onWorkerEnd hook
2022-11-11T13:14:34.198Z INFO @wdio/cli:launcher: Run onComplete hook
2022-11-11T13:14:34.198Z INFO @wdio/selenium-standalone-service: shutting down all browsers

 "spec" Reporter:
------------------------------------------------------------------
[chrome 107.0.5304.110 linux #0-0] Running: chrome (v107.0.5304.110) on linux
[chrome 107.0.5304.110 linux #0-0] Session ID: f7a9dba0322c591476cce10841a3b871
[chrome 107.0.5304.110 linux #0-0]
[chrome 107.0.5304.110 linux #0-0] ยป /features/login.feature
[chrome 107.0.5304.110 linux #0-0] The Internet Guinea Pig Website
[chrome 107.0.5304.110 linux #0-0] As a user, I can log into the secure area
[chrome 107.0.5304.110 linux #0-0]    โœ“ Given I am on the login page
[chrome 107.0.5304.110 linux #0-0]    โœ“ When I login with tomsmith and SuperSecretPassword!
[chrome 107.0.5304.110 linux #0-0]    โœ– Then I should see a flash message saying You logged into a secure area!
[chrome 107.0.5304.110 linux #0-0]
[chrome 107.0.5304.110 linux #0-0] As a user, I can log into the secure area
[chrome 107.0.5304.110 linux #0-0]    โœ“ Given I am on the login page
[chrome 107.0.5304.110 linux #0-0]    โœ“ When I login with foobar and barfoo
[chrome 107.0.5304.110 linux #0-0]    โœ– Then I should see a flash message saying Your username is invalid!
[chrome 107.0.5304.110 linux #0-0]
[chrome 107.0.5304.110 linux #0-0] 4 passing (31.8s)
[chrome 107.0.5304.110 linux #0-0] 2 failing
[chrome 107.0.5304.110 linux #0-0]
[chrome 107.0.5304.110 linux #0-0] 1) As a user, I can log into the secure area Then I should see a flash message saying You logged into a secure area!
[chrome 107.0.5304.110 linux #0-0] TypeError: browser.call is not a function
[chrome 107.0.5304.110 linux #0-0] TypeError: browser.call is not a function
[chrome 107.0.5304.110 linux #0-0]     at Object.toHaveTextFn (/home/pak0stpc/Projects/EasyFundraising/WebDriverIO_Cucumber_EasyFundraising/node_modules/expect-webdriverio/lib/matchers/element/toHaveText.js:17:20)
[chrome 107.0.5304.110 linux #0-0]     at Object.toHaveTextContainingFn (/home/pak0stpc/Projects/EasyFundraising/WebDriverIO_Cucumber_EasyFundraising/node_modules/expect-webdriverio/lib/matchers/element/toHaveTextContaining.js:7:38)
[chrome 107.0.5304.110 linux #0-0]     at Object.runJestExpect (/home/pak0stpc/Projects/EasyFundraising/WebDriverIO_Cucumber_EasyFundraising/node_modules/expect-webdriverio/lib/util/expectAdapter.js:10:15)
[chrome 107.0.5304.110 linux #0-0]     at Object.toHaveTextContaining (/home/pak0stpc/Projects/EasyFundraising/WebDriverIO_Cucumber_EasyFundraising/node_modules/expect-webdriverio/lib/matchers/element/toHaveTextContaining.js:13:38)
[chrome 107.0.5304.110 linux #0-0]     at __EXTERNAL_MATCHER_TRAP__ (/home/pak0stpc/Projects/EasyFundraising/WebDriverIO_Cucumber_EasyFundraising/node_modules/expect/build/index.js:346:30)
[chrome 107.0.5304.110 linux #0-0]     at Object.throwingMatcher [as toHaveTextContaining] (/home/pak0stpc/Projects/EasyFundraising/WebDriverIO_Cucumber_EasyFundraising/node_modules/expect/build/index.js:347:15)
[chrome 107.0.5304.110 linux #0-0]     at World.<anonymous> (/home/pak0stpc/Projects/EasyFundraising/WebDriverIO_Cucumber_EasyFundraising/features/step-definitions/steps.js:20:41)
[chrome 107.0.5304.110 linux #0-0]     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[chrome 107.0.5304.110 linux #0-0]
[chrome 107.0.5304.110 linux #0-0] 2) As a user, I can log into the secure area Then I should see a flash message saying Your username is invalid!
[chrome 107.0.5304.110 linux #0-0] TypeError: browser.call is not a function
[chrome 107.0.5304.110 linux #0-0] TypeError: browser.call is not a function
[chrome 107.0.5304.110 linux #0-0]     at Object.toHaveTextFn (/home/pak0stpc/Projects/EasyFundraising/WebDriverIO_Cucumber_EasyFundraising/node_modules/expect-webdriverio/lib/matchers/element/toHaveText.js:17:20)
[chrome 107.0.5304.110 linux #0-0]     at Object.toHaveTextContainingFn (/home/pak0stpc/Projects/EasyFundraising/WebDriverIO_Cucumber_EasyFundraising/node_modules/expect-webdriverio/lib/matchers/element/toHaveTextContaining.js:7:38)
[chrome 107.0.5304.110 linux #0-0]     at Object.runJestExpect (/home/pak0stpc/Projects/EasyFundraising/WebDriverIO_Cucumber_EasyFundraising/node_modules/expect-webdriverio/lib/util/expectAdapter.js:10:15)
[chrome 107.0.5304.110 linux #0-0]     at Object.toHaveTextContaining (/home/pak0stpc/Projects/EasyFundraising/WebDriverIO_Cucumber_EasyFundraising/node_modules/expect-webdriverio/lib/matchers/element/toHaveTextContaining.js:13:38)
[chrome 107.0.5304.110 linux #0-0]     at __EXTERNAL_MATCHER_TRAP__ (/home/pak0stpc/Projects/EasyFundraising/WebDriverIO_Cucumber_EasyFundraising/node_modules/expect/build/index.js:346:30)
[chrome 107.0.5304.110 linux #0-0]     at Object.throwingMatcher [as toHaveTextContaining] (/home/pak0stpc/Projects/EasyFundraising/WebDriverIO_Cucumber_EasyFundraising/node_modules/expect/build/index.js:347:15)
[chrome 107.0.5304.110 linux #0-0]     at World.<anonymous> (/home/pak0stpc/Projects/EasyFundraising/WebDriverIO_Cucumber_EasyFundraising/features/step-definitions/steps.js:20:41)
[chrome 107.0.5304.110 linux #0-0]     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

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

2022-11-11T13:14:34.199Z INFO @wdio/local-runner: Shutting down spawned worker
2022-11-11T13:14:34.449Z INFO @wdio/local-runner: Waiting for 0 to shut down gracefully
2022-11-11T13:14:34.450Z INFO @wdio/local-runner: shutting down

Code of Conduct

Is there an existing issue for this?

erwinheitzman commented 1 year ago

Can confirm this is an issue which has appeared only since a short time ago.

Can be reproduced by creating a new project using default settings for the CLI wizard.

erwinheitzman commented 1 year ago

Seems like this change is the culprit: https://github.com/webdriverio/expect-webdriverio/pull/932

erwinheitzman commented 1 year ago

There is a temporary workaround which can be applied to your package.json:

  "overrides": {
    "expect-webdriverio": "3.5.0"
  }
psstoyanov commented 1 year ago

As per @erwinheitzman suggestion, forcing expect-webdriverio to an older version resolves the issue:

example forced expect-webdriverio version in package.json ``` { "name": "webdriverio_cucumber_easyfundraising", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [], "author": "", "license": "ISC", "dependencies": { "@wdio/cli": "^7.25.4" }, "devDependencies": { "@wdio/cucumber-framework": "^7.25.4", "@wdio/local-runner": "^7.25.4", "@wdio/spec-reporter": "^7.25.4", "chromedriver": "^107.0.3", "wdio-chromedriver-service": "^8.0.0", "expect-webdriverio": "3.5.0" } } ```

Notes:

Update:

Using an override is indeed far better solution :+1:

christian-bromann commented 1 year ago

The expect-webdriverio dependency is defined via "expect-webdriverio": "^3.0.0" so you will get the latest version with the fix by updating your dependencies:

rm -r node_modules package-lock.json
npm install
psstoyanov commented 1 year ago

@christian-bromann , the issue is observable with the latest expect-webdriverio version 3.5.1 as of right now.

The override to the older 3.5.0 doesn't exhibit the issue with the minimal example.

Am I missing something as to why this ticket is closed?

christian-bromann commented 1 year ago

I see, this is a different error than I thought then. Reopening.

christian-bromann commented 1 year ago

This just got fixed and will be released as v3.5.2.