diff --git a/src/main/java/org/olat/course/nodes/survey/SurveyConfigController.java b/src/main/java/org/olat/course/nodes/survey/SurveyConfigController.java index 90b2ff566a867251ff2f755749b8618c101cf5d8..4f5ca16a4cbf66a96185e4df5aa337770be9edb4 100644 --- a/src/main/java/org/olat/course/nodes/survey/SurveyConfigController.java +++ b/src/main/java/org/olat/course/nodes/survey/SurveyConfigController.java @@ -135,6 +135,7 @@ public class SurveyConfigController extends FormBasicController { buttonsCont.setRootForm(mainForm); formLayout.add(buttonsCont); chooseLink = uifactory.addFormLink("edit.choose", buttonsCont, "btn btn-default o_xsmall"); + chooseLink.setElementCssClass("o_sel_survey_choose_repofile"); replaceLink = uifactory.addFormLink("edit.replace", buttonsCont, "btn btn-default o_xsmall"); editLink = uifactory.addFormLink("edit.edit", buttonsCont, "btn btn-default o_xsmall"); diff --git a/src/main/java/org/olat/modules/ceditor/ui/component/PageEditorComponentRenderer.java b/src/main/java/org/olat/modules/ceditor/ui/component/PageEditorComponentRenderer.java index 4aad022f38ee7b9a87b03129c436f523cb22e144..1abb7230621afd885ee9bbccc3d68f43f05059df 100644 --- a/src/main/java/org/olat/modules/ceditor/ui/component/PageEditorComponentRenderer.java +++ b/src/main/java/org/olat/modules/ceditor/ui/component/PageEditorComponentRenderer.java @@ -147,8 +147,7 @@ public class PageEditorComponentRenderer extends DefaultComponentRenderer { sb.append("</div>"); } - sb.append("<div class='o_page_others_above'>") - .append("<span class='o_page_type'><i class='o_icon $fragment.typeCssClass'> </i> $r.translate($fragment.type)</span>"); + sb.append("<div class='o_page_others_above'>"); Component saveLink = fragment.getSaveLink(); saveLink.getHTMLRendererSingleton().render(renderer, sb, saveLink, ubu, translator, renderResult, args); diff --git a/src/main/java/org/olat/modules/forms/ui/MultipleChoiceEditorController.java b/src/main/java/org/olat/modules/forms/ui/MultipleChoiceEditorController.java index 2456e82cf9fb27d1566ad0a70249a3df7fd5ba79..70bab83247c95d99eac6375c6057627969aec211 100644 --- a/src/main/java/org/olat/modules/forms/ui/MultipleChoiceEditorController.java +++ b/src/main/java/org/olat/modules/forms/ui/MultipleChoiceEditorController.java @@ -133,6 +133,7 @@ public class MultipleChoiceEditorController extends FormBasicController implemen loadModel(); addChoiceEl = uifactory.addFormLink("choice.add", settingsCont, Link.BUTTON); + addChoiceEl.setElementCssClass("o_sel_add_multiple_choice"); addChoiceEl.setIconLeftCSS("o_icon o_icon_add"); addChoiceEl.setVisible(!restrictedEdit); } @@ -155,7 +156,7 @@ public class MultipleChoiceEditorController extends FormBasicController implemen } // value - TextElement valueEl = uifactory.addTextElement("o_value_" + CodeHelper.getRAMUniqueID(), 255, null, flc); + TextElement valueEl = uifactory.addTextElement("o_value_" + CodeHelper.getRAMUniqueID(), null, 255, null, flc); valueEl.setValue(choice.getValue()); valueEl.addActionListener(FormEvent.ONCHANGE); diff --git a/src/main/java/org/olat/modules/forms/ui/SingleChoiceEditorController.java b/src/main/java/org/olat/modules/forms/ui/SingleChoiceEditorController.java index 564254b66ad7ec89ae4021073274720539275300..7ae3185d8993817fc7021a23a0823cb473450c63 100644 --- a/src/main/java/org/olat/modules/forms/ui/SingleChoiceEditorController.java +++ b/src/main/java/org/olat/modules/forms/ui/SingleChoiceEditorController.java @@ -134,6 +134,7 @@ public class SingleChoiceEditorController extends FormBasicController implements loadModel(); addChoiceEl = uifactory.addFormLink("choice.add", settingsCont, Link.BUTTON); + addChoiceEl.setElementCssClass("o_sel_add_single_choice"); addChoiceEl.setIconLeftCSS("o_icon o_icon_add"); addChoiceEl.setVisible(!restrictedEdit); } @@ -156,7 +157,7 @@ public class SingleChoiceEditorController extends FormBasicController implements } // value - TextElement valueEl = uifactory.addTextElement("o_value_" + CodeHelper.getRAMUniqueID(), 255, null, flc); + TextElement valueEl = uifactory.addTextElement("o_value_" + CodeHelper.getRAMUniqueID(), null, 255, null, flc); valueEl.setValue(choice.getValue()); valueEl.addActionListener(FormEvent.ONCHANGE); diff --git a/src/test/java/org/olat/course/nodes/gta/manager/GTATaskRevisionDAOTest.java b/src/test/java/org/olat/course/nodes/gta/manager/GTATaskRevisionDAOTest.java index cd4c1db9bf5d887a5ea5e190bd8bd0a984070f08..67485180064c1b5d4b4a99f935f39af06c879c31 100644 --- a/src/test/java/org/olat/course/nodes/gta/manager/GTATaskRevisionDAOTest.java +++ b/src/test/java/org/olat/course/nodes/gta/manager/GTATaskRevisionDAOTest.java @@ -1,3 +1,22 @@ +/** + * <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.nodes.gta.manager; import java.io.File; diff --git a/src/test/java/org/olat/selenium/CourseElementTest.java b/src/test/java/org/olat/selenium/CourseElementTest.java index f902503e84ebdbc48acd78804a45d77380c3dbe6..02f542a55d44d532a1d0b4410f8d355f5a788947 100644 --- a/src/test/java/org/olat/selenium/CourseElementTest.java +++ b/src/test/java/org/olat/selenium/CourseElementTest.java @@ -60,6 +60,8 @@ import org.olat.selenium.page.forum.ForumPage; import org.olat.selenium.page.graphene.OOGraphene; import org.olat.selenium.page.repository.AuthoringEnvPage; import org.olat.selenium.page.repository.AuthoringEnvPage.ResourceType; +import org.olat.selenium.page.survey.SurveyEditorPage; +import org.olat.selenium.page.survey.SurveyPage; import org.olat.selenium.page.repository.FeedPage; import org.olat.selenium.page.repository.RepositoryEditDescriptionPage; import org.olat.selenium.page.repository.ScormPage; @@ -1787,4 +1789,129 @@ public class CourseElementTest extends Deployments { singlePage .assertInFile("handInTopic1.pdf"); } + + + /** + * An author creates a survey with a multiple choice + * and a single choice. He uses it in a course. A + * participant of the course participates to the + * survey. + * + * @throws IOException + * @throws URISyntaxException + */ + @Test + public void survey(@Drone @User WebDriver userBrowser) + throws IOException, URISyntaxException { + UserVO author = new UserRestClient(deploymentUrl).createRandomAuthor(); + UserVO user = new UserRestClient(deploymentUrl).createRandomUser("Maximilien"); + LoginPage authorLoginPage = LoginPage.load(browser, deploymentUrl); + authorLoginPage.loginAs(author.getLogin(), author.getPassword()); + + //create a survey + String surveyTitle = "Survey-1-" + UUID.randomUUID(); + NavigationPage navBar = NavigationPage.load(browser); + navBar + .openAuthoringEnvironment() + .createSurvey(surveyTitle) + .assertOnInfos() + .clickToolbarBack(); + + SurveyPage survey = SurveyPage + .loadPage(browser); + SurveyEditorPage surveyEditor = survey + .edit(); + surveyEditor + .openElementsChooser() + .addTitle("My survey") + .setTitleSize(1) + .closeEditFragment() + .assertOnTitle("My survey", 1); + + surveyEditor + .openElementsChooser() + .addMultipleChoiceElement() + .addMultipleChoice("Jupiter", 2) + .addMultipleChoice("Saturn", 3) + .closeEditFragment(); + + surveyEditor + .openElementsChooser() + .addSingleChoiceElement() + .addSingleChoice("Mercury", 2) + .addSingleChoice("Venus", 3) + .closeEditFragment(); + + surveyEditor + .close(); + + //create a course + String courseTitle = "Course-With-Survey-" + UUID.randomUUID().toString(); + navBar + .openAuthoringEnvironment() + .createCourse(courseTitle) + .clickToolbarBack(); + + navBar.openCourse(courseTitle); + + String surveyNodeTitle = "SurveyNode-1"; + //create a course element of type CP with the CP that we create above + CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser) + .edit(); + courseEditor + .createNode("survey") + .nodeTitle(surveyNodeTitle) + .selectTabLearnContent() + .chooseSurvey(surveyTitle); + + //publish the course + courseEditor + .publish() + .quickPublish(UserAccess.membersOnly); + + MembersPage membersPage = courseEditor + .clickToolbarBack() + .members(); + + membersPage + .importMembers() + .setMembers(user) + .nextUsers() + .nextOverview() + .nextPermissions() + .finish(); + + //open the course and see the survey + CoursePageFragment course = courseEditor + .clickToolbarBack(); + course + .clickTree() + .selectWithTitle(surveyNodeTitle); + + LoginPage userLoginPage = LoginPage.load(userBrowser, deploymentUrl); + userLoginPage + .loginAs(user.getLogin(), user.getPassword()) + .resume(); + + //open the course + NavigationPage userNavBar = NavigationPage.load(userBrowser); + userNavBar + .openMyCourses() + .select(courseTitle); + + //go to the group task + CoursePageFragment userCourse = new CoursePageFragment(userBrowser); + userCourse + .clickTree() + .selectWithTitle(surveyNodeTitle); + + SurveyPage userSurvey = SurveyPage.loadPage(userBrowser) + .assertOnSurvey(); + + userSurvey + .answerMultipleChoice("Saturn") + //.answerSingleChoice("Venus") + .saveAndCloseSurvey() + .assertOnSurveyClosed(); + } } 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 3000d79605502c72dd924aac8ddbdca3d2241c50..92b098797fe2c68592261c55fc50feaa6b591a57 100644 --- a/src/test/java/org/olat/selenium/page/course/CourseEditorPageFragment.java +++ b/src/test/java/org/olat/selenium/page/course/CourseEditorPageFragment.java @@ -50,6 +50,7 @@ public class CourseEditorPageFragment { public static final By chooseFeedButton = By.className("o_sel_feed_choose_repofile"); public static final By chooseScormButton = By.className("o_sel_scorm_choose_repofile"); public static final By choosePortfolioButton = By.className("o_sel_map_choose_repofile"); + public static final By chooseSurveyButton = By.className("o_sel_survey_choose_repofile"); public static final By changeNodeToolsMenu = By.cssSelector("ul.o_sel_course_editor_change_node"); public static final By changeNodeToolsMenuCaret = By.cssSelector("a.o_sel_course_editor_change_node"); @@ -64,6 +65,7 @@ public class CourseEditorPageFragment { chooseRepoEntriesButtonList.add(chooseFeedButton); chooseRepoEntriesButtonList.add(chooseScormButton); chooseRepoEntriesButtonList.add(choosePortfolioButton); + chooseRepoEntriesButtonList.add(chooseSurveyButton); } private WebDriver browser; @@ -299,7 +301,7 @@ public class CourseEditorPageFragment { /** * Open the tools drop-down - * @return + * @return Itself */ public CourseEditorPageFragment openChangeNodeToolsMenu() { browser.findElement(changeNodeToolsMenuCaret).click(); @@ -311,7 +313,7 @@ public class CourseEditorPageFragment { * Loop the tabs of the course element configuration to find * the one with a button to select a repository entry. * - * @return + * @return Itself */ public CourseEditorPageFragment selectTabLearnContent() { OOGraphene.selectTab("o_node_config", (b) -> { @@ -328,8 +330,8 @@ public class CourseEditorPageFragment { /** * @see chooseResource - * @param resourceTitle - * @return + * @param resourceTitle The title of the CP + * @return Itself */ public CourseEditorPageFragment chooseCP(String resourceTitle) { return chooseResource(chooseCpButton, resourceTitle); @@ -337,8 +339,8 @@ public class CourseEditorPageFragment { /** * @see chooseResource - * @param resourceTitle - * @return + * @param resourceTitle The title of the wiki + * @return Itself */ public CourseEditorPageFragment chooseWiki(String resourceTitle) { return chooseResource(chooseWikiButton, resourceTitle); @@ -346,8 +348,17 @@ public class CourseEditorPageFragment { /** * @see chooseResource - * @param resourceTitle - * @return + * @param resourceTitle The title of the survey + * @return Itself + */ + public CourseEditorPageFragment chooseSurvey(String resourceTitle) { + return chooseResource(chooseSurveyButton, resourceTitle); + } + + /** + * @see chooseResource + * @param resourceTitle The title of the test + * @return Itself */ public CourseEditorPageFragment chooseTest(String resourceTitle) { return chooseResource(chooseTestButton, resourceTitle); @@ -355,8 +366,8 @@ public class CourseEditorPageFragment { /** * @see chooseResource - * @param resourceTitle - * @return + * @param resourceTitle The title of the SCORM + * @return Itself */ public CourseEditorPageFragment chooseScorm(String resourceTitle) { return chooseResource(chooseScormButton, resourceTitle); 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 b086df2277d99de350d40c520c362003403ad9f4..540c60900bf140bab40d4257b5e5e28461d41b4d 100644 --- a/src/test/java/org/olat/selenium/page/repository/AuthoringEnvPage.java +++ b/src/test/java/org/olat/selenium/page/repository/AuthoringEnvPage.java @@ -75,6 +75,12 @@ public class AuthoringEnvPage { .fillCreateForm(title); } + public RepositorySettingsPage createSurvey(String title) { + return openCreateDropDown() + .clickCreate(ResourceType.survey) + .fillCreateForm(title); + } + public CourseSettingsPage createCourse(String title) { openCreateDropDown() .clickCreate(ResourceType.course) @@ -239,7 +245,8 @@ public class AuthoringEnvPage { cp("FileResource.IMSCP"), wiki("FileResource.WIKI"), portfolio("BinderTemplate"), - qti21Test("FileResource.IMSQTI21"); + qti21Test("FileResource.IMSQTI21"), + survey("FileResource.FORM"); private final String type; diff --git a/src/test/java/org/olat/selenium/page/survey/SurveyEditorPage.java b/src/test/java/org/olat/selenium/page/survey/SurveyEditorPage.java new file mode 100644 index 0000000000000000000000000000000000000000..8ca6ab1f599603af647a6bd4b89d652310f123ef --- /dev/null +++ b/src/test/java/org/olat/selenium/page/survey/SurveyEditorPage.java @@ -0,0 +1,161 @@ +/** + * <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.survey; + +import org.olat.selenium.page.graphene.OOGraphene; +import org.openqa.selenium.By; +import org.openqa.selenium.WebDriver; + +/** + * + * Initial date: 27 nov. 2019<br> + * @author srosse, stephane.rosse@frentix.com, http://www.frentix.com + * + */ +public class SurveyEditorPage { + + protected final By editFragmentBy = By.cssSelector("div.o_page_fragment_edit"); + + private final WebDriver browser; + + public SurveyEditorPage(WebDriver browser) { + this.browser = browser; + } + + public SurveyEditorPage openElementsChooser() { + By addBy = By.cssSelector("a.btn.o_sel_add_element_main"); + OOGraphene.waitElement(addBy, browser); + browser.findElement(addBy).click(); + OOGraphene.waitBusy(browser); + By addCalloutBy = By.cssSelector("div.popover div.o_sel_add_element_callout"); + OOGraphene.waitElement(addCalloutBy, browser); + return this; + } + + public SurveyPage close() { + OOGraphene.scrollTop(browser); + OOGraphene.clickBreadcrumbBack(browser); + return new SurveyPage(browser); + } + + /** + * Close the fragment editor. + * + * @return Itself + */ + public SurveyEditorPage closeEditFragment() { + OOGraphene.waitingALittleLonger(); + By closeBy = By.cssSelector("div.o_page_others_above>a.o_sel_save_element>span"); + OOGraphene.waitElement(closeBy, browser); + browser.findElement(closeBy).click(); + OOGraphene.waitBusy(browser); + + By pageEditBy = By.cssSelector("div.o_page_part>div.o_page_fragment_edit>div.o_page_edit"); + OOGraphene.waitElementDisappears(pageEditBy, 5, browser); + OOGraphene.waitingALittleLonger(); + return this; + } + + public SurveyEditorPage addTitle(String title) { + By addTitleBy = By.cssSelector("a#o_coadd_el_formhtitle"); + browser.findElement(addTitleBy).click(); + OOGraphene.waitElement(editFragmentBy, browser); + OOGraphene.tinymce(title, ".o_page_part.o_page_edit", browser); + return this; + } + + /** + * Change the size of the title. + * + * @param size A value between 1 and 6 + * @return + */ + public SurveyEditorPage setTitleSize(int size) { + By titleSize = By.xpath("//div[contains(@class,'o_page_edit_toolbar')]//a[span[contains(text(),'h" + size + "')]]"); + browser.findElement(titleSize).click(); + OOGraphene.waitBusy(browser); + return this; + } + + /** + * Check that the title is on the page with the right size. + * + * @param title The title + * @param size Its size (between 1 and 6) + * @return Itself + */ + public SurveyEditorPage assertOnTitle(String title, int size) { + By titleBy = By.xpath("//div[contains(@class,'o_page_content_editor')]//h" + size + "[contains(text(),'" + title + "')]"); + OOGraphene.waitElement(titleBy, browser); + return this; + } + + public SurveyEditorPage addRubricElement() { + By addTitleBy = By.cssSelector("a#o_coadd_el_formrubric"); + browser.findElement(addTitleBy).click(); + OOGraphene.waitElement(editFragmentBy, browser); + return this; + } + + public SurveyEditorPage addSingleChoiceElement() { + By addTitleBy = By.cssSelector("a#o_coadd_el_formsinglechoice"); + browser.findElement(addTitleBy).click(); + OOGraphene.waitElement(editFragmentBy, browser); + return this; + } + + public SurveyEditorPage addSingleChoice(String choice, int pos) { + return addChoice(choice, pos, "o_sel_add_single_choice"); + } + + public SurveyEditorPage addMultipleChoiceElement() { + By addTitleBy = By.cssSelector("a#o_coadd_el_formmultiplechoice"); + browser.findElement(addTitleBy).click(); + OOGraphene.waitElement(editFragmentBy, browser); + return this; + } + + public SurveyEditorPage addMultipleChoice(String choice, int pos) { + return addChoice(choice, pos, "o_sel_add_multiple_choice"); + } + + private SurveyEditorPage addChoice(String choice, int pos, String buttonClass) { + By addButtonBy = By.xpath("//div[contains(@class,'o_evaluation_editor_form')]//a[contains(@class,'btn')][contains(@class,'" + buttonClass + "')]/span"); + OOGraphene.waitElement(addButtonBy, browser); + browser.findElement(addButtonBy).click(); + if(pos > 2) {// why oh why + OOGraphene.waitingALittleBit(); + browser.findElement(addButtonBy).click(); + } + OOGraphene.waitBusy(browser); + + By choiceBy = By.xpath("//div[contains(@class,'o_evaluation_editor_form')]//table[contains(@class,'table-condensed')]/tbody/tr[" + pos + "]/td/input[@type='text']"); + OOGraphene.waitElement(choiceBy, browser); + browser.findElement(choiceBy).clear(); + OOGraphene.waitBusy(browser); + browser.findElement(choiceBy).sendKeys(choice); + OOGraphene.waitBusy(browser); + + return this; + } + + + +} diff --git a/src/test/java/org/olat/selenium/page/survey/SurveyPage.java b/src/test/java/org/olat/selenium/page/survey/SurveyPage.java new file mode 100644 index 0000000000000000000000000000000000000000..08081a43640698986efd573858ba2c6d215b2472 --- /dev/null +++ b/src/test/java/org/olat/selenium/page/survey/SurveyPage.java @@ -0,0 +1,113 @@ +/** + * <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.survey; + +import org.olat.selenium.page.graphene.OOGraphene; +import org.openqa.selenium.By; +import org.openqa.selenium.WebDriver; + +/** + * + * Initial date: 27 nov. 2019<br> + * @author srosse, stephane.rosse@frentix.com, http://www.frentix.com + * + */ +public class SurveyPage { + + private final By toolsMenu = By.cssSelector("ul.o_sel_repository_tools"); + + private final WebDriver browser; + + public SurveyPage(WebDriver browser) { + this.browser = browser; + } + + public static SurveyPage loadPage(WebDriver browser) { + return new SurveyPage(browser) + .assertOnSurvey(); + } + + public SurveyPage assertOnSurvey() { + By pageBy = By.cssSelector("div.o_evaluation_execution.o_page_content"); + OOGraphene.waitElement(pageBy, browser); + return this; + } + + public SurveyEditorPage edit() { + if(!browser.findElement(toolsMenu).isDisplayed()) { + openToolsMenu(); + } + + By editBy = By.xpath("//ul[contains(@class,'o_sel_repository_tools')]//a[contains(@onclick,'edit.cmd')]"); + browser.findElement(editBy).click(); + OOGraphene.waitBusy(browser); + + By contentEditorBy = By.cssSelector("div.o_page_content_editor"); + OOGraphene.waitElementPresence(contentEditorBy, 5, browser); + return new SurveyEditorPage(browser); + } + + /** + * Click the editor link in the tools drop-down + * @return Itself + */ + public SurveyPage openToolsMenu() { + By toolsMenuCaret = By.cssSelector("a.o_sel_repository_tools"); + browser.findElement(toolsMenuCaret).click(); + OOGraphene.waitElement(toolsMenu, browser); + return this; + } + + public SurveyPage answerSingleChoice(String choice) { + By choiceBy = By.xpath("//div[contains(@class,'o_ed_formsinglechoice')]//label[text()[contains(.,'" + choice + "')]]/input[@type='radio']"); + OOGraphene.waitElement(choiceBy, browser); + browser.findElement(choiceBy).click(); + OOGraphene.waitBusy(browser); + return this; + } + + public SurveyPage answerMultipleChoice(String choice) { + By choiceBy = By.xpath("//div[contains(@class,'o_ed_formmultiplechoice')]//label[text()[contains(.,'" + choice + "')]]/input[@type='checkbox']"); + OOGraphene.waitElement(choiceBy, browser); + browser.findElement(choiceBy).click(); + OOGraphene.waitBusy(browser); + return this; + } + + public SurveyPage saveAndCloseSurvey() { + By saveBy = By.xpath("//div[contains(@class,'o_evaluation_form')]//button[contains(@class,'btn-primary')]"); + browser.findElement(saveBy).click(); + OOGraphene.waitBusy(browser); + + OOGraphene.waitModalDialog(browser); + By yesBy = By.xpath("//div[contains(@class,'modal-dialog')]//a[contains(@onclick,'link_0')]"); + browser.findElement(yesBy).click(); + OOGraphene.waitBusy(browser); + OOGraphene.waitModalDialogDisappears(browser); + return this; + } + + public SurveyPage assertOnSurveyClosed() { + By infoPanelBy = By.cssSelector(".o_surv_run #o_msg_info .panel-body>h4"); + OOGraphene.waitElement(infoPanelBy, browser); + return this; + } + +} diff --git a/src/test/resources/arquillian.xml b/src/test/resources/arquillian.xml index 650be96dfb0516720fe2b588354559b9844fe879..e0a73610f545446d425acf5c025431413d1096c6 100644 --- a/src/test/resources/arquillian.xml +++ b/src/test/resources/arquillian.xml @@ -25,7 +25,7 @@ <property name="dimensions">1024x800</property> <!-- <property name="downloadBinaries">no</property> - <property name="chromeDriverBinary">target/drone/3fc0e4a97cbf2c8c2a9b824d95e25351/chromedriver</property> + <property name="chromeDriverBinary">target/drone/12b3858a57bfe0a3d450cd194e0992aa/chromedriver</property> <property name="firefoxDriverBinary">target/drone/ce03addb1fc8c24900011f90fc80f3c1/geckodriver</property> --> <property name="firefoxUserPreferences">src/test/profile/firefox/prefs.js</property>