CodeceptJS
CodeceptJS copied to clipboard
seeElement does not wait full smartWait time when element is invisible
What are you trying to achieve?
What do you get instead?
Provide console output if related. Use
--verbosemode for more details.
expected elements of #element_id to be seen
Provide test source code if related
Scenario("paste on scroll", ({ I }) => {
I.amOnPage(testPage);
...
I.dontSeeElement("#block_1");
I.scrollTo("#element");
I.seeElement("#block_1");
});
Details
- CodeceptJS version: 3.1.7
- NodeJS Version: 14
- Operating System:
- webdriverio version (if related) 6.12.1
seeElement implementation:
async seeElement(locator) {
const res = await this._locate(locator, true);
assertElementExists(res, locator);
const selected = await forEachAsync(res, async el => el.isDisplayed());
return truth(`elements of ${locator}`, 'to be seen').assert(selected);
}
Where _locate sets implicit timeout for swartWait time, waits for element, then restores 0 implicit timeout and checks is element visible or not.
If element is found before smartWait timeout runs out, but it's not visible seeElement throws error instead of waiting all smartWait time.
For example:
smartWait is set on 20s.
Element in page, but become visible on 10 second.
seeElement will find element in 1 second, and fails immediately, cause element is not visible.
but it should check visibility of during 20s