use of org.olat.selenium.page.NavigationPage in project OpenOLAT by OpenOLAT.
the class CourseTest method confirmMembershipForCourse.
/**
* First, an administrator make in administration part
* the confirmation of group's membership mandatory if
* the group is created by an author.<br>
*
* An author create a course and a group and add two
* participants. The first user jump to the course
* with a rest url, log in, confirm its membership
* and see the course.<br>
* The second participant log-in, confirm its membership,
* go the "My courses" and visit the course.
*
* @param loginPage
* @param authorBrowser
* @param participantBrowser
* @param reiBrowser
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void confirmMembershipForCourse(@InitialPage LoginPage loginPage, @Drone @Author WebDriver authorBrowser, @Drone @Participant WebDriver participantBrowser, @Drone @Student WebDriver reiBrowser) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("Rei");
UserVO participant = new UserRestClient(deploymentUrl).createRandomUser();
// admin make the confirmation of membership mandatory
// for groups created by standard users.
loginPage.loginAs("administrator", "openolat").resume();
AdministrationPage administration = new NavigationPage(browser).openAdministration().openGroupSettings().setGroupConfirmationForAuthor(true);
// author create a course
String courseTitle = "Membership " + UUID.randomUUID();
LoginPage.getLoginPage(authorBrowser, deploymentUrl).loginAs(author).resume();
NavigationPage authorNavBar = new NavigationPage(authorBrowser);
authorNavBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
String groupName = "Groupship " + UUID.randomUUID();
MembersPage members = CoursePageFragment.getCourse(authorBrowser).members();
// create a group
members.selectBusinessGroups().createBusinessGroup(groupName, "-", 1, false, false);
// return to course
authorNavBar.openCourse(courseTitle);
// add the 2 participants to the group
members.selectMembers().addMember().searchMember(rei, true).nextUsers().nextOverview().selectGroupAsParticipant(groupName).nextPermissions().finish();
members.addMember().searchMember(participant, true).nextUsers().nextOverview().selectGroupAsParticipant(groupName).nextPermissions().finish();
members.clickToolbarBack();
// set the course for members only
CoursePageFragment.getCourse(authorBrowser).accessConfiguration().setUserAccess(UserAccess.registred);
String currentUrl = authorBrowser.getCurrentUrl();
int index = currentUrl.indexOf("/Access");
Assert.assertTrue(index > 0);
String courseUrl = currentUrl.substring(0, index);
// rest url -> login -> accept membership
reiBrowser.get(courseUrl);
new LoginPage(reiBrowser).loginAs(rei.getLogin(), rei.getPassword()).assertOnMembershipConfirmation().confirmMembership();
new CoursePageFragment(reiBrowser).assertOnCoursePage().assertOnTitle(courseTitle);
// participant login -> accept membership -> my courses -> course
LoginPage participantLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
participantLoginPage.loginAs(participant.getLogin(), participant.getPassword()).assertOnMembershipConfirmation().confirmMembership();
NavigationPage participantNavBar = new NavigationPage(participantBrowser);
participantNavBar.openMyCourses().select(courseTitle);
new CoursePageFragment(participantBrowser).assertOnCoursePage().assertOnTitle(courseTitle);
// reset the settings
administration.setGroupConfirmationForAuthor(false);
}
use of org.olat.selenium.page.NavigationPage in project OpenOLAT by OpenOLAT.
the class CourseTest method concurrentEditCourse.
/**
* An author create a course, add a second user as co-author
* of the course, and edit the course.<br>
* The co-author select the course and try to edit it, unsuccessfully.
* It try to edit the course directly from the author list without
* success.<br>
* The author closes the editor and the co-author is allowed to edit.
* The author cannot edit i anymore...
*
* @param loginPage Login page of the author
* @param coAuthorBrowser the browser for the coauthor
*/
@Test
@RunAsClient
public void concurrentEditCourse(@InitialPage LoginPage loginPage, @Drone @Participant WebDriver coAuthorBrowser) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
UserVO coAuthor = new UserRestClient(deploymentUrl).createAuthor("Rei");
loginPage.loginAs(author.getLogin(), author.getPassword()).resume();
// go to authoring
AuthoringEnvPage authoringEnv = navBar.assertOnNavigationPage().openAuthoringEnvironment();
String title = "Coedit-" + UUID.randomUUID();
// create course
authoringEnv.openCreateDropDown().clickCreate(ResourceType.course).fillCreateForm(title).assertOnGeneralTab().clickToolbarBack();
// add a second owner
MembersPage members = new CoursePageFragment(browser).members();
members.addMember().searchMember(coAuthor, true).nextUsers().nextOverview().selectRepositoryEntryRole(true, false, false).nextPermissions().finish();
// open the editor
CoursePageFragment coursePage = members.clickToolbarBack();
CourseEditorPageFragment editor = coursePage.edit();
// the second author come in
LoginPage coAuthroLoginPage = LoginPage.getLoginPage(coAuthorBrowser, deploymentUrl);
coAuthroLoginPage.loginAs(coAuthor.getLogin(), coAuthor.getPassword()).resume();
// go to authoring
NavigationPage coAuthorNavBar = new NavigationPage(coAuthorBrowser);
coAuthorNavBar.assertOnNavigationPage().openAuthoringEnvironment().selectResource(title);
// try to edit
CoursePageFragment coAuthorCourse = new CoursePageFragment(coAuthorBrowser);
coAuthorCourse.tryToEdit().assertOnWarning();
// retry in list
coAuthorNavBar.openAuthoringEnvironment().editResource(title);
new CourseEditorPageFragment(coAuthorBrowser).assertOnWarning();
// author close the course editor
editor.clickToolbarBack();
coursePage.assertOnCoursePage();
// co-author edit the course
CourseEditorPageFragment coAuthorEditor = coAuthorCourse.edit().assertOnEditor();
// author try
coursePage.tryToEdit().assertOnWarning();
// co-author close the editor
coAuthorEditor.clickToolbarBack().assertOnCoursePage();
// author reopens the editor
coursePage.edit().assertOnEditor();
}
use of org.olat.selenium.page.NavigationPage in project OpenOLAT by OpenOLAT.
the class CourseTest method concurrentVisitAndPublish.
/**
* An author create a course, a user see it.<br>
* The author change the course and publish it. The user
* must see a warning if the same node as been modified.
*
* @param loginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void concurrentVisitAndPublish(@InitialPage LoginPage loginPage, @Drone @User WebDriver ryomouBrowser) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
loginPage.loginAs(author.getLogin(), author.getPassword());
UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
// create a course
String courseTitle = "Course to publish-" + UUID.randomUUID().toString();
navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
// open course editor
CoursePageFragment course = CoursePageFragment.getCourse(browser);
CourseEditorPageFragment editor = course.assertOnCoursePage().assertOnTitle(courseTitle).openToolsMenu().edit();
// create a course element of type info messages
String firstNodeTitle = "First node";
String secondNodeTitle = "Second node";
editor.assertOnEditor().createNode("info").nodeTitle(firstNodeTitle).createNode("st").nodeTitle(secondNodeTitle).publish().quickPublish(UserAccess.registred);
// The user opens the course
LoginPage ryomouLoginPage = LoginPage.getLoginPage(ryomouBrowser, deploymentUrl);
ryomouLoginPage.loginAs(ryomou.getLogin(), ryomou.getPassword()).resume();
NavigationPage ryomouNavBar = new NavigationPage(ryomouBrowser);
ryomouNavBar.openMyCourses().openSearch().extendedSearch(courseTitle).select(courseTitle).start();
CoursePageFragment ryomouCourse = new CoursePageFragment(ryomouBrowser);
MenuTreePageFragment ryomouCourseTree = ryomouCourse.clickTree().selectWithTitle(firstNodeTitle);
// The author make a change on node 2
String changedNodeTitlev2 = "Changed 2 title";
course = editor.selectNode(secondNodeTitle).nodeTitle(changedNodeTitlev2).autoPublish();
// The user click the first node and the changed second node
ryomouCourseTree.selectWithTitle(firstNodeTitle).selectWithTitle(changedNodeTitlev2);
ryomouCourse.assertOnTitle(changedNodeTitlev2);
// The author changed the second node
String changedNodeTitlev3 = "Changed 3 title";
course = course.edit().selectNode(changedNodeTitlev2).nodeTitle(changedNodeTitlev3).autoPublish();
// The user wait the message
ryomouCourse.assertOnRestart().clickRestart();
ryomouCourseTree.selectWithTitle(changedNodeTitlev3);
ryomouCourse.assertOnTitle(changedNodeTitlev3);
}
use of org.olat.selenium.page.NavigationPage in project OpenOLAT by OpenOLAT.
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");
}
use of org.olat.selenium.page.NavigationPage in project OpenOLAT by OpenOLAT.
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);
}
Aggregations