question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

v6 slow to confirm non-existence of elements

See original GitHub issue

Environment (please complete the following information):

  • WebdriverIO version: 6.7.3
  • Mode: spectron
  • If WDIO Testrunner, running sync/async: [e.g. sync/async]
  • Node.js version: 12.14.1
  • NPM version: 7.0.3
  • Browser name and version: Electron 10 (chrome 85)
  • Platform name and version: macOS 10.15.7
  • Additional wdio packages used (if applicable): [e.g. @wdio/spec reporter, @wdio/selenium-standalone service]

Config of WebdriverIO Stock spectron configuration

Describe the bug When trying to find a non-existing element, it is either much slower than with v4, or can fail if timeouts are not configured carefully. With v4, this is not a problem.

v4 behavior: when waiting for non-existence, if it does not exist right now, succeed quickly. If it exists, only then do you need to wait for it to not exist. 👍

v6 behavior: if it does not exist right now, webdriverio still waits … to see that it does not exist (??) And if we tried to work around this by setting a short global wait timeout (it has to be global, because $ does not accept a timeout parameter)… then if we want to wait for an existing element to disappear within some time frame… now those tests may fail! 👎

To Reproduce See repo: https://github.com/starpit/webdriverio-6092

Expected behavior webdriverio must support both use cases: 1) confirming an element does not exist, and quickly; 2) waiting for an element that may exist to no longer exist.

I’m not sure what you want by design, but in v4, the pattern client.waitForExist('.classname', timeout, true) would correctly and quickly succeed for both use cases.

But this seems to be impossible with v6. The API has changed so that one first must find the element (e.g. via $), and then call waitForExist({ reverse: true }) on the result. The implementation of waitForExist just calls $$ again. As a result, trying to confirm the non-existence of an element requires paying two wait timeout penalties, one of which does not seem to allow for control at call sites — $ does not take a waitTimeout parameter.

As a result, one has to choose whether to make the first, or the second, use case reliable. By setting a short global wait timeout, the first use case (confirming that an non-existing element truly does not exist) can be… fast enough, but still not as fast as v4, because v6 will still pay a waitTimeout penalty to confirm something it already knows…

On the other hand, by setting a longer global wait timeout, the second use case (waiting for an existing element to go away) will work, but the first use case will not! The first use case will either be very slow (paying two wait timeout penalties to confirm something knowable from the get-to), or fail (e.g. if 2*waitTimeout exceeds the mocha timeout).

Log No pertinent logs for this issue

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
christian-bromanncommented, Nov 11, 2020

As a result, trying to confirm the non-existence of an element requires paying two wait timeout penalties

This is only if you have implicit timeouts set, which is not recommended at all. Many people say that you should not make use of implicit waits for various reasons, one of them is exactly this scenario.

I am not sure what waitTimeout in Spectron is doing.

0reactions
starpitcommented, Nov 11, 2020

You guys are awesome, thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting Slow Requests in TAS for VMs
Experiment 6: Test the Network between the Router and the App. After you determine the cause of latency, see the following sections for...
Read more >
Common mistakes with React Testing Library - Kent C. Dodds
The only reason this is useful is to verify that an element is not rendered to the page.
Read more >
Fix list for WebSphere MQ Version 7.0 - IBM
Security APAR APAR Description ✓ IV69190 CVE‑2014‑4771 IV70568 Updates to the versions of GSKIT8 shipped with MQ ✓ IV73860 CVE‑2015‑2013
Read more >
RFC 4960: Stream Control Transmission Protocol
This is the threshold that the endpoint will use to determine whether to perform slow start or congestion avoidance on a particular destination...
Read more >
On the non-existence of elements of Kervaire invariant one
We show that Kervaire invariant one elements in the homotopy groups of spheres exist only in dimensions at most 126. By Browder's Theorem,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found