use of org.olat.selenium.page.qti.QTI21Page in project openolat by klemens.
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);
}
use of org.olat.selenium.page.qti.QTI21Page in project openolat by klemens.
the class ImsQTI21Test method qti21TestFlow_noParts_feedbacksAndResults.
/**
* A test with a single part, feedback for questions and
* tests and the resource options "show results at the end
* of the test".
*
* @param authorLoginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void qti21TestFlow_noParts_feedbacksAndResults(@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_feedbacks.zip");
File qtiTestFile = new File(qtiTestUrl.toURI());
navBar.openAuthoringEnvironment().uploadResource(qtiTestTitle, qtiTestFile);
QTI21Page qtiPage = QTI21Page.getQTI12Page(browser);
qtiPage.clickToolbarBack().options().showResults(Boolean.TRUE, QTI21AssessmentResultsOptions.allOptions()).save();
qtiPage.clickToolbarBack().assertOnAssessmentItem().answerSingleChoiceWithParagraph("Wrong answer").saveAnswer().assertFeedback("Oooops").nextAnswer().assertOnAssessmentItem("Numerical entry").answerGapText("42", "_RESPONSE_1").saveAnswer().assertFeedback("Ok").endTest().assertOnAssessmentTestFeedback("Not for the best").closeTest().assertOnAssessmentTestMaxScore(2).assertOnAssessmentTestScore(1).assertOnAssessmentTestNotPassed();
}
use of org.olat.selenium.page.qti.QTI21Page 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);
}
use of org.olat.selenium.page.qti.QTI21Page in project openolat by klemens.
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();
}
use of org.olat.selenium.page.qti.QTI21Page in project openolat by klemens.
the class ImsQTI21Test method qti21TestFlow_noParts_noFeedbacks.
/**
* Test the flow of the simplest possible test with our
* optimization (jump automatically to the next question,
* jump automatically the close test). The test has one
* part and 2 questions, no feedbacks, no review allowed...
*
* @param authorLoginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void qti21TestFlow_noParts_noFeedbacks(@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_without_feedbacks.zip");
File qtiTestFile = new File(qtiTestUrl.toURI());
navBar.openAuthoringEnvironment().uploadResource(qtiTestTitle, qtiTestFile).clickToolbarRootCrumb();
QTI21Page qtiPage = QTI21Page.getQTI12Page(browser);
qtiPage.assertOnAssessmentItem().answerSingleChoiceWithParagraph("Incorrect response").saveAnswer().assertOnAssessmentItem("Second question").selectItem("First question").assertOnAssessmentItem("First question").answerSingleChoiceWithParagraph("Correct response").saveAnswer().answerMultipleChoice("Correct response").saveAnswer().endTest().assertOnAssessmentTestTerminated();
}
Aggregations