KEYCLOAK-8644 Fix and stabilize Admin Console UI Tests
This commit is contained in:
parent
4d2300f17e
commit
6bf91a3956
3 changed files with 22 additions and 19 deletions
|
@ -29,8 +29,10 @@ import java.util.LinkedHashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.keycloak.testsuite.util.UIUtils.clickLink;
|
||||
import static org.keycloak.testsuite.util.UIUtils.getTextFromElement;
|
||||
import static org.keycloak.testsuite.util.WaitUtils.waitUntilElement;
|
||||
import static org.openqa.selenium.By.xpath;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -84,25 +86,25 @@ public class FlowsTable {
|
|||
}
|
||||
|
||||
public void clickLevelUpButton(String rowLabel) {
|
||||
getRowByLabelText(rowLabel).findElement(By.xpath(".//button[@data-ng-click='raisePriority(execution)']")).click();
|
||||
clickLink(getRowByLabelText(rowLabel).findElement(By.xpath(".//button[@data-ng-click='raisePriority(execution)']")));
|
||||
}
|
||||
|
||||
public void clickLevelDownButton(String rowLabel) {
|
||||
getRowByLabelText(rowLabel).findElement(By.xpath(".//button[@data-ng-click='lowerPriority(execution)']")).click();
|
||||
clickLink(getRowByLabelText(rowLabel).findElement(xpath(".//button[@data-ng-click='lowerPriority(execution)']")));
|
||||
}
|
||||
|
||||
public void changeRequirement(String rowLabel, RequirementOption option) {
|
||||
getRowByLabelText(rowLabel).findElement(By.xpath(".//input[@value = '" + option + "']")).click();
|
||||
clickLink(getRowByLabelText(rowLabel).findElement(xpath(".//input[@value = '" + option + "']")));
|
||||
}
|
||||
|
||||
public void performAction(String rowLabel, Action action) {
|
||||
|
||||
getRowByLabelText(rowLabel).findElement(
|
||||
By.xpath(".//div[@class = 'dropdown']/a[@class='dropdown-toggle ng-binding']")).click();
|
||||
clickLink(getRowByLabelText(rowLabel).findElement(
|
||||
xpath(".//div[@class = 'dropdown']/a[@class='dropdown-toggle ng-binding']")));
|
||||
WebElement currentAction = getRowByLabelText(rowLabel).findElement(
|
||||
By.xpath("//div[@class = 'dropdown open']/ul[@class = 'dropdown-menu']/li/" +
|
||||
"a[@class='ng-binding' and text()='" + action.getName() + "']"));
|
||||
currentAction.click();
|
||||
xpath("//div[@class = 'dropdown open']/ul[@class = 'dropdown-menu']/li/" +
|
||||
"a[@class='ng-binding' and text()='" + action.getName() + "']"));
|
||||
clickLink(currentAction);
|
||||
}
|
||||
|
||||
// Returns all aliases of flows (first "Auth Type" column in table) including the names of execution flows
|
||||
|
|
|
@ -77,22 +77,22 @@ public class ClientClientScopesTest extends AbstractClientTest {
|
|||
|
||||
// Test the initial state
|
||||
Assert.assertNames(setupForm.getAvailableDefaultClientScopes());
|
||||
Assert.assertNames(setupForm.getDefaultClientScopes(), "email", "profile");
|
||||
Assert.assertNames(setupForm.getDefaultClientScopes(), "email", "profile", "roles", "web-origins");
|
||||
Assert.assertNames(setupForm.getAvailableOptionalClientScopes());
|
||||
Assert.assertNames(setupForm.getOptionalClientScopes(), "address", "phone", "offline_access");
|
||||
|
||||
// Remove 'profile' as default client scope and assert
|
||||
setupForm.setDefaultClientScopes(Collections.singletonList("email"));
|
||||
Assert.assertNames(setupForm.getAvailableDefaultClientScopes(), "profile");
|
||||
Assert.assertNames(setupForm.getAvailableDefaultClientScopes(), "profile", "roles", "web-origins");
|
||||
Assert.assertNames(setupForm.getDefaultClientScopes(), "email");
|
||||
Assert.assertNames(setupForm.getAvailableOptionalClientScopes(), "profile");
|
||||
Assert.assertNames(setupForm.getAvailableOptionalClientScopes(), "profile", "roles", "web-origins");
|
||||
Assert.assertNames(setupForm.getOptionalClientScopes(), "address", "phone", "offline_access");
|
||||
|
||||
// Add 'profile' as optional client scope and assert
|
||||
setupForm.setOptionalClientScopes(Arrays.asList("profile", "address", "phone", "offline_access"));
|
||||
Assert.assertNames(setupForm.getAvailableDefaultClientScopes());
|
||||
Assert.assertNames(setupForm.getAvailableDefaultClientScopes(), "roles", "web-origins");
|
||||
Assert.assertNames(setupForm.getDefaultClientScopes(), "email");
|
||||
Assert.assertNames(setupForm.getAvailableOptionalClientScopes());
|
||||
Assert.assertNames(setupForm.getAvailableOptionalClientScopes(), "roles", "web-origins");
|
||||
Assert.assertNames(setupForm.getOptionalClientScopes(), "profile", "address", "phone", "offline_access");
|
||||
|
||||
// Retrieve client through adminClient
|
||||
|
@ -103,12 +103,12 @@ public class ClientClientScopesTest extends AbstractClientTest {
|
|||
|
||||
// Revert and check things successfully reverted
|
||||
setupForm.setOptionalClientScopes(Arrays.asList("address", "phone", "offline_access"));
|
||||
Assert.assertNames(setupForm.getAvailableDefaultClientScopes(), "profile");
|
||||
Assert.assertNames(setupForm.getAvailableDefaultClientScopes(), "profile", "roles", "web-origins");
|
||||
setupForm.setDefaultClientScopes(Arrays.asList("profile", "email"));
|
||||
|
||||
Assert.assertNames(setupForm.getAvailableDefaultClientScopes());
|
||||
Assert.assertNames(setupForm.getAvailableDefaultClientScopes(), "roles", "web-origins");
|
||||
Assert.assertNames(setupForm.getDefaultClientScopes(), "email", "profile");
|
||||
Assert.assertNames(setupForm.getAvailableOptionalClientScopes());
|
||||
Assert.assertNames(setupForm.getAvailableOptionalClientScopes(), "roles", "web-origins");
|
||||
Assert.assertNames(setupForm.getOptionalClientScopes(), "address", "phone", "offline_access");
|
||||
}
|
||||
|
||||
|
@ -123,19 +123,19 @@ public class ClientClientScopesTest extends AbstractClientTest {
|
|||
// Check the defaults
|
||||
Assert.assertNames(evaluateForm.getAvailableClientScopes(), "address", "phone", "offline_access");
|
||||
Assert.assertNames(evaluateForm.getAssignedClientScopes());
|
||||
Assert.assertNames(evaluateForm.getEffectiveClientScopes(), "profile", "email");
|
||||
Assert.assertNames(evaluateForm.getEffectiveClientScopes(), "profile", "email", "roles", "web-origins");
|
||||
|
||||
// Add some optional scopes to the evaluation
|
||||
evaluateForm.setAssignedClientScopes(Arrays.asList("address", "phone"));
|
||||
Assert.assertNames(evaluateForm.getAvailableClientScopes(), "offline_access");
|
||||
Assert.assertNames(evaluateForm.getAssignedClientScopes(), "address", "phone");
|
||||
Assert.assertNames(evaluateForm.getEffectiveClientScopes(), "address", "phone", "profile", "email");
|
||||
Assert.assertNames(evaluateForm.getEffectiveClientScopes(), "address", "phone", "profile", "email", "roles", "web-origins");
|
||||
|
||||
// Remove optional 'phone' scope from the evaluation
|
||||
evaluateForm.setAssignedClientScopes(Arrays.asList("address", "offline_access"));
|
||||
Assert.assertNames(evaluateForm.getAvailableClientScopes(), "phone");
|
||||
Assert.assertNames(evaluateForm.getAssignedClientScopes(), "address", "offline_access");
|
||||
Assert.assertNames(evaluateForm.getEffectiveClientScopes(), "address", "offline_access", "profile", "email");
|
||||
Assert.assertNames(evaluateForm.getEffectiveClientScopes(), "address", "offline_access", "profile", "email", "roles", "web-origins");
|
||||
|
||||
// Select some user
|
||||
evaluateForm.selectUser("test");
|
||||
|
|
|
@ -67,6 +67,7 @@ public class AdminEventsTest extends AbstractConsoleTest {
|
|||
realm.setAdminEventsDetailsEnabled(true);
|
||||
|
||||
testRealmResource().update(realm);
|
||||
testRealmResource().clearAdminEvents();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in a new issue