Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Merge pull request #242 from zanata/google-weirdness-workaround
Browse files Browse the repository at this point in the history
Use the old Google site when necessary.
  • Loading branch information
seanf committed Oct 28, 2013
2 parents 4c5a67d + 64072cc commit e87b469
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
Expand Up @@ -79,4 +79,15 @@ public GoogleAccountPage removeSavedAuthentication() {
getDriver().findElement(By.linkText("Sign in with a different account")).click();
return new GoogleAccountPage(getDriver());
}

/**
* Query if the old google site login is presented to the user.
*
* The Google account profile image only shows on the new Google site, so
* if this element exists return false.
* @return true if the profile image is not shown.
*/
public boolean isTheOldGoogleSite() {
return getDriver().findElements(By.id("profile-img")).size() < 1;
}
}
Expand Up @@ -36,10 +36,15 @@ public HomePage registerGoogleOpenID(String name, String username,
.goToHome()
.clickSignInLink()
.selectGoogleOpenID();

// If Google has remembered us, skip entering the email
// If Google has remembered someone else, change the user
if (googleAccountPage.hasRememberedAuthentication()) {
/*
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();
}
Expand Down

0 comments on commit e87b469

Please sign in to comment.