Search in sources :

Example 51 with QTI21Page

use of org.olat.selenium.page.qti.QTI21Page in project OpenOLAT by OpenOLAT.

the class ImsQTI21EditorTest method qti21EditorSingleChoices.

/**
 * Test different settings in the single choice editor. An author
 * make a test with 2 single choices, one with score all answer correct,
 * the second with score per answer and feedbacks.<br>
 * A second user make the test and check the score at the end of
 * the test.
 *
 * @param authorLoginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void qti21EditorSingleChoices(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver ryomouBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    String qtiTestTitle = "Choices QTI 2.1 " + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createQTI21Test(qtiTestTitle).clickToolbarBack();
    QTI21Page qtiPage = QTI21Page.getQTI12Page(browser);
    QTI21EditorPage qtiEditor = qtiPage.edit();
    // start a blank test
    qtiEditor.selectNode("Single choice").deleteNode();
    // add a single choice: all answers score
    QTI21SingleChoiceEditorPage scEditor = qtiEditor.addSingleChoice();
    scEditor.setAnswer(0, "Wrong").addChoice(1).setCorrect(1).setAnswer(1, "Correct").addChoice(2).setAnswer(2, "Faux").addChoice(3).setAnswer(3, "Falsch").save();
    // change max score
    scEditor.selectScores().setMaxScore("3").save();
    // set some feedbacks
    scEditor.selectFeedbacks().setHint("Hint", "This is only an hint").setCorrectSolution("Correct solution", "This is the correct solution").setCorrectFeedback("Correct feedback", "This is correct").setIncorrectFeedback("Incorrect", "Your answer is not correct").save();
    // score per answers
    scEditor = qtiEditor.addSingleChoice().setAnswer(0, "AlmostRight").addChoice(1).setAnswer(1, "NotRight").addChoice(2).setCorrect(2).setAnswer(2, "RightAnswer").addChoice(3).setAnswer(3, "TheWrongOne").save();
    scEditor.selectScores().setMaxScore("2").selectAssessmentMode(ScoreEvaluation.perAnswer).setScore("Almost", "1").setScore("NotRight", "0").setScore("RightAnswer", "2").setScore("TheWrongOne", "0").save();
    scEditor.selectFeedbacks().setHint("Hint", "The hint").setCorrectSolution("Correct solution", "This is the correct solution").setCorrectFeedback("Correct feedback", "This is correct").setIncorrectFeedback("Incorrect", "Your answer is not correct").save();
    qtiPage.clickToolbarBack();
    // access to all
    qtiPage.accessConfiguration().setUserAccess(UserAccess.guest).clickToolbarBack();
    // show results
    qtiPage.options().showResults(Boolean.TRUE, QTI21AssessmentResultsOptions.allOptions()).save();
    // a user search the content package
    LoginPage userLoginPage = LoginPage.getLoginPage(ryomouBrowser, deploymentUrl);
    userLoginPage.loginAs(ryomou.getLogin(), ryomou.getPassword()).resume();
    NavigationPage userNavBar = new NavigationPage(ryomouBrowser);
    userNavBar.openMyCourses().openSearch().extendedSearch(qtiTestTitle).select(qtiTestTitle).start();
    // make the test
    QTI21Page ryomouQtiPage = QTI21Page.getQTI12Page(ryomouBrowser);
    ryomouQtiPage.assertOnAssessmentItem().answerSingleChoiceWithParagraph("Falsch").saveAnswer().assertFeedback("Incorrect").assertCorrectSolution("Correct solution").hint().assertFeedback("Hint").answerSingleChoiceWithParagraph("Correct").saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerSingleChoiceWithParagraph("Almost").saveAnswer().assertCorrectSolution("Correct solution").assertFeedback("Incorrect").endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// 3 points from the first question, 1 from the second
    4);
}
Also used : QTI21EditorPage(org.olat.selenium.page.qti.QTI21EditorPage) QTI21SingleChoiceEditorPage(org.olat.selenium.page.qti.QTI21SingleChoiceEditorPage) UserVO(org.olat.user.restapi.UserVO) NavigationPage(org.olat.selenium.page.NavigationPage) LoginPage(org.olat.selenium.page.LoginPage) 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 52 with QTI21Page

use of org.olat.selenium.page.qti.QTI21Page in project OpenOLAT by OpenOLAT.

the class ImsQTI21Test method qti21TestFlow_timeLimits_results.

/**
 * Test with time limit and wait for the results at the end.
 *
 * @param authorLoginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void qti21TestFlow_timeLimits_results(@InitialPage LoginPage authorLoginPage) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    // upload a test
    String qtiTestTitle = "Timed QTI 2.1 " + UUID.randomUUID();
    URL qtiTestUrl = JunitTestHelper.class.getResource("file_resources/qti21/test_time_limits.zip");
    File qtiTestFile = new File(qtiTestUrl.toURI());
    navBar.openAuthoringEnvironment().uploadResource(qtiTestTitle, qtiTestFile).clickToolbarRootCrumb();
    QTI21Page qtiPage = QTI21Page.getQTI12Page(browser);
    qtiPage.options().showResults(Boolean.TRUE, new QTI21AssessmentResultsOptions(true, true, false, false, false)).save();
    // check simple time limit
    qtiPage.clickToolbarBack().assertOnAssessmentItem("Single choice").answerSingleChoiceWithParagraph("Correct answer").saveAnswer().assertOnAssessmentItem("Last choice").answerSingleChoiceWithParagraph("True").saveAnswer().assertOnAssessmentResults(15).assertOnAssessmentTestPassed().assertOnAssessmentTestMaxScore(2).assertOnAssessmentTestScore(2);
}
Also used : UserVO(org.olat.user.restapi.UserVO) File(java.io.File) URL(java.net.URL) QTI21AssessmentResultsOptions(org.olat.ims.qti21.QTI21AssessmentResultsOptions) 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 53 with QTI21Page

use of org.olat.selenium.page.qti.QTI21Page in project OpenOLAT by OpenOLAT.

the class ImsQTI21Test method qti21TestFlow_parts_feedbacks.

/**
 * Test with 2 parts and test feedbacks.
 *
 * @param authorLoginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void qti21TestFlow_parts_feedbacks(@InitialPage LoginPage authorLoginPage) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    // upload a test
    String qtiTestTitle = "With parts QTI 2.1 " + UUID.randomUUID();
    URL qtiTestUrl = JunitTestHelper.class.getResource("file_resources/qti21/test_with_parts_and_test_feedbacks.zip");
    File qtiTestFile = new File(qtiTestUrl.toURI());
    navBar.openAuthoringEnvironment().uploadResource(qtiTestTitle, qtiTestFile).clickToolbarRootCrumb();
    QTI21Page qtiPage = QTI21Page.getQTI12Page(browser);
    qtiPage.startTestPart().selectItem("First question").assertOnAssessmentItem("First question").answerSingleChoiceWithParagraph("Correct answer").saveAnswer().assertOnAssessmentItem("Second question").answerMultipleChoice("Valid answer").saveAnswer().endTestPart().selectItem("Third question").assertOnAssessmentItem("Third question").answerSingleChoiceWithParagraph("Right").saveAnswer().answerSingleChoiceWithParagraph("Good").saveAnswer().endTestPart().assertOnAssessmentTestFeedback("Well done").closeTest().assertOnAssessmentTestTerminated();
}
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 54 with QTI21Page

use of org.olat.selenium.page.qti.QTI21Page 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 55 with QTI21Page

use of org.olat.selenium.page.qti.QTI21Page in project OpenOLAT by OpenOLAT.

the class ImsQTI21Test method qti21TestFlow_timeLimits.

/**
 * Test with time limit.
 *
 * @param authorLoginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void qti21TestFlow_timeLimits(@InitialPage LoginPage authorLoginPage) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    // upload a test
    String qtiTestTitle = "Timed QTI 2.1 " + UUID.randomUUID();
    URL qtiTestUrl = JunitTestHelper.class.getResource("file_resources/qti21/test_time_limits.zip");
    File qtiTestFile = new File(qtiTestUrl.toURI());
    navBar.openAuthoringEnvironment().uploadResource(qtiTestTitle, qtiTestFile).clickToolbarRootCrumb();
    QTI21Page qtiPage = QTI21Page.getQTI12Page(browser);
    // check simple time limit
    qtiPage.assertOnAssessmentItem("Single choice").answerSingleChoiceWithParagraph("Correct answer").saveAnswer().assertOnAssessmentItem("Last choice").answerSingleChoiceWithParagraph("True").saveAnswer().assertOnAssessmentTestTerminated(15);
}
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)

Aggregations

RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)96 Test (org.junit.Test)96 QTI21Page (org.olat.selenium.page.qti.QTI21Page)96 UserRestClient (org.olat.test.rest.UserRestClient)96 UserVO (org.olat.user.restapi.UserVO)96 File (java.io.File)60 URL (java.net.URL)60 QTI21EditorPage (org.olat.selenium.page.qti.QTI21EditorPage)46 LoginPage (org.olat.selenium.page.LoginPage)40 NavigationPage (org.olat.selenium.page.NavigationPage)40 QTI21MatchEditorPage (org.olat.selenium.page.qti.QTI21MatchEditorPage)10 QTI21MultipleChoiceEditorPage (org.olat.selenium.page.qti.QTI21MultipleChoiceEditorPage)8 QTI21SingleChoiceEditorPage (org.olat.selenium.page.qti.QTI21SingleChoiceEditorPage)8 CourseEditorPageFragment (org.olat.selenium.page.course.CourseEditorPageFragment)6 CoursePageFragment (org.olat.selenium.page.course.CoursePageFragment)6 QTI21ConfigurationCEPage (org.olat.selenium.page.qti.QTI21ConfigurationCEPage)6 QTI21GapEntriesEditorPage (org.olat.selenium.page.qti.QTI21GapEntriesEditorPage)6 QTI21HotspotEditorPage (org.olat.selenium.page.qti.QTI21HotspotEditorPage)6 QTI21LobEditorPage (org.olat.selenium.page.qti.QTI21LobEditorPage)6 WebElement (org.openqa.selenium.WebElement)6