Search in sources :

Example 16 with UserRestClient

use of org.olat.test.rest.UserRestClient in project OpenOLAT by OpenOLAT.

the class CourseTest method createCourse.

/**
 * An author create a course, jump to it, open the editor
 * add an info messages course element, publish the course
 * and view it.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void createCourse(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    loginPage.loginAs(author.getLogin(), author.getPassword());
    // go to authoring
    AuthoringEnvPage authoringEnv = navBar.assertOnNavigationPage().openAuthoringEnvironment();
    String title = "Create-Selen-" + UUID.randomUUID();
    // create course
    RepositoryEditDescriptionPage editDescription = authoringEnv.openCreateDropDown().clickCreate(ResourceType.course).fillCreateForm(title).assertOnGeneralTab();
    // from description editor, back to the course
    editDescription.clickToolbarBack();
    // open course editor
    CoursePageFragment course = CoursePageFragment.getCourse(browser);
    CourseEditorPageFragment editor = course.assertOnCoursePage().assertOnTitle(title).openToolsMenu().edit();
    // create a course element of type info messages
    PublisherPageFragment publisher = editor.assertOnEditor().createNode("info").publish();
    // publish
    publisher.assertOnPublisher().nextSelectNodes().selectAccess(UserAccess.guest).nextAccess().selectCatalog(false).nextCatalog().finish();
    // back to the course
    CoursePageFragment publishedCourse = editor.clickToolbarBack();
    // review the course
    publishedCourse.assertOnCoursePage().clickTree();
}
Also used : CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserVO(org.olat.user.restapi.UserVO) AuthoringEnvPage(org.olat.selenium.page.repository.AuthoringEnvPage) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) PublisherPageFragment(org.olat.selenium.page.course.PublisherPageFragment) RepositoryEditDescriptionPage(org.olat.selenium.page.repository.RepositoryEditDescriptionPage) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 17 with UserRestClient

use of org.olat.test.rest.UserRestClient 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 18 with UserRestClient

use of org.olat.test.rest.UserRestClient in project OpenOLAT by OpenOLAT.

the class CourseTest method tryImportOfWindowsZip.

/**
 * Try to import a typical Windows zip with encoding issues. The goal
 * is to check that no ugly red screen are produced.
 *
 * @param loginPage
 */
@Test
@RunAsClient
public void tryImportOfWindowsZip(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    loginPage.loginAs(author.getLogin(), author.getPassword());
    URL zipUrl = JunitTestHelper.class.getResource("file_resources/windows_zip.zip");
    File zipFile = new File(zipUrl.toURI());
    // go the authoring environment to create a CP
    String zipTitle = "ZIP - " + UUID.randomUUID();
    navBar.openAuthoringEnvironment().uploadResource(zipTitle, zipFile).assertOnResourceType();
}
Also used : UserVO(org.olat.user.restapi.UserVO) File(java.io.File) URL(java.net.URL) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 19 with UserRestClient

use of org.olat.test.rest.UserRestClient in project OpenOLAT by OpenOLAT.

the class CourseTest method courseRename.

/**
 * Test that renaming the root node is reflected after
 * publishing.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void courseRename(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    loginPage.loginAs(author.getLogin(), author.getPassword());
    // create a course
    String courseTitle = "Course to rename-" + UUID.randomUUID().toString();
    navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    // open course editor
    CoursePageFragment course = CoursePageFragment.getCourse(browser);
    CourseEditorPageFragment editor = course.assertOnCoursePage().assertOnTitle(courseTitle).openToolsMenu().edit();
    // create a course element of type info messages
    course = editor.assertOnEditor().createNode("info").autoPublish();
    // check that the root node has the name of the repository entry
    course.assertOnTitle(courseTitle);
    // rename the root node
    String newCourseName = "Renamed course";
    course = course.edit().selectRoot().nodeTitle(newCourseName).autoPublish();
    // assert the changed name
    course.assertOnTitle(newCourseName);
}
Also used : CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserVO(org.olat.user.restapi.UserVO) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 20 with UserRestClient

use of org.olat.test.rest.UserRestClient in project OpenOLAT by OpenOLAT.

the class CourseTest method courseAccessRules.

/**
 * An author creates a course with 4 course elements. A folder
 * which is visible to group, a forum which is visible to coaches,
 * an assessment and an info visible to the students which passed
 * the assessment above.<br>
 * a student come and checks what it can see, the author make it
 * pass the assessment and the student sees the info.
 *
 * @param loginPage
 * @param kanuBrowser
 * @param reiBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void courseAccessRules(@InitialPage LoginPage loginPage, @Drone @Student WebDriver reiBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("rei");
    loginPage.loginAs(author.getLogin(), author.getPassword());
    // create a course
    String courseTitle = "Course FO " + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    // go the authoring environment to create a forum
    String bcTitle = "BC - " + UUID.randomUUID();
    String foTitle = "FO - " + UUID.randomUUID();
    String msTitle = "MS - " + UUID.randomUUID();
    String infoTitle = "Info - " + UUID.randomUUID();
    String groupName = "Students";
    CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
    // folder is group protected
    courseEditor.createNode("bc").nodeTitle(bcTitle).selectTabVisibility().setGroupCondition().createBusinessGroup(groupName);
    // forum is coach exclusive
    courseEditor.createNode("fo").nodeTitle(foTitle).selectTabVisibility().setCoachExclusive().save();
    // assessment is open
    courseEditor.createNode("ms").nodeTitle(msTitle);
    // configure assessment
    AssessmentCEConfigurationPage assessmentConfig = new AssessmentCEConfigurationPage(browser);
    assessmentConfig.selectConfiguration().setScoreAuto(0.0f, 6.0f, 4.0f);
    // wiki is assessment dependent
    courseEditor.createNode("info").nodeTitle(infoTitle).selectTabVisibility().setAssessmentCondition(1).save();
    OOGraphene.scrollTop(browser);
    courseEditor.publish().nextSelectNodes().selectAccess(UserAccess.membersOnly).nextAccess().selectCatalog(false).nextCatalog().finish();
    courseEditor.clickToolbarBack();
    // add a member to the group we create above
    MembersPage members = CoursePageFragment.getCourse(browser).members();
    members.addMember().searchMember(rei, true).nextUsers().nextOverview().selectGroupAsParticipant(groupName).nextPermissions().finish();
    // participant search the course
    LoginPage.getLoginPage(reiBrowser, deploymentUrl).loginAs(rei).resume();
    NavigationPage reiNavBar = new NavigationPage(reiBrowser);
    reiNavBar.openMyCourses().select(courseTitle);
    MenuTreePageFragment reiTree = new MenuTreePageFragment(reiBrowser);
    reiTree.assertWithTitle(bcTitle.substring(0, 20)).assertWithTitle(msTitle.substring(0, 20)).assertTitleNotExists(foTitle.substring(0, 20)).assertTitleNotExists(infoTitle.substring(0, 20));
    // author set assessment to passed
    AssessmentToolPage assessmentTool = members.clickToolbarBack().assessmentTool();
    assessmentTool.users().assertOnUsers(rei).selectUser(rei).selectCourseNode(msTitle.substring(0, 20)).setAssessmentScore(5.5f).assertUserPassedCourseNode(msTitle.substring(0, 20));
    // student can see info
    reiTree.selectRoot().assertWithTitle(bcTitle.substring(0, 20)).assertWithTitle(msTitle.substring(0, 20)).assertTitleNotExists(foTitle.substring(0, 20)).assertWithTitle(infoTitle.substring(0, 20));
    // author can see all
    assessmentTool.clickToolbarRootCrumb().clickTree().assertWithTitle(bcTitle.substring(0, 20)).assertWithTitle(msTitle.substring(0, 20)).assertWithTitle(foTitle.substring(0, 20)).assertWithTitle(infoTitle.substring(0, 20));
}
Also used : CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserVO(org.olat.user.restapi.UserVO) NavigationPage(org.olat.selenium.page.NavigationPage) AssessmentCEConfigurationPage(org.olat.selenium.page.course.AssessmentCEConfigurationPage) MembersPage(org.olat.selenium.page.course.MembersPage) MenuTreePageFragment(org.olat.selenium.page.core.MenuTreePageFragment) AssessmentToolPage(org.olat.selenium.page.course.AssessmentToolPage) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)258 UserRestClient (org.olat.test.rest.UserRestClient)258 UserVO (org.olat.user.restapi.UserVO)258 RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)254 NavigationPage (org.olat.selenium.page.NavigationPage)110 LoginPage (org.olat.selenium.page.LoginPage)108 CoursePageFragment (org.olat.selenium.page.course.CoursePageFragment)102 QTI21Page (org.olat.selenium.page.qti.QTI21Page)96 URL (java.net.URL)88 File (java.io.File)86 CourseEditorPageFragment (org.olat.selenium.page.course.CourseEditorPageFragment)84 UserToolsPage (org.olat.selenium.page.user.UserToolsPage)62 QTI21EditorPage (org.olat.selenium.page.qti.QTI21EditorPage)46 WebElement (org.openqa.selenium.WebElement)46 MembersPage (org.olat.selenium.page.course.MembersPage)36 AuthoringEnvPage (org.olat.selenium.page.repository.AuthoringEnvPage)34 GroupPage (org.olat.selenium.page.group.GroupPage)22 BinderPage (org.olat.selenium.page.portfolio.BinderPage)12 PortfolioV2HomePage (org.olat.selenium.page.portfolio.PortfolioV2HomePage)12 By (org.openqa.selenium.By)12