Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐛 Bug]: isElementDisplayed returns incorrect result for elements with overflow-x/y: hidden and zero width/height #12781

Open
3 tasks done
louisremi opened this issue May 3, 2024 · 3 comments · May be fixed by #12856
Open
3 tasks done
Labels
Bug 🐛 help wanted Issues that are free to take by anyone interested

Comments

@louisremi
Copy link

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

latest

Node.js Version

latest

Mode

Standalone Mode

Which capabilities are you using?

No response

What happened?

In 8.22.2, a regression was introduced in isDisplayed method. Webdriverio is no longer able to detect that an element isn't displayed with the following styles:

  • overflow-x: hidden; width: 0;
  • or overflow-y: hidden; height: 0;

It is however correctly able to detect that the element isn't displayed with the following styles:

  • overflow: hidden; width: 0; height: 0;

What is your expected behavior?

Webdriver should be consistently able to tell that elements with overflow the following styles are not displayed:

  • overflow: hidden; width: 0; height: 0;
  • overflow-x: hidden; width: 0;
  • or overflow-y: hidden; height: 0;

How to reproduce the bug.

I've started by forking cucumber-boilerplate and adding a test-suite for isDisplayed with different combinations of overflow(-x/-y): hidden; and zero width/height. Here are the steps to reproduce:

  1. clone following repo locally https://github.com/louisremi/cucumber-boilerplate/tree/test-case/isElementDisplayed-overflow-bug:
  • git clone [email protected]:louisremi/cucumber-boilerplate.git
  • git checkout test-case/isElementDisplayed-overflow-bug
  1. install dependencies
  • npm install
  1. run tests locally
  • npm run test:features

The two interesting files in this repo to understand the problem are:

Relevant log output

[chrome-headless-shell 124.0.6367.91 linux #0-0] Running: chrome-headless-shell (v124.0.6367.91) on linux
[chrome-headless-shell 124.0.6367.91 linux #0-0] Session ID: d17b349514a984dac88571ec59af8a9d
[chrome-headless-shell 124.0.6367.91 linux #0-0]
[chrome-headless-shell 124.0.6367.91 linux #0-0] » /src/features/notDisplayed.feature
[chrome-headless-shell 124.0.6367.91 linux #0-0] Test visibility of elements with "overflow(-x/y): hidden"
[chrome-headless-shell 124.0.6367.91 linux #0-0] As a developer
[chrome-headless-shell 124.0.6367.91 linux #0-0] I want to be able to test the visibility of an element
[chrome-headless-shell 124.0.6367.91 linux #0-0]
[chrome-headless-shell 124.0.6367.91 linux #0-0] overflow: hidden & width/height: 100
[chrome-headless-shell 124.0.6367.91 linux #0-0]     Given I open the url "http://localhost:8080/"
[chrome-headless-shell 124.0.6367.91 linux #0-0]     Then I expect that element "#overflow" is displayed
[chrome-headless-shell 124.0.6367.91 linux #0-0]
[chrome-headless-shell 124.0.6367.91 linux #0-0] overflow-x: hidden & width/height: 100
[chrome-headless-shell 124.0.6367.91 linux #0-0]     Given I open the url "http://localhost:8080/"
[chrome-headless-shell 124.0.6367.91 linux #0-0]     Then I expect that element "#overflow-x" is displayed
[chrome-headless-shell 124.0.6367.91 linux #0-0]
[chrome-headless-shell 124.0.6367.91 linux #0-0] overflow-y: hidden & width/height: 100
[chrome-headless-shell 124.0.6367.91 linux #0-0]     Given I open the url "http://localhost:8080/"
[chrome-headless-shell 124.0.6367.91 linux #0-0]     Then I expect that element "#overflow-y" is displayed
[chrome-headless-shell 124.0.6367.91 linux #0-0]
[chrome-headless-shell 124.0.6367.91 linux #0-0] overflow: hidden & width: 0
[chrome-headless-shell 124.0.6367.91 linux #0-0]     Given I open the url "http://localhost:8080/"
[chrome-headless-shell 124.0.6367.91 linux #0-0]     Then I expect that element "#overflow-0w" is not displayed
[chrome-headless-shell 124.0.6367.91 linux #0-0]
[chrome-headless-shell 124.0.6367.91 linux #0-0] overflow: hidden & height: 0
[chrome-headless-shell 124.0.6367.91 linux #0-0]     Given I open the url "http://localhost:8080/"
[chrome-headless-shell 124.0.6367.91 linux #0-0]     Then I expect that element "#overflow-0h" is not displayed
[chrome-headless-shell 124.0.6367.91 linux #0-0]
[chrome-headless-shell 124.0.6367.91 linux #0-0] overflow-x: hidden & width: 0
[chrome-headless-shell 124.0.6367.91 linux #0-0]     Given I open the url "http://localhost:8080/"
[chrome-headless-shell 124.0.6367.91 linux #0-0]     Then I expect that element "#overflow-x-0w" is not displayed
[chrome-headless-shell 124.0.6367.91 linux #0-0]
[chrome-headless-shell 124.0.6367.91 linux #0-0] overflow-y: hidden & height: 0
[chrome-headless-shell 124.0.6367.91 linux #0-0]     Given I open the url "http://localhost:8080/"
[chrome-headless-shell 124.0.6367.91 linux #0-0]     Then I expect that element "#overflow-y-0h" is not displayed
[chrome-headless-shell 124.0.6367.91 linux #0-0]
[chrome-headless-shell 124.0.6367.91 linux #0-0] 12 passing (506ms)
[chrome-headless-shell 124.0.6367.91 linux #0-0] 2 failing

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
@louisremi louisremi added Bug 🐛 Needs Triaging ⏳ No one has looked into the issue yet labels May 3, 2024
@christian-bromann
Copy link
Member

@louisremi thanks for raising the issue.

I think we have to enhance this portion of the code. Any contribution are welcome.

@christian-bromann christian-bromann added help wanted Issues that are free to take by anyone interested and removed Needs Triaging ⏳ No one has looked into the issue yet labels May 3, 2024
@wdio-bot
Copy link
Contributor

wdio-bot commented May 3, 2024

Thanks for reporting!

We greatly appreciate any contributions that help resolve the bug. While we understand that active contributors have their own priorities, we kindly request your assistance if you rely on this bug being fixed. We encourage you to take a look at our contribution guidelines or join our friendly Discord development server, where you can ask any questions you may have. Thank you for your support, and cheers!

@louisremi
Copy link
Author

I have a PR in the pipes, but I'm off next week

@louisremi louisremi linked a pull request May 10, 2024 that will close this issue
16 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🐛 help wanted Issues that are free to take by anyone interested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants