Search in sources :

Example 1 with AuthoringEnvPage

use of org.olat.selenium.page.repository.AuthoringEnvPage in project OpenOLAT by OpenOLAT.

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 2 with AuthoringEnvPage

use of org.olat.selenium.page.repository.AuthoringEnvPage 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 3 with AuthoringEnvPage

use of org.olat.selenium.page.repository.AuthoringEnvPage 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 4 with AuthoringEnvPage

use of org.olat.selenium.page.repository.AuthoringEnvPage in project OpenOLAT by OpenOLAT.

the class CourseTest method courseBooking.

/**
 * An author creates a course, make it visible for
 * members and add an access control by password.
 * The user search for the course, books it and give
 * the password.<br/>
 * The author checks in the list of orders if the booking
 * of the user is there and after it checks if the user is
 * in the member list too.
 *
 * @param loginPage
 * @param ryomouBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void courseBooking(@InitialPage LoginPage loginPage, @Drone @User WebDriver ryomouBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    loginPage.loginAs(author.getLogin(), author.getPassword());
    UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
    // go to authoring
    AuthoringEnvPage authoringEnv = navBar.assertOnNavigationPage().openAuthoringEnvironment();
    String title = "Create-Selen-" + UUID.randomUUID().toString();
    // create course
    authoringEnv.openCreateDropDown().clickCreate(ResourceType.course).fillCreateForm(title).assertOnGeneralTab();
    // open course editor
    CoursePageFragment course = new CoursePageFragment(browser);
    RepositoryAccessPage courseAccess = course.openToolsMenu().edit().createNode("info").autoPublish().accessConfiguration().setUserAccess(UserAccess.registred);
    // add booking by secret token
    courseAccess.boooking().openAddDropMenu().addTokenMethod().configureTokenMethod("secret", "The password is secret");
    courseAccess.clickToolbarBack();
    // a user search the course
    LoginPage ryomouLoginPage = LoginPage.getLoginPage(ryomouBrowser, deploymentUrl);
    ryomouLoginPage.loginAs(ryomou.getLogin(), ryomou.getPassword()).resume();
    NavigationPage ryomouNavBar = new NavigationPage(ryomouBrowser);
    ryomouNavBar.openMyCourses().openSearch().extendedSearch(title).book(title);
    // book the course
    BookingPage booking = new BookingPage(ryomouBrowser);
    booking.bookToken("secret");
    // check the course
    CoursePageFragment bookedCourse = CoursePageFragment.getCourse(ryomouBrowser);
    bookedCourse.assertOnTitle(title);
    // Author go in the list of bookings of the course
    BookingPage bookingList = course.openToolsMenu().bookingTool();
    bookingList.assertFirstNameInListIsOk(ryomou);
    // Author go to members list
    course.members().assertFirstNameInList(ryomou);
}
Also used : UserVO(org.olat.user.restapi.UserVO) AuthoringEnvPage(org.olat.selenium.page.repository.AuthoringEnvPage) NavigationPage(org.olat.selenium.page.NavigationPage) BookingPage(org.olat.selenium.page.core.BookingPage) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) RepositoryAccessPage(org.olat.selenium.page.repository.RepositoryAccessPage) LoginPage(org.olat.selenium.page.LoginPage) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 5 with AuthoringEnvPage

use of org.olat.selenium.page.repository.AuthoringEnvPage in project OpenOLAT by OpenOLAT.

the class CourseTest method concurrentEditCourse.

/**
 * An author create a course, add a second user as co-author
 * of the course, and edit the course.<br>
 * The co-author select the course and try to edit it, unsuccessfully.
 * It try to edit the course directly from the author list without
 * success.<br>
 * The author closes the editor and the co-author is allowed to edit.
 * The author cannot edit i anymore...
 *
 * @param loginPage Login page of the author
 * @param coAuthorBrowser the browser for the coauthor
 */
@Test
@RunAsClient
public void concurrentEditCourse(@InitialPage LoginPage loginPage, @Drone @Participant WebDriver coAuthorBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO coAuthor = new UserRestClient(deploymentUrl).createAuthor("Rei");
    loginPage.loginAs(author.getLogin(), author.getPassword()).resume();
    // go to authoring
    AuthoringEnvPage authoringEnv = navBar.assertOnNavigationPage().openAuthoringEnvironment();
    String title = "Coedit-" + UUID.randomUUID();
    // create course
    authoringEnv.openCreateDropDown().clickCreate(ResourceType.course).fillCreateForm(title).assertOnGeneralTab().clickToolbarBack();
    // add a second owner
    MembersPage members = new CoursePageFragment(browser).members();
    members.addMember().searchMember(coAuthor, true).nextUsers().nextOverview().selectRepositoryEntryRole(true, false, false).nextPermissions().finish();
    // open the editor
    CoursePageFragment coursePage = members.clickToolbarBack();
    CourseEditorPageFragment editor = coursePage.edit();
    // the second author come in
    LoginPage coAuthroLoginPage = LoginPage.getLoginPage(coAuthorBrowser, deploymentUrl);
    coAuthroLoginPage.loginAs(coAuthor.getLogin(), coAuthor.getPassword()).resume();
    // go to authoring
    NavigationPage coAuthorNavBar = new NavigationPage(coAuthorBrowser);
    coAuthorNavBar.assertOnNavigationPage().openAuthoringEnvironment().selectResource(title);
    // try to edit
    CoursePageFragment coAuthorCourse = new CoursePageFragment(coAuthorBrowser);
    coAuthorCourse.tryToEdit().assertOnWarning();
    // retry in list
    coAuthorNavBar.openAuthoringEnvironment().editResource(title);
    new CourseEditorPageFragment(coAuthorBrowser).assertOnWarning();
    // author close the course editor
    editor.clickToolbarBack();
    coursePage.assertOnCoursePage();
    // co-author edit the course
    CourseEditorPageFragment coAuthorEditor = coAuthorCourse.edit().assertOnEditor();
    // author try
    coursePage.tryToEdit().assertOnWarning();
    // co-author close the editor
    coAuthorEditor.clickToolbarBack().assertOnCoursePage();
    // author reopens the editor
    coursePage.edit().assertOnEditor();
}
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) 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

RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)34 Test (org.junit.Test)34 AuthoringEnvPage (org.olat.selenium.page.repository.AuthoringEnvPage)34 UserRestClient (org.olat.test.rest.UserRestClient)34 UserVO (org.olat.user.restapi.UserVO)34 CoursePageFragment (org.olat.selenium.page.course.CoursePageFragment)30 NavigationPage (org.olat.selenium.page.NavigationPage)20 LoginPage (org.olat.selenium.page.LoginPage)18 CourseEditorPageFragment (org.olat.selenium.page.course.CourseEditorPageFragment)14 UserToolsPage (org.olat.selenium.page.user.UserToolsPage)12 Calendar (java.util.Calendar)8 MembersPage (org.olat.selenium.page.course.MembersPage)8 LectureRepositoryAdminListPage (org.olat.selenium.page.lecture.LectureRepositoryAdminListPage)8 LectureRepositoryAdminPage (org.olat.selenium.page.lecture.LectureRepositoryAdminPage)8 URL (java.net.URL)6 RollCallInterceptorPage (org.olat.selenium.page.lecture.RollCallInterceptorPage)6 RepositoryEditDescriptionPage (org.olat.selenium.page.repository.RepositoryEditDescriptionPage)6 File (java.io.File)4 Date (java.util.Date)2 BookingPage (org.olat.selenium.page.core.BookingPage)2