wdi5: browser.asControl({timeout ... has no effect

Describe the bug For a slow responding systems where the page takes too much time to respond, the timeout feature of the browser.asControl has no affect.

To Reproduce Not possible to reproduce on every system.

Expected behavior The timeout parameter should respect the wait for the element to load.

Logs/Console Output

Code

     await browser.asControl({
      selector: {
        controlType: 'sap.ushell.ui.launchpad.AnchorItem',
        properties: { "title":"Administrator" }
      },
      timeout: 90000,
      forceSelect: true
    })
 

Output image

Screenshots if applicable, add screenshots to help explain your problem.

Runtime Env (please complete the following information):

  • wdi5/wdio-ui5-service-version: 1.0.3
  • UI5 version: 1.106.1
  • wdio-version (output of wdio --version): 7.195
  • node-version (output of node --version): 18.12.1
  • OS: MacOS
  • Browser + Version 1.108

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 22 (7 by maintainers)

Most upvoted comments

After discussion we planned to enhance the auto-waiter with support for fetch and sync xmlHttpRequest. Thanks again @Siolto for taking the time to compose the clear samples. We will update when the new implementation is available.

Hi colleagues,

OPA experts are notified about this potential bug and we are waiting for their feedback. Please stay tuned.

BR, Hristo

Hi @nair-sumesh,

Just as a side note, I see you are using UI5 version 1.106.1 which does not contain a recent enhancement to the auto-waiter https://github.com/SAP/openui5/commit/6b478630a249a8311ab1e77fe29efb7111ac55da that enables it to track ongoing animations. It was included in 1.107 and all later UI5 versions. Given that 1.106 is no longer listed as supported (I’m checking against the list at https://sapui5.hana.ondemand.com/versionoverview.html) you could (if you want) from now update to 1.108 or any later supported version while we are working on the remaining discussed enhancements (tracking of fetch and XMLHttpRequest without async set to true)

Hi @Siolto,

Thank you the samples that clearly show cases not covered by the auto-waiter. I’ll request internally to plan a research why these were not covered so far and discuss their inclusion.

I posted my earlier question because these two cases (fetch and sync xmlHttpRequest) are examples where the auto-waiter does not wait at all (because it does not even detect them), while the original issue was supposedly about the auto-waiter waiting too long (because @nair-sumesh mentioned the auto-waiter did not respect the custom timeout)

This is why I wanted @nair-sumesh to clarify again the original issue (waiting too long OR not waiting enough time).

Hi @kineticjs

thanks for looking into this issue. Yes in your example everything is working as expected. But as already written above, it is not about the setTimeout but more about fetch or xmlHttpRequest requests which are not correctly covered via the waitForUI5. Maybe there are even more cases that are not covered by the autoWaiter but these are the two examples I could find.

I have a minimal reproducible example for you with a running express server:

  • clone https://github.com/Siolto/waitForUI5
  • run npm install
  • run npm run start:ui5 and npm run start:node in two different terminals
  • click on one of the buttons you will see that: - setTimeout <== works - fetch <== does not work - xmlHttpRequest <== only works with async specifically set to true (example is in the code)

For the xmlHttpRequest I may have found the line where you could start debugging. It seems like there is the bug.

For the fetch I am pretty sure this should be handled via _promiseWaiter.js but there is to much 🪄 going on to give you a concrete guidance here.

I hope my example helps you get to the root of this problem.

Regards Simon

After having a hard time debugging this, I may have found the Bug:

It is not our custom timeout on the selector but the synchronization with the ui5 framework through sap/ui/test/autowaiter/_autoWaiterAsync. That’s why I want to bring @hmanchev in the loop.

It seems like the sap/ui/test/autowaiter/_autoWaiterAsync is not feature complete or a little bit flaky with some requests. For example all requests via fetch are not recognized and will not be awaited till they are resolved/rejected.

Also the request fired via XMLHttpRequest which are not specifically marked as async will be also not correctly tracked.

Further investigation is needed to really find the root of this problem.