KEYCLOAK-14004 fixed the test
This commit is contained in:
parent
8876294a72
commit
b19b3a40ad
3 changed files with 19 additions and 10 deletions
|
@ -32,9 +32,14 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import static java.util.Collections.singletonList;
|
||||
import static org.hamcrest.core.StringEndsWith.endsWith;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.keycloak.representations.idm.CredentialRepresentation.PASSWORD;
|
||||
import static org.keycloak.testsuite.auth.page.AuthRealm.TEST;
|
||||
import static org.keycloak.testsuite.util.WaitUtils.pause;
|
||||
import static org.keycloak.testsuite.util.WaitUtils.waitForModalFadeIn;
|
||||
import static org.keycloak.testsuite.util.WaitUtils.waitForModalFadeOut;
|
||||
|
||||
public class MyResourcesTest extends AbstractAccountTest {
|
||||
private static final String[] userNames = new String[]{"alice", "jdoe"};
|
||||
|
@ -136,11 +141,14 @@ public class MyResourcesTest extends AbstractAccountTest {
|
|||
|
||||
final int row = 2;
|
||||
myResourcesPage.clickExpandButton(row);
|
||||
pause(2000);
|
||||
|
||||
assertEquals("Resource is shared with alice.", myResourcesPage.getSharedWith(row));
|
||||
|
||||
myResourcesPage.clickEditButton(row);
|
||||
waitForModalFadeIn();
|
||||
myResourcesPage.removeAllPermissions();
|
||||
waitForModalFadeOut();
|
||||
|
||||
assertEquals("This resource is not shared.", myResourcesPage.getSharedWith(row));
|
||||
}
|
||||
|
@ -153,13 +161,16 @@ public class MyResourcesTest extends AbstractAccountTest {
|
|||
|
||||
final int row = 3;
|
||||
myResourcesPage.clickExpandButton(row);
|
||||
pause(2000);
|
||||
|
||||
assertEquals("Resource is shared with jdoe.", myResourcesPage.getSharedWith(row));
|
||||
|
||||
myResourcesPage.clickShareButton(row);
|
||||
waitForModalFadeIn();
|
||||
myResourcesPage.createShare("alice");
|
||||
waitForModalFadeOut();
|
||||
|
||||
assertEquals("Resource is shared with alice and 1 other users.", myResourcesPage.getSharedWith(row));
|
||||
assertThat(myResourcesPage.getSharedWith(row), endsWith("and 1 other users."));
|
||||
}
|
||||
|
||||
private AuthzClient createAuthzClient(ClientRepresentation client) {
|
||||
|
|
|
@ -30,19 +30,17 @@ public class MyResourcesPage extends AbstractLoggedInPage {
|
|||
}
|
||||
|
||||
public void clickShareButton(int row) {
|
||||
//first row is the header
|
||||
final WebElement webElement = resourcesList.get(row + 1);
|
||||
final WebElement webElement = driver.findElement(By.id("ex-expand" + row));
|
||||
|
||||
//first button is the toggle second is share
|
||||
webElement.findElements(By.tagName("button")).get(1).click();
|
||||
//first button is share
|
||||
webElement.findElements(By.tagName("button")).get(0).click();
|
||||
}
|
||||
|
||||
public void clickEditButton(int row) {
|
||||
//first row is the header
|
||||
final WebElement webElement = resourcesList.get(row + 1);
|
||||
final WebElement webElement = driver.findElement(By.id("ex-expand" + row));
|
||||
|
||||
//first button is the toggle second is share 3rd is the edit button
|
||||
webElement.findElements(By.tagName("button")).get(2).click();
|
||||
//first button share 2rd is the edit button
|
||||
webElement.findElements(By.tagName("button")).get(1).click();
|
||||
}
|
||||
|
||||
public void createShare(String userName) {
|
||||
|
|
|
@ -37,7 +37,7 @@ nextPage=Next
|
|||
previousPage=Previous
|
||||
firstPage=First Page
|
||||
resourceSharedWith=Resource is shared with {0}
|
||||
and= and {0} other users
|
||||
and=\ and {0} other users
|
||||
add=Add
|
||||
shareSuccess=Resource successfully shared.
|
||||
resourceAlreadyShared=Resource is already shared with this user.
|
||||
|
|
Loading…
Reference in a new issue