Search in sources :

Example 6 with QTI21SingleChoiceEditorPage

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

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 7 with QTI21SingleChoiceEditorPage

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

the class ImsQTI21EditorTest method qti21EditorNegativePoints.

/**
 * An author make a test and use the negative points.<br>
 * 3 users search the test, pass the test or not and
 * check their results.
 *
 * @param authorLoginPage
 * @param participantBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void qti21EditorNegativePoints(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver participantBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
    UserVO asuka = new UserRestClient(deploymentUrl).createRandomUser("Asuka");
    UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("Rei");
    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();
    scEditor.selectScores().selectAssessmentMode(ScoreEvaluation.perAnswer).setMaxScore("2.0").setMinScore("-1.0").setScore("Wrong", "-1").setScore("Correct", "2").setScore("Faux", "-1").save();
    // add a multiple choice
    QTI21MultipleChoiceEditorPage mcEditor = qtiEditor.addMultipleChoice();
    mcEditor.setAnswer(0, "Correct").setCorrect(0).addChoice(1).setCorrect(1).setAnswer(1, "Ok").addChoice(2).setAnswer(2, "Faux").addChoice(3).setAnswer(3, "Falsch").save();
    mcEditor.selectScores().selectAssessmentMode(ScoreEvaluation.perAnswer).setMaxScore("2.0").setMinScore("-2").setScore("Correct", "1").setScore("Ok", "1").setScore("Faux", "-2").setScore("Falsch", "-2").save();
    // add an hotspot
    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();
    hotspotEditor.selectScores().selectAssessmentMode(ScoreEvaluation.perAnswer).setMaxScore("3.0").setMinScore("-2").setScore("1.", // circle
    "3.0").setScore("2.", // rectangle
    "-2").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 with all correct answers
    QTI21Page ryomouQtiPage = QTI21Page.getQTI12Page(participantBrowser);
    ryomouQtiPage.assertOnAssessmentItem().assertHiddenSection().answerSingleChoiceWithParagraph("Correct").saveAnswer().answerMultipleChoice("Ok").answerMultipleChoice("Correct").saveAnswer().answerHotspot("circle").saveAnswer().endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(7).assertOnAssessmentTestMaxScore(7);
    // 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 with all correct answers
    QTI21Page asukaQtiPage = QTI21Page.getQTI12Page(participantBrowser);
    asukaQtiPage.assertOnAssessmentItem().assertHiddenSection().answerSingleChoiceWithParagraph("Wrong").saveAnswer().answerMultipleChoice("Falsch").answerMultipleChoice("Faux").saveAnswer().answerHotspot("rect").saveAnswer().endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// -1 + -4 but never under 0
    0).assertOnAssessmentTestMaxScore(7);
    // a third 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 some correct answers
    QTI21Page reiQtiPage = QTI21Page.getQTI12Page(participantBrowser);
    reiQtiPage.assertOnAssessmentItem().assertHiddenSection().answerSingleChoiceWithParagraph("Faux").saveAnswer().answerMultipleChoice("Ok").answerMultipleChoice("Correct").saveAnswer().answerHotspot("circle").saveAnswer().endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// -1 + 2 + 3 points
    4).assertOnAssessmentTestMaxScore(7);
}
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) 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 8 with QTI21SingleChoiceEditorPage

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

the class ImsQTI21EditorTest method qti21EditorSingleChoices.

/**
 * Test different settings in the single choice editor. An author
 * make a test with 2 single choices, one with score all answer correct,
 * the second with score per answer and feedbacks.<br>
 * A second user make the test and check the score at the end of
 * the test.
 *
 * @param authorLoginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void qti21EditorSingleChoices(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver ryomouBrowser) 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();
    // start a blank test
    qtiEditor.selectNode("Single choice").deleteNode();
    // add a single choice: all answers score
    QTI21SingleChoiceEditorPage scEditor = qtiEditor.addSingleChoice();
    scEditor.setAnswer(0, "Wrong").addChoice(1).setCorrect(1).setAnswer(1, "Correct").addChoice(2).setAnswer(2, "Faux").addChoice(3).setAnswer(3, "Falsch").save();
    // change max score
    scEditor.selectScores().setMaxScore("3").save();
    // set some feedbacks
    scEditor.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();
    // score per answers
    scEditor = qtiEditor.addSingleChoice().setAnswer(0, "AlmostRight").addChoice(1).setAnswer(1, "NotRight").addChoice(2).setCorrect(2).setAnswer(2, "RightAnswer").addChoice(3).setAnswer(3, "TheWrongOne").save();
    scEditor.selectScores().setMaxScore("2").selectAssessmentMode(ScoreEvaluation.perAnswer).setScore("Almost", "1").setScore("NotRight", "0").setScore("RightAnswer", "2").setScore("TheWrongOne", "0").save();
    scEditor.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(ryomouBrowser, deploymentUrl);
    userLoginPage.loginAs(ryomou.getLogin(), ryomou.getPassword()).resume();
    NavigationPage userNavBar = new NavigationPage(ryomouBrowser);
    userNavBar.openMyCourses().openSearch().extendedSearch(qtiTestTitle).select(qtiTestTitle).start();
    // make the test
    QTI21Page ryomouQtiPage = QTI21Page.getQTI12Page(ryomouBrowser);
    ryomouQtiPage.assertOnAssessmentItem().answerSingleChoiceWithParagraph("Falsch").saveAnswer().assertFeedback("Incorrect").assertCorrectSolution("Correct solution").hint().assertFeedback("Hint").answerSingleChoiceWithParagraph("Correct").saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerSingleChoiceWithParagraph("Almost").saveAnswer().assertCorrectSolution("Correct solution").assertFeedback("Incorrect").endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// 3 points from the first question, 1 from the second
    4);
}
Also used : QTI21EditorPage(org.olat.selenium.page.qti.QTI21EditorPage) QTI21SingleChoiceEditorPage(org.olat.selenium.page.qti.QTI21SingleChoiceEditorPage) 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)8 Test (org.junit.Test)8 QTI21EditorPage (org.olat.selenium.page.qti.QTI21EditorPage)8 QTI21Page (org.olat.selenium.page.qti.QTI21Page)8 QTI21SingleChoiceEditorPage (org.olat.selenium.page.qti.QTI21SingleChoiceEditorPage)8 UserRestClient (org.olat.test.rest.UserRestClient)8 UserVO (org.olat.user.restapi.UserVO)8 LoginPage (org.olat.selenium.page.LoginPage)6 NavigationPage (org.olat.selenium.page.NavigationPage)6 QTI21MultipleChoiceEditorPage (org.olat.selenium.page.qti.QTI21MultipleChoiceEditorPage)4 File (java.io.File)2 URL (java.net.URL)2 QTI21HotspotEditorPage (org.olat.selenium.page.qti.QTI21HotspotEditorPage)2