Skip to content

Conversation

@abdel-ships-it
Copy link

This is almost the same change as #962, but against the v3. This will ensure older versions of the framework still get the correct async matchers signature. This is inline with how the v3 branch is documented with toBeDisplayed getting awaited.

```js
const { remote } = require('webdriverio');
require('expect-webdriverio')
;(async () => {
const browser = await remote({
capabilities: {
browserName: 'chrome'
}
})
await browser.url('https://webdriver.io')
const $button = await browser.$('button')
await expect($button).toBeDisplayed()
await browser.deleteSession()
})().catch(console.error)
```

Some more context, in our projects people are sometimes forgetting to await Promises, this typings change together with the eslint rule no-floating-promises will allow us to highlight these bugs earlier in the development process.

image

For more context, see the back and forth comments starting here

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jul 10, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: abdel-ships-it / name: Abdel (e4f70c7)

@christian-bromann
Copy link
Member

It seems like the tests are failing and it seems it is related to this change.

@abdel-ships-it
Copy link
Author

@christian-bromann Im having a look 👍🏼

@abdel-ships-it
Copy link
Author

@christian-bromann I think I found a more elegant solution that does not affect jasmine. I will rebase for clean git history, I see the tests passing as well.

@abdel-ships-it
Copy link
Author

It seems like the tests are failing and it seems it is related to this change.

The PR is ready for review now 👌

Copy link
Member

@christian-bromann christian-bromann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@christian-bromann christian-bromann merged commit 5943f6e into webdriverio:v3 Jul 10, 2025
4 checks passed
@christian-bromann
Copy link
Member

Released as 3.7.0

@abdel-ships-it
Copy link
Author

@christian-bromann I want to point out a slight problem with the v3 branch, Im seeing toBeVisible and toBeVisibleInViewport are missing in the typings, although they are supported matchers in WDIO v7 (see docs)

I believe toBeDisplayed and toBeDisplayedInViewport are identical methods so I will be using those for now

@abdel-ships-it
Copy link
Author

Im going to add that my changes introduce unwanted side effects :/ It looks like non WDIO matchers also get the Promise return signature because of typescript global declaration merging. I will be creating a revert PR and fixing this locally using patch-package instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants