Skip to content

Wait for button Visibility To matches #6

Description

@m0agh

Guys, I've added your tool to my test, I need my test waits and checks Visibility of 2 buttons then finishes the test.

In my test:

ConditionWatcher.waitForCondition(new BtnSendVerificationInstruction());
onView(withId(R.id.btnSendVerification)).perform(click());`

The Instruction:

public class BtnSendVerificationInstruction extends Instruction {
@Override
public String getDescription() {
    return "BtnSendVerification should be moved to center of activity";
}

@Override
public boolean checkCondition() {
    Activity activity = ((TestApplication)
            InstrumentationRegistry.getTargetContext().getApplicationContext()).getCurrentActivity();
    if (activity == null) return false;

    Button btnSendVerification = (Button) activity.findViewById(R.id.btnSendVerification);
    boolean isDisplayed = btnSendVerification.isShown();
    return btnSendVerification != null && isDisplayed;
}
}

Any idea?
Thanks

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions