I am using Testng with Selenium with PageObject Model. In a java file, I have multiple @Test Methods -
@Test( groups={"regression"},description="used to navigate", priority=206)
public void navigateToRegister() {
loginFrameMethods = PageFactory.initElements(driver, LoginFrameObjects.class);
loginFrameMethods.clickAccountButton();
loginFrameMethods.verifyTextPresence();// Asserts are done here
loginFrameMethods.fillSignUpPhoneNumber("1234567890");
loginFrameMethods.clickSignupContinueButton();
loginFrameMethods.verifyResult(); // Asserts are done here
}
@Test(){
//Other Validations
// Asserts May be done here also at the @Test Level
}
Now I wonder what is good practice- to write Assertions in PageFactory Class( in this case LoginFrameMethods) as these methods can be reused in other test flows also or at the individual TestLevel.
If the answer is former, then how to Use SoftAssert as it will require all the PageFactory Classes to have access to same SoftAssert Object to call assertAll() Method.