webdriverio-boneyard / v4

Deprecated code base for all WebdriverIO releases up until v4.x
MIT License
8 stars 21 forks source link

browser.waitForVisible(...) returns timeout error on certain situation #31

Open Taewa opened 5 years ago

Taewa commented 5 years ago

Hi all, I am wondering how wdio v4 detects if certain element is visible when I test with browser.waitForVisible().

I have a reproducible code. And there is explanation on readme.md.

Simply, if there is a component that has only a child element that has position:absolute, browser.waitForVisible() not working (timeout) even if it's actually visible on the browser.

I guess it's failing because <child-component> has 0 height.

This failure is expected behavior?

On readme.md, there is 'The solutions I have found so far' section. Please let me know this is correct approach.

note 1: I am testing with shadowDom. I have installed wdio-webcomponents. note 2: I am using wdio 4 because of CucumberJs.

The key point is the below code.

// step.js
Then('I should see form', () => {
    const path = 'e2e-app child-component';
    browser.waitForVisible(path, 10000);
});

// child-component.html
<style>
    form {
      /* 'fixed' will be also failing */
      position: absolute; 
    }
</style>

<form>
    <label for="someInput">Your name :</label>
    <input type="text" id="someInput">
</form>

Environment (please complete the following information):