use of org.olat.selenium.page.qti.QTI21Page in project openolat by klemens.
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);
}
use of org.olat.selenium.page.qti.QTI21Page in project openolat by klemens.
the class ImsQTI21Test method qti21TestFlow_parts_noFeedbacksButResults.
/**
* 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_parts_noFeedbacksButResults(@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_parts_without_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().startTestPart().selectItem("First question").assertOnAssessmentItem("First question").answerSingleChoiceWithParagraph("Correct").saveAnswer().assertOnAssessmentItem("Second question").answerMultipleChoice("True").saveAnswer().endTestPart().selectItem("Third question").assertOnAssessmentItem("Third question").answerMultipleChoice("Correct").saveAnswer().answerCorrectKPrim("True", "Right").answerIncorrectKPrim("Wrong", "False").saveAnswer().endTestPart().assertOnAssessmentTestMaxScore(4).assertOnAssessmentTestScore(4).assertOnAssessmentTestPassed();
}
use of org.olat.selenium.page.qti.QTI21Page in project openolat by klemens.
the class ImsQTI21Test method qti21TestFlow_suspend.
/**
* Test suspend. An author upload a test, set "enable suspend"
* and make the test visible to registered users. A second user
* open the test, does nothing, suspends and log out (check a possible red
* screen in the next step), log in, answer 3 questions, suspends
* and log out. It log in a last time and finish the test successfully.
*
* @param authorLoginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void qti21TestFlow_suspend(@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());
// upload a test
String qtiTestTitle = "Suspend 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).clickToolbarRootCrumb();
QTI21Page qtiPage = QTI21Page.getQTI12Page(browser);
qtiPage.options().showResults(Boolean.TRUE, QTI21AssessmentResultsOptions.allOptions()).enableSuspend().save();
qtiPage.accessConfiguration().setUserAccess(UserAccess.registred).clickToolbarBack();
// check simple time limit
qtiPage.assertOnAssessmentItem("Single choice");
// 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();
QTI21Page userQtiPage = QTI21Page.getQTI12Page(ryomouBrowser);
userQtiPage.assertOnAssessmentItem("Single choice").suspendTest();
// log out
new UserToolsPage(ryomouBrowser).logout();
// log in and resume test
userLoginPage.loginAs(ryomou.getLogin(), ryomou.getPassword()).resume();
userQtiPage = QTI21Page.getQTI12Page(ryomouBrowser);
userQtiPage.assertOnAssessmentItem("Single choice").answerSingleChoiceWithParagraph("Correct").saveAnswer().answerMultipleChoice("Correct").saveAnswer().assertOnAssessmentItem("Kprim").answerCorrectKPrim("True", "Right").answerIncorrectKPrim("False", "Wrong").saveAnswer().suspendTest();
// second log out
new UserToolsPage(ryomouBrowser).logout();
// log in and resume test
userLoginPage.loginAs(ryomou.getLogin(), ryomou.getPassword()).resume();
userQtiPage = QTI21Page.getQTI12Page(ryomouBrowser);
userQtiPage.assertOnAssessmentItem("Numerical input").answerGapText("42", "_RESPONSE_1").saveAnswer().endTest().assertOnAssessmentResults().assertOnAssessmentTestMaxScore(4).assertOnAssessmentTestScore(4).assertOnAssessmentTestPassed();
}
use of org.olat.selenium.page.qti.QTI21Page in project openolat by klemens.
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);
}
use of org.olat.selenium.page.qti.QTI21Page in project openolat by klemens.
the class ImsQTI21Test method qti21TestFlow_noParts_withFeedbacks.
/**
* Test the flow of a test with questions feedbacks and test
* feedback.
*
* @param authorLoginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void qti21TestFlow_noParts_withFeedbacks(@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).clickToolbarRootCrumb();
QTI21Page qtiPage = QTI21Page.getQTI12Page(browser);
qtiPage.assertOnAssessmentItem().answerSingleChoiceWithParagraph("Wrong answer").saveAnswer().assertFeedback("Oooops").answerSingleChoiceWithParagraph("Correct answer").saveAnswer().assertFeedback("Well done").nextAnswer().assertOnAssessmentItem("Numerical entry").answerGapText("69", "_RESPONSE_1").saveAnswer().assertFeedback("Not really").answerGapText("42", "_RESPONSE_1").saveAnswer().assertFeedback("Ok").endTest().assertOnAssessmentTestFeedback("All right").closeTest().assertOnAssessmentTestTerminated();
}
Aggregations