Search in sources :

Example 86 with UserRestClient

use of org.olat.test.rest.UserRestClient in project openolat by klemens.

the class CourseTest method createCourseWithCalendar_alt.

/**
 * This is a variant of the test above based on the
 * feedback of our beta-testerin.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void createCourseWithCalendar_alt(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    loginPage.loginAs(author.getLogin(), author.getPassword());
    // create a course
    String courseTitle = "Course-iCal-" + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    navBar.openCourse(courseTitle);
    // activate the calendar options
    CoursePageFragment course = CoursePageFragment.getCourse(browser);
    course.options().calendar(Boolean.TRUE).save().clickToolbarBack();
    String calendarNodeTitle = "iCal-2";
    // create a course element of type calendar
    CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
    courseEditor.createNode("cal").nodeTitle(calendarNodeTitle);
    // publish the course
    course = courseEditor.autoPublish();
    // open the course and see the CP
    course.clickTree().selectWithTitle(calendarNodeTitle);
    // create a recurring event
    CalendarPage calendar = new CalendarPage(browser);
    calendar.addEvent(2).setDescription("Repeat", "Loop", "Foreach").setAllDay(false).setBeginEnd(14, 18).setRecurringEvent(KalendarEvent.WEEKLY, 28).save().assertOnEvents("Repeat", 4);
    // pick an occurence which is not the first and modify it
    calendar.openDetailsOccurence("Repeat", 16).edit().setBeginEnd(15, 18).save().confirmModifyAllOccurences().assertOnEventsAt("Repeat", 4, 15);
    // delete futur event of the same event as above
    calendar.openDetailsOccurence("Repeat", 16).edit().delete().confirmDeleteFuturOccurences().assertOnEventsAt("Repeat", 2, 15);
}
Also used : CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserVO(org.olat.user.restapi.UserVO) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) CalendarPage(org.olat.selenium.page.core.CalendarPage) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 87 with UserRestClient

use of org.olat.test.rest.UserRestClient in project openolat by klemens.

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 88 with UserRestClient

use of org.olat.test.rest.UserRestClient in project openolat by klemens.

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 89 with UserRestClient

use of org.olat.test.rest.UserRestClient in project openolat by klemens.

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)

Example 90 with UserRestClient

use of org.olat.test.rest.UserRestClient in project openolat by klemens.

the class CourseTest method createCourseWithCalendar.

/**
 * Create a course with a calendar element, add a recurring event
 * all day, modify an occurence to an event between 13h and 15h.
 * Remove an other single occurence and at the end, remove all remaining
 * events by removing the original event and confirm that
 * all must be deleted.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void createCourseWithCalendar(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    loginPage.loginAs(author.getLogin(), author.getPassword());
    // create a course
    String courseTitle = "Course-With-iCal-" + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    navBar.openCourse(courseTitle);
    String calendarNodeTitle = "iCal-1";
    // create a course element of type calendar
    CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
    courseEditor.createNode("cal").nodeTitle(calendarNodeTitle);
    // publish the course
    courseEditor.publish().quickPublish();
    // open the course and see the calendar
    CoursePageFragment course = courseEditor.clickToolbarBack();
    course.clickTree().selectWithTitle(calendarNodeTitle);
    // create a recurring event
    CalendarPage calendar = new CalendarPage(browser);
    calendar.addEvent(3).setDescription("Eventhor", "Hammer", "Asgard").setAllDay(true).setRecurringEvent(KalendarEvent.WEEKLY, 28).save();
    // modify an occurence
    calendar.openDetailsOccurence("Eventhor", 17).edit().setAllDay(false).setBeginEnd(13, 15).save().confirmModifyOneOccurence();
    // check
    calendar.assertOnEvents("Eventhor", 4).assertOnEventsAt("Eventhor", 1, 13);
    // modify all events
    calendar.openDetailsOccurence("Eventhor", 3).edit().setDescription("Eventoki", null, null).save().confirmModifyAllOccurences();
    // check
    calendar.assertOnEvents("Eventoki", 3).assertOnEventsAt("Eventhor", 1, 13);
    // delete an occurence
    calendar.openDetailsOccurence("Eventoki", 10).edit().delete().confirmDeleteOneOccurence();
    // check
    calendar.assertOnEvents("Eventoki", 2).assertOnEventsAt("Eventhor", 1, 13);
    // delete all
    calendar.openDetailsOccurence("Eventoki", 3).edit().delete().confirmDeleteAllOccurences();
    OOGraphene.waitingALittleBit();
    calendar.assertZeroEvent();
}
Also used : CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserVO(org.olat.user.restapi.UserVO) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) CalendarPage(org.olat.selenium.page.core.CalendarPage) 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