Search in sources :

Example 81 with CourseEditorPageFragment

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

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);
}
Also used : CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserVO(org.olat.user.restapi.UserVO) AuthoringEnvPage(org.olat.selenium.page.repository.AuthoringEnvPage) NavigationPage(org.olat.selenium.page.NavigationPage) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) MenuTreePageFragment(org.olat.selenium.page.core.MenuTreePageFragment) LoginPage(org.olat.selenium.page.LoginPage) URL(java.net.URL) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 82 with CourseEditorPageFragment

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

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);
}
Also used : CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserVO(org.olat.user.restapi.UserVO) NavigationPage(org.olat.selenium.page.NavigationPage) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) MenuTreePageFragment(org.olat.selenium.page.core.MenuTreePageFragment) 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 83 with CourseEditorPageFragment

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

the class AssessmentTest method scormCourseWithAssessment.

/**
 * An author upload a SCORM resource, create a course and use the
 * SCORM within. It publish the course, add a participant to the
 * course. The participant log in, select the course above, run
 * the SCORM and finish it.<br>
 * At the end, the author go to the assessment tool and chec that
 * the participant has successfully passed the test.
 *
 * @param authorLoginPage
 * @param ryomouBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void scormCourseWithAssessment(@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 scormTitle = "SCORM - " + UUID.randomUUID();
    URL scormUrl = JunitTestHelper.class.getResource("file_resources/very_simple_scorm.zip");
    File scormFile = new File(scormUrl.toURI());
    navBar.openAuthoringEnvironment().uploadResource(scormTitle, scormFile);
    // create a course
    String courseTitle = "Course-With-SCORM-" + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    // create a course element of type Scorm with the scorm that we create above
    String scormNodeTitle = "SCORM";
    CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
    courseEditor.createNode("scorm").nodeTitle(scormNodeTitle).selectTabLearnContent().chooseScorm(scormTitle);
    // publish the course
    courseEditor.autoPublish().accessConfiguration().setUserAccess(UserAccess.registred).clickToolbarBack();
    CoursePageFragment courseRuntime = new CoursePageFragment(browser);
    // 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);
    // open the course and see the test start page
    CoursePageFragment ryomouCourse = new CoursePageFragment(ryomouBrowser);
    ryomouCourse.clickTree().selectWithTitle(scormNodeTitle);
    By scormH2By = By.cssSelector("div.o_course_run h2");
    WebElement scormH2 = ryomouBrowser.findElement(scormH2By);
    Assert.assertEquals(scormNodeTitle, scormH2.getText().trim());
    // scorm
    ScormPage scorm = ScormPage.getScormPage(ryomouBrowser);
    scorm.start().passVerySimpleScorm().back();
    WebElement scormH2Back = ryomouBrowser.findElement(scormH2By);
    Assert.assertEquals(scormNodeTitle, scormH2Back.getText().trim());
    // 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 : 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) ScormPage(org.olat.selenium.page.repository.ScormPage) 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 84 with CourseEditorPageFragment

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

the class PortfolioV2Test method collectForumMediaInCourse.

/**
 * Create a course with a forum, open a new thread and pick it as
 * a media. Go in the media center and check that the media
 * is waiting there, click the details and check again.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void collectForumMediaInCourse(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    loginPage.loginAs(author.getLogin(), author.getPassword()).resume();
    String courseTitle = "Collect-Forum-" + UUID.randomUUID();
    String forumTitle = ("Forum-" + UUID.randomUUID()).substring(0, 24);
    // go to authoring, create a course with a forum
    navBar.openAuthoringEnvironment().openCreateDropDown().clickCreate(ResourceType.course).fillCreateForm(courseTitle).clickToolbarBack();
    // open course editor
    CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
    courseEditor.createNode("fo").nodeTitle(forumTitle).publish().quickPublish();
    courseEditor.clickToolbarBack();
    CoursePageFragment course = CoursePageFragment.getCourse(browser);
    course.clickTree().selectWithTitle(forumTitle);
    String mediaTitle = "A post";
    String threadTitle = "Very interessant thread";
    ForumPage forum = ForumPage.getCourseForumPage(browser);
    forum.createThread(threadTitle, "With a lot of content", null).addAsMedia().fillForumMedia(mediaTitle, "A post I write");
    UserToolsPage userTools = new UserToolsPage(browser);
    MediaCenterPage mediaCenter = userTools.openUserToolsMenu().openPortfolioV2().openMediaCenter();
    mediaCenter.assertOnMedia(mediaTitle).selectMedia(mediaTitle).assertOnMediaDetails(mediaTitle);
}
Also used : CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserToolsPage(org.olat.selenium.page.user.UserToolsPage) UserVO(org.olat.user.restapi.UserVO) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) ForumPage(org.olat.selenium.page.forum.ForumPage) MediaCenterPage(org.olat.selenium.page.portfolio.MediaCenterPage) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 85 with CourseEditorPageFragment

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

the class PortfolioV2Test method createTemplate.

/**
 * Create a portfolio, a course with a portoflio course element,
 * publish it, ad a participant. The participant log in, search
 * the course and pick the portfolio.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void createTemplate(@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()).resume();
    String binderTitle = "PF-Binder-" + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createPortfolioBinder(binderTitle).clickToolbarBack();
    String sectionTitle = "Section 1 " + UUID.randomUUID();
    String assignmentTitle = "Assignment 1 " + UUID.randomUUID();
    BinderPage portfolio = new BinderPage(browser);
    portfolio.assertOnBinder().selectEntries().createSectionInEntries(sectionTitle).createAssignmentForSection(sectionTitle, assignmentTitle, "Write a small summary", "Your task is...").assertOnAssignmentInEntries(assignmentTitle);
    String courseTitle = "PF Course " + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    String portfolioNodeTitle = "Template-EP-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).publish().quickPublish(UserAccess.membersOnly);
    MembersPage membersPage = courseEditor.clickToolbarBack().members();
    membersPage.importMembers().setMembers(ryomou).nextUsers().nextOverview().nextPermissions().finish();
    // Participant log in
    LoginPage ryomouLoginPage = LoginPage.getLoginPage(ryomouBrowser, deploymentUrl);
    ryomouLoginPage.loginAs(ryomou).resume();
    // open the course
    NavigationPage ryomouNavBar = new NavigationPage(ryomouBrowser);
    ryomouNavBar.openMyCourses().select(courseTitle);
    // go to the portfolio course element
    CoursePageFragment ryomouTestCourse = new CoursePageFragment(ryomouBrowser);
    ryomouTestCourse.clickTree().selectWithTitle(portfolioNodeTitle);
    PortfolioElementPage portfolioCourseEl = new PortfolioElementPage(ryomouBrowser);
    BinderPage binder = portfolioCourseEl.pickPortfolio().goToPortfolioV2();
    binder.selectEntries().pickAssignment(assignmentTitle);
}
Also used : CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserVO(org.olat.user.restapi.UserVO) NavigationPage(org.olat.selenium.page.NavigationPage) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) MembersPage(org.olat.selenium.page.course.MembersPage) LoginPage(org.olat.selenium.page.LoginPage) UserRestClient(org.olat.test.rest.UserRestClient) BinderPage(org.olat.selenium.page.portfolio.BinderPage) PortfolioElementPage(org.olat.selenium.page.course.PortfolioElementPage) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Aggregations

RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)86 Test (org.junit.Test)86 CourseEditorPageFragment (org.olat.selenium.page.course.CourseEditorPageFragment)86 UserRestClient (org.olat.test.rest.UserRestClient)84 UserVO (org.olat.user.restapi.UserVO)84 CoursePageFragment (org.olat.selenium.page.course.CoursePageFragment)80 NavigationPage (org.olat.selenium.page.NavigationPage)44 LoginPage (org.olat.selenium.page.LoginPage)40 MembersPage (org.olat.selenium.page.course.MembersPage)30 WebElement (org.openqa.selenium.WebElement)30 URL (java.net.URL)24 File (java.io.File)22 UserToolsPage (org.olat.selenium.page.user.UserToolsPage)16 AuthoringEnvPage (org.olat.selenium.page.repository.AuthoringEnvPage)14 AssessmentCEConfigurationPage (org.olat.selenium.page.course.AssessmentCEConfigurationPage)10 AssessmentToolPage (org.olat.selenium.page.course.AssessmentToolPage)10 By (org.openqa.selenium.By)10 EnrollmentConfigurationPage (org.olat.selenium.page.course.EnrollmentConfigurationPage)8 EnrollmentPage (org.olat.selenium.page.course.EnrollmentPage)8 GroupPage (org.olat.selenium.page.group.GroupPage)8