use of org.olat.selenium.page.qti.QTI21Page in project OpenOLAT by OpenOLAT.
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 OpenOLAT.
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();
}
use of org.olat.selenium.page.qti.QTI21Page 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);
}
use of org.olat.selenium.page.qti.QTI21Page in project OpenOLAT by OpenOLAT.
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();
}
use of org.olat.selenium.page.qti.QTI21Page in project OpenOLAT by OpenOLAT.
the class ImsQTI21InteractionsTest method qti21MatchInteraction.
/**
* Check if the classic match interaction return its 3 points.
*
* @param authorLoginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void qti21MatchInteraction(@InitialPage LoginPage authorLoginPage) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
authorLoginPage.loginAs(author.getLogin(), author.getPassword());
// upload a test
String qtiTestTitle = "Match QTI 2.1 " + UUID.randomUUID();
URL qtiTestUrl = JunitTestHelper.class.getResource("file_resources/qti21/simple_QTI_21_match_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().answerMatch("Prospero", "Romeo and Juliet", true).answerMatch("Capulet", "Romeo and Juliet", true).answerMatch("Demetrius", "A Midsummer", true).answerMatch("Lysander", "A Midsummer", true).answerMatch("Prospero", "Romeo and Juliet", false).answerMatch("Prospero", "The Tempest", true).saveAnswer().endTest();
// check the results
qtiPage.assertOnAssessmentResults().assertOnAssessmentItemScore("Characters and Plays", 3);
}
Aggregations