Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Sometimes browser.asControl fails with the error "cannot read properties of undefined (reading compare)" #386

Closed
ArnaudBuchholz opened this issue Dec 9, 2022 · 0 comments · Fixed by #387
Assignees
Labels
bug Something isn't working

Comments

@ArnaudBuchholz
Copy link
Collaborator

Describe the bug
We have an environment where the behavior of WDI5 is flaky : it works or it does not work from time to time.
After qualifying, we found that error in the traces :

image

Our qualification revealed that the injectTools script sometimes define window.compareVersions but sometimes it fails.
It comes from the fact that :

  • This injectTools script seems to use some kind of Universal Module Loader (testing define, exports...)
  • Depending on which libraries are being loaded in the UI5 environment (in particular when the FLP loads tons of tiles where some use 3rd party code), the define, exports or other magic keywords can be introduced to enable a compatibility layer with UI5
  • But in the end, the injectTools intends to add compareVersions to the window object only

Which means we should simplify the injectTools script to only add the function to the window object.

To Reproduce
Too complex to explain here, I hope the description above is clear enough.
It really depends on the FLP configuration and environment.

Expected behavior
The injectTools being used by WDI5 to instrument the browser environment with expected tools should only consider the browser environment (and not any possible environment).

Logs/Console Output
N/A

Screenshots
See problem description

Runtime Env (please complete the following information):

  • wdi5/wdio-ui5-service-version: latest
  • UI5 version: 1.110.x
  • wdio-version (output of wdio --version): not relevant
  • node-version (output of node --version): not relevant
  • OS: not relevant
  • Chrome + latest (but shall be true for all browsers)

Additional context
@nair-sumesh spent 2 days qualifying the issue before contacting me and we nailed it together !

@ArnaudBuchholz ArnaudBuchholz self-assigned this Dec 9, 2022
@ArnaudBuchholz ArnaudBuchholz added the bug Something isn't working label Dec 9, 2022
ArnaudBuchholz pushed a commit that referenced this issue Dec 9, 2022
FIX #386
Also fixed a typo

Co-authored-by: Sumesh Nair <nair.sumesh@outlook.com>
@ArnaudBuchholz ArnaudBuchholz linked a pull request Dec 9, 2022 that will close this issue
@vobu vobu closed this as completed in #387 Dec 12, 2022
vobu pushed a commit that referenced this issue Dec 12, 2022
fixes #386
Also fixed a typo

Co-authored-by: i850991 <arnaud.buchholz@sap.com>
Co-authored-by: Sumesh Nair <nair.sumesh@outlook.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant