*/
public class RegisterWorkFlow extends AbstractWebWorkFlow {
public HomePage registerGoogleOpenID(String name, String username,
String password, String email) {
GoogleAccountPage googleAccountPage = new BasicWorkFlow()
.goToHome()
.clickSignInLink()
.selectGoogleOpenID();
/*
There is the chance that Google presents the old page. It seems
to be random. Just enter the email in this case.
Otherwise, If Google has remembered us, skip entering the email.
If Google has remembered someone else, change the user.
*/
if (googleAccountPage.isTheOldGoogleSite()) {
googleAccountPage = googleAccountPage.enterGoogleEmail(email);
} else if (googleAccountPage.hasRememberedAuthentication()) {
if (!googleAccountPage.rememberedUser().equals(email)) {
googleAccountPage = googleAccountPage.removeSavedAuthentication();
}
} else {
googleAccountPage = googleAccountPage.enterGoogleEmail(email);
}
EditProfilePage editProfilePage = googleAccountPage
.enterGooglePassword(password)
.clickSignIn()
.acceptPermissions();
return editProfilePage.enterName(name).enterUserName(username)