Skip to content
Snippets Groups Projects
Commit 958a3d9c authored by srosse's avatar srosse
Browse files

no-jira: first piece of a selenium test for survey

parent 883214cf
No related branches found
No related tags found
No related merge requests found
Showing
with 456 additions and 16 deletions
...@@ -135,6 +135,7 @@ public class SurveyConfigController extends FormBasicController { ...@@ -135,6 +135,7 @@ public class SurveyConfigController extends FormBasicController {
buttonsCont.setRootForm(mainForm); buttonsCont.setRootForm(mainForm);
formLayout.add(buttonsCont); formLayout.add(buttonsCont);
chooseLink = uifactory.addFormLink("edit.choose", buttonsCont, "btn btn-default o_xsmall"); 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"); replaceLink = uifactory.addFormLink("edit.replace", buttonsCont, "btn btn-default o_xsmall");
editLink = uifactory.addFormLink("edit.edit", buttonsCont, "btn btn-default o_xsmall"); editLink = uifactory.addFormLink("edit.edit", buttonsCont, "btn btn-default o_xsmall");
......
...@@ -147,8 +147,7 @@ public class PageEditorComponentRenderer extends DefaultComponentRenderer { ...@@ -147,8 +147,7 @@ public class PageEditorComponentRenderer extends DefaultComponentRenderer {
sb.append("</div>"); sb.append("</div>");
} }
sb.append("<div class='o_page_others_above'>") 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>");
Component saveLink = fragment.getSaveLink(); Component saveLink = fragment.getSaveLink();
saveLink.getHTMLRendererSingleton().render(renderer, sb, saveLink, ubu, translator, renderResult, args); saveLink.getHTMLRendererSingleton().render(renderer, sb, saveLink, ubu, translator, renderResult, args);
......
...@@ -133,6 +133,7 @@ public class MultipleChoiceEditorController extends FormBasicController implemen ...@@ -133,6 +133,7 @@ public class MultipleChoiceEditorController extends FormBasicController implemen
loadModel(); loadModel();
addChoiceEl = uifactory.addFormLink("choice.add", settingsCont, Link.BUTTON); addChoiceEl = uifactory.addFormLink("choice.add", settingsCont, Link.BUTTON);
addChoiceEl.setElementCssClass("o_sel_add_multiple_choice");
addChoiceEl.setIconLeftCSS("o_icon o_icon_add"); addChoiceEl.setIconLeftCSS("o_icon o_icon_add");
addChoiceEl.setVisible(!restrictedEdit); addChoiceEl.setVisible(!restrictedEdit);
} }
...@@ -155,7 +156,7 @@ public class MultipleChoiceEditorController extends FormBasicController implemen ...@@ -155,7 +156,7 @@ public class MultipleChoiceEditorController extends FormBasicController implemen
} }
// value // 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.setValue(choice.getValue());
valueEl.addActionListener(FormEvent.ONCHANGE); valueEl.addActionListener(FormEvent.ONCHANGE);
......
...@@ -134,6 +134,7 @@ public class SingleChoiceEditorController extends FormBasicController implements ...@@ -134,6 +134,7 @@ public class SingleChoiceEditorController extends FormBasicController implements
loadModel(); loadModel();
addChoiceEl = uifactory.addFormLink("choice.add", settingsCont, Link.BUTTON); addChoiceEl = uifactory.addFormLink("choice.add", settingsCont, Link.BUTTON);
addChoiceEl.setElementCssClass("o_sel_add_single_choice");
addChoiceEl.setIconLeftCSS("o_icon o_icon_add"); addChoiceEl.setIconLeftCSS("o_icon o_icon_add");
addChoiceEl.setVisible(!restrictedEdit); addChoiceEl.setVisible(!restrictedEdit);
} }
...@@ -156,7 +157,7 @@ public class SingleChoiceEditorController extends FormBasicController implements ...@@ -156,7 +157,7 @@ public class SingleChoiceEditorController extends FormBasicController implements
} }
// value // 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.setValue(choice.getValue());
valueEl.addActionListener(FormEvent.ONCHANGE); valueEl.addActionListener(FormEvent.ONCHANGE);
......
/**
* <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; package org.olat.course.nodes.gta.manager;
import java.io.File; import java.io.File;
......
...@@ -60,6 +60,8 @@ import org.olat.selenium.page.forum.ForumPage; ...@@ -60,6 +60,8 @@ import org.olat.selenium.page.forum.ForumPage;
import org.olat.selenium.page.graphene.OOGraphene; import org.olat.selenium.page.graphene.OOGraphene;
import org.olat.selenium.page.repository.AuthoringEnvPage; import org.olat.selenium.page.repository.AuthoringEnvPage;
import org.olat.selenium.page.repository.AuthoringEnvPage.ResourceType; 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.FeedPage;
import org.olat.selenium.page.repository.RepositoryEditDescriptionPage; import org.olat.selenium.page.repository.RepositoryEditDescriptionPage;
import org.olat.selenium.page.repository.ScormPage; import org.olat.selenium.page.repository.ScormPage;
...@@ -1787,4 +1789,129 @@ public class CourseElementTest extends Deployments { ...@@ -1787,4 +1789,129 @@ public class CourseElementTest extends Deployments {
singlePage singlePage
.assertInFile("handInTopic1.pdf"); .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();
}
} }
...@@ -50,6 +50,7 @@ public class CourseEditorPageFragment { ...@@ -50,6 +50,7 @@ public class CourseEditorPageFragment {
public static final By chooseFeedButton = By.className("o_sel_feed_choose_repofile"); 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 chooseScormButton = By.className("o_sel_scorm_choose_repofile");
public static final By choosePortfolioButton = By.className("o_sel_map_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 changeNodeToolsMenu = By.cssSelector("ul.o_sel_course_editor_change_node");
public static final By changeNodeToolsMenuCaret = By.cssSelector("a.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 { ...@@ -64,6 +65,7 @@ public class CourseEditorPageFragment {
chooseRepoEntriesButtonList.add(chooseFeedButton); chooseRepoEntriesButtonList.add(chooseFeedButton);
chooseRepoEntriesButtonList.add(chooseScormButton); chooseRepoEntriesButtonList.add(chooseScormButton);
chooseRepoEntriesButtonList.add(choosePortfolioButton); chooseRepoEntriesButtonList.add(choosePortfolioButton);
chooseRepoEntriesButtonList.add(chooseSurveyButton);
} }
private WebDriver browser; private WebDriver browser;
...@@ -299,7 +301,7 @@ public class CourseEditorPageFragment { ...@@ -299,7 +301,7 @@ public class CourseEditorPageFragment {
/** /**
* Open the tools drop-down * Open the tools drop-down
* @return * @return Itself
*/ */
public CourseEditorPageFragment openChangeNodeToolsMenu() { public CourseEditorPageFragment openChangeNodeToolsMenu() {
browser.findElement(changeNodeToolsMenuCaret).click(); browser.findElement(changeNodeToolsMenuCaret).click();
...@@ -311,7 +313,7 @@ public class CourseEditorPageFragment { ...@@ -311,7 +313,7 @@ public class CourseEditorPageFragment {
* Loop the tabs of the course element configuration to find * Loop the tabs of the course element configuration to find
* the one with a button to select a repository entry. * the one with a button to select a repository entry.
* *
* @return * @return Itself
*/ */
public CourseEditorPageFragment selectTabLearnContent() { public CourseEditorPageFragment selectTabLearnContent() {
OOGraphene.selectTab("o_node_config", (b) -> { OOGraphene.selectTab("o_node_config", (b) -> {
...@@ -328,8 +330,8 @@ public class CourseEditorPageFragment { ...@@ -328,8 +330,8 @@ public class CourseEditorPageFragment {
/** /**
* @see chooseResource * @see chooseResource
* @param resourceTitle * @param resourceTitle The title of the CP
* @return * @return Itself
*/ */
public CourseEditorPageFragment chooseCP(String resourceTitle) { public CourseEditorPageFragment chooseCP(String resourceTitle) {
return chooseResource(chooseCpButton, resourceTitle); return chooseResource(chooseCpButton, resourceTitle);
...@@ -337,8 +339,8 @@ public class CourseEditorPageFragment { ...@@ -337,8 +339,8 @@ public class CourseEditorPageFragment {
/** /**
* @see chooseResource * @see chooseResource
* @param resourceTitle * @param resourceTitle The title of the wiki
* @return * @return Itself
*/ */
public CourseEditorPageFragment chooseWiki(String resourceTitle) { public CourseEditorPageFragment chooseWiki(String resourceTitle) {
return chooseResource(chooseWikiButton, resourceTitle); return chooseResource(chooseWikiButton, resourceTitle);
...@@ -346,8 +348,17 @@ public class CourseEditorPageFragment { ...@@ -346,8 +348,17 @@ public class CourseEditorPageFragment {
/** /**
* @see chooseResource * @see chooseResource
* @param resourceTitle * @param resourceTitle The title of the survey
* @return * @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) { public CourseEditorPageFragment chooseTest(String resourceTitle) {
return chooseResource(chooseTestButton, resourceTitle); return chooseResource(chooseTestButton, resourceTitle);
...@@ -355,8 +366,8 @@ public class CourseEditorPageFragment { ...@@ -355,8 +366,8 @@ public class CourseEditorPageFragment {
/** /**
* @see chooseResource * @see chooseResource
* @param resourceTitle * @param resourceTitle The title of the SCORM
* @return * @return Itself
*/ */
public CourseEditorPageFragment chooseScorm(String resourceTitle) { public CourseEditorPageFragment chooseScorm(String resourceTitle) {
return chooseResource(chooseScormButton, resourceTitle); return chooseResource(chooseScormButton, resourceTitle);
......
...@@ -75,6 +75,12 @@ public class AuthoringEnvPage { ...@@ -75,6 +75,12 @@ public class AuthoringEnvPage {
.fillCreateForm(title); .fillCreateForm(title);
} }
public RepositorySettingsPage createSurvey(String title) {
return openCreateDropDown()
.clickCreate(ResourceType.survey)
.fillCreateForm(title);
}
public CourseSettingsPage createCourse(String title) { public CourseSettingsPage createCourse(String title) {
openCreateDropDown() openCreateDropDown()
.clickCreate(ResourceType.course) .clickCreate(ResourceType.course)
...@@ -239,7 +245,8 @@ public class AuthoringEnvPage { ...@@ -239,7 +245,8 @@ public class AuthoringEnvPage {
cp("FileResource.IMSCP"), cp("FileResource.IMSCP"),
wiki("FileResource.WIKI"), wiki("FileResource.WIKI"),
portfolio("BinderTemplate"), portfolio("BinderTemplate"),
qti21Test("FileResource.IMSQTI21"); qti21Test("FileResource.IMSQTI21"),
survey("FileResource.FORM");
private final String type; private final String type;
......
/**
* <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;
}
}
/**
* <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;
}
}
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
<property name="dimensions">1024x800</property> <property name="dimensions">1024x800</property>
<!-- <!--
<property name="downloadBinaries">no</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="firefoxDriverBinary">target/drone/ce03addb1fc8c24900011f90fc80f3c1/geckodriver</property>
--> -->
<property name="firefoxUserPreferences">src/test/profile/firefox/prefs.js</property> <property name="firefoxUserPreferences">src/test/profile/firefox/prefs.js</property>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment