use of org.olat.selenium.page.user.UserToolsPage in project openolat by klemens.
the class UserTest method restUrlAfterLogin.
/**
* Check if a user can use the rest url in OpenOLAT.
* It jump from the static sites to its home, user tools,
* to the visiting card of an other user.
*
* @param loginPage
* @param authorBrowser
* @param participantBrowser
* @param reiBrowser
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void restUrlAfterLogin(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
// create a random user
UserRestClient userClient = new UserRestClient(deploymentUrl);
UserVO user = userClient.createRandomUser("Kanu");
UserVO ryomou = userClient.createRandomUser("Ryomou");
// load dmz
loginPage.assertOnLoginPage().loginAs(user.getLogin(), user.getPassword());
// go to courses
navBar.openMyCourses();
// use url to go to the other users business card
String ryomouBusinessCardUrl = deploymentUrl.toString() + "auth/Identity/" + ryomou.getKey();
browser.get(ryomouBusinessCardUrl);
new VisitingCardPage(browser).assertOnVisitingCard().assertOnLastName(ryomou.getLastName());
// return to my courses
navBar.openMyCourses().assertOnMyCourses();
// go to profile by url
String userUrl = deploymentUrl.toString() + "url/Identity/" + user.getKey();
browser.get(userUrl);
new UserProfilePage(browser).assertOnProfile().assertOnUsername(user.getLogin());
// go to groups
String groupsUrl = deploymentUrl.toString() + "url/GroupsSite/0/AllGroups/0";
browser.get(groupsUrl);
new GroupsPage(browser).assertOnMyGroupsSelected();
// go to my calendar
String calendarUrl = deploymentUrl.toString() + "auth/HomeSite/0/calendar/0";
browser.get(calendarUrl);
new UserToolsPage(browser).assertOnCalendar();
// go to my folder
String folderUrl = deploymentUrl.toString() + "auth/HomeSite/" + user.getKey() + "/userfolder/0";
browser.get(folderUrl);
new UserToolsPage(browser).assertOnFolder();
}
use of org.olat.selenium.page.user.UserToolsPage in project openolat by klemens.
the class UserTest method deleteUser.
/**
* Test if deleted user cannot login anymore. An administrator
* create a user. This user log in and log out. The administrator
* use the direct delete workflow in user management to delete
* it.<br>
* The user try to log in again, unsuccessfully. The
* administrator doesn't find it anymore in the user
* search of the user management tab.
*/
@Test
@RunAsClient
public void deleteUser(@InitialPage LoginPage loginPage, @Drone @User WebDriver userBrowser) {
// login
loginPage.assertOnLoginPage().loginAs("administrator", "openolat").resume();
String uuid = UUID.randomUUID().toString();
String username = "miku-" + uuid;
String lastName = "Hatsune" + uuid;
UserVO userVo = UserAdminPage.createUserVO(username, "Miku", lastName, "miku-" + uuid + "@openolat.com", "miku01");
UserAdminPage userAdminPage = navBar.openUserManagement().openCreateUser().fillUserForm(userVo).assertOnUserEditView(username);
// user log in
LoginPage userLoginPage = LoginPage.getLoginPage(userBrowser, deploymentUrl);
// tools
userLoginPage.loginAs(username, "miku01").resume().assertLoggedIn(userVo);
// log out
new UserToolsPage(userBrowser).logout();
// admin delete
userAdminPage.openDirectDeleteUser().searchUserToDelete(username).selectAndDeleteUser(lastName);
// user try the login
userLoginPage = LoginPage.getLoginPage(userBrowser, deploymentUrl);
userLoginPage.loginDenied(username, "miku01");
// assert on error message
By errorMessageby = By.cssSelector("div.modal-body.alert.alert-danger");
OOGraphene.waitElement(errorMessageby, 2, userBrowser);
// administrator search the deleted user
userAdminPage.openSearchUser().searchByUsername(username).assertNotInUserList(username);
}
use of org.olat.selenium.page.user.UserToolsPage in project openolat by klemens.
the class UserTest method loginInHomeWithRestUrl.
/**
* Jump to notifications in home, go to the courses and return
* to home's notification with a REST url.
*
* @see https://jira.openolat.org/browse/OO-1962
* @param loginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void loginInHomeWithRestUrl(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
// create a random user
UserRestClient userClient = new UserRestClient(deploymentUrl);
UserVO user = userClient.createRandomUser();
// load dmz
loginPage.assertOnLoginPage();
String jumpToNotificationsUrl = deploymentUrl.toString() + "url/HomeSite/" + user.getKey() + "/notifications/0";
browser.get(jumpToNotificationsUrl);
loginPage.loginAs(user.getLogin(), user.getPassword());
// must see the notification
new UserToolsPage(browser).assertOnNotifications();
// go to courses
navBar.openMyCourses();
// use url to go to notifications
String goToNotificationsUrl = deploymentUrl.toString() + "auth/HomeSite/" + user.getKey() + "/notifications/0";
browser.get(goToNotificationsUrl);
// must see the notification
new UserToolsPage(browser).assertOnNotifications();
}
use of org.olat.selenium.page.user.UserToolsPage in project openolat by klemens.
the class UserTest method resumeCourseOnDemand.
/**
* Set the resume preferences to resume the session on request,
* open a course, log out, log in, resume the session and check
* if the course is resumed.
*
* @param loginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
public void resumeCourseOnDemand(@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.loginAs(user.getLogin(), user.getPassword());
// set the preferences to resume automatically
UserToolsPage userTools = new UserToolsPage(browser);
userTools.openUserToolsMenu().openMySettings().openPreferences().setResume(ResumeOption.ondemand);
// open a course via REST url and click it
CoursePageFragment.getCourse(browser, deploymentUrl, course).clickTree();
// logout
userTools.logout();
// login again
loginPage.assertOnLoginPage().loginAs(user.getLogin(), user.getPassword());
// resume
loginPage.resumeWithAssert();
// 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()));
}
use of org.olat.selenium.page.user.UserToolsPage in project openolat by klemens.
the class AssessmentTest method certificatesManuallyGenerated.
/**
* An author create a course, publish it and add a participant.
* It set the certificate, create one for the participant.<br>
* The participant logs in and look at its wonderful certificate.
*
* @param authorLoginPage
* @param reiBrowser
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void certificatesManuallyGenerated(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver reiBrowser) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
authorLoginPage.loginAs(author.getLogin(), author.getPassword());
UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("Rei");
// create a course
String courseTitle = "Course-With-Certificates-" + UUID.randomUUID();
navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
// create a course element of type CP with the CP that we create above
CoursePageFragment courseRuntime = CoursePageFragment.getCourse(browser).edit().createNode("info").autoPublish();
// add a participant to the course
MembersPage members = courseRuntime.members();
members.addMember().searchMember(rei, true).nextUsers().nextOverview().nextPermissions().finish();
// return to course
courseRuntime = members.clickToolbarBack().efficiencyStatementConfiguration().clickToolbarBack().efficiencyStatementConfiguration().enableCertificates(false).enableRecertification().save().clickToolbarBack();
// create a certificate
courseRuntime.assessmentTool().users().selectUser(rei).generateCertificate();
// Participant log in
LoginPage reiLoginPage = LoginPage.getLoginPage(reiBrowser, deploymentUrl);
reiLoginPage.loginAs(rei.getLogin(), rei.getPassword()).resume();
// open the efficiency statements
UserToolsPage reiUserTools = new UserToolsPage(reiBrowser);
reiUserTools.openUserToolsMenu().openMyEfficiencyStatement().assertOnEfficiencyStatmentPage().assertOnCertificate(courseTitle);
}
Aggregations