This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #180 from zanata/openid-tests
Clean up Page and Workflow concept for OpenID tests
- Loading branch information
Showing
16 changed files
with
562 additions
and
93 deletions.
There are no files selected for viewing
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
78 changes: 78 additions & 0 deletions
78
functional-test/src/main/java/org/zanata/page/account/EditProfilePage.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* | ||
* Copyright 2013, Red Hat, Inc. and individual contributors as indicated by the | ||
* @author tags. See the copyright.txt file in the distribution for a full | ||
* listing of individual contributors. | ||
* | ||
* This is free software; you can redistribute it and/or modify it under the | ||
* terms of the GNU Lesser General Public License as published by the Free | ||
* Software Foundation; either version 2.1 of the License, or (at your option) | ||
* any later version. | ||
* | ||
* This software is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more | ||
* details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this software; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF | ||
* site: http://www.fsf.org. | ||
*/ | ||
package org.zanata.page.account; | ||
|
||
import org.openqa.selenium.WebDriver; | ||
import org.openqa.selenium.WebElement; | ||
import org.openqa.selenium.support.FindBy; | ||
import org.zanata.page.BasePage; | ||
import org.zanata.page.utility.HomePage; | ||
|
||
/** | ||
* @author Damian Jansen <a href="mailto:djansen@redhat.com">djansen@redhat.com</a> | ||
*/ | ||
public class EditProfilePage extends BasePage | ||
{ | ||
@FindBy(id = "editProfileForm:nameField:name") | ||
private WebElement nameField; | ||
|
||
@FindBy(id = "editProfileForm:usernameField:username") | ||
private WebElement usernameField; | ||
|
||
@FindBy(id = "editProfileForm:emailField:email") | ||
private WebElement emailField; | ||
|
||
@FindBy(id = "editProfileForm:saveButton") | ||
private WebElement saveButton; | ||
|
||
@FindBy(id = "editProfileForm:cancelButton") | ||
private WebElement cancelButton; | ||
|
||
public EditProfilePage(WebDriver driver) | ||
{ | ||
super(driver); | ||
} | ||
|
||
public EditProfilePage enterName(String name) | ||
{ | ||
nameField.sendKeys(name); | ||
return new EditProfilePage(getDriver()); | ||
} | ||
|
||
public EditProfilePage enterUserName(String userName) | ||
{ | ||
usernameField.sendKeys(userName); | ||
return new EditProfilePage(getDriver()); | ||
} | ||
|
||
public EditProfilePage enterEmail(String email) | ||
{ | ||
emailField.sendKeys(email); | ||
return new EditProfilePage(getDriver()); | ||
} | ||
|
||
public HomePage clickSave() | ||
{ | ||
saveButton.click(); | ||
return new HomePage(getDriver()); | ||
} | ||
|
||
} |
71 changes: 71 additions & 0 deletions
71
functional-test/src/main/java/org/zanata/page/account/GoogleAccountPage.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
* Copyright 2013, Red Hat, Inc. and individual contributors as indicated by the | ||
* @author tags. See the copyright.txt file in the distribution for a full | ||
* listing of individual contributors. | ||
* | ||
* This is free software; you can redistribute it and/or modify it under the | ||
* terms of the GNU Lesser General Public License as published by the Free | ||
* Software Foundation; either version 2.1 of the License, or (at your option) | ||
* any later version. | ||
* | ||
* This software is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more | ||
* details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this software; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF | ||
* site: http://www.fsf.org. | ||
*/ | ||
package org.zanata.page.account; | ||
|
||
import org.openqa.selenium.WebDriver; | ||
import org.openqa.selenium.WebElement; | ||
import org.openqa.selenium.support.FindBy; | ||
import org.zanata.page.AbstractPage; | ||
|
||
/** | ||
* @author Damian Jansen <a href="mailto:djansen@redhat.com">djansen@redhat.com</a> | ||
*/ | ||
public class GoogleAccountPage extends AbstractPage | ||
{ | ||
@FindBy(id = "Email") | ||
private WebElement emailField; | ||
|
||
@FindBy(id = "Passwd") | ||
private WebElement passwordField; | ||
|
||
@FindBy(id = "signIn") | ||
private WebElement signInButton; | ||
|
||
public GoogleAccountPage(WebDriver driver) | ||
{ | ||
super(driver); | ||
} | ||
|
||
public GoogleAccountPage enterGoogleEmail(String email) | ||
{ | ||
emailField.sendKeys(email); | ||
return new GoogleAccountPage(getDriver()); | ||
} | ||
|
||
public GoogleAccountPage enterGooglePassword(String password) | ||
{ | ||
passwordField.sendKeys(password); | ||
return new GoogleAccountPage(getDriver()); | ||
} | ||
|
||
public EditProfilePage clickSignIn() | ||
{ | ||
signInButton.click(); | ||
|
||
// May return a Permissions request page, if this is the first run | ||
if(!getDriver().getTitle().contains("Edit Profile")) | ||
{ | ||
GooglePermissionsPage googlePermissionsPage = new GooglePermissionsPage(getDriver()); | ||
googlePermissionsPage.acceptPermissions(); | ||
} | ||
return new EditProfilePage(getDriver()); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
functional-test/src/main/java/org/zanata/page/account/GooglePermissionsPage.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package org.zanata.page.account; | ||
|
||
import org.openqa.selenium.By; | ||
import org.openqa.selenium.WebDriver; | ||
import org.openqa.selenium.WebElement; | ||
import org.openqa.selenium.support.FindBy; | ||
import org.zanata.page.AbstractPage; | ||
|
||
/** | ||
* @author Damian Jansen <a href="mailto:djansen@redhat.com">djansen@redhat.com</a> | ||
*/ | ||
public class GooglePermissionsPage extends AbstractPage | ||
{ | ||
public GooglePermissionsPage(WebDriver driver) | ||
{ | ||
super(driver); | ||
} | ||
|
||
public EditProfilePage acceptPermissions() | ||
{ | ||
getDriver().findElement(By.id("submit_approve_access")).click(); | ||
return new EditProfilePage(getDriver()); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
functional-test/src/main/java/org/zanata/page/account/OpenIDPage.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package org.zanata.page.account; | ||
|
||
import org.openqa.selenium.WebDriver; | ||
import org.openqa.selenium.WebElement; | ||
import org.openqa.selenium.support.FindBy; | ||
import org.zanata.page.BasePage; | ||
|
||
/** | ||
* @author Damian Jansen <a href="mailto:djansen@redhat.com">djansen@redhat.com</a> | ||
*/ | ||
public class OpenIDPage extends BasePage | ||
{ | ||
|
||
@FindBy(id="Email") | ||
private WebElement emailField; | ||
|
||
@FindBy(id="signIn") | ||
private WebElement signInButton; | ||
|
||
public OpenIDPage(WebDriver driver) | ||
{ | ||
super(driver); | ||
} | ||
|
||
public OpenIDPage enterEmail(String email) | ||
{ | ||
emailField.sendKeys(email); | ||
return new OpenIDPage(getDriver()); | ||
} | ||
|
||
public GoogleAccountPage clickSignIn() | ||
{ | ||
signInButton.click(); | ||
return new GoogleAccountPage(getDriver()); | ||
} | ||
|
||
} |
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
Oops, something went wrong.