From aaa5579919216c9bdb3a7d7be50515f74fac7ec6 Mon Sep 17 00:00:00 2001 From: srosse <none@none> Date: Tue, 17 Apr 2018 20:03:12 +0200 Subject: [PATCH] no-jira: selenium test to check progress of student in the test cockpit (QTI 2.1) --- .../ui/component/CompletionRenderer.java | 2 +- .../org/olat/selenium/AssessmentTest.java | 2 +- .../java/org/olat/selenium/CourseTest.java | 2 +- .../org/olat/selenium/ImsQTI21EditorTest.java | 112 ++++++------- .../selenium/ImsQTI21InteractionsTest.java | 28 ++-- .../java/org/olat/selenium/ImsQTI21Test.java | 155 ++++++++++++++++-- .../org/olat/selenium/PortfolioV2Test.java | 2 +- .../page/course/AssessmentToolPage.java | 58 ++++++- .../org/olat/selenium/page/qti/QTI21Page.java | 4 +- src/test/resources/arquillian.xml | 2 +- 10 files changed, 269 insertions(+), 98 deletions(-) diff --git a/src/main/java/org/olat/modules/assessment/ui/component/CompletionRenderer.java b/src/main/java/org/olat/modules/assessment/ui/component/CompletionRenderer.java index b24c31bd9c7..bb8615062ac 100644 --- a/src/main/java/org/olat/modules/assessment/ui/component/CompletionRenderer.java +++ b/src/main/java/org/olat/modules/assessment/ui/component/CompletionRenderer.java @@ -52,7 +52,7 @@ public class CompletionRenderer extends DefaultComponentRenderer { sb.append("<div id='").append(ccp.getFormItem().getFormDispatchId()).append("'"); if(ccp.isEnded()) { - sb.append(">").append(ccp.getCompletionTranslator().translate("run.ended")); + sb.append(" class='o_sel_ended'>").append(ccp.getCompletionTranslator().translate("run.ended")); } else { sb.append(" class='progress' style=\"width:100%;\"><div class='progress-bar' style=\"width:") .append(Math.round(percentCompletion)) diff --git a/src/test/java/org/olat/selenium/AssessmentTest.java b/src/test/java/org/olat/selenium/AssessmentTest.java index 69e21c7f118..c8b4e82b7b5 100644 --- a/src/test/java/org/olat/selenium/AssessmentTest.java +++ b/src/test/java/org/olat/selenium/AssessmentTest.java @@ -830,7 +830,7 @@ public class AssessmentTest extends Deployments { .users() .assertOnUsers(ryomou) .selectUser(ryomou) - .selectCourseNode(assessmentNodeTitle) + .selectUsersCourseNode(assessmentNodeTitle) .setAssessmentScore(8.0f) .assertUserPassedCourseNode(assessmentNodeTitle); diff --git a/src/test/java/org/olat/selenium/CourseTest.java b/src/test/java/org/olat/selenium/CourseTest.java index 3a2a0606eec..3d5694f69c1 100644 --- a/src/test/java/org/olat/selenium/CourseTest.java +++ b/src/test/java/org/olat/selenium/CourseTest.java @@ -1222,7 +1222,7 @@ public class CourseTest extends Deployments { .users() .assertOnUsers(rei) .selectUser(rei) - .selectCourseNode(msTitle.substring(0, 20)) + .selectUsersCourseNode(msTitle.substring(0, 20)) .setAssessmentScore(5.5f) .assertUserPassedCourseNode(msTitle.substring(0, 20)); diff --git a/src/test/java/org/olat/selenium/ImsQTI21EditorTest.java b/src/test/java/org/olat/selenium/ImsQTI21EditorTest.java index 5019fd74316..da02f100528 100644 --- a/src/test/java/org/olat/selenium/ImsQTI21EditorTest.java +++ b/src/test/java/org/olat/selenium/ImsQTI21EditorTest.java @@ -102,7 +102,7 @@ public class ImsQTI21EditorTest extends Deployments { .clickToolbarBack(); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); QTI21EditorPage qtiEditor = qtiPage .edit(); @@ -180,7 +180,7 @@ public class ImsQTI21EditorTest extends Deployments { .clickToolbarBack(); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); QTI21EditorPage qtiEditor = qtiPage .edit(); @@ -260,7 +260,7 @@ public class ImsQTI21EditorTest extends Deployments { .clickToolbarBack(); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); QTI21EditorPage qtiEditor = qtiPage .edit(); //start a blank test @@ -352,7 +352,7 @@ public class ImsQTI21EditorTest extends Deployments { // make the test QTI21Page ryomouQtiPage = QTI21Page - .getQTI12Page(ryomouBrowser); + .getQTI21Page(ryomouBrowser); ryomouQtiPage .assertOnAssessmentItem() .answerSingleChoiceWithParagraph("Falsch") @@ -399,7 +399,7 @@ public class ImsQTI21EditorTest extends Deployments { .clickToolbarBack(); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); QTI21EditorPage qtiEditor = qtiPage .edit(); qtiEditor @@ -473,7 +473,7 @@ public class ImsQTI21EditorTest extends Deployments { .clickToolbarBack(); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); QTI21EditorPage qtiEditor = qtiPage .edit(); //start a blank test @@ -567,7 +567,7 @@ public class ImsQTI21EditorTest extends Deployments { // make the test QTI21Page ryomouQtiPage = QTI21Page - .getQTI12Page(participantBrowser); + .getQTI21Page(participantBrowser); ryomouQtiPage .assertOnAssessmentItem() .answerMultipleChoice("Falsch") @@ -606,7 +606,7 @@ public class ImsQTI21EditorTest extends Deployments { // make the test QTI21Page - .getQTI12Page(participantBrowser) + .getQTI21Page(participantBrowser) .assertOnAssessmentItem() .answerMultipleChoice("Correct", "OkToo") .saveAnswer() @@ -643,7 +643,7 @@ public class ImsQTI21EditorTest extends Deployments { .clickToolbarBack(); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); QTI21EditorPage qtiEditor = qtiPage .edit(); qtiEditor @@ -748,7 +748,7 @@ public class ImsQTI21EditorTest extends Deployments { .clickToolbarBack(); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); QTI21EditorPage qtiEditor = qtiPage .edit(); //start a blank test @@ -836,7 +836,7 @@ public class ImsQTI21EditorTest extends Deployments { // make the test QTI21Page reiQtiPage = QTI21Page - .getQTI12Page(participantBrowser); + .getQTI21Page(participantBrowser); reiQtiPage .assertOnAssessmentItem() .answerCorrectKPrim("Correct", "OkToo", "Faux") @@ -875,7 +875,7 @@ public class ImsQTI21EditorTest extends Deployments { // make the test QTI21Page - .getQTI12Page(participantBrowser) + .getQTI21Page(participantBrowser) .assertOnAssessmentItem() .answerCorrectKPrim("Correct", "OkToo") .answerIncorrectKPrim("Faux", "Falsch") @@ -919,7 +919,7 @@ public class ImsQTI21EditorTest extends Deployments { .clickToolbarBack(); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); QTI21EditorPage qtiEditor = qtiPage .edit(); //start a blank test @@ -1011,7 +1011,7 @@ public class ImsQTI21EditorTest extends Deployments { // make the test QTI21Page ryomouQtiPage = QTI21Page - .getQTI12Page(participantBrowser); + .getQTI21Page(participantBrowser); ryomouQtiPage .assertOnAssessmentItem() .answerHotspot("rect") @@ -1048,7 +1048,7 @@ public class ImsQTI21EditorTest extends Deployments { // make the test QTI21Page - .getQTI12Page(participantBrowser) + .getQTI21Page(participantBrowser) .assertOnAssessmentItem() .answerHotspot("circle") .saveAnswer() @@ -1090,7 +1090,7 @@ public class ImsQTI21EditorTest extends Deployments { .clickToolbarBack(); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); QTI21EditorPage qtiEditor = qtiPage .edit(); //start a blank test @@ -1184,7 +1184,7 @@ public class ImsQTI21EditorTest extends Deployments { // make the test QTI21Page ryomouQtiPage = QTI21Page - .getQTI12Page(participantBrowser); + .getQTI21Page(participantBrowser); ryomouQtiPage .assertOnAssessmentItem() .answerHotspot("rect") @@ -1221,7 +1221,7 @@ public class ImsQTI21EditorTest extends Deployments { // make the test QTI21Page - .getQTI12Page(participantBrowser) + .getQTI21Page(participantBrowser) .assertOnAssessmentItem() .answerHotspot("circle") .answerHotspot("rect") @@ -1266,7 +1266,7 @@ public class ImsQTI21EditorTest extends Deployments { .clickToolbarBack(); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); QTI21EditorPage qtiEditor = qtiPage .edit(); //start a blank test @@ -1352,7 +1352,7 @@ public class ImsQTI21EditorTest extends Deployments { // first user make the test QTI21Page ryomouQtiPage = QTI21Page - .getQTI12Page(participantBrowser); + .getQTI21Page(participantBrowser); ryomouQtiPage .assertOnAssessmentItem() .answerGapTextWithPlaceholder("Log", "314") @@ -1392,7 +1392,7 @@ public class ImsQTI21EditorTest extends Deployments { // make the test with all the correct answers QTI21Page - .getQTI12Page(participantBrowser) + .getQTI21Page(participantBrowser) .assertOnAssessmentItem() .answerGapTextWithPlaceholder("Pi", "314") .answerGapTextWithPlaceholder("Ln", "lognat") @@ -1438,7 +1438,7 @@ public class ImsQTI21EditorTest extends Deployments { .clickToolbarBack(); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); QTI21EditorPage qtiEditor = qtiPage .edit(); //start a blank test @@ -1524,7 +1524,7 @@ public class ImsQTI21EditorTest extends Deployments { // first user make the test QTI21Page ryomouQtiPage = QTI21Page - .getQTI12Page(participantBrowser); + .getQTI21Page(participantBrowser); ryomouQtiPage .assertOnAssessmentItem() .answerGapTextWithPlaceholder("2", "three") @@ -1564,7 +1564,7 @@ public class ImsQTI21EditorTest extends Deployments { // make the test with all the correct answers QTI21Page - .getQTI12Page(participantBrowser) + .getQTI21Page(participantBrowser) .assertOnAssessmentItem() .answerGapTextWithPlaceholder("3", "three") .answerGapTextWithPlaceholder("9", "nine") @@ -1609,7 +1609,7 @@ public class ImsQTI21EditorTest extends Deployments { .clickToolbarBack(); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); QTI21EditorPage qtiEditor = qtiPage .edit(); //start a blank test @@ -1688,7 +1688,7 @@ public class ImsQTI21EditorTest extends Deployments { // first user make the test QTI21Page ryomouQtiPage = QTI21Page - .getQTI12Page(participantBrowser); + .getQTI21Page(participantBrowser); ryomouQtiPage .assertOnAssessmentItem() .answerGapTextWithPlaceholder("3", "pi") @@ -1730,7 +1730,7 @@ public class ImsQTI21EditorTest extends Deployments { // make the test with all the correct answers QTI21Page - .getQTI12Page(participantBrowser) + .getQTI21Page(participantBrowser) .assertOnAssessmentItem() .answerGapTextWithPlaceholder("3.2", "pi") .saveAnswer() @@ -1775,7 +1775,7 @@ public class ImsQTI21EditorTest extends Deployments { .clickToolbarBack(); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); QTI21EditorPage qtiEditor = qtiPage .edit(); //start a blank test @@ -1833,7 +1833,7 @@ public class ImsQTI21EditorTest extends Deployments { // make the test QTI21Page ryomouQtiPage = QTI21Page - .getQTI12Page(participantBrowser); + .getQTI21Page(participantBrowser); ryomouQtiPage .assertOnAssessmentItem() .answerHottext(2) @@ -1880,7 +1880,7 @@ public class ImsQTI21EditorTest extends Deployments { .clickToolbarBack(); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); QTI21EditorPage qtiEditor = qtiPage .edit(); //start a blank test @@ -1982,7 +1982,7 @@ public class ImsQTI21EditorTest extends Deployments { // make the test QTI21Page reiQtiPage = QTI21Page - .getQTI12Page(participantBrowser); + .getQTI21Page(participantBrowser); reiQtiPage .assertOnAssessmentItem() .answerMatch("Eclipse", "IDE", true) @@ -2022,7 +2022,7 @@ public class ImsQTI21EditorTest extends Deployments { // make the test QTI21Page - .getQTI12Page(participantBrowser) + .getQTI21Page(participantBrowser) .assertOnAssessmentItem() .answerMatch("Eclipse", "IDE", true) .answerMatch("vim", "TextEditor", true) @@ -2072,7 +2072,7 @@ public class ImsQTI21EditorTest extends Deployments { .clickToolbarBack(); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); QTI21EditorPage qtiEditor = qtiPage .edit(); //start a blank test @@ -2169,7 +2169,7 @@ public class ImsQTI21EditorTest extends Deployments { // make the test QTI21Page reiQtiPage = QTI21Page - .getQTI12Page(participantBrowser); + .getQTI21Page(participantBrowser); reiQtiPage .assertOnAssessmentItem() .answerMatch("Eclipse", "WordProcessor", true) @@ -2209,7 +2209,7 @@ public class ImsQTI21EditorTest extends Deployments { // make the test QTI21Page - .getQTI12Page(participantBrowser) + .getQTI21Page(participantBrowser) .assertOnAssessmentItem() .saveAnswer() .assertFeedback("Correct feedback") @@ -2259,7 +2259,7 @@ public class ImsQTI21EditorTest extends Deployments { .clickToolbarBack(); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); QTI21EditorPage qtiEditor = qtiPage .edit(); //start a blank test @@ -2363,7 +2363,7 @@ public class ImsQTI21EditorTest extends Deployments { // make the test QTI21Page asukaQtiPage = QTI21Page - .getQTI12Page(participantBrowser); + .getQTI21Page(participantBrowser); asukaQtiPage .assertOnAssessmentItem() .answerMatchDropSourceToTarget("Einstein", "Physicist") @@ -2403,7 +2403,7 @@ public class ImsQTI21EditorTest extends Deployments { // make the test QTI21Page - .getQTI12Page(participantBrowser) + .getQTI21Page(participantBrowser) .answerMatchDropSourceToTarget("Einstein", "Physicist") .answerMatchDropSourceToTarget("Planck", "Physicist") .answerMatchDropSourceToTarget("Euler", "Mathematician") @@ -2449,7 +2449,7 @@ public class ImsQTI21EditorTest extends Deployments { .clickToolbarBack(); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); QTI21EditorPage qtiEditor = qtiPage .edit(); //start a blank test @@ -2547,7 +2547,7 @@ public class ImsQTI21EditorTest extends Deployments { // make the test QTI21Page asukaQtiPage = QTI21Page - .getQTI12Page(participantBrowser); + .getQTI21Page(participantBrowser); asukaQtiPage .assertOnAssessmentItem() .answerMatchDropSourceToTarget("Einstein", "Chemistry") @@ -2587,7 +2587,7 @@ public class ImsQTI21EditorTest extends Deployments { // make the test QTI21Page - .getQTI12Page(participantBrowser) + .getQTI21Page(participantBrowser) .saveAnswer() .assertFeedback("Correct feedback") .nextAnswer() @@ -2635,7 +2635,7 @@ public class ImsQTI21EditorTest extends Deployments { .clickToolbarBack(); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); QTI21EditorPage qtiEditor = qtiPage .edit(); //start a blank test @@ -2729,7 +2729,7 @@ public class ImsQTI21EditorTest extends Deployments { // make the test QTI21Page reiQtiPage = QTI21Page - .getQTI12Page(participantBrowser); + .getQTI21Page(participantBrowser); reiQtiPage .assertOnAssessmentItem() .answerMatch("Eclipse", TrueFalse.right, true) @@ -2769,7 +2769,7 @@ public class ImsQTI21EditorTest extends Deployments { // make the test QTI21Page - .getQTI12Page(participantBrowser) + .getQTI21Page(participantBrowser) .assertOnAssessmentItem() .answerMatch("Eclipse", TrueFalse.right, true) .answerMatch("vim", TrueFalse.wrong, true) @@ -2810,7 +2810,7 @@ public class ImsQTI21EditorTest extends Deployments { .clickToolbarBack(); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); QTI21EditorPage qtiEditor = qtiPage .edit(); //start a blank test @@ -2863,7 +2863,7 @@ public class ImsQTI21EditorTest extends Deployments { // make the test QTI21Page reiQtiPage = QTI21Page - .getQTI12Page(participantBrowser); + .getQTI21Page(participantBrowser); reiQtiPage .assertOnAssessmentItem() .saveAnswer() @@ -2909,7 +2909,7 @@ public class ImsQTI21EditorTest extends Deployments { .clickToolbarBack(); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); QTI21EditorPage qtiEditor = qtiPage .edit(); //start a blank test @@ -2962,7 +2962,7 @@ public class ImsQTI21EditorTest extends Deployments { // make the test QTI21Page reiQtiPage = QTI21Page - .getQTI12Page(participantBrowser); + .getQTI21Page(participantBrowser); reiQtiPage .assertOnAssessmentItem() .saveAnswer() @@ -3006,7 +3006,7 @@ public class ImsQTI21EditorTest extends Deployments { .clickToolbarBack(); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); QTI21EditorPage qtiEditor = qtiPage .edit(); //start a blank test @@ -3063,7 +3063,7 @@ public class ImsQTI21EditorTest extends Deployments { // make the test QTI21Page reiQtiPage = QTI21Page - .getQTI12Page(participantBrowser); + .getQTI21Page(participantBrowser); reiQtiPage .assertOnAssessmentItem() .saveAnswer() @@ -3108,7 +3108,7 @@ public class ImsQTI21EditorTest extends Deployments { .clickToolbarBack(); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); QTI21EditorPage qtiEditor = qtiPage .edit(); //customize the section @@ -3172,7 +3172,7 @@ public class ImsQTI21EditorTest extends Deployments { // make the test QTI21Page ryomouQtiPage = QTI21Page - .getQTI12Page(participantBrowser); + .getQTI21Page(participantBrowser); ryomouQtiPage .assertOnAssessmentItem() .assertHiddenSection() @@ -3216,7 +3216,7 @@ public class ImsQTI21EditorTest extends Deployments { .clickToolbarBack(); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); QTI21EditorPage qtiEditor = qtiPage .edit(); //customize the section @@ -3323,7 +3323,7 @@ public class ImsQTI21EditorTest extends Deployments { // make the test with all correct answers QTI21Page ryomouQtiPage = QTI21Page - .getQTI12Page(participantBrowser); + .getQTI21Page(participantBrowser); ryomouQtiPage .assertOnAssessmentItem() .assertHiddenSection() @@ -3356,7 +3356,7 @@ public class ImsQTI21EditorTest extends Deployments { // make the test with all correct answers QTI21Page asukaQtiPage = QTI21Page - .getQTI12Page(participantBrowser); + .getQTI21Page(participantBrowser); asukaQtiPage .assertOnAssessmentItem() .assertHiddenSection() @@ -3388,7 +3388,7 @@ public class ImsQTI21EditorTest extends Deployments { // make the test with some correct answers QTI21Page reiQtiPage = QTI21Page - .getQTI12Page(participantBrowser); + .getQTI21Page(participantBrowser); reiQtiPage .assertOnAssessmentItem() .assertHiddenSection() diff --git a/src/test/java/org/olat/selenium/ImsQTI21InteractionsTest.java b/src/test/java/org/olat/selenium/ImsQTI21InteractionsTest.java index 74fec822329..b5ffd935b49 100644 --- a/src/test/java/org/olat/selenium/ImsQTI21InteractionsTest.java +++ b/src/test/java/org/olat/selenium/ImsQTI21InteractionsTest.java @@ -100,7 +100,7 @@ public class ImsQTI21InteractionsTest extends Deployments { .clickToolbarRootCrumb(); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); qtiPage .options() .showResults(Boolean.TRUE, QTI21AssessmentResultsOptions.allOptions()) @@ -144,7 +144,7 @@ public class ImsQTI21InteractionsTest extends Deployments { .clickToolbarRootCrumb(); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); qtiPage .options() .showResults(Boolean.TRUE, QTI21AssessmentResultsOptions.allOptions()) @@ -192,7 +192,7 @@ public class ImsQTI21InteractionsTest extends Deployments { .clickToolbarRootCrumb(); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); qtiPage .options() .showResults(Boolean.TRUE, QTI21AssessmentResultsOptions.allOptions()) @@ -238,7 +238,7 @@ public class ImsQTI21InteractionsTest extends Deployments { .clickToolbarRootCrumb(); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); qtiPage .options() .showResults(Boolean.TRUE, QTI21AssessmentResultsOptions.allOptions()) @@ -286,7 +286,7 @@ public class ImsQTI21InteractionsTest extends Deployments { .clickToolbarRootCrumb(); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); qtiPage .options() .showResults(Boolean.TRUE, QTI21AssessmentResultsOptions.allOptions()) @@ -332,7 +332,7 @@ public class ImsQTI21InteractionsTest extends Deployments { .clickToolbarRootCrumb(); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); qtiPage .options() .showResults(Boolean.TRUE, QTI21AssessmentResultsOptions.allOptions()) @@ -393,7 +393,7 @@ public class ImsQTI21InteractionsTest extends Deployments { .clickToolbarRootCrumb(); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); qtiPage .options() .showResults(Boolean.TRUE, QTI21AssessmentResultsOptions.allOptions()) @@ -439,7 +439,7 @@ public class ImsQTI21InteractionsTest extends Deployments { .clickToolbarRootCrumb(); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); qtiPage .options() .showResults(Boolean.TRUE, QTI21AssessmentResultsOptions.allOptions()) @@ -483,7 +483,7 @@ public class ImsQTI21InteractionsTest extends Deployments { .clickToolbarRootCrumb(); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); qtiPage .options() .showResults(Boolean.TRUE, QTI21AssessmentResultsOptions.allOptions()) @@ -530,7 +530,7 @@ public class ImsQTI21InteractionsTest extends Deployments { .clickToolbarRootCrumb(); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); qtiPage .options() .showResults(Boolean.TRUE, QTI21AssessmentResultsOptions.allOptions()) @@ -576,7 +576,7 @@ public class ImsQTI21InteractionsTest extends Deployments { .clickToolbarRootCrumb(); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); qtiPage .options() .showResults(Boolean.TRUE, QTI21AssessmentResultsOptions.allOptions()) @@ -620,7 +620,7 @@ public class ImsQTI21InteractionsTest extends Deployments { .clickToolbarRootCrumb(); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); qtiPage .options() .showResults(Boolean.TRUE, QTI21AssessmentResultsOptions.allOptions()) @@ -664,7 +664,7 @@ public class ImsQTI21InteractionsTest extends Deployments { .clickToolbarRootCrumb(); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); qtiPage .options() .showResults(Boolean.TRUE, QTI21AssessmentResultsOptions.allOptions()) @@ -709,7 +709,7 @@ public class ImsQTI21InteractionsTest extends Deployments { .clickToolbarRootCrumb(); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); qtiPage .options() .showResults(Boolean.TRUE, QTI21AssessmentResultsOptions.allOptions()) diff --git a/src/test/java/org/olat/selenium/ImsQTI21Test.java b/src/test/java/org/olat/selenium/ImsQTI21Test.java index 3629c5116bc..56081a7ef7c 100644 --- a/src/test/java/org/olat/selenium/ImsQTI21Test.java +++ b/src/test/java/org/olat/selenium/ImsQTI21Test.java @@ -38,6 +38,7 @@ import org.olat.ims.qti21.QTI21AssessmentResultsOptions; import org.olat.selenium.page.LoginPage; import org.olat.selenium.page.NavigationPage; import org.olat.selenium.page.User; +import org.olat.selenium.page.course.AssessmentToolPage; import org.olat.selenium.page.course.CourseEditorPageFragment; import org.olat.selenium.page.course.CoursePageFragment; import org.olat.selenium.page.qti.QTI21ConfigurationCEPage; @@ -95,7 +96,7 @@ public class ImsQTI21Test extends Deployments { .clickToolbarRootCrumb(); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); qtiPage .assertOnAssessmentItem() .answerSingleChoiceWithParagraph("Incorrect response") @@ -137,7 +138,7 @@ public class ImsQTI21Test extends Deployments { .clickToolbarRootCrumb(); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); qtiPage .assertOnAssessmentItem() .answerSingleChoiceWithParagraph("Wrong answer") @@ -186,7 +187,7 @@ public class ImsQTI21Test extends Deployments { .uploadResource(qtiTestTitle, qtiTestFile); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); qtiPage .clickToolbarBack() .options() @@ -238,7 +239,7 @@ public class ImsQTI21Test extends Deployments { .uploadResource(qtiTestTitle, qtiTestFile); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); qtiPage .clickToolbarBack() .options() @@ -294,7 +295,7 @@ public class ImsQTI21Test extends Deployments { .clickToolbarRootCrumb(); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); qtiPage .startTestPart() @@ -343,7 +344,7 @@ public class ImsQTI21Test extends Deployments { .clickToolbarRootCrumb(); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); //check simple time limit qtiPage .assertOnAssessmentItem("Single choice") @@ -380,7 +381,7 @@ public class ImsQTI21Test extends Deployments { .clickToolbarRootCrumb(); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); qtiPage .options() .showResults(Boolean.TRUE, new QTI21AssessmentResultsOptions(true, true, false, false, false)) @@ -432,7 +433,7 @@ public class ImsQTI21Test extends Deployments { .clickToolbarRootCrumb(); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); qtiPage .options() .showResults(Boolean.TRUE, QTI21AssessmentResultsOptions.allOptions()) @@ -448,7 +449,7 @@ public class ImsQTI21Test extends Deployments { qtiPage .assertOnAssessmentItem("Single choice"); - //a user search the content package + //a user search the test LoginPage userLoginPage = LoginPage.getLoginPage(ryomouBrowser, deploymentUrl); userLoginPage .loginAs(ryomou.getLogin(), ryomou.getPassword()) @@ -462,7 +463,7 @@ public class ImsQTI21Test extends Deployments { .start(); QTI21Page userQtiPage = QTI21Page - .getQTI12Page(ryomouBrowser); + .getQTI21Page(ryomouBrowser); userQtiPage .assertOnAssessmentItem("Single choice") .suspendTest(); @@ -475,7 +476,7 @@ public class ImsQTI21Test extends Deployments { .loginAs(ryomou.getLogin(), ryomou.getPassword()) .resume(); userQtiPage = QTI21Page - .getQTI12Page(ryomouBrowser); + .getQTI21Page(ryomouBrowser); userQtiPage .assertOnAssessmentItem("Single choice") .answerSingleChoiceWithParagraph("Correct") @@ -497,7 +498,7 @@ public class ImsQTI21Test extends Deployments { .loginAs(ryomou.getLogin(), ryomou.getPassword()) .resume(); userQtiPage = QTI21Page - .getQTI12Page(ryomouBrowser); + .getQTI21Page(ryomouBrowser); userQtiPage .assertOnAssessmentItem("Numerical input") .answerGapText("42", "_RESPONSE_1") @@ -576,7 +577,7 @@ public class ImsQTI21Test extends Deployments { Assert.assertEquals(testNodeTitle, testH2.getText().trim()); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); qtiPage .start() .answerSingleChoiceWithParagraph("Right") @@ -662,7 +663,7 @@ public class ImsQTI21Test extends Deployments { Assert.assertEquals(testNodeTitle, testH2.getText().trim()); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); qtiPage .start() .answerSingleChoiceWithParagraph("Right") @@ -757,7 +758,7 @@ public class ImsQTI21Test extends Deployments { Assert.assertEquals(testNodeTitle, testH2.getText().trim()); QTI21Page qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); qtiPage .start() .answerSingleChoiceWithParagraph("Correct") @@ -775,7 +776,7 @@ public class ImsQTI21Test extends Deployments { .resume(); //resume the course, resume the test qtiPage = QTI21Page - .getQTI12Page(browser); + .getQTI21Page(browser); qtiPage .start() .assertOnAssessmentItem("Kprim") @@ -795,4 +796,126 @@ public class ImsQTI21Test extends Deployments { .assertOnCourseAssessmentTestScore(4) .assertOnCourseAttempts(1); } + + /** + * An author create a course with a test to overview + * the progress of a participant doing a test. + * + * @param loginPage + * @param participantBrowser + * @throws IOException + * @throws URISyntaxException + */ + @Test + @RunAsClient + public void qti21CourseTestCockpitProgress(@InitialPage LoginPage loginPage, + @Drone @User WebDriver participantBrowser) + throws IOException, URISyntaxException { + + UserVO author = new UserRestClient(deploymentUrl).createAuthor(); + UserVO participant = new UserRestClient(deploymentUrl).createRandomUser("Ryomou"); + + loginPage.loginAs(author.getLogin(), author.getPassword()); + //upload a test + String qtiTestTitle = "Cockpit 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); + + //create a course + String courseTitle = "Cockpit QTI 2.1 " + UUID.randomUUID(); + navBar + .openAuthoringEnvironment() + .createCourse(courseTitle) + .clickToolbarBack(); + + String testNodeTitle = "QTI21Cockpit-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 + .autoPublish() + .accessConfiguration() + .setUserAccess(UserAccess.registred); + + //add a participant + CoursePageFragment courseRuntime = courseEditor + .clickToolbarBack(); + courseRuntime + .members() + .quickAdd(participant); + //open the assessment tool + AssessmentToolPage assessmentTool = courseRuntime + .assessmentTool(); + assessmentTool + .courseElements() + // test cockpit + .selectElementsCourseNode(testNodeTitle); + + + //a user search the content package + LoginPage userLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl); + userLoginPage + .loginAs(participant.getLogin(), participant.getPassword()) + .resume(); + NavigationPage userNavBar = new NavigationPage(participantBrowser); + userNavBar + .openMyCourses() + .openSearch() + .extendedSearch(courseTitle) + .select(courseTitle); + + // open the course and see the test + CoursePageFragment course = CoursePageFragment.getCourse(participantBrowser); + course + .clickTree() + .selectWithTitle(testNodeTitle); + QTI21Page qtiPage = QTI21Page + .getQTI21Page(participantBrowser); + qtiPage + .start() + .assertOnAssessmentItem() + .answerSingleChoiceWithParagraph("Correct response") + .saveAnswer() + .assertOnAssessmentItem("Second question"); + + // author wait the progress + assessmentTool + .assertProgress(participant, 50); + + // answer the last question + qtiPage + .answerMultipleChoice("Correct response") + .saveAnswer(); + + // author wait the progress + assessmentTool + .assertProgress(participant, 100); + + // participant ends the test + qtiPage + .endTest()//auto close because 1 part, no feedbacks + .assertOnCourseAssessmentTestScore(2); + + // author wait the status changes + assessmentTool + .assertStatusDone(participant) + .assertProgressEnded(participant); + } } diff --git a/src/test/java/org/olat/selenium/PortfolioV2Test.java b/src/test/java/org/olat/selenium/PortfolioV2Test.java index 551f8d03fa7..07c25efe8ae 100644 --- a/src/test/java/org/olat/selenium/PortfolioV2Test.java +++ b/src/test/java/org/olat/selenium/PortfolioV2Test.java @@ -480,7 +480,7 @@ public class PortfolioV2Test extends Deployments { .users() .assertOnUsers(ryomou) .selectUser(ryomou) - .selectCourseNode(assessmentNodeTitle) + .selectUsersCourseNode(assessmentNodeTitle) .setAssessmentScore(4.5f) .assertUserPassedCourseNode(assessmentNodeTitle); diff --git a/src/test/java/org/olat/selenium/page/course/AssessmentToolPage.java b/src/test/java/org/olat/selenium/page/course/AssessmentToolPage.java index 57e6c528fdb..611ce2d39fd 100644 --- a/src/test/java/org/olat/selenium/page/course/AssessmentToolPage.java +++ b/src/test/java/org/olat/selenium/page/course/AssessmentToolPage.java @@ -44,8 +44,7 @@ public class AssessmentToolPage { public AssessmentToolPage users() { By usersBy = By.cssSelector("a.o_sel_assessment_tool_assessed_users"); - WebElement usersLink = browser.findElement(usersBy); - usersLink.click(); + browser.findElement(usersBy).click(); OOGraphene.waitBusy(browser); return this; } @@ -76,13 +75,24 @@ public class AssessmentToolPage { return this; } + /** + * To see the list of course elements + * @return Itself + */ + public AssessmentToolPage courseElements() { + By elementsBy = By.cssSelector("a.o_sel_assessment_tool_assessable_course_nodes"); + browser.findElement(elementsBy).click(); + OOGraphene.waitBusy(browser); + return this; + } + /** * Select the course node in "Users" > "Course nodes". * - * @param nodeTitle - * @return + * @param nodeTitle The title of the course node + * @return Itself */ - public AssessmentToolPage selectCourseNode(String nodeTitle) { + public AssessmentToolPage selectUsersCourseNode(String nodeTitle) { By rowsBy = By.xpath("//div[contains(@class,'o_table_wrapper')]//table//tr[td/span[contains(text(),'" + nodeTitle + "')]]/td/a[contains(@href,'cmd.select.node')]"); List<WebElement> rowEls = browser.findElements(rowsBy); Assert.assertEquals(1, rowEls.size()); @@ -91,6 +101,20 @@ public class AssessmentToolPage { return this; } + /** + * Select the course node in the tree > "Course nodes". + * + * @param nodeTitle The title of the course node + * @return Itself + */ + public AssessmentToolPage selectElementsCourseNode(String nodeTitle) { + By elementBy = By.xpath("//div[contains(@class,'o_tree')]//ul//li[div/span/a/span[@class='o_tree_item'][contains(text(),'" + nodeTitle + "')]]/div/span/a[contains(@onclick,'nidle')]"); + OOGraphene.waitElement(elementBy, browser); + browser.findElement(elementBy).click(); + OOGraphene.waitBusy(browser); + return this; + } + /** * Check in "Users" > "Course nodes" if a specific course node * is passed. @@ -140,6 +164,30 @@ public class AssessmentToolPage { return this; } + /** + * + * @param user The user to overview + * @param progress The progress in percent + * @return Itself + */ + public AssessmentToolPage assertProgress(UserVO user, int progress) { + By progressBy = By.xpath("//div[contains(@class,'o_table_wrapper')]/table//tr[td/a[contains(.,'" + user.getFirstName() + "')]]/td/div[@class='progress']/div[@title='" + progress + "%']"); + OOGraphene.waitElement(progressBy, 10, browser); + return this; + } + + public AssessmentToolPage assertStatusDone(UserVO user) { + By doneBy = By.xpath("//div[contains(@class,'o_table_wrapper')]/table//tr[td/a[contains(.,'" + user.getFirstName() + "')]]/td/i[contains(@class,'o_icon_status_done')]"); + OOGraphene.waitElement(doneBy, 10, browser); + return this; + } + + public AssessmentToolPage assertProgressEnded(UserVO user) { + By progressBy = By.xpath("//div[contains(@class,'o_table_wrapper')]/table//tr[td/a[contains(.,'" + user.getFirstName() + "')]]/td/div[@class='o_sel_ended']"); + OOGraphene.waitElement(progressBy, 10, browser); + return this; + } + public AssessmentToolPage generateCertificate() { By userLinksBy = By.className("o_sel_certificate_generate"); browser.findElement(userLinksBy).click(); diff --git a/src/test/java/org/olat/selenium/page/qti/QTI21Page.java b/src/test/java/org/olat/selenium/page/qti/QTI21Page.java index dcfcb6a4167..02a4a1a83b6 100644 --- a/src/test/java/org/olat/selenium/page/qti/QTI21Page.java +++ b/src/test/java/org/olat/selenium/page/qti/QTI21Page.java @@ -50,7 +50,7 @@ public class QTI21Page { this.browser = browser; } - public static QTI21Page getQTI12Page(WebDriver browser) { + public static QTI21Page getQTI21Page(WebDriver browser) { By mainBy = By.id("o_main_wrapper"); OOGraphene.waitElement(mainBy, 5, browser); WebElement main = browser.findElement(mainBy); @@ -865,7 +865,7 @@ public class QTI21Page { OOGraphene.closeBlueMessageWindow(browser); browser.findElement(NavigationPage.toolbarBackBy).click(); OOGraphene.waitBusy(browser); - return QTI21Page.getQTI12Page(browser); + return QTI21Page.getQTI21Page(browser); } public enum TrueFalse { diff --git a/src/test/resources/arquillian.xml b/src/test/resources/arquillian.xml index adc9d8be81d..d622a71d227 100644 --- a/src/test/resources/arquillian.xml +++ b/src/test/resources/arquillian.xml @@ -25,7 +25,7 @@ <property name="dimensions">1024x800</property> <!-- <property name="downloadBinaries">no</property> - <property name="chromeDriverBinary">target/drone/312cd778e385a255c60caed5ffbaf6e5/chromedriver</property> + <property name="chromeDriverBinary">target/drone/75928443ebcccdfe49dffa924c1ee935/chromedriver</property> <property name="firefoxDriverBinary">target/drone/30f3fdc84d76c53de2916008a889d26f/geckodriver</property> --> <property name="firefoxUserPreferences">src/test/profile/firefox/prefs.js</property> -- GitLab