From 5ba26c1fcc0f0931e80114096f82dd489e38cf45 Mon Sep 17 00:00:00 2001 From: srosse <none@none> Date: Fri, 4 Jul 2014 07:25:18 +0200 Subject: [PATCH] OO-1068: 1 selenium test which create a course with the course wizard, remove jcodec assert --- .../olat/course/CourseXStreamAliasesTest.java | 2 +- .../org/olat/course/FunctionalCourseTest.java | 246 ------------------ .../RepositoryEntryAuthorQueriesTest.java | 2 +- .../RepositoryEntryMyCourseQueriesTest.java | 2 +- .../org/olat/selenium/BusinessGroupTest.java | 11 +- .../java/org/olat/selenium/CourseTest.java | 62 +++++ .../org/olat/selenium/page/LoginPage.java | 2 +- .../page/course/CourseEditorPageFragment.java | 2 +- .../page/course/CourseWizardPage.java | 95 +++++++ .../page/course/PublisherPageFragment.java | 2 +- .../olat/selenium/page/group/GroupPage.java | 13 +- .../olat/selenium/page/group/GroupsPage.java | 2 +- .../page/portfolio/ArtefactWizardPage.java | 2 +- .../page/repository/AuthoringEnvPage.java | 21 +- .../repository/RepositoryDetailsPage.java | 2 +- .../RepositoryEditDescriptionPage.java | 6 +- .../selenium/page/user/UserSettingsPage.java | 2 +- .../selenium/page/user/UserToolsPage.java | 2 +- .../org/olat/selenium/page/wiki/WikiPage.java | 2 +- 19 files changed, 204 insertions(+), 274 deletions(-) delete mode 100644 src/test/java/org/olat/course/FunctionalCourseTest.java create mode 100644 src/test/java/org/olat/selenium/page/course/CourseWizardPage.java diff --git a/src/test/java/org/olat/course/CourseXStreamAliasesTest.java b/src/test/java/org/olat/course/CourseXStreamAliasesTest.java index a1fc8bfabd6..cdd00a3243f 100644 --- a/src/test/java/org/olat/course/CourseXStreamAliasesTest.java +++ b/src/test/java/org/olat/course/CourseXStreamAliasesTest.java @@ -21,7 +21,7 @@ package org.olat.course; import java.io.InputStream; -import org.jcodec.common.Assert; +import org.junit.Assert; import org.junit.Test; import com.thoughtworks.xstream.XStream; diff --git a/src/test/java/org/olat/course/FunctionalCourseTest.java b/src/test/java/org/olat/course/FunctionalCourseTest.java deleted file mode 100644 index 49aad84c736..00000000000 --- a/src/test/java/org/olat/course/FunctionalCourseTest.java +++ /dev/null @@ -1,246 +0,0 @@ -/** - * <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.course; - -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.net.URISyntaxException; -import java.net.URL; -import java.security.NoSuchAlgorithmException; -import java.security.NoSuchProviderException; -import java.util.List; -import java.util.Random; - -import org.apache.commons.codec.binary.Base64; -import org.apache.commons.io.IOUtils; -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.junit.Arquillian; -import org.jboss.arquillian.test.api.ArquillianResource; -import org.jboss.shrinkwrap.api.spec.WebArchive; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.olat.core.logging.OLog; -import org.olat.core.logging.Tracing; -import org.olat.restapi.support.vo.GroupVO; -import org.olat.restapi.support.vo.RepositoryEntryVO; -import org.olat.test.ArquillianDeployments; -import org.olat.util.FunctionalCourseUtil; -import org.olat.util.FunctionalCourseUtil.CourseNodeAlias; -import org.olat.util.FunctionalHtmlUtil; -import org.olat.util.FunctionalRepositorySiteUtil; -import org.olat.util.FunctionalRepositorySiteUtil.CourseWizardAccess; -import org.olat.util.FunctionalRepositorySiteUtil.CourseWizardElement; -import org.olat.util.FunctionalUtil; -import org.olat.util.FunctionalUtil.OlatSite; -import org.olat.util.FunctionalVOUtil; - -import com.google.common.io.Files; -import com.thoughtworks.selenium.DefaultSelenium; - -/** - * - * @author jkraehemann, joel.kraehemann@frentix.com, frentix.com - */ -@RunWith(Arquillian.class) -public class FunctionalCourseTest { - - private final static OLog log = Tracing.createLoggerFor(FunctionalCourseTest.class); - - public final static String WIZARD_COURSE_TITLE = "wizard-course"; - public final static String WIZARD_COURSE_DESCRIPTION = "course created by wizard"; - - public final static String EDITOR_COURSE_TITLE = "editor-course"; - public final static String EDITOR_COURSE_CHANGED_TITLE = "editor-course-renamed"; - public final static String EDITOR_COURSE_DESCRIPTION = "course create within editor"; - public final static String EDITOR_COURSE_OVERVIEW_FILE = "/org/olat/course/overview_comprehensive_guide_to_c_programming.html"; - - public final static int LARGE_COURSE_FILE_COUNT = 20; - public final static long LARGE_COURSE_FILE_SIZE = 50000; - public final static int LARGE_COURSE_TEST_COUNT = 20; - public final static int LARGE_COURSE_GROUP_COUNT = 15; - public final static String LARGE_COURSE_IQ_TEST_SHORT_TITLE = "QTI"; - public final static String LARGE_COURSE_IQ_TEST_LONG_TITLE = "generated test No. "; - public final static String LARGE_COURSE_IQ_TEST_DESCRIPTION_0 = "generated within a loop: test#"; - public final static String LARGE_COURSE_IQ_TEST_DESCRIPTION_1 = " of totally " + LARGE_COURSE_TEST_COUNT; - - @Deployment(testable = false) - public static WebArchive createDeployment() { - return ArquillianDeployments.createDeployment(); - } - - @Drone - DefaultSelenium browser; - - @ArquillianResource - URL deploymentUrl; - - static FunctionalUtil functionalUtil; - static FunctionalRepositorySiteUtil functionalRepositorySiteUtil; - static FunctionalCourseUtil functionalCourseUtil; - - static FunctionalVOUtil functionalVOUtil; - - static FunctionalHtmlUtil functionalHtmlUtil; - - static boolean initialized = false; - - @Before - public void setup() throws IOException, URISyntaxException{ - if(!initialized){ - functionalUtil = new FunctionalUtil(); - functionalUtil.setDeploymentUrl(deploymentUrl.toString()); - functionalRepositorySiteUtil = functionalUtil.getFunctionalRepositorySiteUtil(); - functionalCourseUtil = functionalRepositorySiteUtil.getFunctionalCourseUtil(); - - functionalVOUtil = new FunctionalVOUtil(functionalUtil.getUsername(), functionalUtil.getPassword()); - - functionalHtmlUtil = functionalUtil.getFunctionalHtmlUtil(); - - initialized = true; - } - } - - @Test - @RunAsClient - public void checkCreateUsingWizard(){ - /* login */ - Assert.assertTrue(functionalUtil.login(browser, functionalUtil.getUsername(), functionalUtil.getPassword(), true)); - - /* open repository site */ - Assert.assertTrue(functionalUtil.openSite(browser, OlatSite.LEARNING_RESOURCES)); - - /* create course using wizard */ - CourseWizardElement[] elementArray = new CourseWizardElement[]{ - CourseWizardElement.INFO_PAGE, - CourseWizardElement.FORUM, - CourseWizardElement.ENROLLMENT, - CourseWizardElement.DOWNLOAD_FOLDER, - CourseWizardElement.EMAIL}; - - Assert.assertTrue(functionalRepositorySiteUtil.createCourseUsingWizard(browser, WIZARD_COURSE_TITLE, WIZARD_COURSE_DESCRIPTION, - elementArray, null, true, CourseWizardAccess.USERS)); - - /* click each node once */ - for(int i = 0; i < elementArray.length; i++){ - functionalCourseUtil.open(browser, i); - } - - functionalUtil.logout(browser); - } - - @Test - @RunAsClient - public void checkCreateLargeCourse() throws URISyntaxException, IOException, NoSuchAlgorithmException, NoSuchProviderException{ - File[] largeFile = new File[LARGE_COURSE_FILE_COUNT]; - Random random = new Random(); - - for(int i = 0; i < largeFile.length; i++){ - File currentFile = - largeFile[i] = new File(Files.createTempDir(), "largeText" + i + ".txt"); - - if(currentFile.exists()){ - currentFile.delete(); - } - - currentFile.createNewFile(); - OutputStream out = new FileOutputStream(currentFile); - - log.info("creating large file: " + LARGE_COURSE_FILE_SIZE + "bytes"); - - for(int j = 0; currentFile.length() < LARGE_COURSE_FILE_SIZE; j++){ - ByteArrayOutputStream dataOut = new ByteArrayOutputStream(); - - dataOut.write(new String("Line number #" + j + ": ").getBytes()); - byte[] chunck = new byte[1024]; - random.nextBytes(chunck); - dataOut.write(Base64.encodeBase64(chunck, false)); - dataOut.write("\n".getBytes()); - IOUtils.write(dataOut.toByteArray(), out); - out.flush(); - } - - out.close(); - } - - /* create groups via REST-API */ - List<GroupVO> group = functionalVOUtil.createTestCourseGroups(deploymentUrl, LARGE_COURSE_GROUP_COUNT); - - /* login */ - Assert.assertTrue(functionalUtil.login(browser, functionalUtil.getUsername(), functionalUtil.getPassword(), true)); - - /* open repository site */ - Assert.assertTrue(functionalUtil.openSite(browser, OlatSite.LEARNING_RESOURCES)); - - /* create course using wizard */ - CourseWizardElement[] elementArray = new CourseWizardElement[]{ - CourseWizardElement.INFO_PAGE, - CourseWizardElement.DOWNLOAD_FOLDER}; - - Assert.assertTrue(functionalRepositorySiteUtil.createCourseUsingWizard(browser, WIZARD_COURSE_TITLE, WIZARD_COURSE_DESCRIPTION, - elementArray, null, true, CourseWizardAccess.USERS)); - - Assert.assertNotNull(functionalCourseUtil.open(browser, 1)); - - for(File currentFile: largeFile){ - Assert.assertTrue(functionalCourseUtil.uploadFileToCourseFolder(browser, currentFile.toURI())); - } - - /* click course node and open editor */ - functionalCourseUtil.open(browser, -1); - Assert.assertTrue(functionalCourseUtil.openCourseEditor(browser)); - String businessPath = functionalCourseUtil.readExternalLink(browser); - - /* create tests */ - for(int i = 0; i < LARGE_COURSE_TEST_COUNT; i++){ - String title = LARGE_COURSE_IQ_TEST_SHORT_TITLE + i; - String description = LARGE_COURSE_IQ_TEST_DESCRIPTION_0 + i + LARGE_COURSE_IQ_TEST_DESCRIPTION_1; - - /* create course node and assign qti test to it */ - Assert.assertTrue(functionalCourseUtil.createCourseNode(browser, - CourseNodeAlias.IQ_TEST, - title, LARGE_COURSE_IQ_TEST_LONG_TITLE + i, description, - 2 * i + 4)); - Assert.assertTrue(functionalCourseUtil.createQTITest(browser, title, description)); - } - - functionalUtil.logout(browser); - - /* assign groups to course */ - long repoKey = functionalCourseUtil.extractRepositoryEntryKey(businessPath); - RepositoryEntryVO repoEntryVO = functionalVOUtil.getRepositoryEntryByKey(deploymentUrl, repoKey); - long courseId = repoEntryVO.getOlatResourceId(); - - functionalVOUtil.addGroupToCourse(deploymentUrl, courseId, group); - - /* login */ - Assert.assertTrue(functionalUtil.login(browser, functionalUtil.getUsername(), functionalUtil.getPassword(), true)); - - //TODO:JK: copy course - - functionalUtil.logout(browser); - } -} diff --git a/src/test/java/org/olat/repository/manager/RepositoryEntryAuthorQueriesTest.java b/src/test/java/org/olat/repository/manager/RepositoryEntryAuthorQueriesTest.java index 7ce0d8898d8..5881f8951ff 100644 --- a/src/test/java/org/olat/repository/manager/RepositoryEntryAuthorQueriesTest.java +++ b/src/test/java/org/olat/repository/manager/RepositoryEntryAuthorQueriesTest.java @@ -21,7 +21,7 @@ package org.olat.repository.manager; import java.util.List; -import org.jcodec.common.Assert; +import org.junit.Assert; import org.junit.Test; import org.olat.basesecurity.BaseSecurity; import org.olat.core.commons.persistence.DB; diff --git a/src/test/java/org/olat/repository/manager/RepositoryEntryMyCourseQueriesTest.java b/src/test/java/org/olat/repository/manager/RepositoryEntryMyCourseQueriesTest.java index 7601316f256..c72f1406eed 100644 --- a/src/test/java/org/olat/repository/manager/RepositoryEntryMyCourseQueriesTest.java +++ b/src/test/java/org/olat/repository/manager/RepositoryEntryMyCourseQueriesTest.java @@ -21,7 +21,7 @@ package org.olat.repository.manager; import java.util.List; -import org.jcodec.common.Assert; +import org.junit.Assert; import org.junit.Test; import org.olat.basesecurity.BaseSecurity; import org.olat.core.commons.persistence.DB; diff --git a/src/test/java/org/olat/selenium/BusinessGroupTest.java b/src/test/java/org/olat/selenium/BusinessGroupTest.java index e502f39e158..34c45b1d408 100644 --- a/src/test/java/org/olat/selenium/BusinessGroupTest.java +++ b/src/test/java/org/olat/selenium/BusinessGroupTest.java @@ -39,6 +39,7 @@ import org.olat.selenium.page.LoginPage; import org.olat.selenium.page.NavigationPage; import org.olat.selenium.page.Participant; import org.olat.selenium.page.group.GroupPage; +import org.olat.selenium.page.group.MembersWizardPage; import org.olat.selenium.page.user.UserToolsPage; import org.olat.test.ArquillianDeployments; import org.olat.test.rest.UserRestClient; @@ -105,11 +106,17 @@ public class BusinessGroupTest { .openGroups(browser) .createGroup(groupName, "A very little group"); - group + MembersWizardPage members = group .openAdministration() .openAdminMembers() .setVisibility(true, true) - .addMember(participant); + .addMember(); + + members.searchMember(participant) + .next() + .next() + .next() + .finish(); LoginPage participantLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl); //tools diff --git a/src/test/java/org/olat/selenium/CourseTest.java b/src/test/java/org/olat/selenium/CourseTest.java index 30176f37d3b..7cd1ac27505 100644 --- a/src/test/java/org/olat/selenium/CourseTest.java +++ b/src/test/java/org/olat/selenium/CourseTest.java @@ -22,6 +22,7 @@ package org.olat.selenium; import java.io.IOException; import java.net.URISyntaxException; import java.net.URL; +import java.util.List; import java.util.UUID; import junit.framework.Assert; @@ -40,8 +41,10 @@ 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.course.CourseWizardPage; import org.olat.selenium.page.course.PublisherPageFragment; import org.olat.selenium.page.course.PublisherPageFragment.Access; +import org.olat.selenium.page.graphene.OOGraphene; import org.olat.selenium.page.repository.AuthoringEnvPage; import org.olat.selenium.page.repository.FeedPage; import org.olat.selenium.page.repository.AuthoringEnvPage.ResourceType; @@ -143,6 +146,65 @@ public class CourseTest { .clickTree(); } + /** + * Create a course, use the course wizard, select all course + * elements and go further with the standard settings. + * + * Go from the description editor to the course, check + * that the course is automatically published and that + * the five course elements are there. + * + * @param loginPage + * @throws IOException + * @throws URISyntaxException + */ + @Test + @RunAsClient + public void createCourse_withWizard(@InitialPage LoginPage loginPage) + throws IOException, URISyntaxException { + UserVO author = new UserRestClient(deploymentUrl).createAuthor(); + loginPage.loginAs(author.getLogin(), author.getPassword()); + + //go to authoring + AuthoringEnvPage authoringEnv = navBar + .assertOnNavigationPage() + .openAuthoringEnvironment(); + + String title = "Create-Course-Wizard-" + UUID.randomUUID().toString(); + //create course + CourseWizardPage courseWizard = authoringEnv + .openCreateDropDown() + .clickCreate(ResourceType.course) + .fillCreateFormAndStartWizard(title); + + courseWizard + .selectAllCourseElements() + .next() + .next() + .finish(); + + RepositoryEditDescriptionPage editDescription = RepositoryEditDescriptionPage.getPage(browser); + //from description editor, back to details and launch the course + editDescription + .clickToolbarBack() + .assertOnTitle(title) + .launch(); + + //open course editor + CoursePageFragment course = CoursePageFragment.getCourse(browser); + course + .assertOnCoursePage(); + + //assert the 5 nodes are there and click them + By nodeBy = By.cssSelector("a.o_tree_link.o_tree_l1.o_tree_level_label_leaf"); + List<WebElement> nodes = browser.findElements(nodeBy); + Assert.assertEquals(5, nodes.size()); + for(WebElement node:nodes) { + node.click(); + OOGraphene.waitBusy(); + } + } + /** * Create a course, create a CP, go the the course editor, * create a course element of type CP, select the CP which just created, diff --git a/src/test/java/org/olat/selenium/page/LoginPage.java b/src/test/java/org/olat/selenium/page/LoginPage.java index a78ca4c155c..a3c3f87b23b 100644 --- a/src/test/java/org/olat/selenium/page/LoginPage.java +++ b/src/test/java/org/olat/selenium/page/LoginPage.java @@ -26,7 +26,7 @@ import java.util.List; import org.jboss.arquillian.drone.api.annotation.Drone; import org.jboss.arquillian.graphene.Graphene; import org.jboss.arquillian.graphene.page.Location; -import org.jcodec.common.Assert; +import org.junit.Assert; import org.olat.selenium.page.graphene.OOGraphene; import org.olat.user.restapi.UserVO; import org.openqa.selenium.By; diff --git a/src/test/java/org/olat/selenium/page/course/CourseEditorPageFragment.java b/src/test/java/org/olat/selenium/page/course/CourseEditorPageFragment.java index cc1306efaaa..939a46e3e30 100644 --- a/src/test/java/org/olat/selenium/page/course/CourseEditorPageFragment.java +++ b/src/test/java/org/olat/selenium/page/course/CourseEditorPageFragment.java @@ -24,7 +24,7 @@ import java.util.List; import org.jboss.arquillian.drone.api.annotation.Drone; import org.jboss.arquillian.graphene.Graphene; -import org.jcodec.common.Assert; +import org.junit.Assert; import org.olat.selenium.page.graphene.OOGraphene; import org.olat.selenium.page.portfolio.PortfolioPage; import org.olat.selenium.page.repository.AuthoringEnvPage; diff --git a/src/test/java/org/olat/selenium/page/course/CourseWizardPage.java b/src/test/java/org/olat/selenium/page/course/CourseWizardPage.java new file mode 100644 index 00000000000..f24a3316796 --- /dev/null +++ b/src/test/java/org/olat/selenium/page/course/CourseWizardPage.java @@ -0,0 +1,95 @@ +/** + * <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.page.course; + +import java.util.List; + +import org.jboss.arquillian.drone.api.annotation.Drone; +import org.jboss.arquillian.graphene.Graphene; +import org.junit.Assert; +import org.olat.selenium.page.graphene.OOGraphene; +import org.openqa.selenium.By; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; + +/** + * + * Drive the wizard to create a course. + * + * Initial date: 04.07.2014<br> + * @author srosse, stephane.rosse@frentix.com, http://www.frentix.com + * + */ +public class CourseWizardPage { + + public static final By nextBy = By.className("o_wizard_button_next"); + public static final By finishBy = By.className("o_wizard_button_finish"); + + @Drone + private WebDriver browser; + + public static CourseWizardPage getWizard(WebDriver browser) { + By modalBy = By.className("modal-content"); + WebElement modal = browser.findElement(modalBy); + return Graphene.createPageFragment(CourseWizardPage.class, modal); + } + + /** + * Next + * @return this + */ + public CourseWizardPage next() { + WebElement next = browser.findElement(nextBy); + Assert.assertTrue(next.isDisplayed()); + Assert.assertTrue(next.isEnabled()); + next.click(); + OOGraphene.waitBusy(); + OOGraphene.closeBlueMessageWindow(browser); + return this; + } + + /** + * Finish the wizard + * @return this + */ + public CourseWizardPage finish() { + WebElement finish = browser.findElement(finishBy); + Assert.assertTrue(finish.isDisplayed()); + Assert.assertTrue(finish.isEnabled()); + finish.click(); + OOGraphene.waitBusy(); + OOGraphene.closeBlueMessageWindow(browser); + return this; + } + + public CourseWizardPage selectAllCourseElements() { + By checkAllBy = By.cssSelector("div.modal div.form-group input[type='checkbox']"); + List<WebElement> checkAll = browser.findElements(checkAllBy); + Assert.assertFalse(checkAll.isEmpty()); + for(WebElement check:checkAll) { + check.click(); + } + + return this; + } + + + +} diff --git a/src/test/java/org/olat/selenium/page/course/PublisherPageFragment.java b/src/test/java/org/olat/selenium/page/course/PublisherPageFragment.java index 1715fa84280..4de61d16eac 100644 --- a/src/test/java/org/olat/selenium/page/course/PublisherPageFragment.java +++ b/src/test/java/org/olat/selenium/page/course/PublisherPageFragment.java @@ -20,7 +20,7 @@ package org.olat.selenium.page.course; import org.jboss.arquillian.drone.api.annotation.Drone; -import org.jcodec.common.Assert; +import org.junit.Assert; import org.olat.selenium.page.graphene.OOGraphene; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; diff --git a/src/test/java/org/olat/selenium/page/group/GroupPage.java b/src/test/java/org/olat/selenium/page/group/GroupPage.java index fa88f684173..9a4f1b39478 100644 --- a/src/test/java/org/olat/selenium/page/group/GroupPage.java +++ b/src/test/java/org/olat/selenium/page/group/GroupPage.java @@ -23,7 +23,6 @@ import java.util.List; import org.junit.Assert; import org.olat.selenium.page.graphene.OOGraphene; -import org.olat.user.restapi.UserVO; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; @@ -82,20 +81,12 @@ public class GroupPage { return this; } - public GroupPage addMember(UserVO user) { + public MembersWizardPage addMember() { By addMemberBy = By.className("o_sel_group_add_member"); WebElement addMemberButton = browser.findElement(addMemberBy); addMemberButton.click(); OOGraphene.waitBusy(); - - new MembersWizardPage(browser) - .searchMember(user) - .next() - .next() - .next() - .finish(); - - return this; + return new MembersWizardPage(browser); } private void openAdminTab(By marker) { diff --git a/src/test/java/org/olat/selenium/page/group/GroupsPage.java b/src/test/java/org/olat/selenium/page/group/GroupsPage.java index b365c506943..dab0c68747f 100644 --- a/src/test/java/org/olat/selenium/page/group/GroupsPage.java +++ b/src/test/java/org/olat/selenium/page/group/GroupsPage.java @@ -21,7 +21,7 @@ package org.olat.selenium.page.group; import java.util.List; -import org.jcodec.common.Assert; +import org.junit.Assert; import org.olat.selenium.page.graphene.OOGraphene; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; diff --git a/src/test/java/org/olat/selenium/page/portfolio/ArtefactWizardPage.java b/src/test/java/org/olat/selenium/page/portfolio/ArtefactWizardPage.java index 968bfb5ed8d..c8516f12af9 100644 --- a/src/test/java/org/olat/selenium/page/portfolio/ArtefactWizardPage.java +++ b/src/test/java/org/olat/selenium/page/portfolio/ArtefactWizardPage.java @@ -24,7 +24,7 @@ import java.util.List; import org.jboss.arquillian.drone.api.annotation.Drone; import org.jboss.arquillian.graphene.Graphene; -import org.jcodec.common.Assert; +import org.junit.Assert; import org.olat.selenium.page.graphene.OOGraphene; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; diff --git a/src/test/java/org/olat/selenium/page/repository/AuthoringEnvPage.java b/src/test/java/org/olat/selenium/page/repository/AuthoringEnvPage.java index 9bd92ab5f99..9732d4dcdf8 100644 --- a/src/test/java/org/olat/selenium/page/repository/AuthoringEnvPage.java +++ b/src/test/java/org/olat/selenium/page/repository/AuthoringEnvPage.java @@ -21,7 +21,8 @@ package org.olat.selenium.page.repository; import org.jboss.arquillian.drone.api.annotation.Drone; import org.jboss.arquillian.graphene.Graphene; -import org.jcodec.common.Assert; +import org.junit.Assert; +import org.olat.selenium.page.course.CourseWizardPage; import org.olat.selenium.page.graphene.OOGraphene; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; @@ -41,6 +42,7 @@ public class AuthoringEnvPage { public static final By createModal = By.cssSelector("div.modal.o_sel_author_create_popup"); public static final By displayNameInput = By.cssSelector("div.o_sel_author_displayname input"); public static final By createSubmit = By.className("o_sel_author_create_submit"); + public static final By createWizard = By.className("o_sel_author_create_wizard"); @Drone private WebDriver browser; @@ -97,7 +99,7 @@ public class AuthoringEnvPage { } /** - * Fil the create form + * Fill the create form and submit * @param displayName * @return */ @@ -113,6 +115,21 @@ public class AuthoringEnvPage { return Graphene.createPageFragment(RepositoryEditDescriptionPage.class, main); } + /** + * Fill the create form and start the wizard + * @param displayName + * @return + */ + public CourseWizardPage fillCreateFormAndStartWizard(String displayName) { + WebElement modal = browser.findElement(createModal); + WebElement input = modal.findElement(displayNameInput); + input.sendKeys(displayName); + modal.findElement(createWizard).click(); + OOGraphene.waitBusy(); + + return CourseWizardPage.getWizard(browser); + } + /** * Short cut to create quickly a course * @param title diff --git a/src/test/java/org/olat/selenium/page/repository/RepositoryDetailsPage.java b/src/test/java/org/olat/selenium/page/repository/RepositoryDetailsPage.java index 062977cd06f..c7eb8fb1b28 100644 --- a/src/test/java/org/olat/selenium/page/repository/RepositoryDetailsPage.java +++ b/src/test/java/org/olat/selenium/page/repository/RepositoryDetailsPage.java @@ -22,7 +22,7 @@ package org.olat.selenium.page.repository; import java.util.List; import org.jboss.arquillian.drone.api.annotation.Drone; -import org.jcodec.common.Assert; +import org.junit.Assert; import org.olat.selenium.page.graphene.OOGraphene; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; diff --git a/src/test/java/org/olat/selenium/page/repository/RepositoryEditDescriptionPage.java b/src/test/java/org/olat/selenium/page/repository/RepositoryEditDescriptionPage.java index 690131c4687..a82df4b56b8 100644 --- a/src/test/java/org/olat/selenium/page/repository/RepositoryEditDescriptionPage.java +++ b/src/test/java/org/olat/selenium/page/repository/RepositoryEditDescriptionPage.java @@ -21,7 +21,7 @@ package org.olat.selenium.page.repository; import org.jboss.arquillian.drone.api.annotation.Drone; import org.jboss.arquillian.graphene.Graphene; -import org.jcodec.common.Assert; +import org.junit.Assert; import org.olat.selenium.page.NavigationPage; import org.olat.selenium.page.graphene.OOGraphene; import org.openqa.selenium.By; @@ -48,6 +48,10 @@ public class RepositoryEditDescriptionPage { @FindBy(className = "o_sel_edit_repositoryentry") private WebElement generalTab; + public static RepositoryEditDescriptionPage getPage(WebDriver browser) { + WebElement main = browser.findElement(By.id("o_main")); + return Graphene.createPageFragment(RepositoryEditDescriptionPage.class, main); + } public RepositoryEditDescriptionPage assertOnGeneralTab() { Assert.assertTrue(generalTab.isDisplayed()); diff --git a/src/test/java/org/olat/selenium/page/user/UserSettingsPage.java b/src/test/java/org/olat/selenium/page/user/UserSettingsPage.java index 7a7a8a0344c..211ac71e645 100644 --- a/src/test/java/org/olat/selenium/page/user/UserSettingsPage.java +++ b/src/test/java/org/olat/selenium/page/user/UserSettingsPage.java @@ -21,7 +21,7 @@ package org.olat.selenium.page.user; import org.jboss.arquillian.drone.api.annotation.Drone; import org.jboss.arquillian.graphene.Graphene; -import org.jcodec.common.Assert; +import org.junit.Assert; import org.olat.selenium.page.graphene.OOGraphene; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; diff --git a/src/test/java/org/olat/selenium/page/user/UserToolsPage.java b/src/test/java/org/olat/selenium/page/user/UserToolsPage.java index d1dc77e9f42..d6f4682fbe1 100644 --- a/src/test/java/org/olat/selenium/page/user/UserToolsPage.java +++ b/src/test/java/org/olat/selenium/page/user/UserToolsPage.java @@ -22,7 +22,7 @@ package org.olat.selenium.page.user; import org.jboss.arquillian.drone.api.annotation.Drone; import org.jboss.arquillian.graphene.Graphene; import org.jboss.arquillian.graphene.page.Page; -import org.jcodec.common.Assert; +import org.junit.Assert; import org.olat.selenium.page.LoginPage; import org.olat.selenium.page.graphene.OOGraphene; import org.olat.selenium.page.portfolio.PortfolioPage; diff --git a/src/test/java/org/olat/selenium/page/wiki/WikiPage.java b/src/test/java/org/olat/selenium/page/wiki/WikiPage.java index 1fe6ebfed37..30c302fb3e4 100644 --- a/src/test/java/org/olat/selenium/page/wiki/WikiPage.java +++ b/src/test/java/org/olat/selenium/page/wiki/WikiPage.java @@ -21,7 +21,7 @@ package org.olat.selenium.page.wiki; import org.jboss.arquillian.drone.api.annotation.Drone; import org.jboss.arquillian.graphene.Graphene; -import org.jcodec.common.Assert; +import org.junit.Assert; import org.olat.selenium.page.graphene.OOGraphene; import org.olat.selenium.page.portfolio.ArtefactWizardPage; import org.openqa.selenium.By; -- GitLab