Search in sources :

Example 71 with RunAsClient

use of org.jboss.arquillian.container.test.api.RunAsClient in project OpenOLAT by OpenOLAT.

the class ImsQTI21InteractionsTest method qti21InlineChoiceInteraction.

/**
 * Check if the position object interaction returns 3 points
 * if answered correctly.
 *
 * @param authorLoginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void qti21InlineChoiceInteraction(@InitialPage LoginPage authorLoginPage) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    // upload a test
    String qtiTestTitle = "Inline choice QTI 2.1 " + UUID.randomUUID();
    URL qtiTestUrl = JunitTestHelper.class.getResource("file_resources/qti21/simple_QTI_21_inline_choice_ims.zip");
    File qtiTestFile = new File(qtiTestUrl.toURI());
    navBar.openAuthoringEnvironment().uploadResource(qtiTestTitle, qtiTestFile).clickToolbarRootCrumb();
    QTI21Page qtiPage = QTI21Page.getQTI12Page(browser);
    qtiPage.options().showResults(Boolean.TRUE, QTI21AssessmentResultsOptions.allOptions()).save();
    // to the test and spot it
    qtiPage.clickToolbarBack().assertOnAssessmentItem().answerInlineChoice("Y").saveAnswer().endTest().closeTest();
    // check the results
    qtiPage.assertOnAssessmentResults().assertOnAssessmentItemScore("Richard III", 1);
}
Also used : UserVO(org.olat.user.restapi.UserVO) File(java.io.File) URL(java.net.URL) UserRestClient(org.olat.test.rest.UserRestClient) QTI21Page(org.olat.selenium.page.qti.QTI21Page) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 72 with RunAsClient

use of org.jboss.arquillian.container.test.api.RunAsClient in project OpenOLAT by OpenOLAT.

the class LecturesTest method lecturesRollCall_authorizedAbsence.

/**
 * 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.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void lecturesRollCall_authorizedAbsence(@InitialPage LoginPage loginPage, @Drone @User WebDriver coachBrowser, @Drone @Participant WebDriver participantBrowser) throws IOException, URISyntaxException {
    // configure the lectures module
    loginPage.loginAs("administrator", "openolat").resume();
    new NavigationPage(browser).openAdministration().openLecturesSettings().configure(true, true, true, false, false).save();
    // start the test with authorized absence on
    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("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(coach, 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(coach).setDate(today, hour, 0, hour, 59).save();
    // coach at work
    LoginPage coachLoginPage = LoginPage.getLoginPage(coachBrowser, deploymentUrl);
    coachLoginPage.loginAs(coach);
    new RollCallInterceptorPage(coachBrowser).start().setAbsence(participant1, "1").closeRollCall().confirmCloseRollCall().assertOnClosedTable();
    // participant check it roll call
    LoginPage participantLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
    participantLoginPage.loginAs(participant1).resume();
    UserToolsPage participantUserTools = new UserToolsPage(participantBrowser);
    participantUserTools.openUserToolsMenu().openLectures().assertOnParticipantLecturesList().selectCourseAsParticipant(title).assertOnParticipantLectureBlocks().assertOnParticipantLectureBlockAbsent(coach, 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 73 with RunAsClient

use of org.jboss.arquillian.container.test.api.RunAsClient in project OpenOLAT by OpenOLAT.

the class LecturesTest method lectureMobileRollCall_authorizedAbsence.

/**
 * 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
 * version mobile.<br>
 * 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.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void lectureMobileRollCall_authorizedAbsence(@InitialPage LoginPage loginPage, @Drone @User WebDriver coachBrowser, @Drone @User WebDriver participantBrowser) throws IOException, URISyntaxException {
    // configure the lectures module
    loginPage.loginAs("administrator", "openolat").resume();
    new NavigationPage(browser).openAdministration().openLecturesSettings().configure(true, true, true, false, false).save();
    // start the test with authorized absence on
    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("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(coach, 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 = "2.Lecture";
    lectureList.newLectureBlock().setTitle(lectureTitle).setTeacher(coach).setDate(today, hour, 0, hour, 59).save();
    // coach at work
    LoginPage coachLoginPage = LoginPage.getLoginPage(coachBrowser, deploymentUrl);
    coachLoginPage.loginAs(coach);
    new RollCallInterceptorPage(coachBrowser).startMobile().setAbsence("1").saveAndNext().setAbsence("1").setAbsence("2").saveAndNext().closeRollCall();
    // check that a roll call at least is closed
    new TeacherRollCallPage(coachBrowser).assertOnClosedTable();
    // participant check it roll call
    LoginPage participantLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
    participantLoginPage.loginAs(participant1).resume();
    UserToolsPage participantUserTools = new UserToolsPage(participantBrowser);
    participantUserTools.openUserToolsMenu().openLectures().assertOnParticipantLecturesList().selectCourseAsParticipant(title).assertOnParticipantLectureBlocks().assertOnParticipantLectureBlockAbsent(coach, 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) TeacherRollCallPage(org.olat.selenium.page.lecture.TeacherRollCallPage) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 74 with RunAsClient

use of org.jboss.arquillian.container.test.api.RunAsClient in project OpenOLAT by OpenOLAT.

the class LecturesTest method lecturesRollCall.

/**
 * An author create a course to use the absence management
 * without authorized absence.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void lecturesRollCall(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
    // configure the lectures module
    loginPage.loginAs("administrator", "openolat").resume();
    new NavigationPage(browser).openAdministration().openLecturesSettings().configure(true, true, false, false, false).save();
    // start
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO participant1 = new UserRestClient(deploymentUrl).createRandomUser("Kanu");
    UserVO participant2 = new UserRestClient(deploymentUrl).createRandomUser("Rymou");
    LoginPage authorLoginPage = LoginPage.getLoginPage(browser, deploymentUrl);
    authorLoginPage.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();
    CoursePageFragment course = new CoursePageFragment(browser);
    // add a coach
    course.members().quickAdd(author, true, true);
    // add the participants
    course.members().quickImport(participant1, participant2);
    // enable the lectures
    LectureRepositoryAdminPage lecturesAdmin = course.lecturesAdministration();
    lecturesAdmin.settings().enableLectures().overrideDefaultSettings().saveSettings();
    // add a lecture
    LectureRepositoryAdminListPage lectureList = lecturesAdmin.lectureList();
    String lectureTitle = "2.Lecture";
    lectureList.newLectureBlock().setTitle(lectureTitle).setTeacher(author).setDateOneHourBefore().save();
    // go to the lectures list as "teacher"
    LecturesRepositoryPage teachersLectures = lecturesAdmin.clickToolbarRootCrumb().lectures();
    teachersLectures.openRollCall(lectureTitle).setAbsence(participant1, "1").setAbsence(participant1, "2").setAbsence(participant1, "3").closeRollCall().confirmCloseRollCall().assertOnClosedTable();
    // go to the lecture administration in the course
    lecturesAdmin = teachersLectures.clickToolbarRootCrumb().lecturesAdministration();
    // edit the first admission to see some result
    LectureRepositoryParticipantsPage participantsAdmin = lecturesAdmin.participantList().editParticipant(participant1).firstAdmissionBack().saveParticipant().editParticipant(participant2).firstAdmissionBack().saveParticipant();
    // check
    participantsAdmin.assertOnParticipantLectureBlockAbsent(participant1, 3).assertOnParticipantLectureBlockAbsent(participant2, 0);
}
Also used : LectureRepositoryAdminPage(org.olat.selenium.page.lecture.LectureRepositoryAdminPage) NavigationPage(org.olat.selenium.page.NavigationPage) UserVO(org.olat.user.restapi.UserVO) AuthoringEnvPage(org.olat.selenium.page.repository.AuthoringEnvPage) LectureRepositoryParticipantsPage(org.olat.selenium.page.lecture.LectureRepositoryParticipantsPage) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) LecturesRepositoryPage(org.olat.selenium.page.lecture.LecturesRepositoryPage) LectureRepositoryAdminListPage(org.olat.selenium.page.lecture.LectureRepositoryAdminListPage) 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 75 with RunAsClient

use of org.jboss.arquillian.container.test.api.RunAsClient in project OpenOLAT by OpenOLAT.

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)

Aggregations

RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)878 Test (org.junit.Test)862 URL (java.net.URL)492 JBossWSTest (org.jboss.wsf.test.JBossWSTest)410 QName (javax.xml.namespace.QName)289 UserVO (org.olat.user.restapi.UserVO)260 Service (javax.xml.ws.Service)254 UserRestClient (org.olat.test.rest.UserRestClient)254 LoginPage (org.olat.selenium.page.LoginPage)116 NavigationPage (org.olat.selenium.page.NavigationPage)112 CoursePageFragment (org.olat.selenium.page.course.CoursePageFragment)102 File (java.io.File)99 QTI21Page (org.olat.selenium.page.qti.QTI21Page)96 CourseEditorPageFragment (org.olat.selenium.page.course.CourseEditorPageFragment)86 OperateOnDeployment (org.jboss.arquillian.container.test.api.OperateOnDeployment)82 WebElement (org.openqa.selenium.WebElement)78 UserToolsPage (org.olat.selenium.page.user.UserToolsPage)60 QTI21EditorPage (org.olat.selenium.page.qti.QTI21EditorPage)46 Bus (org.apache.cxf.Bus)44 HashMap (java.util.HashMap)41