(webdriverio): Add case insensitive text match feature #4951#11358
(webdriverio): Add case insensitive text match feature #4951#11358christian-bromann merged 4 commits intowebdriverio:mainfrom
Conversation
|
Awesome work @AnthonyQuy 👍 It would be nice to add a function that lowercases text and then uppercases every other character so that we can use the same string for two different assertions and it keeps the rest easy to understand. So something like: const alternateCase = str => str.forEach(i => i % 2 == 0 ? i.toUpperCase() : i.toLowerCase())
alternateCase('example text') // outputs: eXaMpLe tExTEDIT: actually after checking more individual testcases I feel this is a nice idea but the texts are a bit too specific to do this so you can ignore this suggestion and I'll resolve it |
christian-bromann
left a comment
There was a problem hiding this comment.
Change looks good, thanks for picking it up 👍
Mind adding/updating the documentation on that in https://github.com/webdriverio/webdriverio/blob/main/website/docs/Selectors.md ?
@christian-bromann Seem the document page is using a sample project. I think we can merge this PR then update the sample project after new version release |
|
@AnthonyQuy merged pr on example recipes, please go ahead. |
|
Thanks @christian-bromann updated the Selectors.md |
christian-bromann
left a comment
There was a problem hiding this comment.
Let's not use "we".
The rest looks good to me. Great work 👍
|
Agreed. Thank you!! |
christian-bromann
left a comment
There was a problem hiding this comment.
Actually I think the code examples aren't properly updated, can you set it to:
Or using query partial text:
```js reference useHTTPS
https://github.com/webdriverio/example-recipes/blob/13eddfac6f18a2a4812cc09ed7aa5e468f392060/selectors/example.js#L44C9-L47
```
The same works for `id` and `class` names:
```html reference
https://github.com/webdriverio/example-recipes/blob/e8b147e88e7a38351b0918b4f7efbd9ae292201d/selectors/example.html#L4
```
You can query this element by calling:
```js reference useHTTPS
https://github.com/webdriverio/example-recipes/blob/13eddfac6f18a2a4812cc09ed7aa5e468f392060/selectors/example.js#L49-L67
```
|
Yes you're right! Sorry I overlooked the page. Created a update commit |
|
Hey Team, 1 doubt: What if someone want's to check the exact text ?? |
|
|
How can it be achievable with xpath? |


Proposed changes
Add case insensitive text match feature #4951
Types of changes
Checklist
Further comments
Reviewers: @webdriverio/project-committers