Skip to content

Wait for button Visibility To matches #6

@m0agh

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

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