use of org.olat.selenium.page.qti.QTI21Page in project openolat by klemens.
the class ImsQTI21EditorTest method qti21EditorUpload.
/**
* An author make a test with 1 upload and feedbacks.<br>
* A user make the test, test hint and upload the file.
*
* @param authorLoginPage
* @param participantBrowser
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void qti21EditorUpload(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver participantBrowser) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("Rei");
authorLoginPage.loginAs(author.getLogin(), author.getPassword());
// make a test
String qtiTestTitle = "Upload 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 an upload interaction
QTI21LobEditorPage uploadEditor = qtiEditor.addUpload();
uploadEditor.setQuestion("Upload a file").save().selectScores().setMaxScore("2.0").save();
uploadEditor.selectFeedbacks().setHint("Hint", "Need a little help.").setCorrectSolution("Correct solution", "Only for Word").setAnsweredFeedback("Full", "You upload something").setEmpytFeedback("Empty", "You do not upload anything").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 reiLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
reiLoginPage.loginAs(rei.getLogin(), rei.getPassword()).resume();
NavigationPage reiNavBar = new NavigationPage(participantBrowser);
reiNavBar.openMyCourses().openSearch().extendedSearch(qtiTestTitle).select(qtiTestTitle).start();
// make the test
QTI21Page reiQtiPage = QTI21Page.getQTI12Page(participantBrowser);
reiQtiPage.assertOnAssessmentItem().saveAnswer().assertFeedback("Empty").hint().assertFeedback("Hint");
URL imageUrl = JunitTestHelper.class.getResource("file_resources/IMG_1482.JPG");
File imageFile = new File(imageUrl.toURI());
reiQtiPage.answerUpload(imageFile).saveAnswer().assertFeedback("Full").endTest().assertOnAssessmentResults().assertOnAssessmentResultUpload("IMG_1482");
}
use of org.olat.selenium.page.qti.QTI21Page in project openolat by klemens.
the class ImsQTI21EditorTest method importQuestionsCSV.
/**
* Create a test, import the CSV example, remove the
* first single choice which come if someone create a
* test. Change the delivery settings of the test to
* show the detailled results.<br>
* Run the test and check the results.
*
* @param loginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void importQuestionsCSV(@InitialPage LoginPage authorLoginPage) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
authorLoginPage.loginAs(author.getLogin(), author.getPassword());
// upload a test
String qtiTestTitle = "Excel QTI 2.1 " + UUID.randomUUID();
navBar.openAuthoringEnvironment().createQTI21Test(qtiTestTitle).clickToolbarBack();
QTI21Page qtiPage = QTI21Page.getQTI12Page(browser);
QTI21EditorPage qtiEditor = qtiPage.edit();
// import a single choice, a multiple and 2 gap texts
qtiEditor.importTable().importFile("qti21/import_qti21_excel.txt").next().assertOnNumberOfQuestions(5).finish();
// remove the single choice which come from the creation
// of the test
qtiEditor.selectNode("Single choice").deleteNode();
// go to options and show the results
qtiPage.clickToolbarBack().options().showResults(Boolean.TRUE, QTI21AssessmentResultsOptions.allOptions()).save();
// go to the test
qtiPage.clickToolbarBack().assertOnAssessmentItem().answerGapText("verbannen", "_RESPONSE_1").saveAnswer().nextAnswer().answerGapText(",", "_RESPONSE_1").answerGapText("", "_RESPONSE_2").answerGapText("", "_RESPONSE_3").saveAnswer().answerMultipleChoice("Deutschland", "Brasilien", "S\u00FCdafrika").saveAnswer().answerSingleChoiceWithParagraph("Italien").saveAnswer().answerCorrectKPrim("Deutschland", "Uruguay").answerIncorrectKPrim("Frankreich", "Spanien").saveAnswer().endTest();
// check the results
qtiPage.assertOnAssessmentResults().assertOnAssessmentTestScore(9).assertOnAssessmentTestMaxScore(9);
}
use of org.olat.selenium.page.qti.QTI21Page in project openolat by klemens.
the class ImsQTI21EditorTest method qti21EditorMultipleChoices_complexConditionalFeedback.
/**
* Test the conditional feedback with 3 conditions based
* on attempts (and an incorrect feedback used as marker),
* on score and on response. It's done with a multiple
* choice with score per answer and a negative min. score.
*
* @param authorLoginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void qti21EditorMultipleChoices_complexConditionalFeedback(@InitialPage LoginPage authorLoginPage) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
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();
qtiEditor.selectNode("Single choice").deleteNode();
// add a single choice: all answers score
QTI21MultipleChoiceEditorPage mcEditor = qtiEditor.addMultipleChoice();
mcEditor.setAnswer(0, "Ok").setCorrect(0).addChoice(1).setCorrect(1).setAnswer(1, "Correct").addChoice(2).setAnswer(2, "Faux").addChoice(3).setAnswer(3, "Falsch").save();
// add negative scores to play with
mcEditor.selectScores().selectAssessmentMode(ScoreEvaluation.perAnswer).setScore("Ok", "3").setScore("Correct", "1").setScore("Faux", "-1").setScore("Falsch", "-1").setMaxScore("4").save();
// set a conditional feedback
mcEditor.selectFeedbacks().setIncorrectFeedback("Incorrect", "Not the right response").addConditionalFeedback(1, "NegativeFirstAttempts", "Negative score").setCondition(1, 1, Variable.attempts, Operator.equals, "1").addCondition(1, 1).setCondition(1, 2, Variable.score, Operator.smaller, "0").addConditionalFeedback(2, "FauxAnswer", "You choose the 'Faux' answer").setCondition(2, 1, Variable.response, Operator.equals, "Faux").addConditionalFeedback(3, "Positive", "Score between 0 and 3").setCondition(3, 1, Variable.score, Operator.biggerEquals, "0").addCondition(3, 1).setCondition(3, 2, Variable.score, Operator.smaller, "3").save();
qtiPage.clickToolbarBack().assertOnAssessmentItem().answerMultipleChoice("Falsch", "Faux").saveAnswer().assertFeedback("Incorrect").assertFeedback("FauxAnswer").assertFeedback("NegativeFirstAttempts").assertNoFeedback("Positive").deselectAnswerMultipleChoice("Faux", "Falsch").answerMultipleChoice("Faux", "Correct").saveAnswer().assertFeedback("Incorrect").assertFeedback("FauxAnswer").assertFeedback("Positive").assertNoFeedback("NegativeFirstAttempts").deselectAnswerMultipleChoice("Faux").answerMultipleChoice("Ok").saveAnswer().assertNoFeedback().endTest();
}
use of org.olat.selenium.page.qti.QTI21Page in project openolat by klemens.
the class ImsQTI21InteractionsTest method qti21SliderInteraction.
/**
* Check if the slider interaction returns 1 point
* if answered correctly.
*
* @param authorLoginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void qti21SliderInteraction(@InitialPage LoginPage authorLoginPage) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
authorLoginPage.loginAs(author.getLogin(), author.getPassword());
// upload a test
String qtiTestTitle = "Slider QTI 2.1 " + UUID.randomUUID();
URL qtiTestUrl = JunitTestHelper.class.getResource("file_resources/qti21/simple_QTI_21_slider_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().answerVerticalSlider(16).saveAnswer().endTest().closeTest();
// check the results
qtiPage.assertOnAssessmentResults().assertOnAssessmentItemScore("Jedi Knights", 1);
}
use of org.olat.selenium.page.qti.QTI21Page in project openolat by klemens.
the class ImsQTI21InteractionsTest method qti21OrderInteraction.
/**
* Check if the order interaction return its 1 point.
*
* @param authorLoginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void qti21OrderInteraction(@InitialPage LoginPage authorLoginPage) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
authorLoginPage.loginAs(author.getLogin(), author.getPassword());
// upload a test
String qtiTestTitle = "Order QTI 2.1 " + UUID.randomUUID();
URL qtiTestUrl = JunitTestHelper.class.getResource("file_resources/qti21/simple_QTI_21_order_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().answerOrderDropItem("Jenson").answerOrderDropItem("Rubens").answerOrderDropItem("Michael").saveAnswer().endTest().closeTest();
// check the results
qtiPage.assertOnAssessmentResults().assertOnAssessmentItemScore("Grand Prix of Bahrain", 1);
}
Aggregations