use of org.olat.selenium.page.NavigationPage in project openolat by klemens.
the class LecturesTest method lecturesRollCall.
/**
* An author create a course to use the absence management
* without authorized absence.
*
* @param loginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void lecturesRollCall(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
// configure the lectures module
loginPage.loginAs("administrator", "openolat").resume();
new NavigationPage(browser).openAdministration().openLecturesSettings().configure(true, true, false, false, false).save();
// start
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
UserVO participant1 = new UserRestClient(deploymentUrl).createRandomUser("Kanu");
UserVO participant2 = new UserRestClient(deploymentUrl).createRandomUser("Rymou");
LoginPage authorLoginPage = LoginPage.getLoginPage(browser, deploymentUrl);
authorLoginPage.loginAs(author.getLogin(), author.getPassword());
// go to authoring
AuthoringEnvPage authoringEnv = navBar.assertOnNavigationPage().openAuthoringEnvironment();
String title = "Lecture " + UUID.randomUUID();
// create course
authoringEnv.openCreateDropDown().clickCreate(ResourceType.course).fillCreateForm(title).assertOnGeneralTab().clickToolbarBack();
CoursePageFragment course = new CoursePageFragment(browser);
// add a coach
course.members().quickAdd(author, true, true);
// add the participants
course.members().quickImport(participant1, participant2);
// enable the lectures
LectureRepositoryAdminPage lecturesAdmin = course.lecturesAdministration();
lecturesAdmin.settings().enableLectures().overrideDefaultSettings().saveSettings();
// add a lecture
LectureRepositoryAdminListPage lectureList = lecturesAdmin.lectureList();
String lectureTitle = "2.Lecture";
lectureList.newLectureBlock().setTitle(lectureTitle).setTeacher(author).setDateOneHourBefore().save();
// go to the lectures list as "teacher"
LecturesRepositoryPage teachersLectures = lecturesAdmin.clickToolbarRootCrumb().lectures();
teachersLectures.openRollCall(lectureTitle).setAbsence(participant1, "1").setAbsence(participant1, "2").setAbsence(participant1, "3").closeRollCall().confirmCloseRollCall().assertOnClosedTable();
// go to the lecture administration in the course
lecturesAdmin = teachersLectures.clickToolbarRootCrumb().lecturesAdministration();
// edit the first admission to see some result
LectureRepositoryParticipantsPage participantsAdmin = lecturesAdmin.participantList().editParticipant(participant1).firstAdmissionBack().saveParticipant().editParticipant(participant2).firstAdmissionBack().saveParticipant();
// check
participantsAdmin.assertOnParticipantLectureBlockAbsent(participant1, 3).assertOnParticipantLectureBlockAbsent(participant2, 0);
}
use of org.olat.selenium.page.NavigationPage in project openolat by klemens.
the class LecturesTest method lecturesRollCall_defaultAuthorizedAbsence.
/**
* An author create a course, enable the absence management,
* create a lecture block, add a coach and two participants.<br>
* The coach login in, see the interceptor to start the roll call.
* It starts the roll call, set an absence and close.<br>
* The participant with an absence log in, use the lectures user's
* tool to see that it has an absence.<br>
* The absence management has the following settings: holding partial
* lecture is disable, cancel status of lectures is disabled, authorized
* absence are enabled with them as default authorized, teachers can
* authorized absences.
*
* @param loginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void lecturesRollCall_defaultAuthorizedAbsence(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
// configure the lectures module
loginPage.loginAs("administrator", "openolat").resume();
new NavigationPage(browser).openAdministration().openLecturesSettings().configure(false, false, true, true, true).save();
// start the test with authorized absence on
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
UserVO participant1 = new UserRestClient(deploymentUrl).createRandomUser("Kanu");
UserVO participant2 = new UserRestClient(deploymentUrl).createRandomUser("Rymou");
LoginPage.getLoginPage(browser, deploymentUrl).loginAs(author.getLogin(), author.getPassword());
// go to authoring
AuthoringEnvPage authoringEnv = navBar.assertOnNavigationPage().openAuthoringEnvironment();
String title = "Lecture " + UUID.randomUUID();
// create course
authoringEnv.openCreateDropDown().clickCreate(ResourceType.course).fillCreateForm(title).assertOnGeneralTab().clickToolbarBack();
// set access
CoursePageFragment course = new CoursePageFragment(browser);
course.accessConfiguration().setUserAccess(UserAccess.registred).clickToolbarBack();
// add a coach
course.members().addMember().searchMember(author, true).nextUsers().nextOverview().selectRepositoryEntryRole(false, true, false).nextPermissions().finish();
// add the participants
course.members().importMembers().setMembers(participant1, participant2).nextUsers().nextOverview().nextPermissions().finish();
// enable the lectures
LectureRepositoryAdminPage lecturesAdmin = course.lecturesAdministration();
lecturesAdmin.settings().enableLectures().overrideDefaultSettings().saveSettings();
LectureRepositoryAdminListPage lectureList = lecturesAdmin.lectureList();
Calendar cal = Calendar.getInstance();
int today = cal.get(Calendar.DATE);
int hour = cal.get(Calendar.HOUR_OF_DAY);
String lectureTitle = "1. Lecture";
lectureList.newLectureBlock().setTitle(lectureTitle).setTeacher(author).setDate(today, hour, 0, hour, 59).save();
// coach at work
LoginPage coachLoginPage = LoginPage.getLoginPage(browser, deploymentUrl);
coachLoginPage.loginAs(author);
new RollCallInterceptorPage(browser).start().setAbsence(participant1, "1").closeRollCall().confirmCloseRollCall().assertOnClosedTable();
// participant check it roll call
LoginPage participantLoginPage = LoginPage.getLoginPage(browser, deploymentUrl);
participantLoginPage.loginAs(participant1).resume();
UserToolsPage participantUserTools = new UserToolsPage(browser);
participantUserTools.openUserToolsMenu().openLectures().assertOnParticipantLecturesList().selectCourseAsParticipant(title).assertOnParticipantLectureBlocks().assertOnParticipantLectureBlockAuthorised(author, lectureTitle, title);
}
use of org.olat.selenium.page.NavigationPage in project OpenOLAT by OpenOLAT.
the class CourseTest method createContentPackage.
/**
* An author creates a CP, changes the name of a page, import
* an other page, create two pages and delete one, import an
* image...<br>
* A user come to see the CP, check that the deleted page is
* really deleted and that the "Small HTML page" exists and
* can be read.
*
* @param loginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void createContentPackage(@InitialPage LoginPage loginPage, @Drone @User WebDriver ryomouBrowser) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
loginPage.loginAs(author.getLogin(), author.getPassword());
// create a CP
String cpTitle = "CP " + UUID.randomUUID();
navBar.openAuthoringEnvironment().createCP(cpTitle).clickToolbarBack();
String firstPage = "Page 1 " + UUID.randomUUID();
String secondPage = "Seite 2 " + UUID.randomUUID();
String thirdPage = "Feuillet 3 " + UUID.randomUUID();
String deletedPage = "To delete 4 " + UUID.randomUUID();
URL pageUrl = JunitTestHelper.class.getResource("file_resources/page.html");
File pageFile = new File(pageUrl.toURI());
URL imageUrl = JunitTestHelper.class.getResource("file_resources/IMG_1482.JPG");
File imageFile = new File(imageUrl.toURI());
CPPage cpPage = new CPPage(browser);
cpPage.openEditor().editMetadata(firstPage).clickRoot().newPage(secondPage).clickRoot().newPage(deletedPage).clickRoot().importPage(pageFile).fillMetadataForm(thirdPage).importPage(imageFile).closeMetadataForm().selectPage(deletedPage).deletePage().clickToolbarBack();
// set access to registered members
cpPage.accessConfiguration().setUserAccess(UserAccess.registred).clickToolbarBack();
// a user search the content package
LoginPage ryomouLoginPage = LoginPage.getLoginPage(ryomouBrowser, deploymentUrl);
ryomouLoginPage.loginAs(ryomou.getLogin(), ryomou.getPassword()).resume();
NavigationPage ryomouNavBar = new NavigationPage(ryomouBrowser);
ryomouNavBar.openMyCourses().openSearch().extendedSearch(cpTitle).select(cpTitle).start();
CPPage ryomouPage = new CPPage(ryomouBrowser);
ryomouPage.assertPageDeleted(deletedPage).assertInIFrame(By.xpath("//h1[text()[contains(.,'Small HTML page')]]")).selectPage(secondPage).selectPage(firstPage).assertInIFrame(By.xpath("//h2[text()[contains(.,'Lorem Ipsum')]]"));
}
use of org.olat.selenium.page.NavigationPage in project OpenOLAT by OpenOLAT.
the class ImsQTI21EditorTest method qti21EditorNumericalInput_absolut.
/**
* An author make a test with 2 questions using numerical input to
* test the absolute tolerance mode.<br>
* A first user make the test, but doesn't answer all questions
* correctly, log out and a second user make the perfect test but
* on the limit.
*
* @param authorLoginPage
* @param participantBrowser
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void qti21EditorNumericalInput_absolut(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver participantBrowser) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("Rei");
authorLoginPage.loginAs(author.getLogin(), author.getPassword());
String qtiTestTitle = "Numerical 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 numerical input: 3.1 - 3.2
QTI21GapEntriesEditorPage fibEditor = qtiEditor.addNumerical().appendContent("Usefull for circles ").editNumericalInput("3.1416", "pi", ToleranceMode.ABSOLUTE, "3.2", "3.1", 1).saveNumericInput().save();
// use standard score setting
// set feedbacks
fibEditor.selectFeedbacks().setCorrectFeedback("Correct feedback", "Your answer is correct").setIncorrectFeedback("Incorrect", "Out of bounds").save();
// add a numerical input which represent a rounding issue
fibEditor = qtiEditor.addNumerical().appendContent("Check rounding issue ").editNumericalInput("14.923", "rounding", ToleranceMode.ABSOLUTE, "14.925", "14.915", 1).saveNumericInput().save();
// set feedbacks
fibEditor.selectFeedbacks().setCorrectFeedback("Correct feedback", "Your answer is correct").setIncorrectFeedback("Incorrect", "Your answer is not correct").save();
// add a numerical input with negative values
fibEditor = qtiEditor.addNumerical().appendContent("Check rounding issue ").editNumericalInput("-14.923", "negative", ToleranceMode.ABSOLUTE, "-14.921", "-14.931", 1).saveNumericInput().save();
// set feedbacks
fibEditor.selectFeedbacks().setCorrectFeedback("Correct feedback", "Your answer 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();
// first user make the test
QTI21Page ryomouQtiPage = QTI21Page.getQTI12Page(participantBrowser);
ryomouQtiPage.assertOnAssessmentItem().answerGapTextWithPlaceholder("3", "pi").saveAnswer().assertFeedback("Incorrect").answerGapTextWithPlaceholder("3.15", "pi").saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerGapTextWithPlaceholder("14.914", "rounding").saveAnswer().assertFeedback("Incorrect").answerGapTextWithPlaceholder("14.915", "rounding").saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerGapTextWithPlaceholder("-14.932", "negative").saveAnswer().assertFeedback("Incorrect").answerGapTextWithPlaceholder("-14.920", "negative").saveAnswer().endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// 1 point + 1 point + 0 point
2);
// 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 with all the correct answers
QTI21Page.getQTI12Page(participantBrowser).assertOnAssessmentItem().answerGapTextWithPlaceholder("3.2", "pi").saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerGapTextWithPlaceholder("14.925", "rounding").saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerGapTextWithPlaceholder("-14.921", "negative").saveAnswer().assertFeedback("Correct feedback").endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(3);
}
use of org.olat.selenium.page.NavigationPage in project OpenOLAT by OpenOLAT.
the class ImsQTI21EditorTest method qti21EditorFib_text.
/**
* An author make a test with 2 questions using fill-in-blank,
* 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 qti21EditorFib_text(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver participantBrowser) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("Rei");
authorLoginPage.loginAs(author.getLogin(), author.getPassword());
String qtiTestTitle = "FIB 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 gap entry: all answers score
QTI21GapEntriesEditorPage fibEditor = qtiEditor.addFib().appendContent("Usefull for circles ").addGapEntry("Pi", "314").saveGapEntry().editGapEntry("Ln", "lognat", 2).saveGapEntry().save();
// set max score
fibEditor.selectScores().selectAssessmentMode(ScoreEvaluation.allCorrectAnswers).setMaxScore("2").save();
// set feedbacks
fibEditor.selectFeedbacks().setHint("Hint", "This is a usefull hint").setCorrectSolution("Correct solution", "This is an information about the correct solution").setCorrectFeedback("Correct feedback", "Your answer is correct").setIncorrectFeedback("Incorrect", "Your answer is not correct").save();
// add a gap entry: score per anser
fibEditor = qtiEditor.addFib().appendContent("European rocket ").addGapEntry("Ariane", "ari").saveGapEntry().editGapEntry("Falcon9", "falc", 2).saveGapEntry().save();
// set max score
fibEditor.selectScores().selectAssessmentMode(ScoreEvaluation.perAnswer).setMaxScore("4").setScore("Ariane", "3").setScore("Falcon9", "1").save();
// set feedbacks
fibEditor.selectFeedbacks().setHint("Hint", "Think to space").setCorrectSolution("Correct solution", "This is an information about the correct solution").setCorrectFeedback("Correct feedback", "Your answer 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();
// first user make the test
QTI21Page ryomouQtiPage = QTI21Page.getQTI12Page(participantBrowser);
ryomouQtiPage.assertOnAssessmentItem().answerGapTextWithPlaceholder("Log", "314").answerGapTextWithPlaceholder("Sin", "lognat").saveAnswer().assertFeedback("Incorrect").assertCorrectSolution("Correct solution").hint().assertFeedback("Hint").answerGapTextWithPlaceholder("Pi", "314").answerGapTextWithPlaceholder("Ln", "lognat").saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerGapTextWithPlaceholder("Saturn 5", "ari").answerGapTextWithPlaceholder("Falcon9", "falc").saveAnswer().assertCorrectSolution("Correct solution").assertFeedback("Incorrect").endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// 2 points from the first question, 1 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 with all the correct answers
QTI21Page.getQTI12Page(participantBrowser).assertOnAssessmentItem().answerGapTextWithPlaceholder("Pi", "314").answerGapTextWithPlaceholder("Ln", "lognat").saveAnswer().assertFeedback("Correct feedback").nextAnswer().answerGapTextWithPlaceholder("Ariane", "ari").answerGapTextWithPlaceholder("Falcon9", "falc").saveAnswer().endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(// 2 points from the first question, 4 from the second
6);
}
Aggregations