Search in sources :

Example 81 with UserRestClient

use of org.olat.test.rest.UserRestClient in project openolat by klemens.

the class CourseElementTest method courseWithSCORM_fullAuto.

/**
 * This test an edge case where a course start automatically its first
 *  course element, which is a structure node which start itself its first
 *  element, which is a SCORM which launch itself automatically.
 *
 * @param loginPage
 */
@Test
@RunAsClient
public void courseWithSCORM_fullAuto(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    loginPage.loginAs(author.getLogin(), author.getPassword());
    URL zipUrl = JunitTestHelper.class.getResource("file_resources/scorm/SCORM_course_full_auto.zip");
    File zipFile = new File(zipUrl.toURI());
    // go the authoring environment to import our course
    String zipTitle = "SCORM - " + UUID.randomUUID();
    navBar.openAuthoringEnvironment().uploadResource(zipTitle, zipFile);
    // publish the course
    new RepositoryEditDescriptionPage(browser).clickToolbarBack();
    CoursePageFragment.getCourse(browser).edit().autoPublish();
    // scorm is auto started -> back
    ScormPage.getScormPage(browser).back();
    // log out
    new UserToolsPage(browser).logout();
    // log in and resume test
    loginPage.loginAs(author.getLogin(), author.getPassword()).resume();
    // direct jump in SCORM content
    ScormPage.getScormPage(browser).passVerySimpleScorm().back().assertOnScormPassed().assertOnScormScore(33);
}
Also used : UserToolsPage(org.olat.selenium.page.user.UserToolsPage) UserVO(org.olat.user.restapi.UserVO) File(java.io.File) URL(java.net.URL) RepositoryEditDescriptionPage(org.olat.selenium.page.repository.RepositoryEditDescriptionPage) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 82 with UserRestClient

use of org.olat.test.rest.UserRestClient in project openolat by klemens.

the class CourseElementTest method createCourseWithWiki.

/**
 * Create a course, create a wiki, go the the course editor,
 * create a course element of type wiki, select the wiki which just created,
 * close the course editor and select the index page of the wiki.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void createCourseWithWiki(@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-Wiki-" + UUID.randomUUID().toString();
    navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    // go the authoring environment to create a CP
    String wikiTitle = "Wiki for a course - " + UUID.randomUUID().toString();
    navBar.openAuthoringEnvironment().createWiki(wikiTitle).assertOnGeneralTab();
    navBar.openCourse(courseTitle);
    String wikiNodeTitle = "Wiki-1";
    // create a course element of type CP with the CP that we create above
    CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
    courseEditor.createNode("wiki").nodeTitle(wikiNodeTitle).selectTabLearnContent().chooseWiki(wikiTitle);
    // publish the course
    courseEditor.publish().quickPublish();
    // open the course and see the CP
    CoursePageFragment course = courseEditor.clickToolbarBack();
    course.clickTree().selectWithTitle(wikiNodeTitle).selectWithTitle("Index");
    // check that the title of the index article/page is visible
    WebElement indexArticleTitle = browser.findElement(By.className("o_wikimod_heading"));
    Assert.assertEquals("Index", indexArticleTitle.getText().trim());
}
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 83 with UserRestClient

use of org.olat.test.rest.UserRestClient in project openolat by klemens.

the class CourseElementTest method createCourseWithWiki_createInCourseEditor.

/**
 * Create a course, create a course element of type wiki. Open
 * the resource chooser, create a wiki, close the editor, show the
 * index page of the wiki.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void createCourseWithWiki_createInCourseEditor(@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-Wiki-" + UUID.randomUUID().toString();
    navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    String wikiNodeTitle = "Wiki-1";
    String wikiTitle = "Wiki for a course - " + UUID.randomUUID().toString();
    // create a course element of type CP with the CP that we create above
    CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
    courseEditor.createNode("wiki").nodeTitle(wikiNodeTitle).selectTabLearnContent().createWiki(wikiTitle);
    // publish the course
    courseEditor.publish().quickPublish();
    // open the course and see the CP
    CoursePageFragment course = courseEditor.clickToolbarBack();
    course.clickTree().selectWithTitle(wikiNodeTitle).selectWithTitle("Index");
    // check that the title of the index article/page is visible
    WebElement indexArticleTitle = browser.findElement(By.className("o_wikimod_heading"));
    Assert.assertEquals("Index", indexArticleTitle.getText().trim());
}
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 84 with UserRestClient

use of org.olat.test.rest.UserRestClient in project openolat by klemens.

the class CourseElementTest method forumConcurrent.

/**
 * An author creates a course with a forum, publish it, open a new thread.
 * A first user come to see the thread. A second come via the peekview.
 * The three make a reply at the same time. And they check that they see
 * the replies, and the ones of the others.
 *
 * @param loginPage
 * @param kanuBrowser
 * @param reiBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void forumConcurrent(@InitialPage LoginPage loginPage, @Drone @Participant WebDriver kanuBrowser, @Drone @Student WebDriver reiBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO kanu = new UserRestClient(deploymentUrl).createRandomUser("Kanu");
    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 foTitle = "FO - " + UUID.randomUUID();
    CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
    courseEditor.createNode("fo").nodeTitle(foTitle).publish().quickPublish(UserAccess.registred);
    // go to the forum
    courseEditor.clickToolbarBack().clickTree().selectWithTitle(foTitle.substring(0, 20));
    ForumPage authorForum = ForumPage.getCourseForumPage(browser);
    authorForum.createThread("The best anime ever", "What is the best anime ever?", null);
    // 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(courseTitle).select(courseTitle).start();
    // go to the forum
    new CoursePageFragment(kanuBrowser).clickTree().selectWithTitle(foTitle.substring(0, 20));
    ForumPage kanuForum = ForumPage.getCourseForumPage(kanuBrowser).openThread("The best anime ever");
    // First user go to the course
    LoginPage reiLoginPage = LoginPage.getLoginPage(reiBrowser, deploymentUrl);
    reiLoginPage.loginAs(rei).resume();
    NavigationPage reiNavBar = new NavigationPage(reiBrowser);
    reiNavBar.openMyCourses().openSearch().extendedSearch(courseTitle).select(courseTitle).start();
    // select the thread in peekview
    ForumPage reiForum = new ForumPage(reiBrowser).openThreadInPeekview("The best anime ever");
    // concurrent reply
    String kanuReply = "Ikki Touzen";
    String reiReply = "Neon Genesis Evangelion";
    String authorReply = "Lain, serial experiment";
    authorForum.replyToMessageNoWait("The best anime ever", null, authorReply);
    reiForum.replyToMessageNoWait("The best anime ever", null, reiReply);
    kanuForum.replyToMessageNoWait("The best anime ever", null, kanuReply);
    // wait the responses
    OOGraphene.waitBusy(browser);
    OOGraphene.waitBusy(kanuBrowser);
    OOGraphene.waitBusy(reiBrowser);
    // check own responses
    authorForum.assertMessageBody(authorReply);
    kanuForum.assertMessageBody(kanuReply);
    reiForum.assertMessageBody(reiReply);
    // check others responses
    authorForum.flatView().waitMessageBody(kanuReply);
    reiForum.flatView().waitMessageBody(kanuReply);
    kanuForum.flatView().waitMessageBody(reiReply);
}
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) ForumPage(org.olat.selenium.page.forum.ForumPage) 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 85 with UserRestClient

use of org.olat.test.rest.UserRestClient in project openolat by klemens.

the class CourseElementTest method createCourseWithBlog_externalFeed.

@Test
@RunAsClient
public void createCourseWithBlog_externalFeed(@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-Blog-" + UUID.randomUUID().toString();
    navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    String blogNodeTitle = "Blog-1";
    String blogTitle = "Blog - " + UUID.randomUUID();
    // create a course element of type blog
    CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
    courseEditor.createNode("blog").nodeTitle(blogNodeTitle).selectTabLearnContent().createFeed(blogTitle);
    // publish the course
    courseEditor.publish().quickPublish();
    // open the course and see the blog
    CoursePageFragment course = courseEditor.clickToolbarBack();
    course.clickTree().selectWithTitle(blogNodeTitle);
    // check that the title of the podcast is correct
    WebElement podcastH2 = browser.findElement(By.cssSelector("div.o_blog_info>h2>i.o_FileResource-BLOG_icon"));
    Assert.assertNotNull(podcastH2);
    // Assert.assertEquals(blogTitle, podcastH2.getText().trim());
    FeedPage feed = FeedPage.getFeedPage(browser);
    feed.newExternalBlog(blogTitle, "https://www.openolat.com/feed/");
// check only that the subscription link is visible
/*
		By subscriptionBy = By.cssSelector("div.o_subscription>a");
		OOGraphene.waitElement(subscriptionBy, 20, browser);
		WebElement subscriptionLink = browser.findElement(subscriptionBy);
		Assert.assertTrue(subscriptionLink.isDisplayed());
		*/
}
Also used : CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserVO(org.olat.user.restapi.UserVO) FeedPage(org.olat.selenium.page.repository.FeedPage) 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)

Aggregations

Test (org.junit.Test)258 UserRestClient (org.olat.test.rest.UserRestClient)258 UserVO (org.olat.user.restapi.UserVO)258 RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)254 NavigationPage (org.olat.selenium.page.NavigationPage)110 LoginPage (org.olat.selenium.page.LoginPage)108 CoursePageFragment (org.olat.selenium.page.course.CoursePageFragment)102 QTI21Page (org.olat.selenium.page.qti.QTI21Page)96 URL (java.net.URL)88 File (java.io.File)86 CourseEditorPageFragment (org.olat.selenium.page.course.CourseEditorPageFragment)84 UserToolsPage (org.olat.selenium.page.user.UserToolsPage)62 QTI21EditorPage (org.olat.selenium.page.qti.QTI21EditorPage)46 WebElement (org.openqa.selenium.WebElement)46 MembersPage (org.olat.selenium.page.course.MembersPage)36 AuthoringEnvPage (org.olat.selenium.page.repository.AuthoringEnvPage)34 GroupPage (org.olat.selenium.page.group.GroupPage)22 BinderPage (org.olat.selenium.page.portfolio.BinderPage)12 PortfolioV2HomePage (org.olat.selenium.page.portfolio.PortfolioV2HomePage)12 By (org.openqa.selenium.By)12