Fix broken tests (KEYCLOAK-1857)
This commit is contained in:
parent
f7a8bbbcc8
commit
fe2278b320
6 changed files with 63 additions and 21 deletions
|
@ -6,7 +6,7 @@
|
|||
${msg("loginProfileTitle")}
|
||||
<#elseif section = "form">
|
||||
<form id="kc-update-profile-form" class="${properties.kcFormClass!}" action="${url.loginAction}" method="post">
|
||||
<#if !realm.editUsernameAllowed>
|
||||
<#if realm.editUsernameAllowed>
|
||||
<div class="${properties.kcFormGroupClass!} ${messagesPerField.printIfExists('username',properties.kcFormGroupErrorClass!)}">
|
||||
<div class="${properties.kcLabelWrapperClass!}">
|
||||
<label for="username" class="${properties.kcLabelClass!}">${msg("username")}</label>
|
||||
|
|
|
@ -33,11 +33,8 @@ import org.keycloak.models.UserModel.RequiredAction;
|
|||
import org.keycloak.services.managers.RealmManager;
|
||||
import org.keycloak.testsuite.AssertEvents;
|
||||
import org.keycloak.testsuite.OAuthClient;
|
||||
import org.keycloak.testsuite.pages.AppPage;
|
||||
import org.keycloak.testsuite.pages.*;
|
||||
import org.keycloak.testsuite.pages.AppPage.RequestType;
|
||||
import org.keycloak.testsuite.pages.LoginPage;
|
||||
import org.keycloak.testsuite.pages.LoginPasswordUpdatePage;
|
||||
import org.keycloak.testsuite.pages.LoginUpdateProfilePage;
|
||||
import org.keycloak.testsuite.rule.KeycloakRule;
|
||||
import org.keycloak.testsuite.rule.KeycloakRule.KeycloakSetup;
|
||||
import org.keycloak.testsuite.rule.WebResource;
|
||||
|
@ -83,7 +80,7 @@ public class RequiredActionMultipleActionsTest {
|
|||
protected LoginPasswordUpdatePage changePasswordPage;
|
||||
|
||||
@WebResource
|
||||
protected LoginUpdateProfilePage updateProfilePage;
|
||||
protected LoginUpdateProfileEditUsernameAllowedPage updateProfilePage;
|
||||
|
||||
@Test
|
||||
public void updateProfileAndPassword() throws Exception {
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.keycloak.testsuite.AssertEvents;
|
|||
import org.keycloak.testsuite.pages.AppPage;
|
||||
import org.keycloak.testsuite.pages.AppPage.RequestType;
|
||||
import org.keycloak.testsuite.pages.LoginPage;
|
||||
import org.keycloak.testsuite.pages.LoginUpdateProfilePage;
|
||||
import org.keycloak.testsuite.pages.LoginUpdateProfileEditUsernameAllowedPage;
|
||||
import org.keycloak.testsuite.rule.KeycloakRule;
|
||||
import org.keycloak.testsuite.rule.WebResource;
|
||||
import org.keycloak.testsuite.rule.WebRule;
|
||||
|
@ -62,7 +62,7 @@ public class RequiredActionUpdateProfileTest {
|
|||
protected LoginPage loginPage;
|
||||
|
||||
@WebResource
|
||||
protected LoginUpdateProfilePage updateProfilePage;
|
||||
protected LoginUpdateProfileEditUsernameAllowedPage updateProfilePage;
|
||||
|
||||
@Before
|
||||
public void before() {
|
||||
|
|
|
@ -451,7 +451,7 @@ public abstract class AbstractIdentityProviderTest {
|
|||
doAfterProviderAuthentication();
|
||||
|
||||
this.updateProfilePage.assertCurrent();
|
||||
this.updateProfilePage.update("Test", "User", "psilva@redhat.com", "psilva");
|
||||
this.updateProfilePage.update("Test", "User", "psilva@redhat.com");
|
||||
|
||||
WebElement element = this.driver.findElement(By.className("kc-feedback-text"));
|
||||
|
||||
|
@ -460,7 +460,7 @@ public abstract class AbstractIdentityProviderTest {
|
|||
assertEquals("Email already exists.", element.getText());
|
||||
|
||||
this.updateProfilePage.assertCurrent();
|
||||
this.updateProfilePage.update("Test", "User", "test-user@redhat.com", "test-user");
|
||||
this.updateProfilePage.update("Test", "User", "test-user@redhat.com");
|
||||
|
||||
assertTrue(this.driver.getCurrentUrl().startsWith("http://localhost:8081/test-app"));
|
||||
|
||||
|
@ -724,7 +724,7 @@ public abstract class AbstractIdentityProviderTest {
|
|||
|
||||
// update profile
|
||||
this.updateProfilePage.assertCurrent();
|
||||
this.updateProfilePage.update(userFirstName, userLastName, userEmail, username);
|
||||
this.updateProfilePage.update(userFirstName, userLastName, userEmail);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* JBoss, Home of Professional Open Source.
|
||||
* Copyright 2012, 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.keycloak.testsuite.pages;
|
||||
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
|
||||
*/
|
||||
public class LoginUpdateProfileEditUsernameAllowedPage extends LoginUpdateProfilePage {
|
||||
|
||||
@FindBy(id = "username")
|
||||
private WebElement usernameInput;
|
||||
|
||||
public void update(String firstName, String lastName, String email, String username) {
|
||||
usernameInput.clear();
|
||||
usernameInput.sendKeys(username);
|
||||
update(firstName, lastName, email);
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return usernameInput.getAttribute("value");
|
||||
}
|
||||
|
||||
public boolean isCurrent() {
|
||||
return driver.getTitle().equals("Update Account Information");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
}
|
|
@ -38,24 +38,19 @@ public class LoginUpdateProfilePage extends AbstractPage {
|
|||
@FindBy(id = "email")
|
||||
private WebElement emailInput;
|
||||
|
||||
@FindBy(id = "username")
|
||||
private WebElement usernameInput;
|
||||
|
||||
@FindBy(css = "input[type=\"submit\"]")
|
||||
private WebElement submitButton;
|
||||
|
||||
@FindBy(className = "feedback-error")
|
||||
private WebElement loginErrorMessage;
|
||||
|
||||
public void update(String firstName, String lastName, String email, String username) {
|
||||
public void update(String firstName, String lastName, String email) {
|
||||
firstNameInput.clear();
|
||||
firstNameInput.sendKeys(firstName);
|
||||
lastNameInput.clear();
|
||||
lastNameInput.sendKeys(lastName);
|
||||
emailInput.clear();
|
||||
emailInput.sendKeys(email);
|
||||
usernameInput.clear();
|
||||
usernameInput.sendKeys(username);
|
||||
submitButton.click();
|
||||
}
|
||||
|
||||
|
@ -75,10 +70,6 @@ public class LoginUpdateProfilePage extends AbstractPage {
|
|||
return emailInput.getAttribute("value");
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return usernameInput.getAttribute("value");
|
||||
}
|
||||
|
||||
public boolean isCurrent() {
|
||||
return driver.getTitle().equals("Update Account Information");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue