Search in sources :

Example 11 with LoginPage

use of org.olat.selenium.page.LoginPage 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 12 with LoginPage

use of org.olat.selenium.page.LoginPage 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 13 with LoginPage

use of org.olat.selenium.page.LoginPage in project OpenOLAT by OpenOLAT.

the class ImsQTI21EditorTest method qti21EditorMatchTrueFalse.

/**
 * An author make a test with 2 matches of the True/false variant. A match
 * with score "all answers", a second with score "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 qti21EditorMatchTrueFalse(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver participantBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("Rei");
    UserVO asuka = new UserRestClient(deploymentUrl).createRandomUser("Asuka");
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    String qtiTestTitle = "True false 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, score "all answers"
    QTI21MatchEditorPage matchEditor = qtiEditor.addMatchTrueFalse();
    matchEditor.setSource(0, "Eclipse is a Java IDE").setSource(1, "vim is Database viewer").setMatch(0, 1, true).setMatch(1, 2, true).save();
    // change max score
    matchEditor.selectScores().setMaxScore("4").save();
    // set some feedbacks
    matchEditor.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();
    // second match
    matchEditor = qtiEditor.addMatchTrueFalse().setSource(0, "Java has several IDE like Eclipse").setSource(1, "C is object oriented").addRow().setSource(2, "What do you think of PHP?").setMatch(0, 1, true).setMatch(1, 2, true).setMatch(2, 0, true).save();
    // select score "per answer" and set the scores
    matchEditor.selectScores().selectAssessmentMode(ScoreEvaluation.perAnswer).setMaxScore("3").setScore(0, 0, "0.0").setScore(0, 1, "1.0").setScore(0, 2, "0.0").setScore(1, 0, "0.0").setScore(1, 1, "0.0").setScore(1, 2, "1.0").setScore(2, 0, "1.0").setScore(2, 1, "0.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();
    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().answerMatch("Eclipse", TrueFalse.right, true).answerMatch("vim", TrueFalse.right, true).saveAnswer().assertFeedback("Incorrect").assertCorrectSolution("Correct solution").hint().assertFeedback("Hint").answerMatch("vim", TrueFalse.wrong, true).saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerMatch("Java", TrueFalse.right, true).answerMatch("oriented", TrueFalse.wrong, true).answerMatch("PHP", TrueFalse.wrong, true).saveAnswer().assertCorrectSolution("Correct solution").assertFeedback("Incorrect").endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// 4 points from the first question, 2 from the second
    6);
    // a second 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.getQTI12Page(participantBrowser).assertOnAssessmentItem().answerMatch("Eclipse", TrueFalse.right, true).answerMatch("vim", TrueFalse.wrong, true).saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerMatch("Java", TrueFalse.right, true).answerMatch("oriented", TrueFalse.wrong, true).saveAnswer().endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// 4 points from the first question, 6 from the second
    7);
}
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 14 with LoginPage

use of org.olat.selenium.page.LoginPage in project OpenOLAT by OpenOLAT.

the class ImsQTI21EditorTest method qti21EditorHiddenSection.

/**
 * An author make a test with 2 questions and in the expert
 * settings of the section, it hides the title. It set the
 * access configuration.<br>
 * A user search the test, make it, check that the sections
 * are not visible, pass the test and check the assessment
 * results.
 * @param authorLoginPage
 * @param participantBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void qti21EditorHiddenSection(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver participantBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
    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();
    // customize the section
    qtiEditor.selectSection().selectExpertOptions().sectionTitle(false).save();
    // edit the default single choice
    qtiEditor.selectItem("Single Choice");
    QTI21SingleChoiceEditorPage scEditor = new QTI21SingleChoiceEditorPage(browser);
    scEditor.setAnswer(0, "Wrong").addChoice(1).setCorrect(1).setAnswer(1, "Correct").addChoice(2).setAnswer(2, "Faux").save();
    // add a multiple choice
    QTI21MultipleChoiceEditorPage mcEditor = qtiEditor.addMultipleChoice();
    mcEditor.setAnswer(0, "Correct").setCorrect(0).addChoice(1).setCorrect(1).setAnswer(1, "OkToo").addChoice(2).setAnswer(2, "Faux").addChoice(3).setAnswer(3, "Falsch").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().assertHiddenSection().answerSingleChoiceWithParagraph("Correct").saveAnswer().answerMultipleChoice("OkToo").answerMultipleChoice("Correct").saveAnswer().endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(2).assertOnAssessmentTestMaxScore(2);
}
Also used : QTI21EditorPage(org.olat.selenium.page.qti.QTI21EditorPage) QTI21SingleChoiceEditorPage(org.olat.selenium.page.qti.QTI21SingleChoiceEditorPage) UserVO(org.olat.user.restapi.UserVO) QTI21MultipleChoiceEditorPage(org.olat.selenium.page.qti.QTI21MultipleChoiceEditorPage) 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 15 with LoginPage

use of org.olat.selenium.page.LoginPage in project OpenOLAT by OpenOLAT.

the class ImsQTI21EditorTest method qti21EditorHotspot_multipleChoice.

/**
 * An author make a test with 2 hotspots with the multiple 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_multipleChoice(@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.MULTIPLE).setCorrect("2.", true).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.MULTIPLE).setCorrect("2.", true).save();
    // change scoring
    hotspotEditor.selectScores().setMaxScore("3").selectAssessmentMode(ScoreEvaluation.perAnswer).setScore("1.", "2").setScore("2.", "1").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("circle").saveAnswer().assertCorrectSolution("Correct solution").assertFeedback("Incorrect").endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// 3 points from the first question, 2 from the second
    5);
    // 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").answerHotspot("rect").saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerHotspot("circle").answerHotspot("rect").saveAnswer().endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// 3 points from the first question, 3 from the second
    6);
}
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)

Aggregations

RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)116 Test (org.junit.Test)116 LoginPage (org.olat.selenium.page.LoginPage)116 UserVO (org.olat.user.restapi.UserVO)114 UserRestClient (org.olat.test.rest.UserRestClient)108 NavigationPage (org.olat.selenium.page.NavigationPage)100 CoursePageFragment (org.olat.selenium.page.course.CoursePageFragment)54 CourseEditorPageFragment (org.olat.selenium.page.course.CourseEditorPageFragment)40 QTI21Page (org.olat.selenium.page.qti.QTI21Page)40 QTI21EditorPage (org.olat.selenium.page.qti.QTI21EditorPage)38 URL (java.net.URL)32 File (java.io.File)30 MembersPage (org.olat.selenium.page.course.MembersPage)28 UserToolsPage (org.olat.selenium.page.user.UserToolsPage)24 AuthoringEnvPage (org.olat.selenium.page.repository.AuthoringEnvPage)18 WebElement (org.openqa.selenium.WebElement)12 GroupPage (org.olat.selenium.page.group.GroupPage)10 QTI21MatchEditorPage (org.olat.selenium.page.qti.QTI21MatchEditorPage)10 By (org.openqa.selenium.By)10 Calendar (java.util.Calendar)8