I think I already get the gist of the PageObject pattern but there are some parts of it that I didn't get.
So I was following this tutorial and now I have this Page class:
public class SignUpPage extends AbstractPage {
AndroidDriver<MobileElement> driver;
public SignUpPage(AndroidDriver<MobileElement> driver) {
super(driver);
}
public void signUpAllFieldsEmpty() {
signup_button.click();
}
public void signUpOnlyFirstName() {
first_name_edittext.sendKeys("First name");
hideKeyboard();
signup_button.click();
}
@AndroidFindBy(id="signup_button")
private MobileElement signup_button;
@AndroidFindBy(id="first_name_edittext")
private MobileElement first_name_edittext;
@AndroidFindBy(id="last_name_edittext")
private MobileElement last_name_edittext;
@AndroidFindBy(id="signup_email_edittext")
private MobileElement signup_email_edittext;
@AndroidFindBy(id="signup_password_edittext")
private MobileElement signup_password_edittext;
@AndroidFindBy(id="confirm_password_edittext")
private MobileElement confirm_password_edittext;
}
Then I have this Test class:
public class Test_001_SignUp extends AbstractTest {
public Test_001_SignUp() {}
@Test
public void signUp_allFieldsEmpty() {
app.landingPage().goToSignUpPage();
app.signUpPage().signUpAllFieldsEmpty();
}
@Test
public void signUp_onlyFirstName() {
app.signUpPage().signUpOnlyFirstName();
}
}
I am not sure if I am doing it right because it looks like the method in the test class becomes redundant if I create another @Test method that will be relevant to the test.
How could I improve this? Or am I doing something wrong with this test?
Aucun commentaire:
Enregistrer un commentaire