Taiko: navigationTimeout not working with click()

Created on 11 Nov 2020  路  8Comments  路  Source: getgauge/taiko

Describe the bug
navigationTimeout is not taking effect

To Reproduce
Steps (or script) to reproduce the behavior:

  1. Using await click(into(link(text))); while testing a page that takes up to 22 seconds to load, I get: "Error Message: Error: Link with text X not found"

Since it really takes a lot of time:

image

I'm increasing the navigationTimeout

  1. Using await click(into(link(text)), { navigationTimeout: 120000 });, I still get: "Error Message: Error: Link with text X not found" after the same amount of time than not using navigationTimeout

Logs

        Stacktrace: 
        Error: Link with text Enable Screens  not found
            at findElements (node_modules\taiko\lib\elementSearch.js:271:11)
            at async waitAndGetActionableElement (node_modules\taiko\lib\actions\pageActionChecks.js:85:47)
            at async click (node_modules\taiko\lib\actions\click.js:50:21)
            at async module.exports.click (node_modules\taiko\lib\taiko.js:1099:16)
            at async module.exports.<computed> (node_modules\taiko\lib\taiko.js:3107:14)
            at async Object.<anonymous> (tests\steps.js:110:5)```

Expected behavior
navigationTimeout should keep click() to wait up to 120 seconds, in this case


Versions:

  • Taiko: Version: 1.0.26 (Chromium: 87.0.4279.0) RELEASE
  • OS: Windows 10 Pro 20H2
  • Node.js v12.19.0
Gauge version: 1.1.1
Commit Hash: 6e0d83f

Plugins
-------
flash (0.0.2)
html-report (4.0.12)
js (2.3.14)
screenshot (0.0.1)

All 8 comments

navigationTimeout is for waiting after the action is performed and not for the availability of the element.. try waiting for existence of the element instead like below

await waitFor(link(text), 20000) // default timeout is 10s, increase it by  passing second arg in milliseconds

try waiting for existence of the element instead

Closing this issue for now as this is the right way to wait for elements.

@NivedhaSenthil @zabil thanks for the reply. I have another question, based on https://github.com/getgauge/taiko#handle-xhr-and-dynamic-content:

Taiko implicitly waits for elements to load on the page before performing executing the command. Scripts written in Taiko are free of explicit local or global waits and the flakiness.

Is there any way to interact with a webpage like the above free of explicit local/global waits?

Thanks

Taiko implicitly waits for elements to load on the page before performing executing the command

This implicit wait has a default timeout to avoid indefinitely waiting for elements. If page rendering times are longer than the default time, you can check why the element takes so the time to load as this might be a usability issue. If that is not under your control you can override the default wait time globally

Thanks Zabil!

@NivedhaSenthil @zabil following your suggestion, I'm using:

setConfig({navigationTimeout:60000, retryTimeout:60000, highlightOnAction:'true'});

Now, in less than 40s I get a different error:

Stacktrace:
Error: Timed out
at Timeout. (C:gaugepluginsjs2.3.14srctest.js:44:23)
at listOnTimeout (internal/timers.js:554:17)
at processTimers (internal/timers.js:497:7)

It seems like a bug, what do you think?

There are two timeouts.

  • Taiko timeout
  • Gauge timeout

If you are using Taiko with Gauge you need to increase Gauge's timeout to be more than Taiko's, you can find more info here

https://docs.gauge.org/configuration.html?os=linux&language=javascript&ide=vscode#language-plugin-configurations

Thank you Zabil!

Setting _test_timeout = 30000_ @ js.properties made the job!

Was this page helpful?
0 / 5 - 0 ratings