Search in sources :

Example 1 with AdministrationMessagesPage

use of org.olat.selenium.page.core.AdministrationMessagesPage in project OpenOLAT by OpenOLAT.

the class LoginTest method maintenanceMessage.

/**
 * An administrator set a maintenance message. A first user
 * logs in before and wait until the message appears. A second
 * user load the login page, check that the message is visible,
 * logs in and check that the message is visible too.
 *
 * @param loginPage
 * @param reiBrowser
 * @param kanuBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void maintenanceMessage(@InitialPage LoginPage loginPage, @Drone @Participant WebDriver reiBrowser, @Drone @Student WebDriver kanuBrowser) throws IOException, URISyntaxException {
    UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("Rei");
    UserVO kanu = new UserRestClient(deploymentUrl).createRandomUser("Kanu");
    // a first user log in
    LoginPage kanuLogin = LoginPage.getLoginPage(kanuBrowser, deploymentUrl).loginAs(kanu).resume();
    // administrator come in, and set a maintenance message
    loginPage.assertOnLoginPage().loginAs("administrator", "openolat").resume();
    String message = "Hello - " + UUID.randomUUID();
    AdministrationMessagesPage messagesPage = new NavigationPage(browser).openAdministration().selectInfoMessages().newMaintenanceMessage(message);
    // A new user see the login page
    LoginPage.getLoginPage(reiBrowser, deploymentUrl).waitOnMaintenanceMessage(message).loginAs(rei).resume().assertOnMaintenanceMessage(message);
    kanuLogin.waitOnMaintenanceMessage(message);
    // administrator remove the message
    messagesPage.clearMaintenanceMessage();
    // we wait it disappears
    kanuLogin.waitOnMaintenanceMessageCleared();
}
Also used : UserVO(org.olat.user.restapi.UserVO) NavigationPage(org.olat.selenium.page.NavigationPage) LoginPage(org.olat.selenium.page.LoginPage) AdministrationMessagesPage(org.olat.selenium.page.core.AdministrationMessagesPage) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 2 with AdministrationMessagesPage

use of org.olat.selenium.page.core.AdministrationMessagesPage in project openolat by klemens.

the class LoginTest method maintenanceMessage.

/**
 * An administrator set a maintenance message. A first user
 * logs in before and wait until the message appears. A second
 * user load the login page, check that the message is visible,
 * logs in and check that the message is visible too.
 *
 * @param loginPage
 * @param reiBrowser
 * @param kanuBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void maintenanceMessage(@InitialPage LoginPage loginPage, @Drone @Participant WebDriver reiBrowser, @Drone @Student WebDriver kanuBrowser) throws IOException, URISyntaxException {
    UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("Rei");
    UserVO kanu = new UserRestClient(deploymentUrl).createRandomUser("Kanu");
    // a first user log in
    LoginPage kanuLogin = LoginPage.getLoginPage(kanuBrowser, deploymentUrl).loginAs(kanu).resume();
    // administrator come in, and set a maintenance message
    loginPage.assertOnLoginPage().loginAs("administrator", "openolat").resume();
    String message = "Hello - " + UUID.randomUUID();
    AdministrationMessagesPage messagesPage = new NavigationPage(browser).openAdministration().selectInfoMessages().newMaintenanceMessage(message);
    // A new user see the login page
    LoginPage.getLoginPage(reiBrowser, deploymentUrl).waitOnMaintenanceMessage(message).loginAs(rei).resume().assertOnMaintenanceMessage(message);
    kanuLogin.waitOnMaintenanceMessage(message);
    // administrator remove the message
    messagesPage.clearMaintenanceMessage();
    // we wait it disappears
    kanuLogin.waitOnMaintenanceMessageCleared();
}
Also used : UserVO(org.olat.user.restapi.UserVO) NavigationPage(org.olat.selenium.page.NavigationPage) LoginPage(org.olat.selenium.page.LoginPage) AdministrationMessagesPage(org.olat.selenium.page.core.AdministrationMessagesPage) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Aggregations

RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)2 Test (org.junit.Test)2 LoginPage (org.olat.selenium.page.LoginPage)2 NavigationPage (org.olat.selenium.page.NavigationPage)2 AdministrationMessagesPage (org.olat.selenium.page.core.AdministrationMessagesPage)2 UserRestClient (org.olat.test.rest.UserRestClient)2 UserVO (org.olat.user.restapi.UserVO)2