use of org.olat.selenium.page.NavigationPage in project OpenOLAT by OpenOLAT.
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);
}
use of org.olat.selenium.page.NavigationPage in project OpenOLAT by OpenOLAT.
the class ImsQTI21Test method qti21TestFlow_suspend.
/**
* Test suspend. An author upload a test, set "enable suspend"
* and make the test visible to registered users. A second user
* open the test, does nothing, suspends and log out (check a possible red
* screen in the next step), log in, answer 3 questions, suspends
* and log out. It log in a last time and finish the test successfully.
*
* @param authorLoginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void qti21TestFlow_suspend(@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());
// upload a test
String qtiTestTitle = "Suspend QTI 2.1 " + UUID.randomUUID();
URL qtiTestUrl = JunitTestHelper.class.getResource("file_resources/qti21/test_4_no_skipping.zip");
File qtiTestFile = new File(qtiTestUrl.toURI());
navBar.openAuthoringEnvironment().uploadResource(qtiTestTitle, qtiTestFile).clickToolbarRootCrumb();
QTI21Page qtiPage = QTI21Page.getQTI12Page(browser);
qtiPage.options().showResults(Boolean.TRUE, QTI21AssessmentResultsOptions.allOptions()).enableSuspend().save();
qtiPage.accessConfiguration().setUserAccess(UserAccess.registred).clickToolbarBack();
// check simple time limit
qtiPage.assertOnAssessmentItem("Single choice");
// 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();
QTI21Page userQtiPage = QTI21Page.getQTI12Page(ryomouBrowser);
userQtiPage.assertOnAssessmentItem("Single choice").suspendTest();
// log out
new UserToolsPage(ryomouBrowser).logout();
// log in and resume test
userLoginPage.loginAs(ryomou.getLogin(), ryomou.getPassword()).resume();
userQtiPage = QTI21Page.getQTI12Page(ryomouBrowser);
userQtiPage.assertOnAssessmentItem("Single choice").answerSingleChoiceWithParagraph("Correct").saveAnswer().answerMultipleChoice("Correct").saveAnswer().assertOnAssessmentItem("Kprim").answerCorrectKPrim("True", "Right").answerIncorrectKPrim("False", "Wrong").saveAnswer().suspendTest();
// second log out
new UserToolsPage(ryomouBrowser).logout();
// log in and resume test
userLoginPage.loginAs(ryomou.getLogin(), ryomou.getPassword()).resume();
userQtiPage = QTI21Page.getQTI12Page(ryomouBrowser);
userQtiPage.assertOnAssessmentItem("Numerical input").answerGapText("42", "_RESPONSE_1").saveAnswer().endTest().assertOnAssessmentResults().assertOnAssessmentTestMaxScore(4).assertOnAssessmentTestScore(4).assertOnAssessmentTestPassed();
}
use of org.olat.selenium.page.NavigationPage in project OpenOLAT by OpenOLAT.
the class BusinessGroupTest method enrollmentWithWaitingList.
/**
* An author create a course, with an enrollment course element. It
* configure it and create a group with max. participant set to 1 and
* enables the waiting list.<br>
*
* Three users goes to the course and try to enroll. One will become
* a participant, the 2 others land in the waiting list.
*
* @param authorLoginPage
* @param ryomouBrowser
* @param reiBrowser
* @param kanuBrowser
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void enrollmentWithWaitingList(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver ryomouBrowser, @Drone @Participant WebDriver reiBrowser, @Drone @Student WebDriver kanuBrowser) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
authorLoginPage.loginAs(author.getLogin(), author.getPassword());
UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("Rei");
UserVO kanu = new UserRestClient(deploymentUrl).createRandomUser("kanu");
UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
// create a course
String courseTitle = "Enrolment-1-" + UUID.randomUUID();
navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
// create a course element of type Enrolment
String enNodeTitle = "Enrolment-1";
CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
courseEditor.createNode("en").nodeTitle(enNodeTitle);
// configure enrolment with a group that we create
String groupName = "Enrolment group - 1 " + UUID.randomUUID();
EnrollmentConfigurationPage enrolmentConfig = new EnrollmentConfigurationPage(browser);
enrolmentConfig.selectConfiguration().createBusinessGroup(groupName, "-", 1, true, false);
// publish the course
courseEditor.publish().quickPublish(UserAccess.registred);
courseEditor.clickToolbarBack();
GroupPage authorGroup = navBar.openGroups(browser).selectGroup(groupName).openAdministration().openAdminMembers().setVisibility(true, true, true).openMembers().assertParticipantList();
// Rei open the course
Enrollment[] participantDrivers = new Enrollment[] { new Enrollment(ryomou, ryomouBrowser), new Enrollment(rei, reiBrowser), new Enrollment(kanu, kanuBrowser) };
for (Enrollment enrollment : participantDrivers) {
WebDriver driver = enrollment.getDriver();
LoginPage.getLoginPage(driver, deploymentUrl).loginAs(enrollment.getUser()).resume();
NavigationPage participantNavBar = new NavigationPage(driver);
participantNavBar.openMyCourses().openSearch().extendedSearch(courseTitle).select(courseTitle).start();
// go to the enrollment
CoursePageFragment participantCourse = new CoursePageFragment(driver);
participantCourse.clickTree().selectWithTitle(enNodeTitle);
EnrollmentPage enrollmentPage = new EnrollmentPage(driver);
enrollmentPage.assertOnEnrolmentPage();
enrollment.setEnrollmentPage(enrollmentPage);
}
// enroll
for (Enrollment enrollment : participantDrivers) {
enrollment.getEnrollmentPage().enrollNoWait();
}
// wait
for (Enrollment enrollment : participantDrivers) {
OOGraphene.waitBusy(enrollment.getDriver());
}
// author check the lists
authorGroup.openMembers();
// must a participant and 2 in waiting list
int participants = 0;
int waitingList = 0;
for (Enrollment enrollment : participantDrivers) {
if (authorGroup.isInMembersParticipantList(enrollment.getUser()))
participants++;
if (authorGroup.isInMembersInWaitingList(enrollment.getUser()))
waitingList++;
}
Assert.assertEquals(1, participants);
Assert.assertEquals(2, waitingList);
}
use of org.olat.selenium.page.NavigationPage in project OpenOLAT by OpenOLAT.
the class CourseTest method catalogRoundTrip.
/**
* Create a catalog, create a course, while publishing add the
* course to the catalog. Go to the catalog, find the course and
* open it.
*
* @param loginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void catalogRoundTrip(@Drone @Administrator WebDriver adminBrowser, @Drone @User WebDriver userBrowser) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
UserVO user = new UserRestClient(deploymentUrl).createRandomUser();
// administrator create the categories in the catalog
LoginPage adminLogin = LoginPage.getLoginPage(adminBrowser, deploymentUrl);
adminLogin.loginAs("administrator", "openolat").resume();
NavigationPage adminNavBar = new NavigationPage(adminBrowser);
String node1 = "First level " + UUID.randomUUID();
String node2_1 = "Second level first element " + UUID.randomUUID();
String node2_2 = "Second level second element " + UUID.randomUUID();
adminNavBar.openCatalogAdministration().addCatalogNode(node1, "First level of the catalog").selectNode(node1).addCatalogNode(node2_1, "First element of the second level").addCatalogNode(node2_2, "Second element of the second level");
// An author create a course and publish it under a category
// created above
LoginPage login = LoginPage.getLoginPage(browser, deploymentUrl);
login.loginAs(author.getLogin(), author.getPassword()).resume();
String courseTitle = "Catalog-Course-" + UUID.randomUUID();
navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
courseEditor.publish().nextSelectNodes().selectAccess(UserAccess.guest).nextAccess().selectCatalog(true).selectCategory(node1, node2_2).finish();
// User logs in, go to "My courses", navigate the catalog and start
// the course
LoginPage userLogin = LoginPage.getLoginPage(userBrowser, deploymentUrl);
userLogin.loginAs(user.getLogin(), user.getPassword()).resume();
NavigationPage userNavBar = new NavigationPage(userBrowser);
userNavBar.openMyCourses().openCatalog().selectCatalogEntry(node1).selectCatalogEntry(node2_2).select(// go to the details page
courseTitle).start();
By courseTitleBy = By.cssSelector("div.o_course_run h2");
WebElement courseTitleEl = userBrowser.findElement(courseTitleBy);
Assert.assertTrue(courseTitleEl.getText().contains(courseTitle));
}
use of org.olat.selenium.page.NavigationPage in project OpenOLAT by OpenOLAT.
the class CourseTest method coursePassword.
/**
* An author creates a course with a structure element. The structure
* element is password protected. Under it, there is an info node. The
* course is published and a first user search the course, go to the
* structure element, give the password and see the info node. A second
* user grabs the rest url of the structure node, use it, give the password
* and go to the info node.
*
* @param loginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void coursePassword(@InitialPage LoginPage loginPage, @Drone @Participant WebDriver kanuBrowser, @Drone @User WebDriver ryomouBrowser) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
UserVO kanu = new UserRestClient(deploymentUrl).createRandomUser("Kanu");
UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
loginPage.loginAs(author.getLogin(), author.getPassword());
// go to authoring
AuthoringEnvPage authoringEnv = navBar.assertOnNavigationPage().openAuthoringEnvironment();
String title = "Password-me-" + UUID.randomUUID();
// create course
authoringEnv.openCreateDropDown().clickCreate(ResourceType.course).fillCreateForm(title).assertOnGeneralTab().clickToolbarBack();
String infoTitle = "Info - " + UUID.randomUUID();
String structureTitle = "St - " + UUID.randomUUID();
// open course editor, create a structure node
CoursePageFragment course = new CoursePageFragment(browser);
CourseEditorPageFragment editor = course.openToolsMenu().edit();
editor.createNode("st").nodeTitle(structureTitle);
String courseInfoUrl = editor.getRestUrl();
editor.createNode("info").nodeTitle(infoTitle).moveUnder(structureTitle).selectNode(structureTitle).selectTabPassword().setPassword("super secret").autoPublish().accessConfiguration().setUserAccess(UserAccess.registred).clickToolbarBack();
MenuTreePageFragment courseTree = course.clickTree().selectWithTitle(structureTitle.substring(0, 20));
course.assertOnPassword().enterPassword("super secret");
courseTree.selectWithTitle(infoTitle.substring(0, 20));
course.assertOnTitle(infoTitle);
// First user go to the course
LoginPage kanuLoginPage = LoginPage.getLoginPage(kanuBrowser, deploymentUrl);
kanuLoginPage.loginAs(kanu.getLogin(), kanu.getPassword()).resume();
NavigationPage kanuNavBar = new NavigationPage(kanuBrowser);
kanuNavBar.openMyCourses().openSearch().extendedSearch(title).select(title).start();
// go to the structure, give the password
CoursePageFragment kanuCourse = new CoursePageFragment(kanuBrowser);
MenuTreePageFragment kanuTree = kanuCourse.clickTree().selectWithTitle(structureTitle.substring(0, 20));
kanuCourse.assertOnPassword().enterPassword("super secret");
kanuTree.selectWithTitle(infoTitle.substring(0, 20));
kanuCourse.assertOnTitle(infoTitle);
// Second user use the rest url
LoginPage ryomouLoginPage = LoginPage.getLoginPage(ryomouBrowser, new URL(courseInfoUrl));
ryomouLoginPage.loginAs(ryomou.getLogin(), ryomou.getPassword()).resume();
CoursePageFragment ryomouCourse = new CoursePageFragment(ryomouBrowser);
ryomouCourse.assertOnPassword().enterPassword("super secret");
// find the secret info course element
ryomouCourse.clickTree().selectWithTitle(structureTitle.substring(0, 20)).selectWithTitle(infoTitle.substring(0, 20));
ryomouCourse.assertOnTitle(infoTitle);
}
Aggregations