forked from keycloak/keycloak
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[KEYCLOAK-4869] Integration tests for app-html5 are failing after upg…
…rade to 3.1.0.Final
- Loading branch information
Bruno Oliveira
committed
May 23, 2017
1 parent
8d40ee1
commit 7afdd98
Showing
4 changed files
with
250 additions
and
21 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
64 changes: 64 additions & 0 deletions
64
misc/keycloak-test-helper/src/main/java/org/keycloak/test/page/IndexPage.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,64 @@ | ||
/* | ||
* Copyright 2016 Red Hat, Inc. and/or its affiliates | ||
* and other contributors as indicated by the @author tags. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.keycloak.test.page; | ||
|
||
import org.openqa.selenium.WebElement; | ||
import org.openqa.selenium.support.FindBy; | ||
|
||
/** | ||
* @author <a href="mailto:bruno@abstractj.org">Bruno Oliveira</a> | ||
*/ | ||
public class IndexPage { | ||
|
||
public static final String UNAUTHORIZED = "401 Unauthorized"; | ||
|
||
@FindBy(name = "loginBtn") | ||
private WebElement loginButton; | ||
|
||
@FindBy(name = "logoutBtn") | ||
private WebElement logoutButton; | ||
|
||
@FindBy(name = "adminBtn") | ||
private WebElement adminButton; | ||
|
||
@FindBy(name = "publicBtn") | ||
private WebElement publicButton; | ||
|
||
@FindBy(name = "securedBtn") | ||
private WebElement securedBtn; | ||
|
||
public void clickLogin() { | ||
loginButton.click(); | ||
} | ||
|
||
public void clickLogout() { | ||
logoutButton.click(); | ||
} | ||
|
||
public void clickAdmin() { | ||
adminButton.click(); | ||
} | ||
|
||
public void clickPublic() { | ||
publicButton.click(); | ||
} | ||
|
||
public void clickSecured() { | ||
securedBtn.click(); | ||
} | ||
} |
87 changes: 87 additions & 0 deletions
87
misc/keycloak-test-helper/src/main/java/org/keycloak/test/page/LoginPage.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,87 @@ | ||
/* | ||
* Copyright 2016 Red Hat, Inc. and/or its affiliates | ||
* and other contributors as indicated by the @author tags. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.keycloak.test.page; | ||
|
||
import org.openqa.selenium.WebElement; | ||
import org.openqa.selenium.support.FindBy; | ||
|
||
/** | ||
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a> | ||
*/ | ||
public class LoginPage { | ||
|
||
@FindBy(id = "username") | ||
private WebElement usernameInput; | ||
|
||
@FindBy(id = "password") | ||
private WebElement passwordInput; | ||
|
||
@FindBy(id = "totp") | ||
private WebElement totp; | ||
|
||
@FindBy(id = "rememberMe") | ||
private WebElement rememberMe; | ||
|
||
@FindBy(name = "login") | ||
private WebElement submitButton; | ||
|
||
@FindBy(name = "cancel") | ||
private WebElement cancelButton; | ||
|
||
@FindBy(linkText = "Register") | ||
private WebElement registerLink; | ||
|
||
@FindBy(linkText = "Forgot Password?") | ||
private WebElement resetPasswordLink; | ||
|
||
@FindBy(linkText = "Username") | ||
private WebElement recoverUsernameLink; | ||
|
||
@FindBy(className = "alert-error") | ||
private WebElement loginErrorMessage; | ||
|
||
@FindBy(className = "alert-warning") | ||
private WebElement loginWarningMessage; | ||
|
||
@FindBy(className = "alert-success") | ||
private WebElement loginSuccessMessage; | ||
|
||
|
||
@FindBy(className = "alert-info") | ||
private WebElement loginInfoMessage; | ||
|
||
@FindBy(className = "instruction") | ||
private WebElement instruction; | ||
|
||
|
||
@FindBy(id = "kc-current-locale-link") | ||
private WebElement languageText; | ||
|
||
@FindBy(id = "kc-locale-dropdown") | ||
private WebElement localeDropdown; | ||
|
||
public void login(String username, String password) { | ||
usernameInput.clear(); | ||
usernameInput.sendKeys(username); | ||
|
||
passwordInput.clear(); | ||
passwordInput.sendKeys(password); | ||
|
||
submitButton.click(); | ||
} | ||
} |
71 changes: 71 additions & 0 deletions
71
misc/keycloak-test-helper/src/main/java/org/keycloak/test/page/ProfilePage.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 2016 Red Hat, Inc. and/or its affiliates | ||
* and other contributors as indicated by the @author tags. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.keycloak.test.page; | ||
|
||
import org.openqa.selenium.WebElement; | ||
import org.openqa.selenium.support.FindBy; | ||
|
||
/** | ||
* @author <a href="mailto:bruno@abstractj.org">Bruno Oliveira</a> | ||
*/ | ||
public class ProfilePage { | ||
|
||
@FindBy(name = "profileBtn") | ||
private WebElement profileButton; | ||
|
||
@FindBy(name = "tokenBtn") | ||
private WebElement tokenButton; | ||
|
||
@FindBy(name = "logoutBtn") | ||
private WebElement logoutButton; | ||
|
||
@FindBy(name = "accountBtn") | ||
private WebElement accountButton; | ||
|
||
@FindBy(id = "token-content") | ||
private WebElement tokenContent; | ||
|
||
@FindBy(id = "username") | ||
private WebElement username; | ||
|
||
public String getUsername() { | ||
return username.getText(); | ||
} | ||
|
||
public void clickProfile() { | ||
profileButton.click(); | ||
} | ||
|
||
public void clickToken() { | ||
tokenButton.click(); | ||
} | ||
|
||
public void clickLogout() { | ||
logoutButton.click(); | ||
} | ||
|
||
public void clickAccount() { | ||
accountButton.click(); | ||
} | ||
|
||
public String getTokenContent() throws Exception { | ||
return tokenContent.getText(); | ||
} | ||
|
||
} | ||
|