Skip to content
Snippets Groups Projects
Commit af1fcdc4 authored by anttil's avatar anttil
Browse files

SWE-2 / SP-263: RoleAssignmentBrowserTest + CI related changes.

SVN: 26523
parent 4e994974
No related branches found
No related tags found
No related merge requests found
Showing with 133 additions and 13 deletions
......@@ -51,6 +51,7 @@ public class TopMenu extends LayoutContainer
{
ADMINISTRATION_MENU_MANAGE_GROUPS,
ADMINISTRATION_MENU_MANAGE_TYPES,
ADMINISTRATION_MENU_MANAGE_AUTHORIZATION,
AUTHORIZATION_MENU_USERS, AUTHORIZATION_MENU_ROLES,
AUTHORIZATION_MENU_AUTHORIZATION_GROUPS,
......
......@@ -36,6 +36,7 @@ public class AuthorizationMenu extends MenuItem
public AuthorizationMenu(IMessageProvider messageProvider, ComponentProvider componentProvider)
{
super(messageProvider.getMessage(Dict.MENU_AUTHORIZATION));
setId(TopMenu.ActionMenuKind.ADMINISTRATION_MENU_MANAGE_AUTHORIZATION.toString());
Menu menu = new Menu();
menu.add(new ActionMenu(TopMenu.ActionMenuKind.AUTHORIZATION_MENU_USERS, messageProvider,
......
......@@ -9,6 +9,7 @@ import ch.systemsx.cisd.openbis.uitest.infra.User;
import ch.systemsx.cisd.openbis.uitest.page.HomePage;
import ch.systemsx.cisd.openbis.uitest.page.InvalidPasswordDialog;
import ch.systemsx.cisd.openbis.uitest.page.LoginPage;
import ch.systemsx.cisd.openbis.uitest.page.RoleAssignmentBrowser;
@Test(groups =
{ "no-login" })
......@@ -25,7 +26,7 @@ public class AuthorizationTest extends SeleniumTest
@Test
public void loginFailsWithValidUserNameAndInvalidPassword() throws Exception
{
openbis.login(User.ADMIN.getName(), "invalid");
openbis.login(User.ADMIN.getName() + "begfga", "invalid");
get(InvalidPasswordDialog.class).dismiss();
}
......@@ -39,4 +40,14 @@ public class AuthorizationTest extends SeleniumTest
assertThat(browser(), isShowing(LoginPage.class));
}
@Test
public void adminCanOpenRoleAssignmentBrowser() throws Exception
{
openbis.login(User.ADMIN);
openbis.browseToRoleAssignmentBrowser();
assertThat(browser(), isShowing(RoleAssignmentBrowser.class));
openbis.logout();
}
}
......@@ -21,6 +21,7 @@ import ch.systemsx.cisd.openbis.uitest.page.AddSpaceDialog;
import ch.systemsx.cisd.openbis.uitest.page.EditSampleTypeDialog;
import ch.systemsx.cisd.openbis.uitest.page.LoginPage;
import ch.systemsx.cisd.openbis.uitest.page.PrivatePage;
import ch.systemsx.cisd.openbis.uitest.page.RoleAssignmentBrowser;
import ch.systemsx.cisd.openbis.uitest.page.SampleBrowser;
import ch.systemsx.cisd.openbis.uitest.page.SampleTypeBrowser;
import ch.systemsx.cisd.openbis.uitest.page.SpaceBrowser;
......@@ -102,6 +103,11 @@ public class ApplicationRunner
return getMenus().browse().samples();
}
public RoleAssignmentBrowser browseToRoleAssignmentBrowser()
{
return getMenus().admin().authorization().roles();
}
public void closeAllTabs()
{
getMenus().closeTabs();
......
......@@ -29,7 +29,6 @@ import java.util.concurrent.TimeUnit;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher;
import org.openqa.selenium.NoAlertPresentException;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
......@@ -56,7 +55,7 @@ public abstract class SeleniumTest
protected ApplicationRunner openbis;
@BeforeSuite
// @BeforeSuite
public void initWebDriver()
{
System.setProperty("webdriver.firefox.bin",
......@@ -69,17 +68,19 @@ public abstract class SeleniumTest
delete(new File("targets/dist"));
driver.manage().deleteAllCookies();
driver.get("https://sprint-openbis.ethz.ch/openbis/");
// driver.get("http://127.0.0.1:8888/ch.systemsx.cisd.openbis.OpenBIS/index.html?gwt.codesvr=127.0.0.1:9997");
driver.get("http://127.0.0.1:8888/ch.systemsx.cisd.openbis.OpenBIS/index.html?gwt.codesvr=127.0.0.1:9997");
}
try
{
driver.switchTo().alert().accept();
} catch (NoAlertPresentException e)
{
}
this.loginAsAdmin();
this.logout();
@BeforeSuite
public void initWebDriverForCi()
{
driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
delete(new File("targets/dist"));
driver.manage().deleteAllCookies();
driver.get("https://sprint-openbis.ethz.ch/openbis/");
}
@AfterSuite
......
......@@ -34,6 +34,9 @@ public class AdminMenu extends PrivatePage
@FindBy(id = "openbis_top-menu_SAMPLE_MENU_TYPES")
private WebElement sampleTypes;
@FindBy(id = "ADMINISTRATION_MENU_MANAGE_AUTHORIZATION")
private WebElement authorization;
public SpaceBrowser spaces()
{
spaces.click();
......@@ -52,4 +55,11 @@ public class AdminMenu extends PrivatePage
sampleTypes.click();
return get(SampleTypeBrowser.class);
}
public AuthorizationMenu authorization()
{
Actions builder = new Actions(SeleniumTest.driver);
builder.moveToElement(authorization).build().perform();
return get(AuthorizationMenu.class);
}
}
/*
* Copyright 2012 ETH Zuerich, CISD
*
* 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 ch.systemsx.cisd.openbis.uitest.page;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
public class AuthorizationMenu extends PrivatePage
{
@FindBy(id = "openbis_top-menu_AUTHORIZATION_MENU_ROLES")
private WebElement roles;
public RoleAssignmentBrowser roles()
{
roles.click();
return get(RoleAssignmentBrowser.class);
}
}
/*
* Copyright 2012 ETH Zuerich, CISD
*
* 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 ch.systemsx.cisd.openbis.uitest.page;
import java.util.List;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
public class RoleAssignmentBrowser extends BrowserPage
{
@FindBy(id = "openbis_role-browser_assign-button")
private WebElement assignRoleButton;
/*
@FindBys(
{
@FindBy(id = "openbis_sample-type-browser-grid"),
@FindBy(xpath = "//*[contains(@class, \"x-grid\") and contains(@class, \"-header \")]") })
*/
private List<WebElement> columns;
/*
@FindBys(
{
@FindBy(id = "openbis_sample-type-browser-grid"),
@FindBy(xpath = "//*[contains(@class, \"x-grid\") and contains(@class, \"-col \")]") })
*/
private List<WebElement> data;
@Override
protected List<WebElement> getColumns()
{
return this.columns;
}
@Override
protected List<WebElement> getData()
{
return this.data;
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment