use of org.olat.selenium.page.user.UserToolsPage in project OpenOLAT by OpenOLAT.
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 OpenOLAT.
the class UserTest method userResetItsPreferences.
/**
* Reset the preferences and check that a log out happens
*
* @param loginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void userResetItsPreferences(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
UserVO user = new UserRestClient(deploymentUrl).createRandomUser();
loginPage.loginAs(user.getLogin(), user.getPassword()).resume();
UserToolsPage userTools = new UserToolsPage(browser);
UserPreferencesPageFragment prefs = userTools.openUserToolsMenu().openMySettings().openPreferences();
// reset the preferences
prefs.resetPreferences();
// check the user is log out
loginPage.assertOnLoginPage();
}
use of org.olat.selenium.page.user.UserToolsPage in project OpenOLAT by OpenOLAT.
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 OpenOLAT.
the class CourseTest method courseReminders.
/**
* An author create a course, set a start and end date for life-cycle.
* It add a participant to the course. It creates a reminder
* with a rule to catch only participant, an other to send
* the reminder after the start of the course. It sends the reminder
* manually, checks the reminders send, checks the log.
*
* @param loginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void courseReminders(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
// configure at least a license
loginPage.loginAs("administrator", "openolat").resume();
new NavigationPage(browser).openAdministration().openLicenses().enableForResources("all rights reserved");
new UserToolsPage(browser).logout();
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
loginPage.loginAs(author.getLogin(), author.getPassword());
UserVO kanu = new UserRestClient(deploymentUrl).createRandomUser("Kanu");
// go to authoring
AuthoringEnvPage authoringEnv = navBar.assertOnNavigationPage().openAuthoringEnvironment();
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
cal.add(Calendar.DATE, -10);
Date validFrom = cal.getTime();
cal.add(Calendar.DATE, 20);
Date validTo = cal.getTime();
String title = "Remind-me-" + UUID.randomUUID();
// create course
authoringEnv.openCreateDropDown().clickCreate(ResourceType.course).fillCreateForm(title).assertOnGeneralTab().setLicense().setLifecycle(validFrom, validTo, Locale.GERMAN).save().clickToolbarBack();
// open course editor, create a node, set access
CoursePageFragment course = new CoursePageFragment(browser);
course.openToolsMenu().edit().createNode("info").autoPublish().accessConfiguration().setUserAccess(UserAccess.registred).clickToolbarBack();
// add a participant
course.members().quickAdd(kanu);
// go to reminders
RemindersPage reminders = course.reminders().assertOnRemindersList();
String reminderTitle = "REM-" + UUID.randomUUID();
reminders.addReminder().setDescription(reminderTitle).setSubject(reminderTitle).setTimeBasedRule(1, "RepositoryEntryLifecycleAfterValidFromRuleSPI", 5, "day").addRule(1).setRoleBasedRule(2, "RepositoryEntryRoleRuleSPI", "participant").saveReminder().assertOnRemindersList().assertOnReminderInList(reminderTitle);
// send the reminders
reminders.openActionMenu(reminderTitle).sendReminders();
// check the reminder is send to user
reminders.openActionMenu(reminderTitle).showSentReminders().assertSentRemindersList(kanu, true).assertSentRemindersList(author, false);
// open reminders log
reminders.clickToolbarBack().openLog().assertLogList(kanu, reminderTitle, true).assertLogList(author, reminderTitle, false);
}
use of org.olat.selenium.page.user.UserToolsPage in project OpenOLAT by OpenOLAT.
the class AssessmentTest method assessmentCourseElement.
/**
* An author create a course with an assessment course element with
* min., max., cut value and so on. It add an user to the course,
* go to the assessment tool and set a score to the assessed user.<br>
*
* The user log in, go to the efficiency statements list and check
* it become its statement.
*
* @param authorLoginPage
* @param ryomouBrowser
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void assessmentCourseElement(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver ryomouBrowser) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
authorLoginPage.loginAs(author.getLogin(), author.getPassword());
// create a course
String courseTitle = "Course-Assessment-" + UUID.randomUUID();
navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
// create a course element of type Test with the test that we create above
String assessmentNodeTitle = "Assessment CE";
CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit().createNode("ms").nodeTitle(assessmentNodeTitle);
// configure assessment
AssessmentCEConfigurationPage assessmentConfig = new AssessmentCEConfigurationPage(browser);
assessmentConfig.selectConfiguration().setScoreAuto(0.1f, 10.0f, 5.0f);
// set the score / passed calculation in root node and publish
courseEditor.selectRoot().selectTabScore().enableRootScoreByNodes().autoPublish().accessConfiguration().setUserAccess(UserAccess.registred);
// go to members management
CoursePageFragment courseRuntime = courseEditor.clickToolbarBack();
MembersPage members = courseRuntime.members();
members.addMember().searchMember(ryomou, true).nextUsers().nextOverview().nextPermissions().finish();
// efficiency statement is default on
// go to the assessment to to set the points
members.clickToolbarBack().assessmentTool().users().assertOnUsers(ryomou).selectUser(ryomou).selectCourseNode(assessmentNodeTitle).setAssessmentScore(8.0f).assertUserPassedCourseNode(assessmentNodeTitle);
// Ryomou login
LoginPage ryomouLoginPage = LoginPage.getLoginPage(ryomouBrowser, deploymentUrl);
ryomouLoginPage.loginAs(ryomou.getLogin(), ryomou.getPassword()).resume();
// see its beautiful efficiency statement
UserToolsPage ryomouUserTools = new UserToolsPage(ryomouBrowser);
ryomouUserTools.openUserToolsMenu().openMyEfficiencyStatement().assertOnEfficiencyStatmentPage().assertOnStatement(courseTitle, true).selectStatement(courseTitle).assertOnCourseDetails(assessmentNodeTitle, true);
}
Aggregations