Search in sources :

Example 96 with CoursePageFragment

use of org.olat.selenium.page.course.CoursePageFragment in project openolat by klemens.

the class CourseElementTest method forumWithGuest.

/**
 * An administrator create a category in catalog. It creates a new course
 * with a forum open to guests. it publish the course in the
 * catalog.<br>
 * The guest find the course, create a new thread. The administrator reply
 * to the message, the guest to its reply.<br>
 * The administrator checks the last message in its new messages, click
 * back, use the list of users to see the messages of the guest. It clicks
 * back to the threads list and checks the thread has 3 messages.
 *
 * @param loginPage
 * @param guestBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void forumWithGuest(@InitialPage LoginPage loginPage, @Drone @User WebDriver guestBrowser) throws IOException, URISyntaxException {
    loginPage.loginAs("administrator", "openolat").resume();
    String node1 = "Forums " + UUID.randomUUID();
    navBar.openCatalogAdministration().addCatalogNode(node1, "First level of the catalog");
    // create a course
    String courseTitle = "Guest FO " + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    // go the authoring environment to create a forum
    String foTitle = "GFO - " + UUID.randomUUID();
    CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
    courseEditor.createNode("fo").nodeTitle(foTitle);
    // configure for guest
    ForumCEPage forumConfig = new ForumCEPage(browser);
    forumConfig.selectConfiguration().allowGuest();
    // publish the course
    courseEditor.publish().nextSelectNodes().selectAccess(UserAccess.guest).nextAccess().selectCatalog(true).selectCategory(null, node1).nextCatalog().finish();
    // back in course
    courseEditor.clickToolbarBack();
    // guest go to the catalog and find the course
    LoginPage guestLogin = LoginPage.getLoginPage(guestBrowser, deploymentUrl);
    guestLogin.asGuest();
    NavigationPage guestNavBar = new NavigationPage(guestBrowser);
    guestNavBar.openCatalog().selectCatalogEntry(node1).select(courseTitle).start();
    // go to the forum
    new CoursePageFragment(guestBrowser).clickTree().selectWithTitle(foTitle.substring(0, 20));
    String guestAlias = "Guest-" + UUID.randomUUID();
    ForumPage guestForum = ForumPage.getCourseForumPage(guestBrowser).createThread("Your favorite author", "Name your favorite author", guestAlias);
    // admin go to the forum
    new CoursePageFragment(browser).clickTree().selectWithTitle(foTitle.substring(0, 20));
    // admin reply to the thread of guest
    ForumPage adminForum = ForumPage.getCourseForumPage(browser).openThread("Your favorite author").assertOnGuestPseudonym(guestAlias).newMessages().assertOnGuestPseudonym(guestAlias).replyToMessage("Your favorite author", "Huxley is my favorite author", "My favorite author is Huxley");
    // guest refresh the view and reply to admin
    guestForum.flatView().assertMessageBody("Huxley").replyToMessage("Huxley is my favorite author", " I prefer Orwell", "Orwell is my favorite author");
    // admin see its new messages, see the list of users, select the guest and its messages
    // JMS message need to be delivered
    OOGraphene.waitingALittleLonger();
    adminForum.newMessages().assertMessageBody("Orwell").clickBack().userFilter().selectFilteredUser(guestAlias).assertMessageBody("Orwell").clickBack().clickBack().assertThreadListOnNumber("Your favorite author", 3);
}
Also used : CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) ForumCEPage(org.olat.selenium.page.course.ForumCEPage) NavigationPage(org.olat.selenium.page.NavigationPage) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) ForumPage(org.olat.selenium.page.forum.ForumPage) LoginPage(org.olat.selenium.page.LoginPage) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 97 with CoursePageFragment

use of org.olat.selenium.page.course.CoursePageFragment in project openolat by klemens.

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 98 with CoursePageFragment

use of org.olat.selenium.page.course.CoursePageFragment in project openolat by klemens.

the class CourseTest method coursePassword.

/**
 * An author creates a course with a structure element. The structure
 * element is password protected. Under it, there is an info node. The
 * course is published and a first user search the course, go to the
 * structure element, give the password and see the info node. A second
 * user grabs the rest url of the structure node, use it, give the password
 * and go to the info node.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void coursePassword(@InitialPage LoginPage loginPage, @Drone @Participant WebDriver kanuBrowser, @Drone @User WebDriver ryomouBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO kanu = new UserRestClient(deploymentUrl).createRandomUser("Kanu");
    UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
    loginPage.loginAs(author.getLogin(), author.getPassword());
    // go to authoring
    AuthoringEnvPage authoringEnv = navBar.assertOnNavigationPage().openAuthoringEnvironment();
    String title = "Password-me-" + UUID.randomUUID();
    // create course
    authoringEnv.openCreateDropDown().clickCreate(ResourceType.course).fillCreateForm(title).assertOnGeneralTab().clickToolbarBack();
    String infoTitle = "Info - " + UUID.randomUUID();
    String structureTitle = "St - " + UUID.randomUUID();
    // open course editor, create a structure node
    CoursePageFragment course = new CoursePageFragment(browser);
    CourseEditorPageFragment editor = course.openToolsMenu().edit();
    editor.createNode("st").nodeTitle(structureTitle);
    String courseInfoUrl = editor.getRestUrl();
    editor.createNode("info").nodeTitle(infoTitle).moveUnder(structureTitle).selectNode(structureTitle).selectTabPassword().setPassword("super secret").autoPublish().accessConfiguration().setUserAccess(UserAccess.registred).clickToolbarBack();
    MenuTreePageFragment courseTree = course.clickTree().selectWithTitle(structureTitle.substring(0, 20));
    course.assertOnPassword().enterPassword("super secret");
    courseTree.selectWithTitle(infoTitle.substring(0, 20));
    course.assertOnTitle(infoTitle);
    // First user go to the course
    LoginPage kanuLoginPage = LoginPage.getLoginPage(kanuBrowser, deploymentUrl);
    kanuLoginPage.loginAs(kanu.getLogin(), kanu.getPassword()).resume();
    NavigationPage kanuNavBar = new NavigationPage(kanuBrowser);
    kanuNavBar.openMyCourses().openSearch().extendedSearch(title).select(title).start();
    // go to the structure, give the password
    CoursePageFragment kanuCourse = new CoursePageFragment(kanuBrowser);
    MenuTreePageFragment kanuTree = kanuCourse.clickTree().selectWithTitle(structureTitle.substring(0, 20));
    kanuCourse.assertOnPassword().enterPassword("super secret");
    kanuTree.selectWithTitle(infoTitle.substring(0, 20));
    kanuCourse.assertOnTitle(infoTitle);
    // Second user use the rest url
    LoginPage ryomouLoginPage = LoginPage.getLoginPage(ryomouBrowser, new URL(courseInfoUrl));
    ryomouLoginPage.loginAs(ryomou.getLogin(), ryomou.getPassword()).resume();
    CoursePageFragment ryomouCourse = new CoursePageFragment(ryomouBrowser);
    ryomouCourse.assertOnPassword().enterPassword("super secret");
    // find the secret info course element
    ryomouCourse.clickTree().selectWithTitle(structureTitle.substring(0, 20)).selectWithTitle(infoTitle.substring(0, 20));
    ryomouCourse.assertOnTitle(infoTitle);
}
Also used : CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserVO(org.olat.user.restapi.UserVO) AuthoringEnvPage(org.olat.selenium.page.repository.AuthoringEnvPage) NavigationPage(org.olat.selenium.page.NavigationPage) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) MenuTreePageFragment(org.olat.selenium.page.core.MenuTreePageFragment) LoginPage(org.olat.selenium.page.LoginPage) URL(java.net.URL) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 99 with CoursePageFragment

use of org.olat.selenium.page.course.CoursePageFragment in project openolat by klemens.

the class CourseTest method createCourse_withWizard.

/**
 * Create a course, use the course wizard, select all course
 * elements and go further with the standard settings.
 *
 * Go from the description editor to the course, check
 * that the course is automatically published and that
 * the five course elements are there.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void createCourse_withWizard(@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-Course-Wizard-" + UUID.randomUUID().toString();
    // create course
    CourseWizardPage courseWizard = authoringEnv.openCreateDropDown().clickCreate(ResourceType.course).fillCreateFormAndStartWizard(title);
    courseWizard.selectAllCourseElements().nextNodes().nextCatalog().finish();
    // OOGraphene.closeErrorBox(browser);//STMP error
    RepositoryEditDescriptionPage editDescription = new RepositoryEditDescriptionPage(browser);
    // from description editor, back to details and launch the course
    editDescription.assertOnGeneralTab();
    // close mail error
    OOGraphene.closeErrorBox(browser);
    editDescription.clickToolbarBack();
    // open course editor
    CoursePageFragment course = CoursePageFragment.getCourse(browser);
    course.assertOnCoursePage().assertOnTitle(title);
    // assert the 5 nodes are there and click them
    By nodeBy = By.cssSelector("span.o_tree_link.o_tree_l1.o_tree_level_label_leaf>a");
    List<WebElement> nodes = browser.findElements(nodeBy);
    Assert.assertEquals(5, nodes.size());
    for (WebElement node : nodes) {
        node.click();
        OOGraphene.waitBusy(browser);
    }
}
Also used : UserVO(org.olat.user.restapi.UserVO) AuthoringEnvPage(org.olat.selenium.page.repository.AuthoringEnvPage) CourseWizardPage(org.olat.selenium.page.course.CourseWizardPage) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) By(org.openqa.selenium.By) WebElement(org.openqa.selenium.WebElement) 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 100 with CoursePageFragment

use of org.olat.selenium.page.course.CoursePageFragment in project openolat by klemens.

the class CourseTest method createCourseWithSpecialCharacters.

/**
 * Check if we can create and open a course with this
 * name: It's me, the "course".
 * @see https://jira.openolat.org/browse/OO-1839
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void createCourseWithSpecialCharacters(@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 marker = Long.toString(System.currentTimeMillis());
    String title = "It's me, the \"course\" number " + marker;
    // create course
    RepositoryEditDescriptionPage editDescription = authoringEnv.openCreateDropDown().clickCreate(ResourceType.course).fillCreateForm(title).assertOnGeneralTab();
    // from description editor, back to the course
    editDescription.clickToolbarBack();
    // close the course
    navBar.closeTab();
    // select the authoring
    navBar.openAuthoringEnvironment().selectResource(marker);
    new CoursePageFragment(browser).assertOnCoursePage();
}
Also used : UserVO(org.olat.user.restapi.UserVO) AuthoringEnvPage(org.olat.selenium.page.repository.AuthoringEnvPage) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) 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)

Aggregations

CoursePageFragment (org.olat.selenium.page.course.CoursePageFragment)110 Test (org.junit.Test)104 RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)102 UserRestClient (org.olat.test.rest.UserRestClient)102 UserVO (org.olat.user.restapi.UserVO)102 CourseEditorPageFragment (org.olat.selenium.page.course.CourseEditorPageFragment)80 NavigationPage (org.olat.selenium.page.NavigationPage)56 LoginPage (org.olat.selenium.page.LoginPage)54 MembersPage (org.olat.selenium.page.course.MembersPage)34 AuthoringEnvPage (org.olat.selenium.page.repository.AuthoringEnvPage)30 UserToolsPage (org.olat.selenium.page.user.UserToolsPage)30 WebElement (org.openqa.selenium.WebElement)30 URL (java.net.URL)24 File (java.io.File)22 By (org.openqa.selenium.By)14 Calendar (java.util.Calendar)10 AssessmentCEConfigurationPage (org.olat.selenium.page.course.AssessmentCEConfigurationPage)8 AssessmentToolPage (org.olat.selenium.page.course.AssessmentToolPage)8 EnrollmentConfigurationPage (org.olat.selenium.page.course.EnrollmentConfigurationPage)8 EnrollmentPage (org.olat.selenium.page.course.EnrollmentPage)8