Search in sources :

Example 16 with CourseEditorPageFragment

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

the class CourseElementTest method createCourseWithCP.

/**
 * Create a course, create a CP, go the the course editor,
 * create a course element of type CP, select the CP which just created,
 * close the course editor and check the presence of the CP with the
 * default title of the first page.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void createCourseWithCP(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    loginPage.loginAs(author.getLogin(), author.getPassword());
    // create a course
    String courseTitle = "Course-With-CP-" + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    // go the authoring environment to create a CP
    String cpTitle = "CP for a course - " + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createCP(cpTitle).assertOnGeneralTab();
    navBar.openCourse(courseTitle);
    String cpNodeTitle = "CP-1";
    // create a course element of type CP with the CP that we create above
    CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
    courseEditor.createNode("cp").nodeTitle(cpNodeTitle).selectTabLearnContent().chooseCP(cpTitle);
    // publish the course
    courseEditor.publish().quickPublish();
    // open the course and see the CP
    CoursePageFragment course = courseEditor.clickToolbarBack();
    course.clickTree().selectWithTitle(cpNodeTitle);
    // check that the default title of CP (Lorem Ipsum) is visible in the iframe
    WebElement cpIframe = browser.findElement(By.cssSelector("div.o_iframedisplay>iframe"));
    browser.switchTo().frame(cpIframe);
    browser.findElement(By.xpath("//h2[text()='Lorem Ipsum']"));
}
Also used : CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserVO(org.olat.user.restapi.UserVO) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) WebElement(org.openqa.selenium.WebElement) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 17 with CourseEditorPageFragment

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

the class CourseElementTest method createCourseWithDialog.

/**
 * An author create a course with a dialog course element. It
 * add a participant to the course, a file to the dialog in
 * the course element configuration and after publishing the course
 * in the view of the dialog. It opens the forum of one of the files,
 * create a new thread.<br>
 * The participant log in, open the course and the dialog element. It
 * reads the thread and make a reply. The author answers to the reply.
 *
 * @param loginPage
 */
@Test
@RunAsClient
public void createCourseWithDialog(@InitialPage LoginPage authorLoginPage, @Drone @Participant WebDriver participantBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO participant = new UserRestClient(deploymentUrl).createRandomUser("Rei");
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    // go to authoring
    AuthoringEnvPage authoringEnv = navBar.assertOnNavigationPage().openAuthoringEnvironment();
    String title = "Course dialog " + UUID.randomUUID();
    // create course
    authoringEnv.openCreateDropDown().clickCreate(ResourceType.course).fillCreateForm(title).assertOnGeneralTab().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();
    String dialogNodeTitle = "Dialog";
    // open course editor
    CoursePageFragment course = CoursePageFragment.getCourse(browser);
    CourseEditorPageFragment editor = course.assertOnCoursePage().assertOnTitle(title).openToolsMenu().edit().createNode("dialog").nodeTitle(dialogNodeTitle);
    // upload a file in the configuration
    URL imageUrl = JunitTestHelper.class.getResource("file_resources/IMG_1484.jpg");
    File imageFile = new File(imageUrl.toURI());
    DialogConfigurationPage dialogConfig = new DialogConfigurationPage(browser);
    dialogConfig.selectConfiguration().uploadFile(imageFile);
    // publish and go to the course element
    editor.publish().quickPublish(UserAccess.membersOnly);
    editor.clickToolbarBack();
    course.clickTree().selectWithTitle(dialogNodeTitle);
    // upload a second file
    URL imageRunUrl = JunitTestHelper.class.getResource("file_resources/IMG_1483.png");
    File imageRunFile = new File(imageRunUrl.toURI());
    DialogPage dialog = new DialogPage(browser);
    dialog.assertOnFile(imageFile.getName()).uploadFile(imageRunFile).assertOnFile(imageRunFile.getName()).openForum(imageRunFile.getName()).createThread("JPEG vs PNG", "Which is the best format", null);
    // 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 dialog course element
    CoursePageFragment participantCourse = CoursePageFragment.getCourse(participantBrowser);
    participantCourse.clickTree().selectWithTitle(dialogNodeTitle);
    DialogPage participantDialog = new DialogPage(participantBrowser);
    participantDialog.assertOnFile(imageRunFile.getName()).openForum(imageRunFile.getName()).openThread("JPEG vs PNG").replyToMessage("JPEG vs PNG", "PNG for sure", "Not a loosy format");
    // The author reload the messages
    dialog.back().openForum(imageRunFile.getName()).openThread("JPEG vs PNG").assertMessageBody("Not a loosy format").replyToMessage("PNG for sure", "JPEG smaller", "JPEG is smaller");
    // The participant check the reply
    participantDialog.back().openForum(imageRunFile.getName()).openThread("JPEG vs PNG").assertMessageBody("JPEG is smaller");
}
Also used : CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) URL(java.net.URL) LoginPage(org.olat.selenium.page.LoginPage) UserRestClient(org.olat.test.rest.UserRestClient) 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) DialogPage(org.olat.selenium.page.course.DialogPage) MembersPage(org.olat.selenium.page.course.MembersPage) File(java.io.File) DialogConfigurationPage(org.olat.selenium.page.course.DialogConfigurationPage) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 18 with CourseEditorPageFragment

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

the class CourseElementTest method createCourseWithInfoMessages.

/**
 * Login, create a course, select "Messages Course", insert an info message
 * course element, publish the course, add messages, count if the messages
 * are there, show older messages, count the messages, show current messages,
 * count the messages, edit a message and delete an other, count the messages.
 *
 * @param authorLoginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void createCourseWithInfoMessages(@InitialPage LoginPage authorLoginPage) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    // go to authoring
    AuthoringEnvPage authoringEnv = navBar.assertOnNavigationPage().openAuthoringEnvironment();
    String title = "Course Msg " + UUID.randomUUID().toString();
    // create course
    authoringEnv.openCreateDropDown().clickCreate(ResourceType.course).fillCreateForm(title).assertOnGeneralTab().clickToolbarBack();
    String infoNodeTitle = "Infos - News";
    // open course editor
    CoursePageFragment course = CoursePageFragment.getCourse(browser);
    CourseEditorPageFragment editor = course.assertOnCoursePage().assertOnTitle(title).openToolsMenu().edit().createNode("info").nodeTitle(infoNodeTitle);
    // configure the info messages
    InfoMessageCEPage infoMsgConfig = new InfoMessageCEPage(browser);
    infoMsgConfig.selectConfiguration().configure(3);
    // publish
    editor.publish().quickPublish(UserAccess.registred);
    editor.clickToolbarBack();
    course.clickTree().selectWithTitle(infoNodeTitle);
    // set a message
    infoMsgConfig.createMessage().setMessage("Information 0", "A very important info").next().finish().assertOnMessageTitle("Information 0");
    for (int i = 1; i <= 3; i++) {
        infoMsgConfig.quickMessage("Information " + i, "More informations");
    }
    int numOfMessages = infoMsgConfig.countMessages();
    Assert.assertEquals(3, numOfMessages);
    // count old messages
    int numOfOldMessages = infoMsgConfig.oldMessages().countMessages();
    Assert.assertEquals(4, numOfOldMessages);
    // new messages
    infoMsgConfig.newMessages();
    int numOfNewMessages = infoMsgConfig.countMessages();
    Assert.assertEquals(3, numOfNewMessages);
    // edit
    infoMsgConfig.oldMessages();
    infoMsgConfig.editMessage("Information 2").setMessage("The latest information", "A very important info").save().assertOnMessageTitle("The latest information");
    // delete
    infoMsgConfig.deleteMessage("Information 3").confirmDelete();
    int numOfSurvivingMessages = infoMsgConfig.countMessages();
    Assert.assertEquals(3, numOfSurvivingMessages);
}
Also used : CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserVO(org.olat.user.restapi.UserVO) AuthoringEnvPage(org.olat.selenium.page.repository.AuthoringEnvPage) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) InfoMessageCEPage(org.olat.selenium.page.course.InfoMessageCEPage) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 19 with CourseEditorPageFragment

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

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)

Example 20 with CourseEditorPageFragment

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

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)

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