ui5-community / wdi5

official UI5 end-to-end test framework for UI5 web-apps. wdi5 = Webdriver.IO + UI5 Test API
https://ui5-community.github.io/wdi5/
Apache License 2.0
102 stars 43 forks source link

Does WDI5 support FioriElement Generated App ? #198

Closed ZhanJohnny closed 2 years ago

ZhanJohnny commented 2 years ago

Describe the bug When i try to locate the element generated by FE, it seems it is impossible to get the element.

To Reproduce My code as below:

const oButtonSelector = {
    selector: {
      controlType: 'sap.m.Button',
      id: 'com.sap.project.ui.apps.myapp::sap.suite.ui.generic.template.ListReport.view.ListReport::Books--addEntry',
    }
  };  

const oCreateButton = await browser.asControl(oButtonSelector);  

await oCreateButton.firePress();

Expected behavior Should be able to located the create button

**Console log [0-0] [wdi5] call of getControl() failed because of: Error: waitAsync is already running and cannot be called again at this moment [0-0] [wdi5] error retrieving control: comsap.ctsm.ui.apps.study::sap.suite.ui.generic.template.ListReport.view.ListReport::Studies--addEntrysap.m.Button

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

Runtime Env (please complete the following information):

vobu commented 2 years ago

Hi, thanks for providing detailed context info 👍 Out of the box wdi5 supports selecting FE-like ids, see https://github.com/js-soft/wdi5/blob/3458b34a8256a9407c4109ec1aea146e6a95dd64/examples/ui5-js-app/webapp/test/e2e/basic.test.js#L14

the error message you provided (waitAsync is already running and cannot be called again at this moment) hints at a busy UI5/FE app that prevents the RecordReplay API (that we're using for communicating with the UI5 core) from kicking in. Any chance that prior to selecting the button you're not awaiting a navigation step or similar?

Also, please don't use the sap.m.Button's firePress(), but the regular .press()https://js-soft.github.io/wdi5/#/usage?id=press

PS: Generic FE support via the "OData v4 test library" is being worked on in #155

ZhanJohnny commented 2 years ago

Hi @vobu ,

Thanks for your quick reply. I am not sure how to call the WDI5 test spec after app loaded to fix the message waitAsync is already running and cannot be called again at this moment. I just use a simple pause and it works. await browser.pause(30000) Do you have better idea to wait for UI5 core loading? Thanks in advance.

vobu commented 2 years ago

Do you have better idea to wait for UI5 core loading?

this very much depends on your test setup/organization, meaning the logic, oder and sequence of your describes and its. could you probably share the test code in question?

ZhanJohnny commented 2 years ago

Hi Vobu,

Thanks a lot for your help. I would be grateful if you could share some time to check my test spec.
My test spec is in study.spec.js.

Best Regards Johnny

vobu commented 2 years ago

Thanks a lot for your help. I would be grateful if you could share some time to check my test spec. My test spec is in study.spec.js.

Unfortunately we have no access to SAP-internal GitHub hosting. So either you post/publish your test setup here - or we can go into a 1:1 support for your case. Please note that the latter would require you to become a paid sponsor of this project, which results in exclusive support for you.

ZhanJohnny commented 2 years ago

Hi Vobu,

Oh, I am not ware the you have no access. sorry for that. currently, i use browser.pause for testing and it works. I will close this issue and try to fix it later. Thanks a lot again.