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

Commit

Permalink
Stabilise the profile and login tests
Browse files Browse the repository at this point in the history
ProfileTest has not been part of the test suite. Repaired and added.
Minor changes to the Google OpenID functionality.
Move the credentials to a named property.
Create an 'unstable' suite, for tests that may fail for other reasons.
Move dash settings tabs into a package.
Remove some unused functions and pages.
Migrated to assertj for some tests.
  • Loading branch information
djansen-redhat committed Apr 29, 2014
1 parent 427f128 commit 624b7c7
Show file tree
Hide file tree
Showing 18 changed files with 339 additions and 304 deletions.
2 changes: 1 addition & 1 deletion functional-test/pom.xml
Expand Up @@ -53,7 +53,7 @@
<webdriver.display>:0</webdriver.display>
<webdriver.log>${project.build.directory}/webdriver.log</webdriver.log>
<webdriver.screenshot.dir>${project.build.directory}/screenshots</webdriver.screenshot.dir>

<googleopenid.credentials>zanata.user.1:</googleopenid.credentials>
<!-- on jenkins, this needs to be set to empty - so that cargo can shutdown. see http://stackoverflow.com/questions/1096642/tomcat-failed-to-shutdown -->
<cargo.debug.jvm.args>
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8787
Expand Down
12 changes: 5 additions & 7 deletions functional-test/src/main/java/org/zanata/page/BasePage.java
Expand Up @@ -30,10 +30,10 @@
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import org.zanata.page.account.MyAccountPage;
import org.zanata.page.account.RegisterPage;
import org.zanata.page.account.SignInPage;
import org.zanata.page.administration.AdministrationPage;
import org.zanata.page.dashboard.DashboardBasePage;
import org.zanata.page.glossary.GlossaryPage;
import org.zanata.page.groups.VersionGroupsPage;
import org.zanata.page.projects.ProjectVersionsPage;
Expand Down Expand Up @@ -74,19 +74,17 @@ public class BasePage extends CorePage {

private static final By BY_SIGN_IN = By.id("signin_link");
private static final By BY_SIGN_OUT = By.id("right_menu_sign_out_link");
private static final By BY_PROFILE_LINK = By.id("profile");
private static final By BY_DASHBOARD_LINK = By.id("dashboard");
private static final By BY_ADMINISTRATION_LINK = By.id("administration");

public BasePage(final WebDriver driver) {
super(driver);
}

public MyAccountPage goToMyProfile() {
public DashboardBasePage goToMyDashboard() {
userAvatar.click();

clickLinkAfterAnimation(BY_PROFILE_LINK);

return new MyAccountPage(getDriver());
clickLinkAfterAnimation(BY_DASHBOARD_LINK);
return new DashboardBasePage(getDriver());
}

public ProjectsPage goToProjects() {
Expand Down

This file was deleted.

Expand Up @@ -31,19 +31,19 @@
* href="mailto:djansen@redhat.com">djansen@redhat.com</a>
*/
public class EditProfilePage extends BasePage {
@FindBy(id = "editProfileForm:nameField:name")
@FindBy(id = "profile-form:nameField:name")
private WebElement nameField;

@FindBy(id = "editProfileForm:usernameField:username")
@FindBy(id = "profile-form:usernameField:username")
private WebElement usernameField;

@FindBy(id = "editProfileForm:emailField:email")
@FindBy(id = "profile-form:emailField:email")
private WebElement emailField;

@FindBy(id = "editProfileForm:saveButton")
@FindBy(id = "profile-form:user-create-new")
private WebElement saveButton;

@FindBy(id = "editProfileForm:cancelButton")
@FindBy(id = "profile-form:user-create-cancel")
private WebElement cancelButton;

public EditProfilePage(WebDriver driver) {
Expand All @@ -53,6 +53,7 @@ public EditProfilePage(WebDriver driver) {
public EditProfilePage enterName(String name) {
nameField.clear();
nameField.sendKeys(name);
defocus();
return new EditProfilePage(getDriver());
}

Expand All @@ -64,6 +65,7 @@ public EditProfilePage enterUserName(String userName) {
public EditProfilePage enterEmail(String email) {
emailField.clear();
emailField.sendKeys(email);
defocus();
return new EditProfilePage(getDriver());
}

Expand All @@ -72,18 +74,9 @@ public HomePage clickSave() {
return new HomePage(getDriver());
}

public MyAccountPage clickSaveChanges() {
saveButton.click();
return new MyAccountPage(getDriver());
}

public EditProfilePage clickSaveAndExpectErrors() {
saveButton.click();
return new EditProfilePage(getDriver());
}

public MyAccountPage clickCancel() {
cancelButton.click();
return new MyAccountPage(getDriver());
}
}
Expand Up @@ -23,14 +23,15 @@
import java.util.ArrayList;
import java.util.List;

import com.google.common.base.Predicate;
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.BasePage;
import org.zanata.page.projects.CreateProjectPage;

import com.google.common.base.Predicate;
import org.zanata.page.dashboard.dashboardsettings.DashboardAccountTab;
import org.zanata.page.dashboard.dashboardsettings.DashboardClientTab;
import org.zanata.page.dashboard.dashboardsettings.DashboardProfileTab;

public class DashboardBasePage extends BasePage {

Expand All @@ -43,6 +44,15 @@ public class DashboardBasePage extends BasePage {
@FindBy(id = "settings")
private WebElement settingsTab;

@FindBy(id = "account-tab")
private WebElement settingsAccountTab;

@FindBy(id = "profile-tab")
private WebElement settingsProfileTab;

@FindBy(id = "client-tab")
private WebElement settingsClientTab;

@FindBy(id = "activity-today")
private WebElement todaysActivityTab;

Expand All @@ -56,6 +66,11 @@ public DashboardBasePage(final WebDriver driver) {
super(driver);
}

public String getUserFullName() {
return getDriver().findElement(By.id("profile-overview"))
.findElement(By.tagName("h1")).getText();
}

public DashboardActivityTab gotoActivityTab() {
clickWhenTabEnabled(activityTab);
return new DashboardActivityTab(getDriver());
Expand All @@ -81,8 +96,38 @@ public DashboardProjectsTab gotoProjectsTab() {
return new DashboardProjectsTab(getDriver());
}

public DashboardSettingsTab gotoSettingsTab() {
settingsTab.click();
return new DashboardSettingsTab(getDriver());
public DashboardBasePage goToSettingsTab() {
clickWhenTabEnabled(settingsTab);
return new DashboardBasePage(getDriver());
}

public DashboardAccountTab gotoSettingsAccountTab() {
clickWhenTabEnabled(settingsAccountTab);
return new DashboardAccountTab(getDriver());
}

public DashboardProfileTab goToSettingsProfileTab() {
clickWhenTabEnabled(settingsProfileTab);
return new DashboardProfileTab(getDriver());
}

public DashboardClientTab goToSettingsClientTab() {
clickWhenTabEnabled(settingsClientTab);
return new DashboardClientTab(getDriver());
}

public void waitForLoaderFinished() {
slightPause();
waitForTenSec().until(new Predicate<WebDriver>() {
@Override
public boolean apply(WebDriver input) {
return !isLoaderVisible();
}
});
}

public boolean isLoaderVisible() {
return getDriver().findElement(By.className("loader__spinner"))
.isDisplayed();
}
}
Expand Up @@ -18,18 +18,17 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
* site: http://www.fsf.org.
*/
package org.zanata.page.dashboard;
package org.zanata.page.dashboard.dashboardsettings;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;

import com.google.common.base.Predicate;
import org.zanata.page.dashboard.DashboardBasePage;

/**
* @author Carlos Munoz <a href="mailto:camunoz@redhat.com">camunoz@redhat.com</a>
*/
public class DashboardSettingsTab extends DashboardBasePage {
public class DashboardAccountTab extends DashboardBasePage {

@FindBy(id = "email-update-form:emailField:email")
private WebElement emailField;
Expand All @@ -46,34 +45,34 @@ public class DashboardSettingsTab extends DashboardBasePage {
@FindBy(id = "passwordChangeForm:changePasswordButton")
private WebElement changePasswordButton;

public DashboardSettingsTab(WebDriver driver) {
public DashboardAccountTab(WebDriver driver) {
super(driver);
}

public DashboardSettingsTab typeNewAccountEmailAddress(String emailAddress) {
public DashboardAccountTab typeNewAccountEmailAddress(String emailAddress) {
emailField.clear();
emailField.sendKeys(emailAddress);
return this;
}

public DashboardSettingsTab clickUpdateEmailButton() {
public DashboardAccountTab clickUpdateEmailButton() {
updateEmailButton.click();
return this;
}

public DashboardSettingsTab typeOldPassword(String oldPassword) {
public DashboardAccountTab typeOldPassword(String oldPassword) {
oldPasswordField.clear();
oldPasswordField.sendKeys(oldPassword);
return this;
}

public DashboardSettingsTab typeNewPassword(String newPassword) {
public DashboardAccountTab typeNewPassword(String newPassword) {
newPasswordField.clear();
newPasswordField.sendKeys(newPassword);
return this;
}

public DashboardSettingsTab clickUpdatePasswordButton() {
public DashboardAccountTab clickUpdatePasswordButton() {
changePasswordButton.click();
return this;
}
Expand Down

0 comments on commit 624b7c7

Please sign in to comment.