Search in sources :

Example 1 with QTI21Page

use of org.olat.selenium.page.qti.QTI21Page in project OpenOLAT by OpenOLAT.

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");
}
Also used : QTI21EditorPage(org.olat.selenium.page.qti.QTI21EditorPage) UserVO(org.olat.user.restapi.UserVO) NavigationPage(org.olat.selenium.page.NavigationPage) QTI21LobEditorPage(org.olat.selenium.page.qti.QTI21LobEditorPage) File(java.io.File) LoginPage(org.olat.selenium.page.LoginPage) URL(java.net.URL) UserRestClient(org.olat.test.rest.UserRestClient) QTI21Page(org.olat.selenium.page.qti.QTI21Page) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 2 with QTI21Page

use of org.olat.selenium.page.qti.QTI21Page in project OpenOLAT by OpenOLAT.

the class ImsQTI21EditorTest method qti21EditorHotspot_singleChoice.

/**
 * An author make a test with 2 hotspots with the single choice cardinality,
 * the first with the score set if all answers are correct, the second
 * with scoring per answers.<br>
 * A first user make the test, but doesn't answer all questions
 * correctly, log out and a second user make the perfect test.
 *
 * @param authorLoginPage
 * @param participantBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void qti21EditorHotspot_singleChoice(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver participantBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
    UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("Rei");
    String qtiTestTitle = "Hotspot 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 hotspot: all answers score
    QTI21HotspotEditorPage hotspotEditor = qtiEditor.addHotspot();
    // 2 spots
    URL backgroundImageUrl = JunitTestHelper.class.getResource("file_resources/house.jpg");
    File backgroundImageFile = new File(backgroundImageUrl.toURI());
    hotspotEditor.updloadBackground(backgroundImageFile).resizeCircle().moveCircle(300, 120).addRectangle().moveRectangle(150, 150).setCardinality(Cardinality.SINGLE).save();
    // change max score
    hotspotEditor.selectScores().setMaxScore("3").save();
    // some feedbacks
    hotspotEditor.selectFeedbacks().setHint("Hint", "This is only an hint").setCorrectSolution("Correct solution", "This is the correct solution").setCorrectFeedback("Correct feedback", "This is correct").setIncorrectFeedback("Incorrect", "Your answer is not correct").save();
    // add a second hotspot: score per answer
    hotspotEditor = qtiEditor.addHotspot();
    hotspotEditor.updloadBackground(backgroundImageFile).resizeCircle().moveCircle(310, 125).addRectangle().moveRectangle(145, 155).setCardinality(Cardinality.SINGLE).save();
    // change scoring
    hotspotEditor.selectScores().setMaxScore("2").selectAssessmentMode(ScoreEvaluation.perAnswer).setScore("1.", "2").setScore("2.", "0").save();
    hotspotEditor.selectFeedbacks().setHint("Hint", "The hint").setCorrectSolution("Correct solution", "This is the correct solution").setCorrectFeedback("Correct feedback", "This is correct").setIncorrectFeedback("Incorrect", "Your answer is not correct").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 userLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
    userLoginPage.loginAs(ryomou.getLogin(), ryomou.getPassword()).resume();
    NavigationPage userNavBar = new NavigationPage(participantBrowser);
    userNavBar.openMyCourses().openSearch().extendedSearch(qtiTestTitle).select(qtiTestTitle).start();
    // make the test
    QTI21Page ryomouQtiPage = QTI21Page.getQTI12Page(participantBrowser);
    ryomouQtiPage.assertOnAssessmentItem().answerHotspot("rect").saveAnswer().assertFeedback("Incorrect").assertCorrectSolution("Correct solution").hint().assertFeedback("Hint").answerHotspot("circle").saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerHotspot("rect").saveAnswer().assertCorrectSolution("Correct solution").assertFeedback("Incorrect").endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// 3 points from the first question, 0 from the second
    3);
    // a second 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.getQTI12Page(participantBrowser).assertOnAssessmentItem().answerHotspot("circle").saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerHotspot("circle").saveAnswer().endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// 3 points from the first question, 2 from the second
    5);
}
Also used : QTI21EditorPage(org.olat.selenium.page.qti.QTI21EditorPage) UserVO(org.olat.user.restapi.UserVO) NavigationPage(org.olat.selenium.page.NavigationPage) QTI21HotspotEditorPage(org.olat.selenium.page.qti.QTI21HotspotEditorPage) File(java.io.File) URL(java.net.URL) LoginPage(org.olat.selenium.page.LoginPage) UserRestClient(org.olat.test.rest.UserRestClient) QTI21Page(org.olat.selenium.page.qti.QTI21Page) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 3 with QTI21Page

use of org.olat.selenium.page.qti.QTI21Page in project OpenOLAT by OpenOLAT.

the class ImsQTI21EditorTest method qti21EditorMatchDragAndDrop.

/**
 * An author make a test with 2 match of the drag and drop variety
 * with feedbacks.<br>
 * A first user make the test, check the feedbacks but make an error
 * and score the maximum. A second user answers all the questions
 * correctly.
 *
 * @param authorLoginPage
 * @param participantBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void qti21EditorMatchDragAndDrop(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver participantBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO asuka = new UserRestClient(deploymentUrl).createRandomUser("Asuka");
    UserVO chara = new UserRestClient(deploymentUrl).createRandomUser("Chara");
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    String qtiTestTitle = "Match DnD 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 a match, multiple selection
    QTI21MatchEditorPage matchEditor = qtiEditor.addMatchDragAndDrop();
    matchEditor.setSource(0, "Einstein").setSource(1, "Planck").addRow().setSource(2, "Euler").setTarget(0, "Physicist").setTarget(1, "Mathematician").setMatch(0, 0, true).setMatch(1, 0, true).setMatch(2, 1, true).save();
    // change max score
    matchEditor.selectScores().setMaxScore("4").save();
    // set some feedbacks
    matchEditor.selectFeedbacks().setHint("Hint", "Euler come from Switzerland").setCorrectSolution("Correct solution", "The correct solution is simple").setCorrectFeedback("Correct feedback", "You are right").setIncorrectFeedback("Incorrect", "Your answer is not exactly correct").save();
    // second match
    matchEditor = qtiEditor.addMatchDragAndDrop().setSingleChoices().setSource(0, "Euler").setSource(1, "Broglie").addRow().setSource(2, "Konrad").setTarget(0, "Mathematics").setTarget(1, "Medicine").addColumn().setTarget(2, "Physics").setMatch(0, 0, true).setMatch(1, 2, true).setMatch(2, 1, true).save();
    // select score "per answer" and set the scores
    matchEditor.selectScores().selectAssessmentMode(ScoreEvaluation.perAnswer).setMaxScore("8").setScore(0, 0, "2.0").setScore(0, 1, "0.0").setScore(0, 2, "0.0").setScore(1, 0, "0.0").setScore(1, 1, "0.0").setScore(1, 2, "3.0").setScore(2, 0, "0.0").setScore(2, 1, "2.0").setScore(2, 2, "0.0").save();
    matchEditor.selectFeedbacks().setHint("Hint", "The hint").setCorrectSolution("Correct solution", "This is the correct solution").setCorrectFeedback("Correct feedback", "This is correct").setIncorrectFeedback("Incorrect", "Your answer is not correct").save();
    // close editor
    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 asukaLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
    asukaLoginPage.loginAs(asuka.getLogin(), asuka.getPassword()).resume();
    NavigationPage asukaNavBar = new NavigationPage(participantBrowser);
    asukaNavBar.openMyCourses().openSearch().extendedSearch(qtiTestTitle).select(qtiTestTitle).start();
    // make the test
    QTI21Page asukaQtiPage = QTI21Page.getQTI12Page(participantBrowser);
    asukaQtiPage.assertOnAssessmentItem().answerMatchDropSourceToTarget("Einstein", "Physicist").answerMatchDropSourceToTarget("Planck", "Mathematician").answerMatchDropSourceToTarget("Euler", "Mathematician").saveAnswer().assertFeedback("Incorrect").assertCorrectSolution("Correct solution").hint().assertFeedback("Hint").answerMatchDropTargetToTarget("Planck", "Physicist").saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerMatchDropSourceToTarget("Broglie", // 2 points
    "Physics").answerMatchDropSourceToTarget("Euler", // 2 points
    "Medicine").answerMatchDropSourceToTarget("Konrad", // 3 points
    "Medicine").saveAnswer().assertCorrectSolution("Correct solution").assertFeedback("Incorrect").endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(9);
    // a second user search the content package
    LoginPage charaLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
    charaLoginPage.loginAs(chara.getLogin(), chara.getPassword()).resume();
    NavigationPage charaNavBar = new NavigationPage(participantBrowser);
    charaNavBar.openMyCourses().openSearch().extendedSearch(qtiTestTitle).select(qtiTestTitle).start();
    // make the test
    QTI21Page.getQTI12Page(participantBrowser).answerMatchDropSourceToTarget("Einstein", "Physicist").answerMatchDropSourceToTarget("Planck", "Physicist").answerMatchDropSourceToTarget("Euler", "Mathematician").saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerMatchDropSourceToTarget("Broglie", // 2 points
    "Physics").answerMatchDropSourceToTarget("Euler", // 2 points
    "Mathematics").answerMatchDropSourceToTarget("Konrad", // 3 points
    "Medicine").saveAnswer().endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// 4 points from the first question, 7 from the second
    11);
}
Also used : QTI21MatchEditorPage(org.olat.selenium.page.qti.QTI21MatchEditorPage) QTI21EditorPage(org.olat.selenium.page.qti.QTI21EditorPage) UserVO(org.olat.user.restapi.UserVO) NavigationPage(org.olat.selenium.page.NavigationPage) LoginPage(org.olat.selenium.page.LoginPage) UserRestClient(org.olat.test.rest.UserRestClient) QTI21Page(org.olat.selenium.page.qti.QTI21Page) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 4 with QTI21Page

use of org.olat.selenium.page.qti.QTI21Page in project OpenOLAT by OpenOLAT.

the class ImsQTI21EditorTest method importQuestionsCSVMatchVariants.

/**
 * Create a test, import a CSV with some match variants,
 * 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 importQuestionsCSVMatchVariants(@InitialPage LoginPage authorLoginPage) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    // upload a test
    String qtiTestTitle = "ExcelMatch 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_match.txt").next().assertOnNumberOfQuestions(3).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().answerMatch("Berlin", "Deutschland", true).answerMatch("Bern", "Schweiz", true).answerMatch("Paris", "Frankreich", true).saveAnswer().nextAnswer().assertOnAssessmentItem("Afrika").answerMatchDropSourceToTarget("Nairobi", "Kenia").answerMatchDropSourceToTarget("Windhoek", "Namibia").answerMatchDropSourceToTarget("Algier", "Algerien").saveAnswer().assertOnAssessmentItem("Europa").answerMatch("Paris", TrueFalse.right, true).answerMatch("Bern", TrueFalse.right, true).answerMatch("Stockholm", TrueFalse.wrong, true).saveAnswer().endTest();
    // check the results
    qtiPage.assertOnAssessmentResults().assertOnAssessmentTestScore(9).assertOnAssessmentTestMaxScore(9);
}
Also used : QTI21EditorPage(org.olat.selenium.page.qti.QTI21EditorPage) UserVO(org.olat.user.restapi.UserVO) UserRestClient(org.olat.test.rest.UserRestClient) QTI21Page(org.olat.selenium.page.qti.QTI21Page) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 5 with QTI21Page

use of org.olat.selenium.page.qti.QTI21Page in project OpenOLAT by OpenOLAT.

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);
}
Also used : QTI21EditorPage(org.olat.selenium.page.qti.QTI21EditorPage) UserVO(org.olat.user.restapi.UserVO) UserRestClient(org.olat.test.rest.UserRestClient) QTI21Page(org.olat.selenium.page.qti.QTI21Page) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Aggregations

RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)96 Test (org.junit.Test)96 QTI21Page (org.olat.selenium.page.qti.QTI21Page)96 UserRestClient (org.olat.test.rest.UserRestClient)96 UserVO (org.olat.user.restapi.UserVO)96 File (java.io.File)60 URL (java.net.URL)60 QTI21EditorPage (org.olat.selenium.page.qti.QTI21EditorPage)46 LoginPage (org.olat.selenium.page.LoginPage)40 NavigationPage (org.olat.selenium.page.NavigationPage)40 QTI21MatchEditorPage (org.olat.selenium.page.qti.QTI21MatchEditorPage)10 QTI21MultipleChoiceEditorPage (org.olat.selenium.page.qti.QTI21MultipleChoiceEditorPage)8 QTI21SingleChoiceEditorPage (org.olat.selenium.page.qti.QTI21SingleChoiceEditorPage)8 CourseEditorPageFragment (org.olat.selenium.page.course.CourseEditorPageFragment)6 CoursePageFragment (org.olat.selenium.page.course.CoursePageFragment)6 QTI21ConfigurationCEPage (org.olat.selenium.page.qti.QTI21ConfigurationCEPage)6 QTI21GapEntriesEditorPage (org.olat.selenium.page.qti.QTI21GapEntriesEditorPage)6 QTI21HotspotEditorPage (org.olat.selenium.page.qti.QTI21HotspotEditorPage)6 QTI21LobEditorPage (org.olat.selenium.page.qti.QTI21LobEditorPage)6 WebElement (org.openqa.selenium.WebElement)6