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