Skip to content
Snippets Groups Projects
Commit 730670ae authored by srosse's avatar srosse
Browse files

Merge OpenoLAT default branch to OpenOLAT 13a with 6447df7bbfdb5c3f0c4f8f2c004a8ca4d289dbab

parents 07f16716 0059c394
No related branches found
No related tags found
No related merge requests found
......@@ -182,7 +182,7 @@ public class FileElementImpl extends FormItemImpl
previewEl.setCropSelectionEnabled(cropSelectionEnabled);
previewEl.setMaxWithAndHeightToFitWithin(300, 200);
previewEl.setVisible(true);
} else {
} else if(previewEl != null) {
previewEl.setVisible(false);
}
// Mark associated component dirty, that it gets rerendered
......
......@@ -140,7 +140,7 @@ public class ImsQTI21EditorTest extends Deployments {
.saveAnswer()
.answerMultipleChoice("Deutschland", "Brasilien", "S\u00FCdafrika")
.saveAnswer()
.answerSingleChoice("Italien")
.answerSingleChoiceWithParagraph("Italien")
.saveAnswer()
.answerCorrectKPrim("Deutschland", "Uruguay")
.answerIncorrectKPrim("Frankreich", "Spanien")
......@@ -355,17 +355,17 @@ public class ImsQTI21EditorTest extends Deployments {
.getQTI12Page(ryomouBrowser);
ryomouQtiPage
.assertOnAssessmentItem()
.answerSingleChoice("Falsch")
.answerSingleChoiceWithParagraph("Falsch")
.saveAnswer()
.assertFeedback("Incorrect")
.assertCorrectSolution("Correct solution")
.hint()
.assertFeedback("Hint")
.answerSingleChoice("Correct")
.answerSingleChoiceWithParagraph("Correct")
.saveAnswer()
.assertFeedback("Correct feedback")
.nextAnswer()
.answerSingleChoice("Almost")
.answerSingleChoiceWithParagraph("Almost")
.saveAnswer()
.assertCorrectSolution("Correct solution")
.assertFeedback("Incorrect")
......@@ -431,14 +431,14 @@ public class ImsQTI21EditorTest extends Deployments {
qtiPage
.clickToolbarBack()
.assertOnAssessmentItem()
.answerSingleChoice("Falsch")
.answerSingleChoiceWithParagraph("Falsch")
.saveAnswer()
.assertFeedback("Incorrect")
.answerSingleChoice("Faux")
.answerSingleChoiceWithParagraph("Faux")
.saveAnswer()
.assertFeedback("Incorrect")
.assertFeedback("Attempts")
.answerSingleChoice("Correct")
.answerSingleChoiceWithParagraph("Correct")
.saveAnswer()
.assertNoFeedback()
.endTest();
......@@ -3176,7 +3176,7 @@ public class ImsQTI21EditorTest extends Deployments {
ryomouQtiPage
.assertOnAssessmentItem()
.assertHiddenSection()
.answerSingleChoice("Correct")
.answerSingleChoiceWithParagraph("Correct")
.saveAnswer()
.answerMultipleChoice("OkToo")
.answerMultipleChoice("Correct")
......@@ -3327,7 +3327,7 @@ public class ImsQTI21EditorTest extends Deployments {
ryomouQtiPage
.assertOnAssessmentItem()
.assertHiddenSection()
.answerSingleChoice("Correct")
.answerSingleChoiceWithParagraph("Correct")
.saveAnswer()
.answerMultipleChoice("Ok")
.answerMultipleChoice("Correct")
......@@ -3360,7 +3360,7 @@ public class ImsQTI21EditorTest extends Deployments {
asukaQtiPage
.assertOnAssessmentItem()
.assertHiddenSection()
.answerSingleChoice("Wrong")
.answerSingleChoiceWithParagraph("Wrong")
.saveAnswer()
.answerMultipleChoice("Falsch")
.answerMultipleChoice("Faux")
......@@ -3392,7 +3392,7 @@ public class ImsQTI21EditorTest extends Deployments {
reiQtiPage
.assertOnAssessmentItem()
.assertHiddenSection()
.answerSingleChoice("Faux")
.answerSingleChoiceWithParagraph("Faux")
.saveAnswer()
.answerMultipleChoice("Ok")
.answerMultipleChoice("Correct")
......
......@@ -343,18 +343,18 @@ public class ImsQTI21InteractionsTest extends Deployments {
.assertOnAssessmentItem()
.hint()
.assertFeedbackText("Tony lives in the United Kingdom")
.answerSingleChoice("Tony")
.answerSingleChoiceWithParagraph("Tony")
.saveAnswer()
.assertFeedbackText("No, the correct answer is Vicente Fox")
.assertFeedbackInline("No, he is the Prime Minister of England.")
.assertNoFeedbackText("Tony lives in the United Kingdom")
.answerSingleChoice("George")
.answerSingleChoiceWithParagraph("George")
.saveAnswer()
.assertFeedbackText("No, the correct answer is Vicente Fox")
.assertFeedbackInline("No, he is the President of the USA.")
.assertNoFeedbackText("Tony lives in the United Kingdom")
.assertNoFeedbackInline("No, he is the Prime Minister of England.")
.answerSingleChoice("Vicente")
.answerSingleChoiceWithParagraph("Vicente")
.saveAnswer()
.assertFeedbackText("Yes, that is correct")
.assertNoFeedbackText("Tony lives in the United Kingdom")
......@@ -683,5 +683,58 @@ public class ImsQTI21InteractionsTest extends Deployments {
.assertOnAssessmentResults()
.assertOnAssessmentItemScore("Richard III", 3);
}
/**
* This is an assessment item with severals
* different interactions.
*
* @param authorLoginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void qti21MultipleInput(@InitialPage LoginPage authorLoginPage)
throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
authorLoginPage.loginAs(author.getLogin(), author.getPassword());
//upload a test
String qtiTestTitle = "Gap match QTI 2.1 " + UUID.randomUUID();
URL qtiTestUrl = JunitTestHelper.class.getResource("file_resources/qti21/simple_QTI_21_multi-input.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()
// the single choice
.answerSingleChoice("Some people are afraid of a woman")
// the inline choice
.answerInlineChoice("A2")
// the text entry
.answerGapText("wicked king", "RESPONSE3")
// the gap match
.answerGapMatch(1, "family", true)
.answerGapMatch(2, "castle", true)
.answerGapMatch(3, "horse", true)
.saveAnswer()
.endTest()
.closeTest();
//check the results
qtiPage
.assertOnAssessmentResults()
.assertOnAssessmentItemScore("Legend", 4);
}
}
......@@ -98,12 +98,12 @@ public class ImsQTI21Test extends Deployments {
.getQTI12Page(browser);
qtiPage
.assertOnAssessmentItem()
.answerSingleChoice("Incorrect response")
.answerSingleChoiceWithParagraph("Incorrect response")
.saveAnswer()
.assertOnAssessmentItem("Second question")
.selectItem("First question")
.assertOnAssessmentItem("First question")
.answerSingleChoice("Correct response")
.answerSingleChoiceWithParagraph("Correct response")
.saveAnswer()
.answerMultipleChoice("Correct response")
.saveAnswer()
......@@ -140,10 +140,10 @@ public class ImsQTI21Test extends Deployments {
.getQTI12Page(browser);
qtiPage
.assertOnAssessmentItem()
.answerSingleChoice("Wrong answer")
.answerSingleChoiceWithParagraph("Wrong answer")
.saveAnswer()
.assertFeedback("Oooops")
.answerSingleChoice("Correct answer")
.answerSingleChoiceWithParagraph("Correct answer")
.saveAnswer()
.assertFeedback("Well done")
.nextAnswer()
......@@ -196,7 +196,7 @@ public class ImsQTI21Test extends Deployments {
qtiPage
.clickToolbarBack()
.assertOnAssessmentItem()
.answerSingleChoice("Wrong answer")
.answerSingleChoiceWithParagraph("Wrong answer")
.saveAnswer()
.assertFeedback("Oooops")
.nextAnswer()
......@@ -250,7 +250,7 @@ public class ImsQTI21Test extends Deployments {
.startTestPart()
.selectItem("First question")
.assertOnAssessmentItem("First question")
.answerSingleChoice("Correct")
.answerSingleChoiceWithParagraph("Correct")
.saveAnswer()
.assertOnAssessmentItem("Second question")
.answerMultipleChoice("True")
......@@ -300,7 +300,7 @@ public class ImsQTI21Test extends Deployments {
.startTestPart()
.selectItem("First question")
.assertOnAssessmentItem("First question")
.answerSingleChoice("Correct answer")
.answerSingleChoiceWithParagraph("Correct answer")
.saveAnswer()
.assertOnAssessmentItem("Second question")
.answerMultipleChoice("Valid answer")
......@@ -308,9 +308,9 @@ public class ImsQTI21Test extends Deployments {
.endTestPart()
.selectItem("Third question")
.assertOnAssessmentItem("Third question")
.answerSingleChoice("Right")
.answerSingleChoiceWithParagraph("Right")
.saveAnswer()
.answerSingleChoice("Good")
.answerSingleChoiceWithParagraph("Good")
.saveAnswer()
.endTestPart()
.assertOnAssessmentTestFeedback("Well done")
......@@ -347,10 +347,10 @@ public class ImsQTI21Test extends Deployments {
//check simple time limit
qtiPage
.assertOnAssessmentItem("Single choice")
.answerSingleChoice("Correct answer")
.answerSingleChoiceWithParagraph("Correct answer")
.saveAnswer()
.assertOnAssessmentItem("Last choice")
.answerSingleChoice("True")
.answerSingleChoiceWithParagraph("True")
.saveAnswer()
.assertOnAssessmentTestTerminated(15);
}
......@@ -390,10 +390,10 @@ public class ImsQTI21Test extends Deployments {
qtiPage
.clickToolbarBack()
.assertOnAssessmentItem("Single choice")
.answerSingleChoice("Correct answer")
.answerSingleChoiceWithParagraph("Correct answer")
.saveAnswer()
.assertOnAssessmentItem("Last choice")
.answerSingleChoice("True")
.answerSingleChoiceWithParagraph("True")
.saveAnswer()
.assertOnAssessmentResults(15)
.assertOnAssessmentTestPassed()
......@@ -478,7 +478,7 @@ public class ImsQTI21Test extends Deployments {
.getQTI12Page(ryomouBrowser);
userQtiPage
.assertOnAssessmentItem("Single choice")
.answerSingleChoice("Correct")
.answerSingleChoiceWithParagraph("Correct")
.saveAnswer()
.answerMultipleChoice("Correct")
.saveAnswer()
......@@ -579,7 +579,7 @@ public class ImsQTI21Test extends Deployments {
.getQTI12Page(browser);
qtiPage
.start()
.answerSingleChoice("Right")
.answerSingleChoiceWithParagraph("Right")
.saveAnswer()
.endTest()
.assertOnCourseAttempts(1)
......@@ -665,7 +665,7 @@ public class ImsQTI21Test extends Deployments {
.getQTI12Page(browser);
qtiPage
.start()
.answerSingleChoice("Right")
.answerSingleChoiceWithParagraph("Right")
.saveAnswer()
.endTest()
.assertOnAssessmentResults()
......@@ -760,7 +760,7 @@ public class ImsQTI21Test extends Deployments {
.getQTI12Page(browser);
qtiPage
.start()
.answerSingleChoice("Correct")
.answerSingleChoiceWithParagraph("Correct")
.saveAnswer()
.answerMultipleChoice("Correct")
.saveAnswer()
......
......@@ -105,7 +105,23 @@ public class QTI21Page {
return this;
}
/**
* Check the answer of a single choice.
* @param answer The answer
* @return Itself
*/
public QTI21Page answerSingleChoice(String answer) {
By choiceBy = By.xpath("//tr[contains(@class,'choiceinteraction')][td[contains(@class,'choiceInteraction')][label[text()[contains(normalize-space(.),'" + answer + "')]]]]/td[contains(@class,'control')]/input[@type='radio']");
browser.findElement(choiceBy).click();
return this;
}
/**
* Check the answer of a single choice. The answer is wrapped in a P tag.
* @param answer The answer
* @return Itself
*/
public QTI21Page answerSingleChoiceWithParagraph(String answer) {
By choiceBy = By.xpath("//tr[contains(@class,'choiceinteraction')][td[contains(@class,'choiceInteraction')][label/p[contains(normalize-space(text()),'" + answer + "')]]]/td[contains(@class,'control')]/input[@type='radio']");
browser.findElement(choiceBy).click();
return this;
......
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment