Search in sources :

Example 1 with QTI21HottextEditorPage

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

the class ImsQTI21EditorTest method qti21EditorHottext.

/**
 * An author make a test with a question with 2 hot texts, one checked,
 * one not. A user make the test. The test is limited because I cannot
 * edit the text within the hot text via the web driver.
 *
 * @param authorLoginPage
 * @param participantBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void qti21EditorHottext(@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 = "Hottext 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 hot text with score: all answers
    QTI21HottextEditorPage hottextEditor = qtiEditor.addHottext().appendContent("I cannot modify the hottext ").addHottext().uncheck(2).check(1).save();
    // change max score
    hottextEditor.selectScores().setMaxScore("3").save();
    // set some feedbacks
    hottextEditor.selectFeedbacks().setHint("Hint", "This is an hint").setCorrectSolution("Correct solution", "First not, second yes").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().answerHottext(2).saveAnswer().assertFeedback("Incorrect").assertCorrectSolution("Correct solution").hint().assertFeedback("Hint").answerHottext(1).answerHottext(// un select it
    2).saveAnswer().assertFeedback("Correct feedback").endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// 3 points from the first question
    3);
}
Also used : 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) QTI21HottextEditorPage(org.olat.selenium.page.qti.QTI21HottextEditorPage) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 2 with QTI21HottextEditorPage

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

the class ImsQTI21EditorTest method qti21EditorHottext.

/**
 * An author make a test with a question with 2 hot texts, one checked,
 * one not. A user make the test. The test is limited because I cannot
 * edit the text within the hot text via the web driver.
 *
 * @param authorLoginPage
 * @param participantBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void qti21EditorHottext(@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 = "Hottext 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 hot text with score: all answers
    QTI21HottextEditorPage hottextEditor = qtiEditor.addHottext().appendContent("I cannot modify the hottext ").addHottext().uncheck(2).check(1).save();
    // change max score
    hottextEditor.selectScores().setMaxScore("3").save();
    // set some feedbacks
    hottextEditor.selectFeedbacks().setHint("Hint", "This is an hint").setCorrectSolution("Correct solution", "First not, second yes").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().answerHottext(2).saveAnswer().assertFeedback("Incorrect").assertCorrectSolution("Correct solution").hint().assertFeedback("Hint").answerHottext(1).answerHottext(// un select it
    2).saveAnswer().assertFeedback("Correct feedback").endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// 3 points from the first question
    3);
}
Also used : 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) QTI21HottextEditorPage(org.olat.selenium.page.qti.QTI21HottextEditorPage) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Aggregations

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