Closed abdelhaknezzari closed 1 year ago
a for loop does not wait for an asynchronous operation to complete. so what you're seeing are the side effects of multiple async ops running in parallel. try converting your for loop to a for-of: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of
Hi @vobu , the error: [wdi5] call of _getControl() failed because of: Error: waitAsync is already running and cannot be called again at this moment [wdi5] error retrieving control: columnListItemId-__clone2 [wdi5] _asControl() needed 7.740290999412537 for columnListItemId-__clone2
is coming from statment: const items =await tab.getAggregation("items");
if I continue the debugging until the for loop: for (const item of items) { const cells = await item.getAggregation('cells'); const titleItems = await cells[0].getItems(); const title = await titleItems[0].getTitle(); }
it will give another error,
regards,
of what type is the table that you're trying to call getAggregation("items")
on? sap.ui.table.Table
? b/c then it would be getAggregation("rows")
.
getAggregation("items")
is for a sap.m.Table
.
yes I confirm it is sap.ui.table.Table:
the error is happening as well with : getAggregation("items") and getItems() methods of "sap.m.Table"
you're saying it is a sap.ui.table.Table
, yet your screenshot shows a sap.m.Table
- which one is it now? 😄
and what selector does the Testrecorder show it you switch the "select a dialect" to wdi5
?
it is sap.m.Table (import Table from 'sap/m/Table';)
the selector is working fine: const tab = await browser.asControl({ forceSelect: true, selector: { id: "application-feature-display-component---FeatureList--featureListTableId", interaction: "root" }});
hm, all i can say about this from the distance is that we're extensively using tables/lists as well in our own tests, e.g. https://github.com/ui5-community/wdi5/blob/main/examples/ui5-js-app/webapp/test/e2e/aggregation.test.js https://github.com/ui5-community/wdi5/blob/f45a5b67415caab902de3883fedc132908c9b7bc/examples/ui5-js-app/webapp/test/e2e/fluent-async-api.test.js#L35
does .getItems(0)
work on your sap.m.Table
?
const items = [await tab.getItems(0) ]; is working without errors
but getting errors afterwards with the following code: for (const item of items) { const cells = await item.getAggregation('cells'); const titleItems = await cells[0].getItems(); const title = await titleItems[0].getTitle(); }
Then I'd suggest you try to debug each call as described in https://ui5-community.github.io/wdi5/#/debugging and check where the actual error occurs!
do you mean debug WDI5 library? if yes, do you have suggestion where I can put the debugger statement before it is loaded to the browser,
Hi @vobu not sure if you get the notification for my last question, as the error is coming deep from WDI5, I need some insight where we can debug in the library, especially where the .sap.m.table code is located, to undestand what's going on
The error originates from the _autoWaiterAsync from sap.test package. What does work is calling: await tab.getItems(0) await tab.getItems(1) await tab.getItems(2)
What does not work is await tab.getItems()
It seems wdi5 is triggering retrieving all items simultaneously from the browser, this function here is executed for each item before they are resolved:
This seems to be prevented by the before if statement "if (bWaitStarted)": https://github.com/SAP/openui5/blob/251005d26646ef28e635e40819c94f14b433784a/src/sap.ui.core/src/sap/ui/test/autowaiter/_autoWaiterAsync.js#L37
woah, thanks for diving deep here @philippthiele 🤿 !
from the wdi5
perspective, we're just reusing what the RecordReplay
API offers - e.g. no special handling for retreiving aggregations from a UI5 control.
i'm not sure how to proceed here @abdelhaknezzari as we're at the point where you'd most likely need specific counseling on source- and test-code whom you can't seem to share publicly.
Mind continuing this via e-mail? → see my profile for e-mail-address
@vobu I have created a potential fix here, that is working for me: https://github.com/ui5-community/wdi5/pull/455 Maybe you can assess whether this is the right way to fix the issue or it might spark some idea how to do it correctly otherwise.
providing a PR: that's the spirit, yesss 🙌 let's continue working in there!
Hello, Describe the bug We are getting error: [wdi5] call of _getControl() failed because of: Error: waitAsync is already running and cannot be called again at this moment [wdi5] error retrieving control: columnListItemId-__clone2 [wdi5] _asControl() needed 7.740290999412537 for columnListItemId-__clone2
After calling: const tab = await browser.asControl({ forceSelect: true, selector: { id: "application-feature-display-component---FeatureList--featureListTableId", interaction: "root" // <-- hooray! }}); const items =await tab.getAggregation("items");
the first statement await browser.asControl is working fine, The error is coming from the last statement of getting the items, and we have already a test scenario that is clicking on buttons which working fine, we have a problem only in getting the items of a list.
To Reproduce You need to run the scenario we have, it will be not easy to share
Expected behavior We are expecting the to get the items of table without errors, because we need for every item to extract some information about the rows , like text, statuses, .., this is not working: const items =await tab.getAggregation("items");
Logs/Console Output [wdi5] call of _getControl() failed because of: Error: waitAsync is already running and cannot be called again at this moment [wdi5] error retrieving control: columnListItemId-__clone2 [wdi5] _asControl() needed 7.740290999412537 for columnListItemId-__clone2
Screenshots
Runtime Env (please complete the following information): "@ui5/cli": "3.0.5", "@wdio/cli": "7.20.9", "@wdio/cucumber-framework": "7.20.8", "@wdio/devtools-service": "7.20.9", "@wdio/junit-reporter": "7.20.7", "@wdio/local-runner": "7.20.9", "@wdio/sauce-service": "7.20.9", "@wdio/spec-reporter": "7.20.8", "wdio-cucumber-reporter": "0.0.2", "wdio-cucumberjs-json-reporter": "4.4.3", "wdio-intercept-service": "4.2.2", "wdio-ui5-service": "^1.3.2", "wdi5": "^0.7.0",
Chrome Version 112.0.5615.49 (Official Build) (arm64)
node --version v16.19.1
MacOs:13.3.1 (22E261)
Additional context We are also using OPAE2E also,
services: ['devtools', 'ui5', 'intercept', [ParallelTestService, { rootDir: path.resolve(__dirname), backendPath: backendPath, dwcLocalConfigFile: './dwc-local-config.json', maxParallelInstances: maxParallelInstances, maxWaitForInstancesToStart: 200000, skipInstrument: skipInstrument, profile: 'default' }], [pipelineUtilities.wdioAnalysePR, { repositoryName: "CALMBuild/cdm-features-ui" }]],
wdio.config: .... wdi5: { screenshotPath: require("path").join("some", "dir", "for", "screenshots"), // [optional] {string}, default: "" screenshotsDisabled: false, // [optional] {boolean}, default: false; if set to true, screenshots won't be taken and not written to file system logLevel: "verbose", // [optional] error | verbose | silent, default: "error" skipInjectUI5OnStart: true, // [optional] {boolean}, default: false; true when UI5 is not on the start page, you need to later call.injectUI5() manually
waitForUI5Timeout: 15000 // [optional] {number}, default: 15000; maximum waiting time in milliseconds while checking for UI5 availability
},