Skip to content

Interactions

Mahmoud Ali edited this page Mar 4, 2021 · 1 revision

Right now the only implemented interaction is the Tap gesture. If your View has a TapGestureRecognizer, you can trigger a Tap using the Renderer:

[Test]
public void TapShouldSetTheLabelTextToTrueWhenTappedTwice()
{
    var renderer = new Renderer<App>();
    var screen = renderer.Render<MainPage>();
    // Just to show that there is a Label representing if the user Tapped.
    Assert.NotNull(screen.GetByText<Label>("False"));

    // Tries to tap on the Button with text "Tappable Button" twice.
    renderer.Tap(screen.GetByText("Tappable Button"), 2);

    // The "Tappable Button" triggers a command that updates the other Label property
    Assert.NotNull(screen.GetByText<Label>("True"));
}
Clone this wiki locally