How to perform the navigation to one of particular pages after the button/link click.
Simple sign in form which after ‘Sign In’ button click can navigate user to different pages. For example, to admin page or regular user profile page, depending on user account.
<div class="form-group">
<label for="email">Email</label>
<input type="email" class="form-control" id="email">
</div>
<div class="form-group">
<label for="password">Password</label>
<input type="password" class="form-control" id="password">
</div>
<button class="btn btn-primary">Sign In</button>
using Atata;
namespace SampleApp.UITests
{
using _ = SignInPage;
public class SignInPage : Page<_>
{
public TextInput<_> Email { get; private set; }
public PasswordInput<_> Password { get; private set; }
public Button<_> SignIn { get; private set; }
public UserProfilePage SignInAsUser()
{
return SignIn.ClickAndGo<UserProfilePage>();
}
public AdminPage SignInAsAdmin()
{
return SignIn.ClickAndGo<AdminPage>();
}
}
}
Go.To<SignInPage>()
.Email.Set("user@mail.com")
.Password.Set("abc123")
.SignInAsUser();
Go.To<SignInPage>()
.Email.Set("admin@mail.com")
.Password.Set("abc123")
.SignInAsAdmin();