ui5-uiveri5 icon indicating copy to clipboard operation
ui5-uiveri5 copied to clipboard

[Question] How do I wait for the busy indicator/dialog to finish before continuing on an action?

Open sammok83 opened this issue 3 years ago • 1 comments

My spec as below:

    it('Should save my Purchase Order', () => {
        Given.iStartTheApp();
        When.onTheChargebackPage.iSelectAnOrder();
        When.onTheChargebackPage.iPressTheGoButton();
        When.onTheChargebackPage.iSelectTheOrderInTable();
        When.onTheChargebackPage.iEnterAPurchaseOrder();
        When.onTheChargebackPage.iClickSave();
        // Then.onTheChargebackPage.iShouldSeeMyOrderSaved();
        // When.onTheChargebackPage.iRefreshTheBrowser();
        When.onTheChargebackPage.iSelectAnOrder();
        When.onTheChargebackPage.iPressTheGoButton();
        When.onTheChargebackPage.iSelectTheOrderInTable();
        Then.onTheChargebackPage.iShouldSeeMyPurchaseOrder(browser.testrunner.config.params.purchaseOrder);
    });

Upon clicking 'Save' - When.onTheChargebackPage.iClickSave(), there will be a bunch of promises executed and the screen will be locked with a Busy Dialog.

The intention is upon finishing save, i.e: BusyDialog closes, I will re-execute the same steps to verify that the Purchase Order has been saved. But I will need to wait for the promises to resolve first before re-executing the same steps as per above - after iRefreshTheBrowser. How do I do that?

sammok83 avatar Dec 11 '20 06:12 sammok83

Hi, some background - as you have observed uiveri5 waits automatically. And this magic happens by some instrumentation we load during page loading. When you do "browser refresh" you actually restart the WebApp, it is reinitialized but it also looses our instrumentation. You can inject it again, have a look here: https://github.com/SAP/ui5-uiveri5/blob/master/docs/usage/browser.md But my advice is to avoid such refreshes, it is like restaring your PC to see new mails. Just navigate to another view of the same app and come back and the app will request the data again. Even better, the app should have some refresh button so just press it.

maximnaidenov avatar Dec 11 '20 07:12 maximnaidenov