Search in sources :

Example 16 with AuthoringEnvPage

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

the class LecturesTest method lecturesRollCall_defaultAuthorizedAbsence.

/**
 * An author create a course, enable the absence management,
 * create a lecture block, add a coach and two participants.<br>
 * The coach login in, see the interceptor to start the roll call.
 * It starts the roll call, set an absence and close.<br>
 * The participant with an absence log in, use the lectures user's
 * tool to see that it has an absence.<br>
 * The absence management has the following settings: holding partial
 * lecture is disable, cancel status of lectures is disabled, authorized
 * absence are enabled with them as default authorized, teachers can
 * authorized absences.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void lecturesRollCall_defaultAuthorizedAbsence(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
    // configure the lectures module
    loginPage.loginAs("administrator", "openolat").resume();
    new NavigationPage(browser).openAdministration().openLecturesSettings().configure(false, false, true, true, true).save();
    // start the test with authorized absence on
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO participant1 = new UserRestClient(deploymentUrl).createRandomUser("Kanu");
    UserVO participant2 = new UserRestClient(deploymentUrl).createRandomUser("Rymou");
    LoginPage.getLoginPage(browser, deploymentUrl).loginAs(author.getLogin(), author.getPassword());
    // go to authoring
    AuthoringEnvPage authoringEnv = navBar.assertOnNavigationPage().openAuthoringEnvironment();
    String title = "Lecture " + UUID.randomUUID();
    // create course
    authoringEnv.openCreateDropDown().clickCreate(ResourceType.course).fillCreateForm(title).assertOnGeneralTab().clickToolbarBack();
    // set access
    CoursePageFragment course = new CoursePageFragment(browser);
    course.accessConfiguration().setUserAccess(UserAccess.registred).clickToolbarBack();
    // add a coach
    course.members().addMember().searchMember(author, true).nextUsers().nextOverview().selectRepositoryEntryRole(false, true, false).nextPermissions().finish();
    // add the participants
    course.members().importMembers().setMembers(participant1, participant2).nextUsers().nextOverview().nextPermissions().finish();
    // enable the lectures
    LectureRepositoryAdminPage lecturesAdmin = course.lecturesAdministration();
    lecturesAdmin.settings().enableLectures().overrideDefaultSettings().saveSettings();
    LectureRepositoryAdminListPage lectureList = lecturesAdmin.lectureList();
    Calendar cal = Calendar.getInstance();
    int today = cal.get(Calendar.DATE);
    int hour = cal.get(Calendar.HOUR_OF_DAY);
    String lectureTitle = "1. Lecture";
    lectureList.newLectureBlock().setTitle(lectureTitle).setTeacher(author).setDate(today, hour, 0, hour, 59).save();
    // coach at work
    LoginPage coachLoginPage = LoginPage.getLoginPage(browser, deploymentUrl);
    coachLoginPage.loginAs(author);
    new RollCallInterceptorPage(browser).start().setAbsence(participant1, "1").closeRollCall().confirmCloseRollCall().assertOnClosedTable();
    // participant check it roll call
    LoginPage participantLoginPage = LoginPage.getLoginPage(browser, deploymentUrl);
    participantLoginPage.loginAs(participant1).resume();
    UserToolsPage participantUserTools = new UserToolsPage(browser);
    participantUserTools.openUserToolsMenu().openLectures().assertOnParticipantLecturesList().selectCourseAsParticipant(title).assertOnParticipantLectureBlocks().assertOnParticipantLectureBlockAuthorised(author, lectureTitle, title);
}
Also used : RollCallInterceptorPage(org.olat.selenium.page.lecture.RollCallInterceptorPage) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) Calendar(java.util.Calendar) LoginPage(org.olat.selenium.page.LoginPage) UserRestClient(org.olat.test.rest.UserRestClient) LectureRepositoryAdminPage(org.olat.selenium.page.lecture.LectureRepositoryAdminPage) UserToolsPage(org.olat.selenium.page.user.UserToolsPage) NavigationPage(org.olat.selenium.page.NavigationPage) UserVO(org.olat.user.restapi.UserVO) AuthoringEnvPage(org.olat.selenium.page.repository.AuthoringEnvPage) LectureRepositoryAdminListPage(org.olat.selenium.page.lecture.LectureRepositoryAdminListPage) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 17 with AuthoringEnvPage

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

the class UserTest method loginInHomeWithLandingPage.

/**
 * An user configures its landing page, log out
 * and try it.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void loginInHomeWithLandingPage(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
    // create a random user
    UserRestClient userClient = new UserRestClient(deploymentUrl);
    UserVO user = userClient.createAuthor();
    loginPage.assertOnLoginPage().loginAs(user.getLogin(), user.getPassword());
    UserToolsPage userTools = new UserToolsPage(browser);
    userTools.openUserToolsMenu().openMySettings().openPreferences().setResume(ResumeOption.none).setLandingPage("/RepositorySite/0/Search/0");
    userTools.logout();
    loginPage.assertOnLoginPage().loginAs(user.getLogin(), user.getPassword());
    new AuthoringEnvPage(browser).assertOnGenericSearch();
}
Also used : UserToolsPage(org.olat.selenium.page.user.UserToolsPage) UserVO(org.olat.user.restapi.UserVO) AuthoringEnvPage(org.olat.selenium.page.repository.AuthoringEnvPage) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 18 with AuthoringEnvPage

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

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

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

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)

Example 20 with AuthoringEnvPage

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

the class CourseElementTest method createCourseWithMemberList.

/**
 * An author create a course with a member list course element.
 * It add two participants and a coach. It publish the course and
 * check that it sees the authors, coaches and participants.<br>
 * After that, it edits the course and change the settins to only
 * show the participants. It checks that only the participants are
 * visible.<br>
 * At least, it changes the settings a second time to only show
 * the course coaches.
 *
 * @param authorLoginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void createCourseWithMemberList(@InitialPage LoginPage authorLoginPage) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO coach = new UserRestClient(deploymentUrl).createRandomUser("Rei");
    UserVO participant1 = new UserRestClient(deploymentUrl).createRandomUser("Kanu");
    UserVO participant2 = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    // go to authoring
    AuthoringEnvPage authoringEnv = navBar.assertOnNavigationPage().openAuthoringEnvironment();
    String title = "Course partilist " + UUID.randomUUID();
    // create course
    authoringEnv.openCreateDropDown().clickCreate(ResourceType.course).fillCreateForm(title).assertOnGeneralTab().clickToolbarBack();
    // add 2 participants
    CoursePageFragment course = new CoursePageFragment(browser);
    MembersPage members = course.members();
    members.importMembers().setMembers(participant1, participant2).nextUsers().nextOverview().nextPermissions().finish();
    // add a coach
    course.members().addMember().searchMember(coach, true).nextUsers().nextOverview().selectRepositoryEntryRole(false, true, false).nextPermissions().finish();
    members.clickToolbarBack();
    String memberListTitle = "MemberList";
    // open course editor
    CourseEditorPageFragment editor = course.assertOnCoursePage().assertOnTitle(title).openToolsMenu().edit().createNode("cmembers").nodeTitle(memberListTitle);
    // publish
    editor.publish().quickPublish(UserAccess.registred);
    editor.clickToolbarBack();
    course.clickTree().selectWithTitle(memberListTitle);
    // check the default configuration with authors, coaches and participants
    MemberListPage memberList = new MemberListPage(browser);
    memberList.assertOnOwner(author.getFirstName()).assertOnCoach(coach.getFirstName()).assertOnParticipant(participant1.getFirstName()).assertOnParticipant(participant2.getFirstName());
    // the author is not satisfied with the configuration
    editor = course.openToolsMenu().edit().selectNode(memberListTitle);
    MemberListConfigurationPage memberListConfig = new MemberListConfigurationPage(browser);
    memberListConfig.selectSettings().setOwners(Boolean.FALSE).setCoaches(Boolean.FALSE).save();
    // go check the results
    course = editor.autoPublish();
    course.clickTree().selectWithTitle(memberListTitle);
    memberList.assertOnMembers().assertOnNotOwner(author.getFirstName()).assertOnNotCoach(coach.getFirstName()).assertOnParticipant(participant1.getFirstName()).assertOnParticipant(participant2.getFirstName());
    // perhaps only the coaches
    editor = course.openToolsMenu().edit().selectNode(memberListTitle);
    memberListConfig = new MemberListConfigurationPage(browser);
    memberListConfig.selectSettings().setCoaches(Boolean.TRUE).setCourseCoachesOnly().setParticipants(Boolean.FALSE).save();
    // go check that we see only the coaches results
    course = editor.autoPublish();
    course.clickTree().selectWithTitle(memberListTitle);
    memberList.assertOnMembers().assertOnNotOwner(author.getFirstName()).assertOnCoach(coach.getFirstName()).assertOnNotParticipant(participant1.getFirstName()).assertOnNotParticipant(participant2.getFirstName());
}
Also used : MemberListPage(org.olat.selenium.page.course.MemberListPage) 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) MemberListConfigurationPage(org.olat.selenium.page.course.MemberListConfigurationPage) MembersPage(org.olat.selenium.page.course.MembersPage) 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