-
-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
async controller functions are not resolved #417
Comments
hi, as we're in Node.js land with |
Maybe this line causes indeed the issue:
|
@vobu But that doesn't really matter, as async functions in general might be an issue at least with me :D Little example controller: export default class App extends BaseController {
public async onInit(): Promise<void> {
console.log("App controller onInit");
}
public getSyncNumber(): number{
return 10;
}
public async getAsyncNumber(): Promise<number> {
return new Promise((resolve,reject) => {
resolve(10);
})
}
public async getBusinessPartners() {
return this.query({ entitySet: '/BusinessPartnerSet' });
}
} and the corresponding test case: describe("binding", () => {
it("Odata create", async () => {
const selector = {
selector: {
controlType: "sap.ui.core.mvc.XMLView",
}
}
const view = await (browser as any).asControl(selector);
const controller = await view.getController();
console.log("sync number", await controller.getSyncNumber());
const number = await controller.getAsyncNumber();
console.log(number)
})
}) This will result in the following messages/log:
if i await for this promise like |
thanks for the additional context @freakadunse. your test/use case is very close to the unit testing scope, and not really in the e2e scope ("as a user would operate the app"). Still, here's what we'll do: put in a test case reflecting the setup and refactor so that also in the browser scope, |
you are right @vobu, this is closer to unit testing. But what i test is a controller i extend for all view controllers which gives me methods for application handling like async query and reads, that i need with detail-view data collection on route navigations. but anyways: thanks for taking a look into it and providing a new version in the near future 😊 |
* detect client async fn and await them * cater towards throwing async fn client-side fixes #417
Describe the bug
Asynchronous functions in UI5 Controller are callable, but the promise will not be fulfilled.
The await of the promise results in a timeout.
To Reproduce
Create a UI5 application with only one view and create the following method in the controller:
Create a WDI5 Test suite with the following test:
This would result either in errors or unresolved promises or timeout.
Using sync controller functions will return the correct value.
Expected behavior
The Promise of the controller function would be resolved.
Runtime Env (please complete the following information):
wdi5/wdio-ui5-service
-version: 1.1.0UI5
version: 1.109.0wdio
-version (output ofwdio --version
): 7.30.0node
-version (output ofnode --version
): v16.13.2The text was updated successfully, but these errors were encountered: