Search in sources :

Example 1 with QTI21GapEntriesEditorPage

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

the class ImsQTI21EditorTest method qti21EditorNumericalInput_absolut.

/**
 * An author make a test with 2 questions using numerical input to
 * test the absolute tolerance mode.<br>
 * A first user make the test, but doesn't answer all questions
 * correctly, log out and a second user make the perfect test but
 * on the limit.
 *
 * @param authorLoginPage
 * @param participantBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void qti21EditorNumericalInput_absolut(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver participantBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
    UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("Rei");
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    String qtiTestTitle = "Numerical 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 numerical input: 3.1 - 3.2
    QTI21GapEntriesEditorPage fibEditor = qtiEditor.addNumerical().appendContent("Usefull for circles ").editNumericalInput("3.1416", "pi", ToleranceMode.ABSOLUTE, "3.2", "3.1", 1).saveNumericInput().save();
    // use standard score setting
    // set feedbacks
    fibEditor.selectFeedbacks().setCorrectFeedback("Correct feedback", "Your answer is correct").setIncorrectFeedback("Incorrect", "Out of bounds").save();
    // add a numerical input which represent a rounding issue
    fibEditor = qtiEditor.addNumerical().appendContent("Check rounding issue ").editNumericalInput("14.923", "rounding", ToleranceMode.ABSOLUTE, "14.925", "14.915", 1).saveNumericInput().save();
    // set feedbacks
    fibEditor.selectFeedbacks().setCorrectFeedback("Correct feedback", "Your answer is correct").setIncorrectFeedback("Incorrect", "Your answer is not correct").save();
    // add a numerical input with negative values
    fibEditor = qtiEditor.addNumerical().appendContent("Check rounding issue ").editNumericalInput("-14.923", "negative", ToleranceMode.ABSOLUTE, "-14.921", "-14.931", 1).saveNumericInput().save();
    // set feedbacks
    fibEditor.selectFeedbacks().setCorrectFeedback("Correct feedback", "Your answer 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();
    // first user make the test
    QTI21Page ryomouQtiPage = QTI21Page.getQTI12Page(participantBrowser);
    ryomouQtiPage.assertOnAssessmentItem().answerGapTextWithPlaceholder("3", "pi").saveAnswer().assertFeedback("Incorrect").answerGapTextWithPlaceholder("3.15", "pi").saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerGapTextWithPlaceholder("14.914", "rounding").saveAnswer().assertFeedback("Incorrect").answerGapTextWithPlaceholder("14.915", "rounding").saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerGapTextWithPlaceholder("-14.932", "negative").saveAnswer().assertFeedback("Incorrect").answerGapTextWithPlaceholder("-14.920", "negative").saveAnswer().endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// 1 point + 1 point + 0 point
    2);
    // 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 with all the correct answers
    QTI21Page.getQTI12Page(participantBrowser).assertOnAssessmentItem().answerGapTextWithPlaceholder("3.2", "pi").saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerGapTextWithPlaceholder("14.925", "rounding").saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerGapTextWithPlaceholder("-14.921", "negative").saveAnswer().assertFeedback("Correct feedback").endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(3);
}
Also used : QTI21GapEntriesEditorPage(org.olat.selenium.page.qti.QTI21GapEntriesEditorPage) 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 2 with QTI21GapEntriesEditorPage

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

the class ImsQTI21EditorTest method qti21EditorFib_text.

/**
 * An author make a test with 2 questions using fill-in-blank,
 * 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 qti21EditorFib_text(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver participantBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
    UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("Rei");
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    String qtiTestTitle = "FIB 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 gap entry: all answers score
    QTI21GapEntriesEditorPage fibEditor = qtiEditor.addFib().appendContent("Usefull for circles ").addGapEntry("Pi", "314").saveGapEntry().editGapEntry("Ln", "lognat", 2).saveGapEntry().save();
    // set max score
    fibEditor.selectScores().selectAssessmentMode(ScoreEvaluation.allCorrectAnswers).setMaxScore("2").save();
    // set feedbacks
    fibEditor.selectFeedbacks().setHint("Hint", "This is a usefull hint").setCorrectSolution("Correct solution", "This is an information about the correct solution").setCorrectFeedback("Correct feedback", "Your answer is correct").setIncorrectFeedback("Incorrect", "Your answer is not correct").save();
    // add a gap entry: score per anser
    fibEditor = qtiEditor.addFib().appendContent("European rocket ").addGapEntry("Ariane", "ari").saveGapEntry().editGapEntry("Falcon9", "falc", 2).saveGapEntry().save();
    // set max score
    fibEditor.selectScores().selectAssessmentMode(ScoreEvaluation.perAnswer).setMaxScore("4").setScore("Ariane", "3").setScore("Falcon9", "1").save();
    // set feedbacks
    fibEditor.selectFeedbacks().setHint("Hint", "Think to space").setCorrectSolution("Correct solution", "This is an information about the correct solution").setCorrectFeedback("Correct feedback", "Your answer 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();
    // first user make the test
    QTI21Page ryomouQtiPage = QTI21Page.getQTI12Page(participantBrowser);
    ryomouQtiPage.assertOnAssessmentItem().answerGapTextWithPlaceholder("Log", "314").answerGapTextWithPlaceholder("Sin", "lognat").saveAnswer().assertFeedback("Incorrect").assertCorrectSolution("Correct solution").hint().assertFeedback("Hint").answerGapTextWithPlaceholder("Pi", "314").answerGapTextWithPlaceholder("Ln", "lognat").saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerGapTextWithPlaceholder("Saturn 5", "ari").answerGapTextWithPlaceholder("Falcon9", "falc").saveAnswer().assertCorrectSolution("Correct solution").assertFeedback("Incorrect").endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// 2 points from the first question, 1 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 with all the correct answers
    QTI21Page.getQTI12Page(participantBrowser).assertOnAssessmentItem().answerGapTextWithPlaceholder("Pi", "314").answerGapTextWithPlaceholder("Ln", "lognat").saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerGapTextWithPlaceholder("Ariane", "ari").answerGapTextWithPlaceholder("Falcon9", "falc").saveAnswer().endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// 2 points from the first question, 4 from the second
    6);
}
Also used : QTI21GapEntriesEditorPage(org.olat.selenium.page.qti.QTI21GapEntriesEditorPage) 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 3 with QTI21GapEntriesEditorPage

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

the class ImsQTI21EditorTest method qti21EditorNumericalInput_exact.

/**
 * An author make a test with 2 questions using numerical input,
 * the first with the score set if all answers are correct, the second
 * with scoring per answers. The numerical input have all the tolerance
 * mode set to EXACT.<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 qti21EditorNumericalInput_exact(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver participantBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
    UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("Rei");
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    String qtiTestTitle = "Numerical 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 numerical input: all answers score, tolerance exact
    QTI21GapEntriesEditorPage fibEditor = qtiEditor.addNumerical().appendContent("One plus two: ").addNumericalInput("3", "three", ToleranceMode.EXACT, null, null).saveNumericInput().editNumericalInput("9", "nine", ToleranceMode.EXACT, null, null, 2).saveNumericInput().save();
    // set max score
    fibEditor.selectScores().selectAssessmentMode(ScoreEvaluation.allCorrectAnswers).setMaxScore("2").save();
    // set feedbacks
    fibEditor.selectFeedbacks().setHint("Hint", "The second is the first power two").setCorrectSolution("Correct solution", "I know you know").setCorrectFeedback("Correct feedback", "Your answer is correct").setIncorrectFeedback("Incorrect", "Your answer is not correct").save();
    // add a gap entry: score per answer, tolerance exact
    fibEditor = qtiEditor.addNumerical().appendContent("More difficult: 34 + 23 ").addNumericalInput("57", "57", ToleranceMode.EXACT, null, null).saveNumericInput().editNumericalInput("8", "64squareroot", ToleranceMode.EXACT, null, null, 2).saveNumericInput().save();
    // set max score
    fibEditor.selectScores().selectAssessmentMode(ScoreEvaluation.perAnswer).setMaxScore("4").setScore("57", "2").setScore("8", "3").save();
    // set feedbacks
    fibEditor.selectFeedbacks().setHint("Hint", "The second is the square root of 64").setCorrectSolution("Correct solution", "This is an information about the correct solution").setCorrectFeedback("Correct feedback", "Your answer 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();
    // first user make the test
    QTI21Page ryomouQtiPage = QTI21Page.getQTI12Page(participantBrowser);
    ryomouQtiPage.assertOnAssessmentItem().answerGapTextWithPlaceholder("2", "three").answerGapTextWithPlaceholder("25", "nine").saveAnswer().assertFeedback("Incorrect").assertCorrectSolution("Correct solution").hint().assertFeedback("Hint").answerGapTextWithPlaceholder("3", "three").answerGapTextWithPlaceholder("9", "nine").saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerGapTextWithPlaceholder("57", "57").answerGapTextWithPlaceholder("9", "64squareroot").saveAnswer().assertCorrectSolution("Correct solution").assertFeedback("Incorrect").endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// 2 points from the first question, 4 from the second
    4);
    // 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 with all the correct answers
    QTI21Page.getQTI12Page(participantBrowser).assertOnAssessmentItem().answerGapTextWithPlaceholder("3", "three").answerGapTextWithPlaceholder("9", "nine").saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerGapTextWithPlaceholder("57", "57").answerGapTextWithPlaceholder("8", "64squareroot").saveAnswer().endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// 2 points from the first question, 4 from the second
    6);
}
Also used : QTI21GapEntriesEditorPage(org.olat.selenium.page.qti.QTI21GapEntriesEditorPage) 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 QTI21GapEntriesEditorPage

use of org.olat.selenium.page.qti.QTI21GapEntriesEditorPage in project openolat by klemens.

the class ImsQTI21EditorTest method qti21EditorFib_text.

/**
 * An author make a test with 2 questions using fill-in-blank,
 * 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 qti21EditorFib_text(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver participantBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
    UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("Rei");
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    String qtiTestTitle = "FIB 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 gap entry: all answers score
    QTI21GapEntriesEditorPage fibEditor = qtiEditor.addFib().appendContent("Usefull for circles ").addGapEntry("Pi", "314").saveGapEntry().editGapEntry("Ln", "lognat", 2).saveGapEntry().save();
    // set max score
    fibEditor.selectScores().selectAssessmentMode(ScoreEvaluation.allCorrectAnswers).setMaxScore("2").save();
    // set feedbacks
    fibEditor.selectFeedbacks().setHint("Hint", "This is a usefull hint").setCorrectSolution("Correct solution", "This is an information about the correct solution").setCorrectFeedback("Correct feedback", "Your answer is correct").setIncorrectFeedback("Incorrect", "Your answer is not correct").save();
    // add a gap entry: score per anser
    fibEditor = qtiEditor.addFib().appendContent("European rocket ").addGapEntry("Ariane", "ari").saveGapEntry().editGapEntry("Falcon9", "falc", 2).saveGapEntry().save();
    // set max score
    fibEditor.selectScores().selectAssessmentMode(ScoreEvaluation.perAnswer).setMaxScore("4").setScore("Ariane", "3").setScore("Falcon9", "1").save();
    // set feedbacks
    fibEditor.selectFeedbacks().setHint("Hint", "Think to space").setCorrectSolution("Correct solution", "This is an information about the correct solution").setCorrectFeedback("Correct feedback", "Your answer 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();
    // first user make the test
    QTI21Page ryomouQtiPage = QTI21Page.getQTI12Page(participantBrowser);
    ryomouQtiPage.assertOnAssessmentItem().answerGapTextWithPlaceholder("Log", "314").answerGapTextWithPlaceholder("Sin", "lognat").saveAnswer().assertFeedback("Incorrect").assertCorrectSolution("Correct solution").hint().assertFeedback("Hint").answerGapTextWithPlaceholder("Pi", "314").answerGapTextWithPlaceholder("Ln", "lognat").saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerGapTextWithPlaceholder("Saturn 5", "ari").answerGapTextWithPlaceholder("Falcon9", "falc").saveAnswer().assertCorrectSolution("Correct solution").assertFeedback("Incorrect").endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// 2 points from the first question, 1 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 with all the correct answers
    QTI21Page.getQTI12Page(participantBrowser).assertOnAssessmentItem().answerGapTextWithPlaceholder("Pi", "314").answerGapTextWithPlaceholder("Ln", "lognat").saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerGapTextWithPlaceholder("Ariane", "ari").answerGapTextWithPlaceholder("Falcon9", "falc").saveAnswer().endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// 2 points from the first question, 4 from the second
    6);
}
Also used : QTI21GapEntriesEditorPage(org.olat.selenium.page.qti.QTI21GapEntriesEditorPage) 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 5 with QTI21GapEntriesEditorPage

use of org.olat.selenium.page.qti.QTI21GapEntriesEditorPage in project openolat by klemens.

the class ImsQTI21EditorTest method qti21EditorNumericalInput_exact.

/**
 * An author make a test with 2 questions using numerical input,
 * the first with the score set if all answers are correct, the second
 * with scoring per answers. The numerical input have all the tolerance
 * mode set to EXACT.<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 qti21EditorNumericalInput_exact(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver participantBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
    UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("Rei");
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    String qtiTestTitle = "Numerical 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 numerical input: all answers score, tolerance exact
    QTI21GapEntriesEditorPage fibEditor = qtiEditor.addNumerical().appendContent("One plus two: ").addNumericalInput("3", "three", ToleranceMode.EXACT, null, null).saveNumericInput().editNumericalInput("9", "nine", ToleranceMode.EXACT, null, null, 2).saveNumericInput().save();
    // set max score
    fibEditor.selectScores().selectAssessmentMode(ScoreEvaluation.allCorrectAnswers).setMaxScore("2").save();
    // set feedbacks
    fibEditor.selectFeedbacks().setHint("Hint", "The second is the first power two").setCorrectSolution("Correct solution", "I know you know").setCorrectFeedback("Correct feedback", "Your answer is correct").setIncorrectFeedback("Incorrect", "Your answer is not correct").save();
    // add a gap entry: score per answer, tolerance exact
    fibEditor = qtiEditor.addNumerical().appendContent("More difficult: 34 + 23 ").addNumericalInput("57", "57", ToleranceMode.EXACT, null, null).saveNumericInput().editNumericalInput("8", "64squareroot", ToleranceMode.EXACT, null, null, 2).saveNumericInput().save();
    // set max score
    fibEditor.selectScores().selectAssessmentMode(ScoreEvaluation.perAnswer).setMaxScore("4").setScore("57", "2").setScore("8", "3").save();
    // set feedbacks
    fibEditor.selectFeedbacks().setHint("Hint", "The second is the square root of 64").setCorrectSolution("Correct solution", "This is an information about the correct solution").setCorrectFeedback("Correct feedback", "Your answer 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();
    // first user make the test
    QTI21Page ryomouQtiPage = QTI21Page.getQTI12Page(participantBrowser);
    ryomouQtiPage.assertOnAssessmentItem().answerGapTextWithPlaceholder("2", "three").answerGapTextWithPlaceholder("25", "nine").saveAnswer().assertFeedback("Incorrect").assertCorrectSolution("Correct solution").hint().assertFeedback("Hint").answerGapTextWithPlaceholder("3", "three").answerGapTextWithPlaceholder("9", "nine").saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerGapTextWithPlaceholder("57", "57").answerGapTextWithPlaceholder("9", "64squareroot").saveAnswer().assertCorrectSolution("Correct solution").assertFeedback("Incorrect").endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// 2 points from the first question, 4 from the second
    4);
    // 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 with all the correct answers
    QTI21Page.getQTI12Page(participantBrowser).assertOnAssessmentItem().answerGapTextWithPlaceholder("3", "three").answerGapTextWithPlaceholder("9", "nine").saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerGapTextWithPlaceholder("57", "57").answerGapTextWithPlaceholder("8", "64squareroot").saveAnswer().endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// 2 points from the first question, 4 from the second
    6);
}
Also used : QTI21GapEntriesEditorPage(org.olat.selenium.page.qti.QTI21GapEntriesEditorPage) 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)

Aggregations

RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)6 Test (org.junit.Test)6 LoginPage (org.olat.selenium.page.LoginPage)6 NavigationPage (org.olat.selenium.page.NavigationPage)6 QTI21EditorPage (org.olat.selenium.page.qti.QTI21EditorPage)6 QTI21GapEntriesEditorPage (org.olat.selenium.page.qti.QTI21GapEntriesEditorPage)6 QTI21Page (org.olat.selenium.page.qti.QTI21Page)6 UserRestClient (org.olat.test.rest.UserRestClient)6 UserVO (org.olat.user.restapi.UserVO)6