Search in sources :

Example 1 with UserToolsPage

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());
}
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 2 with UserToolsPage

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();
}
Also used : UserToolsPage(org.olat.selenium.page.user.UserToolsPage) UserVO(org.olat.user.restapi.UserVO) UserPreferencesPageFragment(org.olat.selenium.page.user.UserPreferencesPageFragment) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 3 with UserToolsPage

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);
}
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 4 with UserToolsPage

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);
}
Also used : UserToolsPage(org.olat.selenium.page.user.UserToolsPage) RemindersPage(org.olat.selenium.page.course.RemindersPage) NavigationPage(org.olat.selenium.page.NavigationPage) UserVO(org.olat.user.restapi.UserVO) AuthoringEnvPage(org.olat.selenium.page.repository.AuthoringEnvPage) Calendar(java.util.Calendar) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) Date(java.util.Date) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 5 with UserToolsPage

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);
}
Also used : CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserToolsPage(org.olat.selenium.page.user.UserToolsPage) UserVO(org.olat.user.restapi.UserVO) AssessmentCEConfigurationPage(org.olat.selenium.page.course.AssessmentCEConfigurationPage) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) MembersPage(org.olat.selenium.page.course.MembersPage) LoginPage(org.olat.selenium.page.LoginPage) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) 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