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);
}
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());
}
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());
}
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()));
}
Aggregations