0

Environment:

AutomationName : UIAutomator2

Appium: 1.22.3

Appium Java-client : 8.2.0

Scenario: Registration screen, once all the data provided and submit -> loader displayed. If everything is proper, then next screen displayed else stays on registration screen.

Registration.java

public void enterRegistrationCardDetails(String strCreditCardNumber, String strExpDate, String strDateOfBirth) {
        enterCreditCardNumberToRegister(strCreditCardNumber);
        selectRegistrationCardExpiryDate(strExpDate);
        selectRegistrationDateOfBirth(strDateOfBirth);
        clickOnBtnRegisterForRegistration();
        new Loader().waitForLoaderToComplete(); // Case 1: When an incorrect data provided, then screen remain on registration screen, This case is working perfectly.
                                                // Case 2: When correct data provided, navigated to next screen, but here keeps waiting for 60 seconds for invisible. 
}

Loader.java

public boolean isLoaderDisplayed() {
    try {
        _mobileElementsProgressBar.isDisplayed();
        return true;
    } catch (NoSuchElementException | StaleElementReferenceException e) {
        return false;
    }
}

public void waitForLoaderToComplete() {
    if (isLoaderDisplayed()) {
        System.out.println("LOADING DISPLAYED");
        boolean isLoaderBarDisappear = new WebDriverWait(getBaseMobileDriver(), Duration.ofSeconds(60)).until(ExpectedConditions.invisibilityOf(_mobileElementsProgressBar));
        System.out.println("LOADING COMPLETED " + isLoaderBarDisappear);
    }
}
DeepakVerma
  • 179
  • 1
  • 3
  • 14

0 Answers0