+
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,41 @@ jobs:
with:
job-id: jdk-integration-tests-${{ matrix.os }}-${{ matrix.dist }}-${{ matrix.version }}

login-v1-tests:
name: Login Theme v1 tests
needs: build
timeout-minutes: 100
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- id: integration-test-setup
name: Integration test setup
uses: ./.github/actions/integration-test-setup

- name: Run base tests
run: |
TESTS=`testsuite/integration-arquillian/tests/base/testsuites/suite.sh login`
echo "Tests: $TESTS"
./mvnw test ${{ env.SUREFIRE_RETRY }} -Pauth-server-quarkus -Dtest=$TESTS -pl testsuite/integration-arquillian/tests/base 2>&1 | misc/log/trimmer.sh

- name: Upload JVM Heapdumps
if: always()
uses: ./.github/actions/upload-heapdumps

- uses: ./.github/actions/upload-flaky-tests
name: Upload flaky tests
env:
GH_TOKEN: ${{ github.token }}
with:
job-name: Java Distribution IT

- name: Surefire reports
if: always()
uses: ./.github/actions/archive-surefire-reports
with:
job-id: jdk-integration-tests-${{ matrix.os }}-${{ matrix.dist }}-${{ matrix.version }}

volatile-sessions-tests:
name: Volatile Sessions IT
needs: [build, conditional]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@

import org.keycloak.authentication.requiredactions.DeleteAccount;
import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;

import java.util.List;

import static org.keycloak.testsuite.util.UIUtils.clickLink;

public class DeleteAccountActionConfirmPage extends RequiredActions {

@FindBy(css = "button[name='cancel-aia']")
@FindBy(css = "[name='cancel-aia']")
WebElement cancelActionButton;

@FindBy(css = "button[type='submit']")
@FindBy(css = "[type='submit']")
WebElement confirmActionButton;

@Override
Expand All @@ -34,10 +37,6 @@ public void clickConfirmAction() {
clickLink(confirmActionButton);
}

public boolean isErrorMessageDisplayed() {
return driver.findElements(By.cssSelector(".pf-v5-c-alert")).size() == 1;
}

public String getErrorMessageText() {
return driver.findElement(By.cssSelector("#kc-content-wrapper > div > span.kc-feedback-text")).getText();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,16 @@ public String getText() {
}
}

public String getType() {
private String getType() {
try {
String cssClass = alertRoot.getAttribute("class");
Matcher classMatcher = ALERT_TYPE_CLASS_PATTERN.matcher(cssClass);
if (!classMatcher.find()) {
throw new RuntimeException("Failed to identify feedback message type");
classMatcher = Pattern.compile("alert-(.+)").matcher(cssClass);
if (!classMatcher.find())
throw new RuntimeException("Failed to identify feedback message type");

return classMatcher.group(1);
}
return classMatcher.group(1);
} catch (NoSuchElementException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class InstalledAppRedirectPage extends AbstractPage {
@FindBy(id = "kc-page-title")
private WebElement pageTitle;

@FindBy(className = "pf-v5-c-alert")
@FindBy(css = "div[class^='pf-v5-c-alert'], div[class^='alert-error']")
private WebElement errorBox;

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ public static void assertAttemptedUsernameAvailability(WebDriver driver, boolean
}

public String getAttemptedUsername() {
return attemptedUsernameLabel.getAttribute("value");
String text = attemptedUsernameLabel.getAttribute("value");
if (text == null) return attemptedUsernameLabel.getText();
return text;
}

public void clickResetLogin() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ public class LoginPage extends LanguageComboboxAwarePage {
@FindBy(id = "input-error-password")
private WebElement passwordInputError;

@FindBy(id = "input-error")
private WebElement inputError;

@FindBy(id = "rememberMe")
private WebElement rememberMe;

Expand Down Expand Up @@ -170,7 +173,11 @@ public String getInputError() {
try {
return getTextFromElement(passwordInputError);
} catch (NoSuchElementException e) {
return null;
try {
return getTextFromElement(inputError);
} catch (NoSuchElementException error) {
return null;
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ public class LoginPasswordResetPage extends LanguageComboboxAwarePage {
@FindBy(id = "input-error-username")
private WebElement usernameError;

@FindBy(css = "button[type=\"submit\"]")
@FindBy(css = "[type=\"submit\"]")
private WebElement submitButton;

@FindBy(className = "pf-v5-c-success")
@FindBy(css = "[class='pf-v5-c-success'], [class='alert-success']")
private WebElement emailSuccessMessage;

@FindBy(css = "div[class^='pf-v5-c-alert'], div[class^='alert-error']")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class LoginPasswordUpdatePage extends LogoutSessionsPage {
@FindBy(id = "password-confirm")
private WebElement passwordConfirmInput;

@FindBy(css = "button[type=\"submit\"]")
@FindBy(css = "[type=\"submit\"]")
private WebElement submitButton;

@FindBy(css = "div[class^='pf-v5-c-alert'], div[class^='alert-error']")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class LoginTotpPage extends LanguageComboboxAwarePage {
@FindBy(id = "password-token")
private WebElement passwordToken;

@FindBy(css = "button[type=\"submit\"]")
@FindBy(css = "[type=\"submit\"]")
private WebElement submitButton;

@FindBy(css = "div[class^='pf-v5-c-alert'], div[class^='alert-error']")
Expand All @@ -48,6 +48,9 @@ public class LoginTotpPage extends LanguageComboboxAwarePage {
@FindBy(id = "input-error-otp")
private WebElement totpInputCodeError;

@FindBy(id = "input-error-otp-code")
private WebElement otpInputCodeError;

public void login(String totp) {
otpInput.clear();
if (totp != null) otpInput.sendKeys(totp);
Expand All @@ -67,7 +70,11 @@ public String getInputError(){
try {
return UIUtils.getTextFromElement(totpInputCodeError);
} catch (NoSuchElementException e) {
return null;
try {
return UIUtils.getTextFromElement(otpInputCodeError);
} catch (NoSuchElementException ex) {
return null;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ public class LoginUpdateProfilePage extends AbstractPage {

@FindBy(name = "email")
private WebElement emailInput;

@FindBy(name = "department")
private WebElement departmentInput;

@FindBy(css = "input[type=\"submit\"]")
private WebElement submitButton;

@FindBy(name = "cancel-aia")
private WebElement cancelAIAButton;

Expand Down Expand Up @@ -96,7 +96,7 @@ public String getFirstName() {
public String getLastName() {
return lastNameInput.getAttribute("value");
}

public String getEmail() {
return emailInput.getAttribute("value");
}
Expand All @@ -116,9 +116,9 @@ public boolean isCurrent() {
public UpdateProfileErrors getInputErrors() {
return errorsPage;
}

public String getLabelForField(String fieldId) {
return driver.findElement(By.cssSelector("label[for="+fieldId+"]")).getText();
return driver.findElement(By.cssSelector("label[for="+fieldId+"]")).getText().replaceAll("\\s\\*$", "");
}

public WebElement getElementById(String fieldId) {
Expand All @@ -130,7 +130,7 @@ public WebElement getElementById(String fieldId) {
return null;
}
}

public boolean isDepartmentPresent() {
try {
isDepartmentEnabled();
Expand Down Expand Up @@ -268,7 +268,7 @@ public static class UpdateProfileErrors {

@FindBy(id = "input-error-lastname")
private WebElement inputErrorLastName;

@FindBy(id = "input-error-lastName")
private WebElement inputErrorLastNameDynamic;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ public class OAuthGrantPage extends LanguageComboboxAwarePage {
public static final String OFFLINE_ACCESS_CONSENT_TEXT = "Offline Access";
public static final String ROLES_CONSENT_TEXT = "User roles";

@FindBy(css = "button[name=\"accept\"]")
@FindBy(css = "[name=\"accept\"]")
private WebElement acceptButton;
@FindBy(css = "button[name=\"cancel\"]")
@FindBy(css = "[name=\"cancel\"]")
private WebElement cancelButton;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public String getInstruction() {
}

public String getLabelForField(String fieldId) {
return driver.findElement(By.cssSelector("label[for="+fieldId+"]")).getText();
return driver.findElement(By.cssSelector("label[for="+fieldId+"]")).getText().replaceAll("\\s\\*$", "");
}

public String getFirstName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class UpdateAccountInformationPage extends LanguageComboboxAwarePage {

@FindBy(name = "department")
private WebElement departmentInput;

@FindBy(css = "input[type=\"submit\"]")
private WebElement submitButton;

Expand All @@ -45,27 +45,27 @@ public void updateAccountInformation(String userName,

clickLink(submitButton);
}

public void updateAccountInformation(String userName,
String email,
String firstName,
String lastName,
String lastName,
String department) {
usernameInput.clear();
usernameInput.sendKeys(userName);

emailInput.clear();
emailInput.sendKeys(email);

firstNameInput.clear();
firstNameInput.sendKeys(firstName);

lastNameInput.clear();
lastNameInput.sendKeys(lastName);

departmentInput.clear();
departmentInput.sendKeys(department);

clickLink(submitButton);
}

Expand Down Expand Up @@ -99,11 +99,11 @@ public void updateAccountInformation(String firstName,
public boolean isCurrent() {
return PageUtils.getPageTitle(driver).equalsIgnoreCase("update account information");
}

public String getLabelForField(String fieldId) {
return driver.findElement(By.cssSelector("label[for="+fieldId+"]")).getText();
return driver.findElement(By.cssSelector("label[for="+fieldId+"]")).getText().replaceAll("\\s\\*$", "");
}

public boolean isDepartmentPresent() {
try {
return driver.findElement(By.name("department")).isDisplayed();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ public class VerifyProfilePage extends AbstractPage {

@FindBy(name = "email")
private WebElement emailInput;

@FindBy(name = "department")
private WebElement departmentInput;


@FindBy(css = "input[type=\"submit\"]")
private WebElement submitButton;
Expand All @@ -66,7 +66,7 @@ public void update(String firstName, String lastName) {

submitButton.click();
}

public void update(String firstName, String lastName, String department) {
departmentInput.clear();
if (department != null) {
Expand Down Expand Up @@ -103,9 +103,9 @@ public String getAlertError() {
return null;
}
}

public String getLabelForField(String fieldId) {
return driver.findElement(By.cssSelector("label[for="+fieldId+"]")).getText();
return driver.findElement(By.cssSelector("label[for="+fieldId+"]")).getText().replaceAll("\\s\\*$", "");
}

public String getFirstName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,11 @@ public void testDisplayName() {

//assert field names
// i18n replaced
Assert.assertEquals("First name *", updateProfilePage.getLabelForField("firstName"));
Assert.assertEquals("First name", updateProfilePage.getLabelForField("firstName"));
// attribute name used if no display name set
Assert.assertEquals("lastName", updateProfilePage.getLabelForField("lastName"));
// direct value in display name
Assert.assertEquals("Department *", updateProfilePage.getLabelForField("department"));
Assert.assertEquals("Department", updateProfilePage.getLabelForField("department"));

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.keycloak.testsuite.util.FlowUtil;
import org.keycloak.testsuite.util.UIUtils;
import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebElement;

import static org.junit.Assert.assertEquals;
Expand Down Expand Up @@ -120,7 +121,13 @@ protected void testDefaultIdpSetTriedAndReturnedError(String expectedErrorMessag

waitForPage(driver, "sign in to", true);

WebElement errorElement = driver.findElement(By.className("pf-v5-c-alert"));
WebElement errorElement;
try {
errorElement = driver.findElement(By.className("pf-v5-c-alert"));
} catch (NoSuchElementException e) {
errorElement = driver.findElement(By.className("alert-error"));
}

assertNotNull("Page should show an error message but it's missing", errorElement);

// Login to IDP failed due consent denied. Error message is displayed on the username/password screen of the consumer realm
Expand Down
Loading
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载