Search in sources :

Example 61 with UserToolsPage

use of org.olat.selenium.page.user.UserToolsPage in project openolat by klemens.

the class UserTest method userChangeItsPassword.

/**
 * Change the password, log out and try to log in again
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void userChangeItsPassword(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
    UserVO user = new UserRestClient(deploymentUrl).createRandomUser();
    loginPage.loginAs(user.getLogin(), user.getPassword()).resume();
    UserToolsPage userTools = new UserToolsPage(browser);
    userTools.openUserToolsMenu().openPassword();
    String newPassword = UUID.randomUUID().toString();
    UserPasswordPage password = UserPasswordPage.getUserPasswordPage(browser);
    password.setNewPassword(user.getPassword(), newPassword);
    userTools.logout();
    loginPage.loginAs(user.getLogin(), newPassword).resume().assertLoggedIn(user);
}
Also used : UserToolsPage(org.olat.selenium.page.user.UserToolsPage) UserVO(org.olat.user.restapi.UserVO) UserPasswordPage(org.olat.selenium.page.user.UserPasswordPage) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 62 with UserToolsPage

use of org.olat.selenium.page.user.UserToolsPage in project openolat by klemens.

the class UserTest method resumeDisabled.

/**
 * Disable the resume function and check that the resume
 * popup don't stay in our way after login.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void resumeDisabled(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
    UserVO user = new UserRestClient(deploymentUrl).createRandomUser();
    loginPage.loginAs(user.getLogin(), user.getPassword()).resume();
    // set the preferences to resume automatically
    UserToolsPage userTools = new UserToolsPage(browser);
    userTools.openUserToolsMenu().openMySettings().openPreferences().setResume(ResumeOption.none);
    // logout
    userTools.logout();
    // login again
    loginPage.assertOnLoginPage().loginAs(user.getLogin(), user.getPassword()).assertLoggedIn(user);
    // and check that we don't see the resume button
    List<WebElement> resumeButtons = browser.findElements(LoginPage.resumeButton);
    Assert.assertTrue(resumeButtons.isEmpty());
}
Also used : UserToolsPage(org.olat.selenium.page.user.UserToolsPage) UserVO(org.olat.user.restapi.UserVO) WebElement(org.openqa.selenium.WebElement) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 63 with UserToolsPage

use of org.olat.selenium.page.user.UserToolsPage in project openolat by klemens.

the class UserTest method userSwitchLanguageSwitchToEnglish.

/**
 * Switch the language to german and after logout login to english
 * and check every time.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void userSwitchLanguageSwitchToEnglish(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
    UserVO user = new UserRestClient(deploymentUrl).createRandomUser();
    loginPage.loginAs(user.getLogin(), user.getPassword()).resume();
    // set the languages preferences to german
    UserToolsPage userTools = new UserToolsPage(browser);
    userTools.openUserToolsMenu().openMySettings().assertOnUserSettings().openPreferences().assertOnUserPreferences().setLanguage("de");
    userTools.logout();
    loginPage.loginAs(user.getLogin(), user.getPassword()).resume();
    WebElement usernameDE = browser.findElement(LoginPage.usernameFooterBy);
    boolean de = usernameDE.getText().contains("Eingeloggt als");
    Assert.assertTrue(de);
    List<WebElement> deMarker = browser.findElements(By.className("o_lang_de"));
    Assert.assertFalse(deMarker.isEmpty());
    // set the languages preferences to english
    userTools.openUserToolsMenu().openMySettings().openPreferences().setLanguage("en");
    userTools.logout();
    loginPage.loginAs(user.getLogin(), user.getPassword()).resume();
    WebElement usernameEN = browser.findElement(LoginPage.usernameFooterBy);
    boolean en = usernameEN.getText().contains("Logged in as");
    Assert.assertTrue(en);
    List<WebElement> enMarker = browser.findElements(By.className("o_lang_en"));
    Assert.assertFalse(enMarker.isEmpty());
}
Also used : UserToolsPage(org.olat.selenium.page.user.UserToolsPage) UserVO(org.olat.user.restapi.UserVO) WebElement(org.openqa.selenium.WebElement) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 64 with UserToolsPage

use of org.olat.selenium.page.user.UserToolsPage in project openolat by klemens.

the class UserTest method resumeCourseAutomatically.

/**
 * Set the resume preferences to automatically resume the session,
 * open a course, log out, log in and check if the course is resumed.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
public void resumeCourseAutomatically(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
    // create a random user
    UserVO user = new UserRestClient(deploymentUrl).createRandomUser();
    // deploy a course
    CourseVO course = new RepositoryRestClient(deploymentUrl).deployDemoCourse();
    // login
    loginPage.assertOnLoginPage().loginAs(user.getLogin(), user.getPassword());
    // set the preferences to resume automatically
    UserToolsPage userTools = new UserToolsPage(browser);
    userTools.openUserToolsMenu().openMySettings().assertOnUserSettings().openPreferences().assertOnUserPreferences().setResume(ResumeOption.auto);
    // open a course via REST url
    CoursePageFragment coursePage = CoursePageFragment.getCourse(browser, deploymentUrl, course);
    coursePage.assertOnCoursePage().clickTree();
    // logout
    userTools.logout();
    // login again
    loginPage.assertOnLoginPage().loginAs(user.getLogin(), user.getPassword());
    // check the title of the course if any
    WebElement courseTitle = browser.findElement(By.tagName("h2"));
    Assert.assertNotNull(courseTitle);
    Assert.assertTrue(courseTitle.isDisplayed());
    Assert.assertTrue(courseTitle.getText().contains(course.getTitle()));
}
Also used : RepositoryRestClient(org.olat.test.rest.RepositoryRestClient) CourseVO(org.olat.restapi.support.vo.CourseVO) UserToolsPage(org.olat.selenium.page.user.UserToolsPage) UserVO(org.olat.user.restapi.UserVO) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) WebElement(org.openqa.selenium.WebElement) UserRestClient(org.olat.test.rest.UserRestClient) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)64 UserToolsPage (org.olat.selenium.page.user.UserToolsPage)64 UserVO (org.olat.user.restapi.UserVO)64 UserRestClient (org.olat.test.rest.UserRestClient)62 RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)60 CoursePageFragment (org.olat.selenium.page.course.CoursePageFragment)30 LoginPage (org.olat.selenium.page.LoginPage)24 NavigationPage (org.olat.selenium.page.NavigationPage)18 CourseEditorPageFragment (org.olat.selenium.page.course.CourseEditorPageFragment)16 File (java.io.File)14 URL (java.net.URL)14 WebElement (org.openqa.selenium.WebElement)14 PortfolioV2HomePage (org.olat.selenium.page.portfolio.PortfolioV2HomePage)12 AuthoringEnvPage (org.olat.selenium.page.repository.AuthoringEnvPage)12 MembersPage (org.olat.selenium.page.course.MembersPage)10 BinderPage (org.olat.selenium.page.portfolio.BinderPage)10 Calendar (java.util.Calendar)8 MediaCenterPage (org.olat.selenium.page.portfolio.MediaCenterPage)8 AssessmentCEConfigurationPage (org.olat.selenium.page.course.AssessmentCEConfigurationPage)6 AssessmentToolPage (org.olat.selenium.page.course.AssessmentToolPage)6