Search in sources :

Example 41 with NavigationPage

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

the class AssessmentTest method bulkAssessment.

/**
 * Create an assessment course element, add two users to the course
 * and assesses them with the bulk assessment tool. The 2 users
 * log in and check their results.
 *
 * @param loginPage
 * @param kanuBrowser
 * @param reiBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void bulkAssessment(@InitialPage LoginPage loginPage, @Drone @User WebDriver ryomouBrowser, @Drone @Participant WebDriver kanuBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
    UserVO kanu = new UserRestClient(deploymentUrl).createRandomUser("Kanu");
    loginPage.loginAs(author.getLogin(), author.getPassword());
    // create a course
    String courseTitle = "Course-Assessment-" + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    // create a course element of type Test with the test that we create above
    String assessmentNodeTitle = "Assessment CE";
    CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit().createNode("ms").nodeTitle(assessmentNodeTitle);
    // configure assessment
    AssessmentCEConfigurationPage assessmentConfig = new AssessmentCEConfigurationPage(browser);
    assessmentConfig.selectConfiguration().setScoreAuto(0.1f, 10.0f, 5.0f);
    // set the score / passed calculation in root node and publish
    courseEditor.selectRoot().selectTabScore().enableRootScoreByNodes().autoPublish().accessConfiguration().setUserAccess(UserAccess.registred);
    // go to members management
    CoursePageFragment courseRuntime = courseEditor.clickToolbarBack();
    MembersPage members = courseRuntime.members();
    members.importMembers().setMembers(ryomou, kanu).nextUsers().nextOverview().nextPermissions().finish();
    BulkAssessmentData[] data = new BulkAssessmentData[] { new BulkAssessmentData(ryomou, 8.0f, null, "Well done"), new BulkAssessmentData(kanu, 4.0f, null, "Need more work") };
    members.clickToolbarBack().assessmentTool().bulk().data(data).nextData().nextColumns().nextValidation().finish();
    // Ryomou login
    LoginPage ryomouLoginPage = LoginPage.getLoginPage(ryomouBrowser, deploymentUrl);
    ryomouLoginPage.loginAs(ryomou).resume();
    NavigationPage ryomouNavBar = new NavigationPage(ryomouBrowser);
    ryomouNavBar.openMyCourses().select(courseTitle);
    // go to the group task
    CoursePageFragment ryomouCourse = new CoursePageFragment(ryomouBrowser);
    ryomouCourse.clickTree().selectWithTitle(assessmentNodeTitle);
    // Second login
    LoginPage kanuLoginPage = LoginPage.getLoginPage(kanuBrowser, deploymentUrl);
    kanuLoginPage.loginAs(kanu).resume();
    NavigationPage kanuNavBar = new NavigationPage(kanuBrowser);
    kanuNavBar.openMyCourses().select(courseTitle);
    // go to the group task
    CoursePageFragment kanuCourse = new CoursePageFragment(kanuBrowser);
    kanuCourse.clickTree().selectWithTitle(assessmentNodeTitle);
    // Ryomou -> passed
    WebElement passedEl = ryomouBrowser.findElement(By.cssSelector("tr.o_state.o_passed"));
    Assert.assertTrue(passedEl.isDisplayed());
    // Kanu -> failed
    WebElement failedEl = kanuBrowser.findElement(By.cssSelector("tr.o_state.o_failed"));
    Assert.assertTrue(failedEl.isDisplayed());
}
Also used : CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserVO(org.olat.user.restapi.UserVO) BulkAssessmentData(org.olat.selenium.page.course.BulkAssessmentPage.BulkAssessmentData) NavigationPage(org.olat.selenium.page.NavigationPage) AssessmentCEConfigurationPage(org.olat.selenium.page.course.AssessmentCEConfigurationPage) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) MembersPage(org.olat.selenium.page.course.MembersPage) WebElement(org.openqa.selenium.WebElement) LoginPage(org.olat.selenium.page.LoginPage) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 42 with NavigationPage

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

the class AssessmentTest method qti12CourseWithAssessment.

/**
 * An author upload a test, create a course with a test course
 * element, publish the course, assign the course to a student.
 * The student come to pass the test, logout after passing it.
 * The author check if the test of the student is passed in the
 * assessment tool.
 *
 * @param authorLoginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void qti12CourseWithAssessment(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver ryomouBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
    // upload a test
    String qtiTestTitle = "QTI-Test-1.2-" + UUID.randomUUID();
    URL qtiTestUrl = JunitTestHelper.class.getResource("file_resources/e4_test.zip");
    File qtiTestFile = new File(qtiTestUrl.toURI());
    navBar.openAuthoringEnvironment().uploadResource(qtiTestTitle, qtiTestFile);
    // create a course
    String courseTitle = "Course-With-QTI-Test-1.2-" + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    // create a course element of type CP with the CP that we create above
    String testNodeTitle = "Test-QTI-1.2";
    CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
    courseEditor.createNode("iqtest").nodeTitle(testNodeTitle).selectTabLearnContent().chooseTest(qtiTestTitle);
    // publish the course
    courseEditor.publish().quickPublish(UserAccess.membersOnly);
    // open the course and see the test start page
    CoursePageFragment courseRuntime = courseEditor.clickToolbarBack();
    courseRuntime.clickTree().selectWithTitle(testNodeTitle);
    // check that the title of the start page of test is correct
    WebElement testH2 = browser.findElement(By.cssSelector("div.o_course_run h2"));
    Assert.assertEquals(testNodeTitle, testH2.getText().trim());
    // add Ryomou as a course member
    courseRuntime.members().addMember().searchMember(ryomou, true).nextUsers().nextOverview().nextPermissions().finish();
    // Ryomou open the course
    LoginPage ryomouLoginPage = LoginPage.getLoginPage(ryomouBrowser, deploymentUrl);
    ryomouLoginPage.loginAs(ryomou.getLogin(), ryomou.getPassword()).resume();
    // open the course
    NavigationPage ryomouNavBar = new NavigationPage(ryomouBrowser);
    ryomouNavBar.openMyCourses().select(courseTitle);
    // go to the test
    CoursePageFragment ryomouTestCourse = new CoursePageFragment(ryomouBrowser);
    ryomouTestCourse.clickTree().selectWithTitle(testNodeTitle);
    // start the test
    QTI12Page testPage = QTI12Page.getQTI12Page(ryomouBrowser);
    testPage.start().selectItem("Single choice").answerSingleChoice("Correct answer").saveAnswer().selectItem("Multiple choice").answerMultipleChoice("Correct answer", "The answer is correct").saveAnswer().selectItem("Kprim").answerKPrim(true, false, true, false).saveAnswer().selectItem("Fill-in").answerFillin("not").saveAnswer();
    testPage.endTest();
    // check results page
    By resultsBy = By.id("o_qti_results");
    OOGraphene.waitElement(resultsBy, ryomouBrowser);
    WebElement resultsEl = ryomouBrowser.findElement(resultsBy);
    Assert.assertTrue(resultsEl.getText().contains(ryomou.getFirstName()));
    // close the test
    testPage.closeTest();
    // all answers are correct -> passed
    WebElement passedEl = ryomouBrowser.findElement(By.cssSelector("tr.o_state.o_passed"));
    Assert.assertTrue(passedEl.isDisplayed());
    // log out
    UserToolsPage roymouUserTools = new UserToolsPage(ryomouBrowser);
    roymouUserTools.logout();
    // author take the lead and check the assessment tool
    navBar.openMyCourses().select(courseTitle);
    // open the assessment tool
    AssessmentToolPage assessmentTool = new CoursePageFragment(browser).assessmentTool();
    assessmentTool.users().assertOnUsers(ryomou).selectUser(ryomou).assertPassed(ryomou);
}
Also used : QTI12Page(org.olat.selenium.page.qti.QTI12Page) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) WebElement(org.openqa.selenium.WebElement) URL(java.net.URL) LoginPage(org.olat.selenium.page.LoginPage) UserRestClient(org.olat.test.rest.UserRestClient) CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserToolsPage(org.olat.selenium.page.user.UserToolsPage) UserVO(org.olat.user.restapi.UserVO) NavigationPage(org.olat.selenium.page.NavigationPage) By(org.openqa.selenium.By) AssessmentToolPage(org.olat.selenium.page.course.AssessmentToolPage) File(java.io.File) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 43 with NavigationPage

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

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 44 with NavigationPage

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

the class ImsQTI21EditorTest method qti21EditorEssay.

/**
 * An author make a test with an essai and its special feedback.<br>
 * A user make the test and check the feedback.
 *
 * @param authorLoginPage
 * @param participantBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void qti21EditorEssay(@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 = "Essai 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 essay interaction
    QTI21LobEditorPage essayEditor = qtiEditor.addEssay();
    essayEditor.setQuestion("Write a small story").save().selectScores().setMaxScore("3.0").save();
    essayEditor.selectFeedbacks().setHint("Hint", "Did you search inspiration?").setCorrectSolution("Correct solution", "It is very personal.").setAnsweredFeedback("Full", "Well done").setEmpytFeedback("Empty", "Please, a little effort.").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");
    reiQtiPage.answerEssay("What can I write?").saveAnswer().assertFeedback("Full").endTest().assertOnAssessmentResults().assertOnAssessmentResultEssay("What");
}
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) 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 45 with NavigationPage

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

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)

Aggregations

RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)112 Test (org.junit.Test)112 NavigationPage (org.olat.selenium.page.NavigationPage)112 UserRestClient (org.olat.test.rest.UserRestClient)110 UserVO (org.olat.user.restapi.UserVO)110 LoginPage (org.olat.selenium.page.LoginPage)100 CoursePageFragment (org.olat.selenium.page.course.CoursePageFragment)56 CourseEditorPageFragment (org.olat.selenium.page.course.CourseEditorPageFragment)44 QTI21Page (org.olat.selenium.page.qti.QTI21Page)40 QTI21EditorPage (org.olat.selenium.page.qti.QTI21EditorPage)38 URL (java.net.URL)30 File (java.io.File)28 MembersPage (org.olat.selenium.page.course.MembersPage)28 AuthoringEnvPage (org.olat.selenium.page.repository.AuthoringEnvPage)20 UserToolsPage (org.olat.selenium.page.user.UserToolsPage)18 GroupPage (org.olat.selenium.page.group.GroupPage)16 QTI21MatchEditorPage (org.olat.selenium.page.qti.QTI21MatchEditorPage)10 Calendar (java.util.Calendar)8 AssessmentToolPage (org.olat.selenium.page.course.AssessmentToolPage)8 EnrollmentConfigurationPage (org.olat.selenium.page.course.EnrollmentConfigurationPage)8