Search in sources :

Example 1 with MenuTreePageFragment

use of org.olat.selenium.page.core.MenuTreePageFragment in project OpenOLAT by OpenOLAT.

the class CourseTest method courseAccessRules.

/**
 * An author creates a course with 4 course elements. A folder
 * which is visible to group, a forum which is visible to coaches,
 * an assessment and an info visible to the students which passed
 * the assessment above.<br>
 * a student come and checks what it can see, the author make it
 * pass the assessment and the student sees the info.
 *
 * @param loginPage
 * @param kanuBrowser
 * @param reiBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void courseAccessRules(@InitialPage LoginPage loginPage, @Drone @Student WebDriver reiBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("rei");
    loginPage.loginAs(author.getLogin(), author.getPassword());
    // create a course
    String courseTitle = "Course FO " + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    // go the authoring environment to create a forum
    String bcTitle = "BC - " + UUID.randomUUID();
    String foTitle = "FO - " + UUID.randomUUID();
    String msTitle = "MS - " + UUID.randomUUID();
    String infoTitle = "Info - " + UUID.randomUUID();
    String groupName = "Students";
    CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
    // folder is group protected
    courseEditor.createNode("bc").nodeTitle(bcTitle).selectTabVisibility().setGroupCondition().createBusinessGroup(groupName);
    // forum is coach exclusive
    courseEditor.createNode("fo").nodeTitle(foTitle).selectTabVisibility().setCoachExclusive().save();
    // assessment is open
    courseEditor.createNode("ms").nodeTitle(msTitle);
    // configure assessment
    AssessmentCEConfigurationPage assessmentConfig = new AssessmentCEConfigurationPage(browser);
    assessmentConfig.selectConfiguration().setScoreAuto(0.0f, 6.0f, 4.0f);
    // wiki is assessment dependent
    courseEditor.createNode("info").nodeTitle(infoTitle).selectTabVisibility().setAssessmentCondition(1).save();
    OOGraphene.scrollTop(browser);
    courseEditor.publish().nextSelectNodes().selectAccess(UserAccess.membersOnly).nextAccess().selectCatalog(false).nextCatalog().finish();
    courseEditor.clickToolbarBack();
    // add a member to the group we create above
    MembersPage members = CoursePageFragment.getCourse(browser).members();
    members.addMember().searchMember(rei, true).nextUsers().nextOverview().selectGroupAsParticipant(groupName).nextPermissions().finish();
    // participant search the course
    LoginPage.getLoginPage(reiBrowser, deploymentUrl).loginAs(rei).resume();
    NavigationPage reiNavBar = new NavigationPage(reiBrowser);
    reiNavBar.openMyCourses().select(courseTitle);
    MenuTreePageFragment reiTree = new MenuTreePageFragment(reiBrowser);
    reiTree.assertWithTitle(bcTitle.substring(0, 20)).assertWithTitle(msTitle.substring(0, 20)).assertTitleNotExists(foTitle.substring(0, 20)).assertTitleNotExists(infoTitle.substring(0, 20));
    // author set assessment to passed
    AssessmentToolPage assessmentTool = members.clickToolbarBack().assessmentTool();
    assessmentTool.users().assertOnUsers(rei).selectUser(rei).selectCourseNode(msTitle.substring(0, 20)).setAssessmentScore(5.5f).assertUserPassedCourseNode(msTitle.substring(0, 20));
    // student can see info
    reiTree.selectRoot().assertWithTitle(bcTitle.substring(0, 20)).assertWithTitle(msTitle.substring(0, 20)).assertTitleNotExists(foTitle.substring(0, 20)).assertWithTitle(infoTitle.substring(0, 20));
    // author can see all
    assessmentTool.clickToolbarRootCrumb().clickTree().assertWithTitle(bcTitle.substring(0, 20)).assertWithTitle(msTitle.substring(0, 20)).assertWithTitle(foTitle.substring(0, 20)).assertWithTitle(infoTitle.substring(0, 20));
}
Also used : CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserVO(org.olat.user.restapi.UserVO) NavigationPage(org.olat.selenium.page.NavigationPage) AssessmentCEConfigurationPage(org.olat.selenium.page.course.AssessmentCEConfigurationPage) MembersPage(org.olat.selenium.page.course.MembersPage) MenuTreePageFragment(org.olat.selenium.page.core.MenuTreePageFragment) AssessmentToolPage(org.olat.selenium.page.course.AssessmentToolPage) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 2 with MenuTreePageFragment

use of org.olat.selenium.page.core.MenuTreePageFragment 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);
}
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 3 with MenuTreePageFragment

use of org.olat.selenium.page.core.MenuTreePageFragment in project openolat by klemens.

the class CoursePageFragment method clickTree.

/**
 * Click the first element of the menu tree
 * @return
 */
public MenuTreePageFragment clickTree() {
    OOGraphene.waitElement(MenuTreePageFragment.treeBy, 2, browser);
    MenuTreePageFragment menuTree = new MenuTreePageFragment(browser);
    menuTree.selectRoot();
    return menuTree;
}
Also used : MenuTreePageFragment(org.olat.selenium.page.core.MenuTreePageFragment)

Example 4 with MenuTreePageFragment

use of org.olat.selenium.page.core.MenuTreePageFragment in project openolat by klemens.

the class CourseTest method courseAccessRules.

/**
 * An author creates a course with 4 course elements. A folder
 * which is visible to group, a forum which is visible to coaches,
 * an assessment and an info visible to the students which passed
 * the assessment above.<br>
 * a student come and checks what it can see, the author make it
 * pass the assessment and the student sees the info.
 *
 * @param loginPage
 * @param kanuBrowser
 * @param reiBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void courseAccessRules(@InitialPage LoginPage loginPage, @Drone @Student WebDriver reiBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("rei");
    loginPage.loginAs(author.getLogin(), author.getPassword());
    // create a course
    String courseTitle = "Course FO " + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    // go the authoring environment to create a forum
    String bcTitle = "BC - " + UUID.randomUUID();
    String foTitle = "FO - " + UUID.randomUUID();
    String msTitle = "MS - " + UUID.randomUUID();
    String infoTitle = "Info - " + UUID.randomUUID();
    String groupName = "Students";
    CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
    // folder is group protected
    courseEditor.createNode("bc").nodeTitle(bcTitle).selectTabVisibility().setGroupCondition().createBusinessGroup(groupName);
    // forum is coach exclusive
    courseEditor.createNode("fo").nodeTitle(foTitle).selectTabVisibility().setCoachExclusive().save();
    // assessment is open
    courseEditor.createNode("ms").nodeTitle(msTitle);
    // configure assessment
    AssessmentCEConfigurationPage assessmentConfig = new AssessmentCEConfigurationPage(browser);
    assessmentConfig.selectConfiguration().setScoreAuto(0.0f, 6.0f, 4.0f);
    // wiki is assessment dependent
    courseEditor.createNode("info").nodeTitle(infoTitle).selectTabVisibility().setAssessmentCondition(1).save();
    OOGraphene.scrollTop(browser);
    courseEditor.publish().nextSelectNodes().selectAccess(UserAccess.membersOnly).nextAccess().selectCatalog(false).nextCatalog().finish();
    courseEditor.clickToolbarBack();
    // add a member to the group we create above
    MembersPage members = CoursePageFragment.getCourse(browser).members();
    members.addMember().searchMember(rei, true).nextUsers().nextOverview().selectGroupAsParticipant(groupName).nextPermissions().finish();
    // participant search the course
    LoginPage.getLoginPage(reiBrowser, deploymentUrl).loginAs(rei).resume();
    NavigationPage reiNavBar = new NavigationPage(reiBrowser);
    reiNavBar.openMyCourses().select(courseTitle);
    MenuTreePageFragment reiTree = new MenuTreePageFragment(reiBrowser);
    reiTree.assertWithTitle(bcTitle.substring(0, 20)).assertWithTitle(msTitle.substring(0, 20)).assertTitleNotExists(foTitle.substring(0, 20)).assertTitleNotExists(infoTitle.substring(0, 20));
    // author set assessment to passed
    AssessmentToolPage assessmentTool = members.clickToolbarBack().assessmentTool();
    assessmentTool.users().assertOnUsers(rei).selectUser(rei).selectCourseNode(msTitle.substring(0, 20)).setAssessmentScore(5.5f).assertUserPassedCourseNode(msTitle.substring(0, 20));
    // student can see info
    reiTree.selectRoot().assertWithTitle(bcTitle.substring(0, 20)).assertWithTitle(msTitle.substring(0, 20)).assertTitleNotExists(foTitle.substring(0, 20)).assertWithTitle(infoTitle.substring(0, 20));
    // author can see all
    assessmentTool.clickToolbarRootCrumb().clickTree().assertWithTitle(bcTitle.substring(0, 20)).assertWithTitle(msTitle.substring(0, 20)).assertWithTitle(foTitle.substring(0, 20)).assertWithTitle(infoTitle.substring(0, 20));
}
Also used : CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserVO(org.olat.user.restapi.UserVO) NavigationPage(org.olat.selenium.page.NavigationPage) AssessmentCEConfigurationPage(org.olat.selenium.page.course.AssessmentCEConfigurationPage) MembersPage(org.olat.selenium.page.course.MembersPage) MenuTreePageFragment(org.olat.selenium.page.core.MenuTreePageFragment) AssessmentToolPage(org.olat.selenium.page.course.AssessmentToolPage) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 5 with MenuTreePageFragment

use of org.olat.selenium.page.core.MenuTreePageFragment 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);
}
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)

Aggregations

MenuTreePageFragment (org.olat.selenium.page.core.MenuTreePageFragment)8 RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)6 Test (org.junit.Test)6 NavigationPage (org.olat.selenium.page.NavigationPage)6 CourseEditorPageFragment (org.olat.selenium.page.course.CourseEditorPageFragment)6 UserRestClient (org.olat.test.rest.UserRestClient)6 UserVO (org.olat.user.restapi.UserVO)6 LoginPage (org.olat.selenium.page.LoginPage)4 CoursePageFragment (org.olat.selenium.page.course.CoursePageFragment)4 URL (java.net.URL)2 AssessmentCEConfigurationPage (org.olat.selenium.page.course.AssessmentCEConfigurationPage)2 AssessmentToolPage (org.olat.selenium.page.course.AssessmentToolPage)2 MembersPage (org.olat.selenium.page.course.MembersPage)2 AuthoringEnvPage (org.olat.selenium.page.repository.AuthoringEnvPage)2