Skip to content
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

What is the best way to create custom wait for progress bar/loader on screen in screenplay #2662

Open
atulkumar94 opened this issue Jan 10, 2022 · 2 comments
Labels

Comments

@atulkumar94
Copy link

atulkumar94 commented Jan 10, 2022

I'm using below action to create custom wait for progress bar/loader to disappear but even when loader is disappeared, code still waits for 30s timeout. Can somebody please help?

public class WaitForSpinLoader implements Interaction {
        @Step("User waits for loader to disappear")
        @Override
        @Screenshots(disabled = true)
        public <T extends Actor> void performAs(T actor) {
            WebDriverWait wait = new WebDriverWait(BrowseTheWeb.as(actor).getDriver(),
                10);
            wait.until(new ExpectedCondition<Boolean>() {

                @Override
                public Boolean apply(WebDriver driver) {
                    if (CurrentVisibility.of(CommonPage.spinner).viewedBy(actor).asBoolean()) {
                        return false;
                    } else {
                        return true;
                    }
                }
            });
        }
}

In Serenity.properties I'm using webdriver.timeouts.implicitlywait = 30000.

Note: I'm using this approach as progress bar/loader appears randomly.

@atulkumar94
Copy link
Author

@wakaleo can you please let me know if anything is wrong with this action?

@Rangiferus
Copy link

Why not waiting for it in the standard way like this:

actor. attemptsTo(
   WaitUntil.the(CommonPage.spinner, isNotVisible()).forNoMoreThan(10).seconds())
);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants