Created
March 3, 2020 16:06
-
-
Save NickBaynham/7031108adeb78258fe0ed981fb0f42d2 to your computer and use it in GitHub Desktop.
A workflow that uses Page Objects with Auto Discovery that can be used in tests as modular components
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package selfHealingExamples.workflows; | |
import framework.pageObjects.RegistrationFormAutoDiscovery; | |
import io.nickbaynham.automation.selfhealing.BrowserNotAvailableException; | |
import io.nickbaynham.automation.selfhealing.controllers.ElementNotFoundException; | |
import org.openqa.selenium.WebDriver; | |
public class RegistrationDiscoveryWorkflow { | |
private WebDriver driver; | |
public RegistrationDiscoveryWorkflow(WebDriver driver) { | |
this.driver = driver; | |
} | |
public boolean completeRegistration( | |
String firstName, | |
String lastName, | |
String username, | |
String city, | |
String state, | |
String zip, | |
boolean acceptTerms | |
) throws BrowserNotAvailableException, ElementNotFoundException { | |
RegistrationFormAutoDiscovery registration = new RegistrationFormAutoDiscovery(driver); | |
registration.goToPage(); | |
registration.enterText("First Name", firstName); | |
registration.enterText("Last Name", lastName); | |
registration.enterText("Username", username); | |
registration.enterText("City", city); | |
registration.enterText("State", state); | |
registration.enterText("Zip", zip); | |
registration.clickCheckBox("Accept Terms"); | |
registration.clickButton("Register"); | |
return "Self Healing Test Page".equals(registration.getTitle()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment