Search in sources :

Example 41 with CourseEditorPageFragment

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

the class AssessmentTest method qti12CourseWithAssessment.

/**
 * An author upload a test, create a course with a test course
 * element, publish the course, assign the course to a student.
 * The student come to pass the test, logout after passing it.
 * The author check if the test of the student is passed in the
 * assessment tool.
 *
 * @param authorLoginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void qti12CourseWithAssessment(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver ryomouBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
    // upload a test
    String qtiTestTitle = "QTI-Test-1.2-" + UUID.randomUUID();
    URL qtiTestUrl = JunitTestHelper.class.getResource("file_resources/e4_test.zip");
    File qtiTestFile = new File(qtiTestUrl.toURI());
    navBar.openAuthoringEnvironment().uploadResource(qtiTestTitle, qtiTestFile);
    // create a course
    String courseTitle = "Course-With-QTI-Test-1.2-" + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    // create a course element of type CP with the CP that we create above
    String testNodeTitle = "Test-QTI-1.2";
    CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
    courseEditor.createNode("iqtest").nodeTitle(testNodeTitle).selectTabLearnContent().chooseTest(qtiTestTitle);
    // publish the course
    courseEditor.publish().quickPublish(UserAccess.membersOnly);
    // open the course and see the test start page
    CoursePageFragment courseRuntime = courseEditor.clickToolbarBack();
    courseRuntime.clickTree().selectWithTitle(testNodeTitle);
    // check that the title of the start page of test is correct
    WebElement testH2 = browser.findElement(By.cssSelector("div.o_course_run h2"));
    Assert.assertEquals(testNodeTitle, testH2.getText().trim());
    // add Ryomou as a course member
    courseRuntime.members().addMember().searchMember(ryomou, true).nextUsers().nextOverview().nextPermissions().finish();
    // Ryomou open the course
    LoginPage ryomouLoginPage = LoginPage.getLoginPage(ryomouBrowser, deploymentUrl);
    ryomouLoginPage.loginAs(ryomou.getLogin(), ryomou.getPassword()).resume();
    // open the course
    NavigationPage ryomouNavBar = new NavigationPage(ryomouBrowser);
    ryomouNavBar.openMyCourses().select(courseTitle);
    // go to the test
    CoursePageFragment ryomouTestCourse = new CoursePageFragment(ryomouBrowser);
    ryomouTestCourse.clickTree().selectWithTitle(testNodeTitle);
    // start the test
    QTI12Page testPage = QTI12Page.getQTI12Page(ryomouBrowser);
    testPage.start().selectItem("Single choice").answerSingleChoice("Correct answer").saveAnswer().selectItem("Multiple choice").answerMultipleChoice("Correct answer", "The answer is correct").saveAnswer().selectItem("Kprim").answerKPrim(true, false, true, false).saveAnswer().selectItem("Fill-in").answerFillin("not").saveAnswer();
    testPage.endTest();
    // check results page
    By resultsBy = By.id("o_qti_results");
    OOGraphene.waitElement(resultsBy, ryomouBrowser);
    WebElement resultsEl = ryomouBrowser.findElement(resultsBy);
    Assert.assertTrue(resultsEl.getText().contains(ryomou.getFirstName()));
    // close the test
    testPage.closeTest();
    // all answers are correct -> passed
    WebElement passedEl = ryomouBrowser.findElement(By.cssSelector("tr.o_state.o_passed"));
    Assert.assertTrue(passedEl.isDisplayed());
    // log out
    UserToolsPage roymouUserTools = new UserToolsPage(ryomouBrowser);
    roymouUserTools.logout();
    // author take the lead and check the assessment tool
    navBar.openMyCourses().select(courseTitle);
    // open the assessment tool
    AssessmentToolPage assessmentTool = new CoursePageFragment(browser).assessmentTool();
    assessmentTool.users().assertOnUsers(ryomou).selectUser(ryomou).assertPassed(ryomou);
}
Also used : QTI12Page(org.olat.selenium.page.qti.QTI12Page) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) WebElement(org.openqa.selenium.WebElement) URL(java.net.URL) LoginPage(org.olat.selenium.page.LoginPage) UserRestClient(org.olat.test.rest.UserRestClient) CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserToolsPage(org.olat.selenium.page.user.UserToolsPage) UserVO(org.olat.user.restapi.UserVO) NavigationPage(org.olat.selenium.page.NavigationPage) By(org.openqa.selenium.By) AssessmentToolPage(org.olat.selenium.page.course.AssessmentToolPage) File(java.io.File) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 42 with CourseEditorPageFragment

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

the class ImsQTI21Test method qti21Course_suspend.

/**
 * Upload a test in QTI 2.1 format, create a course, bind
 * the test in a course element, customize the options
 * with full window mode, allow suspending the test,
 * show scores and assessment results.<br>
 * Then run it and at the middle of the test, suspend it, log out.
 * Return with resume to the course and resume the test, finish it
 * and check if the assessment results appears after
 * closing the test and on the start page of the test course element.
 *
 * @param authorLoginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void qti21Course_suspend(@InitialPage LoginPage authorLoginPage) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    // upload a test
    String qtiTestTitle = "No skipping QTI 2.1 " + UUID.randomUUID();
    URL qtiTestUrl = JunitTestHelper.class.getResource("file_resources/qti21/test_4_no_skipping.zip");
    File qtiTestFile = new File(qtiTestUrl.toURI());
    navBar.openAuthoringEnvironment().uploadResource(qtiTestTitle, qtiTestFile);
    // create a course
    String courseTitle = "Course QTI 2.1 " + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    String testNodeTitle = "QTI21Test-1";
    // create a course element of type CP with the CP that we create above
    CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
    courseEditor.createNode("iqtest").nodeTitle(testNodeTitle).selectTabLearnContent().chooseTest(qtiTestTitle);
    QTI21ConfigurationCEPage configPage = new QTI21ConfigurationCEPage(browser);
    configPage.selectLayoutConfiguration().overrideConfiguration().fullWindow().saveLayoutConfiguration();
    configPage.selectConfiguration().showScoreOnHomepage(true).showResultsOnHomepage(Boolean.TRUE, QTI21AssessmentResultsOptions.allOptions()).saveConfiguration().selectLayoutConfiguration().overrideConfiguration().enableSuspend().saveLayoutConfiguration();
    // publish the course
    courseEditor.publish().quickPublish();
    // open the course and see the CP
    CoursePageFragment course = courseEditor.clickToolbarBack();
    course.clickTree().selectWithTitle(testNodeTitle);
    // check that the title of the start page of test is correct
    WebElement testH2 = browser.findElement(By.cssSelector("div.o_course_run h2"));
    Assert.assertEquals(testNodeTitle, testH2.getText().trim());
    QTI21Page qtiPage = QTI21Page.getQTI12Page(browser);
    qtiPage.start().answerSingleChoiceWithParagraph("Correct").saveAnswer().answerMultipleChoice("Correct").saveAnswer().suspendTest();
    // log out
    new UserToolsPage(browser).logout();
    // return
    authorLoginPage.loginAs(author.getLogin(), author.getPassword()).resume();
    // resume the course, resume the test
    qtiPage = QTI21Page.getQTI12Page(browser);
    qtiPage.start().assertOnAssessmentItem("Kprim").answerCorrectKPrim("True", "Right").answerIncorrectKPrim("False", "Wrong").saveAnswer().answerGapText("43", "_RESPONSE_1").saveAnswer().endTest().assertOnAssessmentResults().assertOnAssessmentTestMaxScore(4).assertOnAssessmentTestScore(4).assertOnAssessmentTestPassed().closeAssessmentResults();
    // check the result on the start page
    qtiPage.assertOnCourseAssessmentTestScore(4).assertOnCourseAttempts(1);
}
Also used : CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserToolsPage(org.olat.selenium.page.user.UserToolsPage) UserVO(org.olat.user.restapi.UserVO) QTI21ConfigurationCEPage(org.olat.selenium.page.qti.QTI21ConfigurationCEPage) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) WebElement(org.openqa.selenium.WebElement) 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 43 with CourseEditorPageFragment

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

the class ImsQTI21Test method qti21Course_lmsHidden_results.

/**
 * Upload a test in QTI 2.1 format, create a course, bind
 * the test in a course element, customize the options
 * with full window mode, show scores and assessment results.
 * Then run it and check if the assessment results appears after
 * closing the test and on the start page of the test course element.
 *
 * @param authorLoginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void qti21Course_lmsHidden_results(@InitialPage LoginPage authorLoginPage) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    // upload a test
    String qtiTestTitle = "Simple QTI 2.1 " + UUID.randomUUID();
    URL qtiTestUrl = JunitTestHelper.class.getResource("file_resources/qti21/simple_QTI_21_test.zip");
    File qtiTestFile = new File(qtiTestUrl.toURI());
    navBar.openAuthoringEnvironment().uploadResource(qtiTestTitle, qtiTestFile);
    // create a course
    String courseTitle = "Course QTI 2.1 " + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    String testNodeTitle = "QTI21Test-1";
    // create a course element of type CP with the CP that we create above
    CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
    courseEditor.createNode("iqtest").nodeTitle(testNodeTitle).selectTabLearnContent().chooseTest(qtiTestTitle);
    QTI21ConfigurationCEPage configPage = new QTI21ConfigurationCEPage(browser);
    configPage.selectLayoutConfiguration().overrideConfiguration().fullWindow().saveLayoutConfiguration();
    configPage.selectConfiguration().showScoreOnHomepage(true).showResultsOnHomepage(Boolean.TRUE, QTI21AssessmentResultsOptions.allOptions()).saveConfiguration();
    // publish the course
    courseEditor.publish().quickPublish();
    // open the course and see the CP
    CoursePageFragment course = courseEditor.clickToolbarBack();
    course.clickTree().selectWithTitle(testNodeTitle);
    // check that the title of the start page of test is correct
    WebElement testH2 = browser.findElement(By.cssSelector("div.o_course_run h2"));
    Assert.assertEquals(testNodeTitle, testH2.getText().trim());
    QTI21Page qtiPage = QTI21Page.getQTI12Page(browser);
    qtiPage.start().answerSingleChoiceWithParagraph("Right").saveAnswer().endTest().assertOnAssessmentResults().closeAssessmentResults().assertOnCourseAttempts(1).assertOnCourseAssessmentTestScore(1).assertOnAssessmentResults();
}
Also used : CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserVO(org.olat.user.restapi.UserVO) QTI21ConfigurationCEPage(org.olat.selenium.page.qti.QTI21ConfigurationCEPage) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) WebElement(org.openqa.selenium.WebElement) 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 44 with CourseEditorPageFragment

use of org.olat.selenium.page.course.CourseEditorPageFragment in project OpenOLAT by OpenOLAT.

the class ImsQTI21Test method qti21Course_suspend.

/**
 * Upload a test in QTI 2.1 format, create a course, bind
 * the test in a course element, customize the options
 * with full window mode, allow suspending the test,
 * show scores and assessment results.<br>
 * Then run it and at the middle of the test, suspend it, log out.
 * Return with resume to the course and resume the test, finish it
 * and check if the assessment results appears after
 * closing the test and on the start page of the test course element.
 *
 * @param authorLoginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void qti21Course_suspend(@InitialPage LoginPage authorLoginPage) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    // upload a test
    String qtiTestTitle = "No skipping QTI 2.1 " + UUID.randomUUID();
    URL qtiTestUrl = JunitTestHelper.class.getResource("file_resources/qti21/test_4_no_skipping.zip");
    File qtiTestFile = new File(qtiTestUrl.toURI());
    navBar.openAuthoringEnvironment().uploadResource(qtiTestTitle, qtiTestFile);
    // create a course
    String courseTitle = "Course QTI 2.1 " + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    String testNodeTitle = "QTI21Test-1";
    // create a course element of type CP with the CP that we create above
    CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
    courseEditor.createNode("iqtest").nodeTitle(testNodeTitle).selectTabLearnContent().chooseTest(qtiTestTitle);
    QTI21ConfigurationCEPage configPage = new QTI21ConfigurationCEPage(browser);
    configPage.selectLayoutConfiguration().overrideConfiguration().fullWindow().saveLayoutConfiguration();
    configPage.selectConfiguration().showScoreOnHomepage(true).showResultsOnHomepage(Boolean.TRUE, QTI21AssessmentResultsOptions.allOptions()).saveConfiguration().selectLayoutConfiguration().overrideConfiguration().enableSuspend().saveLayoutConfiguration();
    // publish the course
    courseEditor.publish().quickPublish();
    // open the course and see the CP
    CoursePageFragment course = courseEditor.clickToolbarBack();
    course.clickTree().selectWithTitle(testNodeTitle);
    // check that the title of the start page of test is correct
    WebElement testH2 = browser.findElement(By.cssSelector("div.o_course_run h2"));
    Assert.assertEquals(testNodeTitle, testH2.getText().trim());
    QTI21Page qtiPage = QTI21Page.getQTI12Page(browser);
    qtiPage.start().answerSingleChoiceWithParagraph("Correct").saveAnswer().answerMultipleChoice("Correct").saveAnswer().suspendTest();
    // log out
    new UserToolsPage(browser).logout();
    // return
    authorLoginPage.loginAs(author.getLogin(), author.getPassword()).resume();
    // resume the course, resume the test
    qtiPage = QTI21Page.getQTI12Page(browser);
    qtiPage.start().assertOnAssessmentItem("Kprim").answerCorrectKPrim("True", "Right").answerIncorrectKPrim("False", "Wrong").saveAnswer().answerGapText("43", "_RESPONSE_1").saveAnswer().endTest().assertOnAssessmentResults().assertOnAssessmentTestMaxScore(4).assertOnAssessmentTestScore(4).assertOnAssessmentTestPassed().closeAssessmentResults();
    // check the result on the start page
    qtiPage.assertOnCourseAssessmentTestScore(4).assertOnCourseAttempts(1);
}
Also used : CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserToolsPage(org.olat.selenium.page.user.UserToolsPage) UserVO(org.olat.user.restapi.UserVO) QTI21ConfigurationCEPage(org.olat.selenium.page.qti.QTI21ConfigurationCEPage) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) WebElement(org.openqa.selenium.WebElement) 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 45 with CourseEditorPageFragment

use of org.olat.selenium.page.course.CourseEditorPageFragment in project OpenOLAT by OpenOLAT.

the class ImsQTI21Test method qti21Course.

/**
 * Upload a test in QTI 2.1 format, create a course, bind
 * the test in a course element, run it and check if
 * the attempt go up.
 *
 * @param authorLoginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void qti21Course(@InitialPage LoginPage authorLoginPage) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    // upload a test
    String qtiTestTitle = "Simple QTI 2.1 " + UUID.randomUUID();
    URL qtiTestUrl = JunitTestHelper.class.getResource("file_resources/qti21/simple_QTI_21_test.zip");
    File qtiTestFile = new File(qtiTestUrl.toURI());
    navBar.openAuthoringEnvironment().uploadResource(qtiTestTitle, qtiTestFile);
    // create a course
    String courseTitle = "Course QTI 2.1 " + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    String testNodeTitle = "QTI21Test-1";
    // create a course element of type CP with the CP that we create above
    CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
    courseEditor.createNode("iqtest").nodeTitle(testNodeTitle).selectTabLearnContent().chooseTest(qtiTestTitle);
    QTI21ConfigurationCEPage configPage = new QTI21ConfigurationCEPage(browser);
    configPage.selectConfiguration().showScoreOnHomepage(true).saveConfiguration();
    // publish the course
    courseEditor.publish().quickPublish();
    // open the course and see the CP
    CoursePageFragment course = courseEditor.clickToolbarBack();
    course.clickTree().selectWithTitle(testNodeTitle);
    // check that the title of the start page of test is correct
    WebElement testH2 = browser.findElement(By.cssSelector("div.o_course_run h2"));
    Assert.assertEquals(testNodeTitle, testH2.getText().trim());
    QTI21Page qtiPage = QTI21Page.getQTI12Page(browser);
    qtiPage.start().answerSingleChoiceWithParagraph("Right").saveAnswer().endTest().assertOnCourseAttempts(1).assertOnCourseAssessmentTestScore(1);
}
Also used : CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserVO(org.olat.user.restapi.UserVO) QTI21ConfigurationCEPage(org.olat.selenium.page.qti.QTI21ConfigurationCEPage) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) WebElement(org.openqa.selenium.WebElement) 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)

Aggregations

RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)86 Test (org.junit.Test)86 CourseEditorPageFragment (org.olat.selenium.page.course.CourseEditorPageFragment)86 UserRestClient (org.olat.test.rest.UserRestClient)84 UserVO (org.olat.user.restapi.UserVO)84 CoursePageFragment (org.olat.selenium.page.course.CoursePageFragment)80 NavigationPage (org.olat.selenium.page.NavigationPage)44 LoginPage (org.olat.selenium.page.LoginPage)40 MembersPage (org.olat.selenium.page.course.MembersPage)30 WebElement (org.openqa.selenium.WebElement)30 URL (java.net.URL)24 File (java.io.File)22 UserToolsPage (org.olat.selenium.page.user.UserToolsPage)16 AuthoringEnvPage (org.olat.selenium.page.repository.AuthoringEnvPage)14 AssessmentCEConfigurationPage (org.olat.selenium.page.course.AssessmentCEConfigurationPage)10 AssessmentToolPage (org.olat.selenium.page.course.AssessmentToolPage)10 By (org.openqa.selenium.By)10 EnrollmentConfigurationPage (org.olat.selenium.page.course.EnrollmentConfigurationPage)8 EnrollmentPage (org.olat.selenium.page.course.EnrollmentPage)8 GroupPage (org.olat.selenium.page.group.GroupPage)8