Newer
Older
/**
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at the
* <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Initial code contributed and copyrighted by<br>
* frentix GmbH, http://www.frentix.com
* <p>
*/
package org.olat.selenium;
import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.UUID;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.RunAsClient;
import org.jboss.arquillian.drone.api.annotation.Drone;
import org.jboss.arquillian.graphene.page.InitialPage;
import org.jboss.arquillian.graphene.page.Page;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.arquillian.test.api.ArquillianResource;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.olat.selenium.page.LoginPage;
import org.olat.selenium.page.NavigationPage;
import org.olat.selenium.page.course.CourseEditorPageFragment;
import org.olat.selenium.page.course.CoursePageFragment;
import org.olat.selenium.page.forum.ForumPage;
import org.olat.selenium.page.portfolio.ArtefactWizardPage;
import org.olat.selenium.page.portfolio.PortfolioPage;
import org.olat.selenium.page.repository.AuthoringEnvPage;
import org.olat.selenium.page.repository.AuthoringEnvPage.ResourceType;
import org.olat.selenium.page.repository.FeedPage;
import org.olat.selenium.page.user.UserToolsPage;
import org.olat.selenium.page.wiki.WikiPage;
import org.olat.test.ArquillianDeployments;
import org.olat.test.JunitTestHelper;
import org.olat.test.rest.UserRestClient;
import org.olat.user.restapi.UserVO;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
@RunWith(Arquillian.class)
public class PortfolioTest {
@Deployment(testable = false)
public static WebArchive createDeployment() {
return ArquillianDeployments.createDeployment();
}
@Drone
private WebDriver browser;
@ArquillianResource
private URL deploymentUrl;
@Page
private NavigationPage navBar;
/**
* Create a course with a forum, publish it.
* Create a map.
* Post in the forum, collect the artefact, bind it to the map.
* Check the map and the artefact.
*
* @param loginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void collectForumArtefactInCourse(@InitialPage LoginPage loginPage)
throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
loginPage
.loginAs(author.getLogin(), author.getPassword())
.resume();
//open the portfolio
UserToolsPage userTools = new UserToolsPage(browser);
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
PortfolioPage portfolio = userTools
.openUserToolsMenu()
.openPortfolio();
//create a map
String mapTitle = "Map-Forum-" + UUID.randomUUID();
String pageTitle = "Page-Forum-" + UUID.randomUUID();
String structureElementTitle = "Struct-Forum-" + UUID.randomUUID();
portfolio
.openMyMaps()
.createMap(mapTitle, "Hello forum")
.openEditor()
.selectMapInEditor(mapTitle)
.selectFirstPageInEditor()
.setPage(pageTitle, "With a little description")
.createStructureElement(structureElementTitle, "Structure description");
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)
//open course editor
CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser)
.edit();
courseEditor
.createNode("fo")
.nodeTitle(forumTitle)
.publish()
.quickPublish();
CoursePageFragment course = CoursePageFragment.getCourse(browser);
course
.clickTree()
.selectWithTitle(forumTitle);
String threadTitle = "Very interessant thread";

srosse
committed
ForumPage forum = ForumPage.getCourseForumPage(browser);
ArtefactWizardPage artefactWizard = forum
.createThread(threadTitle, "With a lot of content", null)
.addAsArtfeact();
artefactWizard
.next()
.tags("Forum", "Thread", "Miscellanous")
.next()
.selectMap(mapTitle, pageTitle, structureElementTitle)
.finish();
//open the portfolio
portfolio = userTools
.openUserToolsMenu()
.openPortfolio()
.openMyMaps()
.openMap(mapTitle)
.selectStructureInTOC(structureElementTitle);
portfolio.assertArtefact(threadTitle);
}
/**
* Create a wiki, create a new page.
* Create a map.
* Collect the artefact, bind it to the map.
* Check the map and the artefact.
*
* @param loginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void collectWikiArtefactInWikiResource(@InitialPage LoginPage loginPage)
throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
loginPage
.loginAs(author.getLogin(), author.getPassword())
.resume();
//open the portfolio
UserToolsPage userTools = new UserToolsPage(browser);
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
PortfolioPage portfolio = userTools
.openUserToolsMenu()
.openPortfolio();
//create a map
String mapTitle = "Map-Wiki-" + UUID.randomUUID();
String pageTitle = "Page-Wiki-" + UUID.randomUUID();
String structureElementTitle = "Struct-Wiki-" + UUID.randomUUID();
portfolio
.openMyMaps()
.createMap(mapTitle, "Hello wiki")
.openEditor()
.selectMapInEditor(mapTitle)
.selectFirstPageInEditor()
.setPage(pageTitle, "With a little description about wiki and such tools")
.createStructureElement(structureElementTitle, "Structure description");
//go to authoring
AuthoringEnvPage authoringEnv = navBar
.assertOnNavigationPage()
.openAuthoringEnvironment();
String title = "EP-Wiki-" + UUID.randomUUID();
//create a wiki and launch it
authoringEnv
.openCreateDropDown()
.clickCreate(ResourceType.wiki)
.fillCreateForm(title)
.assertOnGeneralTab()
.clickToolbarBack();
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
//create a page in the wiki
String page = "LMS-" + UUID.randomUUID();
String content = "Learning Management System";
WikiPage wiki = WikiPage.getWiki(browser);
//create page and add it as artefact to portfolio
ArtefactWizardPage artefactWizard = wiki
.createPage(page, content)
.addAsArtfeact();
artefactWizard
.next()
.tags("Wiki", "Thread", "Miscellanous")
.next()
.selectMap(mapTitle, pageTitle, structureElementTitle)
.finish();
//open the portfolio
portfolio = userTools
.openUserToolsMenu()
.openPortfolio()
.openMyMaps()
.openMap(mapTitle)
.selectStructureInTOC(structureElementTitle);
portfolio.assertArtefact(page);
}
/**
* Create a map.
* Create a course with a blog course element.
* Post a new entry in the blog.
* Collect the artefact, bind it to the map.
* Check the map and the artefact.
*
* @param loginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void collectBlogPostInCourse(@InitialPage LoginPage loginPage)
throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
loginPage
.loginAs(author.getLogin(), author.getPassword())
.resume();
//open the portfolio
UserToolsPage userTools = new UserToolsPage(browser);
PortfolioPage portfolio = userTools
.openUserToolsMenu()
.openPortfolio();
//create a map
String mapTitle = "Map-Blog-" + UUID.randomUUID();
String pageTitle = "Page-Blog-" + UUID.randomUUID();
String structureElementTitle = "Struct-Blog-" + UUID.randomUUID();
portfolio
.openMyMaps()
.createMap(mapTitle, "Hello blog post")
.openEditor()
.selectMapInEditor(mapTitle)
.selectFirstPageInEditor()
.setPage(pageTitle, "With a little description")
.createStructureElement(structureElementTitle, "Structure description");
//create a course
String courseTitle = "Course-With-Blog-" + UUID.randomUUID().toString();
navBar
.openAuthoringEnvironment()
.createCourse(courseTitle)
String blogNodeTitle = "Blog-EP-1";
String blogTitle = "Blog - EP - " + UUID.randomUUID().toString();
//create a course element of type blog with a 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 CP
CoursePageFragment course = courseEditor
.clickToolbarBack();
course
.clickTree()
.selectWithTitle(blogNodeTitle);
String postTitle = "Post-EP-" + UUID.randomUUID();
String postSummary = "Some explantations as teaser";
String postContent = "Content of the post";
FeedPage feed = FeedPage.getFeedPage(browser);
ArtefactWizardPage artefactWizard = feed
.newBlog()
.fillPostForm(postTitle, postSummary, postContent)
.publishPost()
.addAsArtfeact();
artefactWizard
.next()
.tags("Forum", "Thread", "Miscellanous")
.next()
.selectMap(mapTitle, pageTitle, structureElementTitle)
.finish();
//open the portfolio
portfolio = userTools
.openUserToolsMenu()
.openPortfolio()
.openMyMaps()
.openMap(mapTitle)
.selectStructureInTOC(structureElementTitle);
portfolio.assertArtefact(postTitle);
}
/**
* Create a map.
* In the artefacts view, create a new text artefact and
* bind it to the map.
* Check the map and the artefact.
*
* @param loginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void addTextArtefact(@InitialPage LoginPage loginPage)
throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
loginPage
.loginAs(author.getLogin(), author.getPassword())
.resume();
//open the portfolio
UserToolsPage userTools = new UserToolsPage(browser);
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
PortfolioPage portfolio = userTools
.openUserToolsMenu()
.openPortfolio();
//create a map
String mapTitle = "Map-Text-1-" + UUID.randomUUID();
String pageTitle = "Page-Text-1-" + UUID.randomUUID();
String structureElementTitle = "Struct-Text-1-" + UUID.randomUUID();
portfolio
.openMyMaps()
.createMap(mapTitle, "Need to place a text artefact")
.openEditor()
.selectMapInEditor(mapTitle)
.selectFirstPageInEditor()
.setPage(pageTitle, "With a little description")
.createStructureElement(structureElementTitle, "Structure description");
//go to my artefacts
portfolio = userTools
.openUserToolsMenu()
.openPortfolio()
.openMyArtefacts();
String textTitle = "Text-1-" + UUID.randomUUID();
//create a text artefact
portfolio
.createTextArtefact()
.fillTextArtefactContent("Content of the text artefact")
.next()
.fillArtefactMetadatas(textTitle, "Description")
.next()
.tags("Forum", "Thread", "Miscellanous")
.next()
.selectMap(mapTitle, pageTitle, structureElementTitle)
.finish();
//open the portfolio
portfolio = userTools
.openUserToolsMenu()
.openPortfolio()
.openMyMaps()
.openMap(mapTitle)
.selectStructureInTOC(structureElementTitle);
}
/**
* Create a map with a structure element and
* create a text artefact.
* Check the map and the artefact.
*
* @param loginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void addTextArtefact_withinMap(@InitialPage LoginPage loginPage)
throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
loginPage
.loginAs(author.getLogin(), author.getPassword())
.resume();
//open the portfolio
UserToolsPage userTools = new UserToolsPage(browser);
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
PortfolioPage portfolio = userTools
.openUserToolsMenu()
.openPortfolio();
//create a map
String mapTitle = "Map-Text-1-" + UUID.randomUUID();
String pageTitle = "Page-Text-1-" + UUID.randomUUID();
String structureElementTitle = "Struct-Text-1-" + UUID.randomUUID();
portfolio
.openMyMaps()
.createMap(mapTitle, "Need to place a text artefact")
.openEditor()
.selectMapInEditor(mapTitle)
.selectFirstPageInEditor()
.setPage(pageTitle, "With a little description")
.createStructureElement(structureElementTitle, "Structure description");
//create the text artefact
ArtefactWizardPage artefactWizard = portfolio
.linkArtefact()
.addArtefact()
.createTextArtefact();
String textTitle = "Text-2-" + UUID.randomUUID();
//create a text artefact
artefactWizard
.fillTextArtefactContent("Content of the text artefact")
.next()
.fillArtefactMetadatas(textTitle, "Description")
.next()
.tags("LateX", "Thread", "Miscellanous")
.next()
.selectMap(mapTitle, pageTitle, structureElementTitle)
.finish();
//reopen the portfolio
portfolio = userTools
.openUserToolsMenu()
.openPortfolio()
.openMyMaps()
.openMap(mapTitle)
.selectStructureInTOC(structureElementTitle);
}
/**
* Create a map.
* In the artefacts view, create a new live blog
* (or learning journal) and bind it to the map.
* Check the map and post an entry in the blog.
*
* @param loginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void addLearningJournal(@InitialPage LoginPage loginPage)
throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
loginPage
.loginAs(author.getLogin(), author.getPassword())
.resume();
//open the portfolio
UserToolsPage userTools = new UserToolsPage(browser);
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
PortfolioPage portfolio = userTools
.openUserToolsMenu()
.openPortfolio();
//create a map
String mapTitle = "Learning-Journal-1-" + UUID.randomUUID();
String pageTitle = "Learning-Journal-Page-1-" + UUID.randomUUID();
String structureElementTitle = "Learning-Journal-Struct-1-" + UUID.randomUUID();
portfolio
.openMyMaps()
.createMap(mapTitle, "Need to journal my learning feelings")
.openEditor()
.selectMapInEditor(mapTitle)
.selectFirstPageInEditor()
.setPage(pageTitle, "With a little description")
.createStructureElement(structureElementTitle, "Structure description");
//go to my artefacts
portfolio = userTools
.openUserToolsMenu()
.openPortfolio()
.openMyArtefacts();
String textTitle = "Journal-1-" + UUID.randomUUID();
//create a live blog or learning journal
portfolio
.createLearningJournal()
.fillArtefactMetadatas(textTitle, "Description")
.next()
.tags("Journal", "Live", "Learning")
.next()
.selectMap(mapTitle, pageTitle, structureElementTitle)
.finish();
//open the portfolio
portfolio = userTools
.openUserToolsMenu()
.openPortfolio()
.openMyMaps()
.openMap(mapTitle)
.selectStructureInTOC(structureElementTitle);
//play with the blog
String postTitle = "Journal-EP-" + UUID.randomUUID();
String postSummary = "Some explantations of the journal";
String postContent = "First impression in my live blog";
FeedPage feed = FeedPage.getFeedPage(browser);
feed
.newBlog()
.fillPostForm(postTitle, postSummary, postContent)
.publishPost();
//check that we see the post
By postTitleBy = By.cssSelector("h3.o_title>a>span");
WebElement postTitleEl = browser.findElement(postTitleBy);
Assert.assertTrue(postTitleEl.getText().contains(postTitle));
}
/**
* Create a map, create a new live blog
* (or learning journal), add a post.
* Check the map and the artefact.
*
* @param loginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void addLearningJournal_withinMap(@InitialPage LoginPage loginPage)
throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
loginPage
.loginAs(author.getLogin(), author.getPassword())
.resume();
//open the portfolio
UserToolsPage userTools = new UserToolsPage(browser);
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
PortfolioPage portfolio = userTools
.openUserToolsMenu()
.openPortfolio();
//create a map
String mapTitle = "Learning-Journal-2-" + UUID.randomUUID();
String pageTitle = "Learning-Journal-Page-2-" + UUID.randomUUID();
String structureElementTitle = "Learning-Journal-Struct-2-" + UUID.randomUUID();
portfolio
.openMyMaps()
.createMap(mapTitle, "Need quickly a journal to share my learning feelings")
.openEditor()
.selectMapInEditor(mapTitle)
.selectFirstPageInEditor()
.setPage(pageTitle, "With a little description")
.createStructureElement(structureElementTitle, "Structure description");
//create the live blog
ArtefactWizardPage artefactWizard = portfolio
.linkArtefact()
.addArtefact()
.createLearningJournal();
String textTitle = "Journal-2-" + UUID.randomUUID();
//create a live blog or learning journal
artefactWizard
.fillArtefactMetadatas(textTitle, "Description")
.next()
.tags("Journal", "Live", "Learning")
.next()
.selectMap(mapTitle, pageTitle, structureElementTitle)
.finish();
//open the portfolio
portfolio = userTools
.openUserToolsMenu()
.openPortfolio()
.openMyMaps()
.openMap(mapTitle)
.selectStructureInTOC(structureElementTitle);
//play with the blog
String postTitle = "Journal-EP-" + UUID.randomUUID();
String postSummary = "Some explantations of the journal";
String postContent = "First impression in my live blog created in few clicks";
FeedPage feed = FeedPage.getFeedPage(browser);
feed
.newBlog()
.fillPostForm(postTitle, postSummary, postContent)
.publishPost();
//check that we see the post
By postTitleBy = By.cssSelector("h3.o_title>a>span");
WebElement postTitleEl = browser.findElement(postTitleBy);
Assert.assertTrue(postTitleEl.getText().contains(postTitle));
}
/**
* Create a map.
* Go the "My artefacts" and create an artefact of type file. Bind it
* to the map. Check the map.
*
* @param loginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void addFileArtefact(@InitialPage LoginPage loginPage)
throws IOException, URISyntaxException {
//File upload only work with Firefox
Assume.assumeTrue(browser instanceof FirefoxDriver);
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
loginPage
.loginAs(author.getLogin(), author.getPassword())
.resume();
//open the portfolio
UserToolsPage userTools = new UserToolsPage(browser);
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
PortfolioPage portfolio = userTools
.openUserToolsMenu()
.openPortfolio();
//create a map
String mapTitle = "Map-File-1-" + UUID.randomUUID();
String pageTitle = "Page-File-1-" + UUID.randomUUID();
String structureElementTitle = "Struct-File-1-" + UUID.randomUUID();
portfolio
.openMyMaps()
.createMap(mapTitle, "Need to upload some file")
.openEditor()
.selectMapInEditor(mapTitle)
.selectFirstPageInEditor()
.setPage(pageTitle, "With a little description")
.createStructureElement(structureElementTitle, "Structure description");
//go to my artefacts
portfolio = userTools
.openUserToolsMenu()
.openPortfolio()
.openMyArtefacts();
String textTitle = "File-1-" + UUID.randomUUID();
URL courseUrl = JunitTestHelper.class.getResource("file_resources/handInTopic1.pdf");
File file = new File(courseUrl.toURI());
//create the artefact
portfolio
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
.createFileArtefact()
.uploadFile(file)
.next()
.fillArtefactMetadatas(textTitle, "Description")
.next()
.tags("File", "PDF", "Learning")
.next()
.selectMap(mapTitle, pageTitle, structureElementTitle)
.finish();
//open the portfolio
portfolio = userTools
.openUserToolsMenu()
.openPortfolio()
.openMyMaps()
.openMap(mapTitle)
.selectStructureInTOC(structureElementTitle);
//check that we see the post
By artefactTitleBy = By.cssSelector("div.panel-heading>h3");
WebElement artefactTitle = browser.findElement(artefactTitleBy);
Assert.assertTrue(artefactTitle.getText().contains(textTitle));
}
/**
* Create a map, create a new file artefact.
* Check the map and the artefact.
*
* @param loginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void addFileArtefact_withinMap(@InitialPage LoginPage loginPage)
throws IOException, URISyntaxException {
//File upload only work with Firefox
Assume.assumeTrue(browser instanceof FirefoxDriver);
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
loginPage
.loginAs(author.getLogin(), author.getPassword())
.resume();
//open the portfolio
UserToolsPage userTools = new UserToolsPage(browser);
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
PortfolioPage portfolio = userTools
.openUserToolsMenu()
.openPortfolio();
//create a map
String mapTitle = "Map-File-2-" + UUID.randomUUID();
String pageTitle = "Page-File-2-" + UUID.randomUUID();
String structureElementTitle = "Struct-File-2-" + UUID.randomUUID();
portfolio
.openMyMaps()
.createMap(mapTitle, "Need a map to upload some files quckly")
.openEditor()
.selectMapInEditor(mapTitle)
.selectFirstPageInEditor()
.setPage(pageTitle, "With a little description")
.createStructureElement(structureElementTitle, "Structure description");
//create the file artefact
ArtefactWizardPage artefactWizard = portfolio
.linkArtefact()
.addArtefact()
.createFileArtefact();
String textTitle = "File-2-" + UUID.randomUUID();
URL courseUrl = JunitTestHelper.class.getResource("file_resources/handInTopic1.pdf");
File file = new File(courseUrl.toURI());
//foolow the wizard
artefactWizard
.uploadFile(file)
.next()
.fillArtefactMetadatas(textTitle, "Description")
.next()
.tags("File", "Data", "Learning")
.next()
.selectMap(mapTitle, pageTitle, structureElementTitle)
.finish();
//open the portfolio
portfolio = userTools
.openUserToolsMenu()
.openPortfolio()
.openMyMaps()
.openMap(mapTitle)
.selectStructureInTOC(structureElementTitle);
//check that we see the post
By artefactTitleBy = By.cssSelector("div.panel-heading>h3");
WebElement artefactTitle = browser.findElement(artefactTitleBy);
Assert.assertTrue(artefactTitle.getText().contains(textTitle));
}
/**
* Create a course with a portfolio course element.
* Create a template from within the portfolio course
* element and edit it. Rename a page, add a structure
* element. Publish the course, go to the course
* and check if the link to take the map is there.
*
* @param loginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void createPortfolioTemplate_inCourse(@InitialPage LoginPage loginPage)
throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
loginPage
.loginAs(author.getLogin(), author.getPassword())
.resume();
String courseTitle = "Course-With-Portfolio-" + UUID.randomUUID();
navBar
.openAuthoringEnvironment()
.createCourse(courseTitle)
String portfolioNodeTitle = "Template-EP-1";
String portfolioTitle = "Template - EP - " + UUID.randomUUID();
//create a course element of type CP with the CP that we create above
CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser)
.edit();
PortfolioPage template = courseEditor
.createNode("ep")
.nodeTitle(portfolioNodeTitle)
.selectTabLearnContent()
.createPortfolio(portfolioTitle)
.editPortfolio();
String pageTitle = "Page-Template-" + UUID.randomUUID();
String structureElementTitle = "Struct-Template-" + UUID.randomUUID();
template
.openResourceEditor()
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
.selectMapInEditor(portfolioTitle)
.selectFirstPageInEditor()
.setPage(pageTitle, "With a little description")
.createStructureElement(structureElementTitle, "Structure description");
//open course
navBar.openCourse(courseTitle);
//reload editor
courseEditor = CourseEditorPageFragment.getEditor(browser);
courseEditor
.publish()
.quickPublish();
//back to the course
CoursePageFragment course = courseEditor
.clickToolbarBack();
//select the portfolio course element
course
.clickTree()
.selectWithTitle(portfolioNodeTitle);
By newMapBy = By.className("o_sel_ep_new_map_template");
WebElement newMapButton = browser.findElement(newMapBy);
Assert.assertTrue(newMapButton.isDisplayed());
}