use of org.olat.selenium.page.NavigationPage in project OpenOLAT by OpenOLAT.
the class CourseElementTest method createCourseWithLTI.
/**
* An author setup a course with a LTI course element with score enabled.
* A participant take the course and see the LTI content. The back channel
* need the url of the OpenOLAT instance which is currently difficult
* for a selenium test. The grading is not tested until a LTI server
* can be installed on localhost.
*
* @param authorLoginPage
* @param participantBrowser
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void createCourseWithLTI(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver participantBrowser) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
UserVO participant = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
authorLoginPage.loginAs(author.getLogin(), author.getPassword());
// create a course
String courseTitle = "Course-LTI-" + UUID.randomUUID();
navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
// create a course element of type Test with the test that we create above
String ltiTitle = "LTI";
CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit().createNode("lti").nodeTitle(ltiTitle);
// configure assessment
LTIConfigurationPage ltiConfig = new LTIConfigurationPage(browser);
ltiConfig.selectConfiguration().setLtiPage("http://lti.frentix.com/tool.php", "123456", "secret").enableScore(10.0d, 5.0d).save();
// 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.addMember().searchMember(participant, true).nextUsers().nextOverview().nextPermissions().finish();
// Participant login
LoginPage participantLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
participantLoginPage.loginAs(participant.getLogin(), participant.getPassword()).resume();
NavigationPage participantNavBar = new NavigationPage(participantBrowser);
participantNavBar.openMyCourses().openSearch().extendedSearch(courseTitle).select(courseTitle);
CoursePageFragment participantCourse = new CoursePageFragment(participantBrowser);
participantCourse.clickTree().selectWithTitle(ltiTitle);
LTIPage lti = new LTIPage(participantBrowser);
lti.start().outcomeToolProvider();
// .sendGrade(0.8d);
}
use of org.olat.selenium.page.NavigationPage in project OpenOLAT by OpenOLAT.
the class CourseElementTest method createCourseWithParticipantFolder.
/**
* An author create a course with a participant folder course
* element. It add a participant to the course and upload file
* in the return box of this participant.<br>
* The participant come in and open the course, see the file
* uploaded by the author in its return box and it uploads an
* image in its drop box. The author go the see the image.
*
* @param authorLoginPage
* @param participantBrowser
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void createCourseWithParticipantFolder(@InitialPage LoginPage authorLoginPage, @Drone @Participant WebDriver participantBrowser) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
UserVO participant = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
authorLoginPage.loginAs(author.getLogin(), author.getPassword());
// go to authoring
AuthoringEnvPage authoringEnv = navBar.assertOnNavigationPage().openAuthoringEnvironment();
String title = "Course partilist " + UUID.randomUUID();
// create course
authoringEnv.openCreateDropDown().clickCreate(ResourceType.course).fillCreateForm(title).assertOnGeneralTab().clickToolbarBack();
String participantFolderTitle = "ParticipantList";
// open course editor
CoursePageFragment course = CoursePageFragment.getCourse(browser);
CourseEditorPageFragment editor = course.assertOnCoursePage().assertOnTitle(title).openToolsMenu().edit().createNode("pf").nodeTitle(participantFolderTitle);
// publish
editor.publish().quickPublish(UserAccess.membersOnly);
editor.clickToolbarBack();
// add a participant
MembersPage members = new CoursePageFragment(browser).members();
members.addMember().searchMember(participant, true).nextUsers().nextOverview().selectRepositoryEntryRole(false, false, true).nextPermissions().finish();
members.clickToolbarBack();
// go to the course element
course.clickTree().selectWithTitle(participantFolderTitle);
// open the return box of the participant and upload a file
URL coachImageUrl = JunitTestHelper.class.getResource("file_resources/IMG_1484.jpg");
File coachImageFile = new File(coachImageUrl.toURI());
ParticipantFolderPage folder = new ParticipantFolderPage(browser);
folder.assertOnParticipantsList().assertOnParticipant(participant.getFirstName()).openParticipantFolder(participant.getFirstName());
FolderPage directory = folder.openReturnBox().uploadFile(coachImageFile).assertOnFile(coachImageFile.getName());
// The participant come in
LoginPage participantLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
participantLoginPage.loginAs(participant.getLogin(), participant.getPassword()).resume();
// The participant find the course
NavigationPage participantNavBar = new NavigationPage(participantBrowser);
participantNavBar.assertOnNavigationPage().openMyCourses().select(title);
// And opens the participant folder
CoursePageFragment participantCourse = CoursePageFragment.getCourse(participantBrowser);
participantCourse.clickTree().selectWithTitle(participantFolderTitle);
ParticipantFolderPage participantFolder = new ParticipantFolderPage(participantBrowser);
participantFolder.openReturnBox().assertOnFile(coachImageFile.getName()).selectRootDirectory();
// Participant upload a file in its drop box
URL participantImageUrl = JunitTestHelper.class.getResource("file_resources/IMG_1484.jpg");
File participantImageFile = new File(participantImageUrl.toURI());
participantFolder.openDropBox().uploadFile(participantImageFile).assertOnFile(participantImageFile.getName());
// Author check the image in the participant drop box
directory.selectRootDirectory();
folder.openDropBox().assertOnFile(participantImageFile.getName());
}
use of org.olat.selenium.page.NavigationPage in project OpenOLAT by OpenOLAT.
the class PortfolioV2Test method binderAssessment.
/**
* This is a long test. It's test the whole process to assess a binder from
* the template create by the author, to the assessment value saved in the
* assessment tool of the course.<br>
* The author creates a portfolio template with 2 sections and 2 assignments,
* it creates a course with a portfolio element and bind the template to it. It
* add a user as participant.<br>
* The participant starts the course, pick the binder and do every assignment.
* It edits the sharing settings to add the author as a coach.<br>
* The author assesses the sections and set the binder as done. Than it goes
* to the course, opens the assessment tool and check the participant passed
* the binder.
*
* @param loginPage
* @param reiBrowser
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void binderAssessment(@InitialPage LoginPage loginPage, @Drone @User WebDriver reiBrowser) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("rei");
loginPage.loginAs(author.getLogin(), author.getPassword()).resume();
String binderTitle = "Binder to assess " + UUID.randomUUID();
navBar.openAuthoringEnvironment().createPortfolioBinder(binderTitle).clickToolbarBack();
// create a binder template with 2 sections and
// an assignment in each
String section1Title = "Section 1 " + UUID.randomUUID();
String assignment1Title = "Assignment 1 " + UUID.randomUUID();
String section2Title = "Section 2 " + UUID.randomUUID();
String assignment2Title = "Assignment 2 " + UUID.randomUUID();
BinderPage binderTemplate = new BinderPage(browser);
binderTemplate.assertOnBinder().selectTableOfContent().deleteSection().selectEntries().createSectionInEntries(section1Title).createAssignmentForSection(section1Title, assignment1Title, "Write a small summary", "Your task is...").assertOnAssignmentInEntries(assignment1Title).createSection(section2Title).createAssignmentForSection(section2Title, assignment2Title, "Second part to do", "you have to work").assertOnAssignmentInEntries(assignment2Title);
// create a course
String courseTitle = "ASPF Course " + UUID.randomUUID();
navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
String portfolioNodeTitle = "Template-ASPF-v2";
// create a course element of type portfolio and choose the one we created above
CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
courseEditor.createNode("ep").nodeTitle(portfolioNodeTitle).selectTabLearnContent().choosePortfolio(binderTitle);
// configure the assessment
AssessmentCEConfigurationPage assessmentConfig = new AssessmentCEConfigurationPage(browser);
assessmentConfig.selectConfiguration().setScoreAuto(0.0f, 10.0f, 5.0f);
courseEditor.publish().quickPublish(UserAccess.membersOnly);
MembersPage membersPage = courseEditor.clickToolbarBack().members();
membersPage.importMembers().setMembers(rei).nextUsers().nextOverview().nextPermissions().finish();
// Participant log in
LoginPage reiLoginPage = LoginPage.getLoginPage(reiBrowser, deploymentUrl);
reiLoginPage.loginAs(rei).resume();
// open the course
NavigationPage reiNavBar = new NavigationPage(reiBrowser);
reiNavBar.openMyCourses().select(courseTitle);
// go to the portfolio course element
CoursePageFragment reiTestCourse = new CoursePageFragment(reiBrowser);
reiTestCourse.clickTree().selectWithTitle(portfolioNodeTitle);
PortfolioElementPage portfolioCourseEl = new PortfolioElementPage(reiBrowser);
BinderPage reiBinder = portfolioCourseEl.pickPortfolio().goToPortfolioV2();
OOGraphene.waitAndCloseBlueMessageWindow(reiBrowser);
reiBinder.selectEntries().pickAssignment(assignment1Title).publishEntry();
reiBinder.selectEntries().pickAssignment(assignment2Title).publishEntry();
// add the author as coach
reiBinder.selectPublish().openAccessMenu().addMember().searchMember(author, false).nextUsers().nextOverview().fillAccessRights(binderTitle, Boolean.TRUE).nextPermissions().deSelectEmail().finish();
// the author come to see the binder
UserToolsPage userTools = new UserToolsPage(browser);
PortfolioV2HomePage portfolio = userTools.openUserToolsMenu().openPortfolioV2();
portfolio.openSharedWithMe().openSharedBindersWithMe().assertOnBinder(binderTitle).selectBinder(binderTitle).selectAssessment().passed(section1Title).save().close(section1Title).passed(section2Title).save().close(section2Title).done().assertPassed(2);
// than go to the course and check the results in the assessment tool
// author take the lead and check the assessment tool
navBar.openMyCourses().select(courseTitle);
// open the assessment tool
AssessmentToolPage assessmentTool = new CoursePageFragment(browser).assessmentTool();
// check that rei has passed the test
assessmentTool.users().assertOnUsers(rei).selectUser(rei).assertPassed(rei);
}
use of org.olat.selenium.page.NavigationPage in project openolat by klemens.
the class ImsQTI21EditorTest method qti21EditorHiddenSection.
/**
* An author make a test with 2 questions and in the expert
* settings of the section, it hides the title. It set the
* access configuration.<br>
* A user search the test, make it, check that the sections
* are not visible, pass the test and check the assessment
* results.
* @param authorLoginPage
* @param participantBrowser
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void qti21EditorHiddenSection(@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 = "Choices QTI 2.1 " + UUID.randomUUID();
navBar.openAuthoringEnvironment().createQTI21Test(qtiTestTitle).clickToolbarBack();
QTI21Page qtiPage = QTI21Page.getQTI12Page(browser);
QTI21EditorPage qtiEditor = qtiPage.edit();
// customize the section
qtiEditor.selectSection().selectExpertOptions().sectionTitle(false).save();
// edit the default single choice
qtiEditor.selectItem("Single Choice");
QTI21SingleChoiceEditorPage scEditor = new QTI21SingleChoiceEditorPage(browser);
scEditor.setAnswer(0, "Wrong").addChoice(1).setCorrect(1).setAnswer(1, "Correct").addChoice(2).setAnswer(2, "Faux").save();
// add a multiple choice
QTI21MultipleChoiceEditorPage mcEditor = qtiEditor.addMultipleChoice();
mcEditor.setAnswer(0, "Correct").setCorrect(0).addChoice(1).setCorrect(1).setAnswer(1, "OkToo").addChoice(2).setAnswer(2, "Faux").addChoice(3).setAnswer(3, "Falsch").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().assertHiddenSection().answerSingleChoiceWithParagraph("Correct").saveAnswer().answerMultipleChoice("OkToo").answerMultipleChoice("Correct").saveAnswer().endTest().assertOnAssessmentResults().assertOnAssessmentTestScore(2).assertOnAssessmentTestMaxScore(2);
}
use of org.olat.selenium.page.NavigationPage in project openolat by klemens.
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