Pollen-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
June 2012
- 5 participants
- 163 discussions
r3470 - in trunk/pollen-ui-struts2/src: main/webapp/WEB-INF/jsp/poll test/java/org/chorem/pollen/ui test/java/org/chorem/pollen/ui/its test/resources
by ymartel@users.chorem.org 13 Jun '12
by ymartel@users.chorem.org 13 Jun '12
13 Jun '12
Author: ymartel
Date: 2012-06-13 18:30:41 +0200 (Wed, 13 Jun 2012)
New Revision: 3470
Url: http://chorem.org/repositories/revision/pollen/3470
Log:
refs #606 : add tests for free text poll creation with no options
Added:
trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/its/CreateFreeTextPollSIT.java
Modified:
trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/createPoll_choices.jsp
trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/PollenFixtures.java
trunk/pollen-ui-struts2/src/test/resources/pollendb.h2.db
Modified: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/createPoll_choices.jsp
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/createPoll_choices.jsp 2012-06-13 15:59:38 UTC (rev 3469)
+++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/createPoll_choices.jsp 2012-06-13 16:30:41 UTC (rev 3470)
@@ -29,7 +29,7 @@
<s:radio key='poll.choiceType' list="choiceTypes" label=''
theme="simple" disabled="%{voteStarted}"/>
<hr/>
-<s:fielderror fieldName="poll.choices"/>
+<s:fielderror fieldName="poll.choices" id="poll_choices_error" />
<s:set id='deleteTitle'><s:text
name="pollen.action.pollChoiceDelete"/></s:set>
@@ -43,7 +43,7 @@
value="%{#choiceNumber}"/></s:set>
<div id='choicesTEXT_<s:property value="choiceNumber"/>'>
<s:hidden key='%{#prefix}.topiaId' value='%{#choice.topiaId}' label=''/>
- <sp:fielderror fieldName="%{#prefix}"/>
+ <sp:fielderror fieldName="%{#prefix}" id="%{#prefix}_error"/>
<div class="fleft choiceName">
<s:label for="%{#prefix}.name" id="choicesTEXT_label_%{#choiceNumber}"
theme="simple" value=''/>
@@ -97,7 +97,7 @@
<div id='choicesDATE_<s:property value="choiceNumber"/>'>
<s:hidden key='%{#prefix}.topiaId' id='%{#prefix}.topiaId'
value='%{#choice.topiaId}' label='' theme="simple"/>
- <sp:fielderror fieldName="%{#prefix}"/>
+ <sp:fielderror fieldName="%{#prefix}" id="%{#prefix}_error"/>
<div class="fleft choiceName">
<s:label for="%{#prefix}.name" id="choicesDATE_label_%{choiceNumber}"
theme="simple" value=''/>
@@ -152,7 +152,7 @@
value="%{#choiceNumber}"/></s:set>
<div id='choicesIMAGE_<s:property value="choiceNumber"/>'>
<s:hidden key='%{#prefix}.topiaId' value='%{#choice.topiaId}' label=''/>
- <sp:fielderror fieldName="%{#prefix}"/>
+ <sp:fielderror fieldName="%{#prefix}" id="%{#prefix}_error"/>
<div class="fleft choiceName">
<s:label for="%{#prefix}.name" id="choicesIMAGE_label_%{choiceNumber}"
theme="simple" value=''/>
Modified: trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/PollenFixtures.java
===================================================================
--- trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/PollenFixtures.java 2012-06-13 15:59:38 UTC (rev 3469)
+++ trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/PollenFixtures.java 2012-06-13 16:30:41 UTC (rev 3470)
@@ -142,4 +142,12 @@
public String poll_creator_requiredURL() {
return baseUrl() + "security/poll_creator_required";
}
+
+ public String createPollURL() {
+ return baseUrl() + "poll/create";
+ }
+
+ public String summaryURL() {
+ return baseUrl() + "poll/summary";
+ }
}
Added: trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/its/CreateFreeTextPollSIT.java
===================================================================
--- trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/its/CreateFreeTextPollSIT.java (rev 0)
+++ trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/its/CreateFreeTextPollSIT.java 2012-06-13 16:30:41 UTC (rev 3470)
@@ -0,0 +1,164 @@
+package org.chorem.pollen.ui.its;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+
+/**
+ * Test the well work of a Free text poll creation page.
+ *
+ * Tested cases :
+ * <ul>
+ * <li>Classic creation with filled mandatory fields (OK)</li>
+ * <li>Classic creation with no title (KO)</li>
+ * <li>Classic creation with no choice (KO)</li>
+ * <li>Classic creation with two same choices (KO)</li>
+ * <li>Classic creation with ending date before starting date (KO)</li>
+ * <li>Classic creation with ending date before now (KO)</li>
+ * <li>Classic creation with invalid email (KO)</li>
+ * <li>Classic creation with an authorized number of choice per vote < 1 (KO)</li>
+ * <li>Classic creation with choice adding ending date before starting date (KO)</li>
+ * <li>Classic creation with choice adding starting date after poll ending date (KO)</li>
+ * <li>Classic creation with choice adding ending date after poll ending date (KO)</li>
+ * </ul>
+ *
+ * @author ymartel <martel(a)codelutin.com>
+ *
+ * @since 1.4
+ */
+public class CreateFreeTextPollSIT extends PollenBaseWebDriverIT {
+
+ public CreateFreeTextPollSIT(Class<? extends WebDriver> driverType) {
+ super(driverType);
+ }
+
+ /**
+ * This test create a simple free text poll.
+ * At the end, should be on summary page.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void createSimpleFreeTextPoll() throws Exception {
+
+ // Go on home page
+ gotoUrl(fixtures.createPollURL());
+
+ // Set title
+ WebElement titleElement = driver.findElement(By.name("poll.title"));
+ Assert.assertEquals("input", titleElement.getTagName());
+ Assert.assertTrue(titleElement.isDisplayed());
+ titleElement.sendKeys("My Poll");
+
+ // Set first choice
+ WebElement choiceOneElement = driver.findElement(By.name("textChoice_0.name"));
+ Assert.assertEquals("input", choiceOneElement.getTagName());
+ Assert.assertTrue(choiceOneElement.isDisplayed());
+ choiceOneElement.sendKeys("Choix numero un");
+
+ // Set second choice
+ WebElement choiceTwoElement = driver.findElement(By.name("textChoice_1.name"));
+ Assert.assertEquals("input", choiceTwoElement.getTagName());
+ Assert.assertTrue(choiceTwoElement.isDisplayed());
+ choiceTwoElement.sendKeys("Choix numero deux");
+
+ // Submit form
+ WebElement submit = driver.findElement(By.name("action:save"));
+ submit.click();
+
+ // All good, should be on summary page !
+ String currentUrl = driver.getCurrentUrl();
+ Assert.assertTrue(currentUrl.startsWith(fixtures.summaryURL()));
+ }
+
+ /**
+ * This test create a simple free text poll without a title.
+ * When submit, an error text should be displayed : title is mandatory
+ *
+ * @throws Exception
+ */
+ @Test
+ public void createSimpleFreeTextPollWithoutTitle() throws Exception {
+
+ // Go on home page
+ gotoUrl(fixtures.createPollURL());
+
+ // Set first choice
+ WebElement choiceOneElement = driver.findElement(By.name("textChoice_0.name"));
+ Assert.assertEquals("input", choiceOneElement.getTagName());
+ Assert.assertTrue(choiceOneElement.isDisplayed());
+ String choiceOneValue = "Choix numero un";
+ choiceOneElement.sendKeys(choiceOneValue);
+
+ // Set second choice
+ WebElement choiceTwoElement = driver.findElement(By.name("textChoice_1.name"));
+ Assert.assertEquals("input", choiceTwoElement.getTagName());
+ Assert.assertTrue(choiceTwoElement.isDisplayed());
+ String choiceTwoValue = "Choix numero deux";
+ choiceTwoElement.sendKeys(choiceTwoValue);
+
+ // Submit form
+ WebElement submit = driver.findElement(By.name("action:save"));
+ submit.click();
+
+ // Title is missing, should stay on create poll page
+ Assert.assertTrue(driver.getCurrentUrl().startsWith(fixtures.createPollURL()));
+
+ // Check an error message has been displayed
+ WebElement titleError = driver.findElement(By.className("errorMessage"));
+ Assert.assertNotNull(titleError);
+
+ // Check that choice fields are not lost
+ choiceOneElement = driver.findElement(By.name("textChoice_0.name"));
+ Assert.assertEquals("input", choiceOneElement.getTagName());
+ Assert.assertTrue(choiceOneElement.isDisplayed());
+ Assert.assertEquals(choiceOneValue, choiceOneElement.getAttribute("value"));
+ choiceTwoElement = driver.findElement(By.name("textChoice_1.name"));
+ Assert.assertEquals("input", choiceTwoElement.getTagName());
+ Assert.assertTrue(choiceTwoElement.isDisplayed());
+ Assert.assertEquals(choiceTwoValue, choiceTwoElement.getAttribute("value"));
+
+ }
+
+ /**
+ * This test create a simple free text poll with no choice.
+ * When submit, an error text should be displayed : at least one choice must be given
+ *
+ * @throws Exception
+ */
+ @Test
+ public void createSimpleFreeTextPollWithoutChoice() throws Exception {
+
+ // Go on home page
+ gotoUrl(fixtures.createPollURL());
+
+ // Set title
+ WebElement titleElement = driver.findElement(By.name("poll.title"));
+ Assert.assertEquals("input", titleElement.getTagName());
+ Assert.assertTrue(titleElement.isDisplayed());
+ String pollTitle = "My Poll";
+ titleElement.sendKeys(pollTitle);
+
+ // Submit form
+ WebElement submit = driver.findElement(By.name("action:save"));
+ submit.click();
+
+ // No choices, should stay on create poll page
+ Assert.assertTrue(driver.getCurrentUrl().startsWith(fixtures.createPollURL()));
+
+ // Check that choice fields are not lost
+ titleElement = driver.findElement(By.name("poll.title"));
+ Assert.assertEquals("input", titleElement.getTagName());
+ Assert.assertTrue(titleElement.isDisplayed());
+ Assert.assertEquals(pollTitle, titleElement.getAttribute("value"));
+
+ // Check an error message has been displayed for choices
+ WebElement choicesError = driver.findElement(By.id("poll_choices_error"));
+ Assert.assertNotNull(choicesError);
+
+
+ }
+
+}
Modified: trunk/pollen-ui-struts2/src/test/resources/pollendb.h2.db
===================================================================
(Binary files differ)
1
0
r3469 - in trunk/pollen-ui-struts2/src/main: resources/i18n webapp/js
by tchemit@users.chorem.org 13 Jun '12
by tchemit@users.chorem.org 13 Jun '12
13 Jun '12
Author: tchemit
Date: 2012-06-13 17:59:38 +0200 (Wed, 13 Jun 2012)
New Revision: 3469
Url: http://chorem.org/repositories/revision/pollen/3469
Log:
readd lost options + disable all hidden input (pass from 126 fields to 65\!)
Modified:
trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties
trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties
trunk/pollen-ui-struts2/src/main/webapp/js/createPoll.js
Modified: trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties
===================================================================
--- trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-06-13 15:58:45 UTC (rev 3468)
+++ trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-06-13 15:59:38 UTC (rev 3469)
@@ -232,6 +232,8 @@
pollen.fieldset.userInformation.toCreate=User informations to create
pollen.fieldset.userInformation.toDelete=User informations to delete
pollen.fieldset.userInformation.toUpdate=User informations to update
+pollen.fieldset.vote.options=Votes
+pollen.fieldset.vote.options.help=Configure votes of the poll
pollen.image.not.loaded=Image not loaded
pollen.information.choice.deleted=Choice deleted.
pollen.information.comment.added=Comment added.
Modified: trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties
===================================================================
--- trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-06-13 15:58:45 UTC (rev 3468)
+++ trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-06-13 15:59:38 UTC (rev 3469)
@@ -232,6 +232,8 @@
pollen.fieldset.userInformation.toCreate=Informations de l'utilisateur à créer
pollen.fieldset.userInformation.toDelete=Informations de l'utilisateur à supprimer
pollen.fieldset.userInformation.toUpdate=Informations de l'utilisateur à mettre à jour
+pollen.fieldset.vote.options=Les votes
+pollen.fieldset.vote.options.help=Configurer les votes du sondage
pollen.image.not.loaded=Image non chargée
pollen.information.choice.deleted=Choix supprimé.
pollen.information.comment.added=Commentaire ajouté.
Modified: trunk/pollen-ui-struts2/src/main/webapp/js/createPoll.js
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/js/createPoll.js 2012-06-13 15:58:45 UTC (rev 3468)
+++ trunk/pollen-ui-struts2/src/main/webapp/js/createPoll.js 2012-06-13 15:59:38 UTC (rev 3469)
@@ -490,8 +490,8 @@
function switchChoices(containerId, choicePrefix, choiceNumber, newChoiceNumber) {
- console.info("will switch (" + choicePrefix + ") [" + choiceNumber
- + "] to [" + newChoiceNumber + "]");
+ //console.info("will switch (" + choicePrefix + ") [" + choiceNumber
+ // + "] to [" + newChoiceNumber + "]");
// change topiaId
switchValue(choicePrefix, choiceNumber, newChoiceNumber, '.topiaId');
@@ -517,7 +517,7 @@
var choiceTIVal = choiceTI.val();
var newChoiceTI = $('[name="' + choicePrefix + newChoiceNumber + suffix + '"]');
var newChoiceTIVal = newChoiceTI.val();
- console.info("switch " + choiceTIVal + " to " + newChoiceTIVal);
+ //console.info("switch " + choiceTIVal + " to " + newChoiceTIVal);
choiceTI.val(newChoiceTIVal);
newChoiceTI.val(choiceTIVal);
}
@@ -528,19 +528,19 @@
var choiceTIVal = choiceTI.attr("alt");
var newChoiceTIVal = newChoiceTI.attr("alt");
- console.info("switch " + choiceTIVal + " to " + newChoiceTIVal);
+ //console.info("switch " + choiceTIVal + " to " + newChoiceTIVal);
choiceTI.attr("alt", newChoiceTIVal);
newChoiceTI.attr("alt", choiceTIVal);
choiceTIVal = choiceTI.attr("title");
newChoiceTIVal = newChoiceTI.attr("title");
- console.info("switch " + choiceTIVal + " to " + newChoiceTIVal);
+ //console.info("switch " + choiceTIVal + " to " + newChoiceTIVal);
choiceTI.attr("title", newChoiceTIVal);
newChoiceTI.attr("title", choiceTIVal);
choiceTIVal = choiceTI.attr("src");
newChoiceTIVal = newChoiceTI.attr("src");
- console.info("switch " + choiceTIVal + " to " + newChoiceTIVal);
+ //console.info("switch " + choiceTIVal + " to " + newChoiceTIVal);
choiceTI.attr("src", newChoiceTIVal);
newChoiceTI.attr("src", choiceTIVal);
}
@@ -558,67 +558,59 @@
jQuery(document).ready(function () {
function changeChoiceAddAllowed(val) {
-// if (val) {
-// $('#addChoiceAddAllowedPanel').show();
-// } else {
-// $('#addChoiceAddAllowedPanel').hide();
-// }
$('[name="poll.beginChoiceDate"],[name="poll.endChoiceDate"]').attr(
'disabled', !val);
}
function changeLimitChoice(val) {
-// if (val) {
-// $('#maxChoiceNbPanel').show();
-// } else {
-// $('#maxChoiceNbPanel').hide();
-// }
$('[name="maxChoices"]').attr('disabled', !val);
}
function changeReminder(val) {
-// if (val) {
-// $('#reminderPanel').show();
-// } else {
-// $('#reminderPanel').hide();
-// }
$('[name="reminderHourCountdown"]').attr('disabled', !val);
}
function changePublicOption(val) {
-// if (val) {
-// $('#publicPanel').show();
-// } else {
-// $('#publicPanel').hide();
-// }
$('[name="poll.continuousResults"]').attr('disabled', !val);
}
function changeAnonymousOption(val) {
-// if (val) {
-// $('#anonymousPanel').show();
-// } else {
-// $('#anonymousPanel').hide();
-// }
- $('[name="poll.anonymousVoteAllowed"]').attr('disabled', !val);
+ $('[name="poll.anonymousVoteAllowed"]').attr('disabled', val);
}
+ function disableAll() {
+ $("#" + $(this).attr('id') + " :input").attr('disabled', true);
+ }
+
+ function undisableAll() {
+ $("#" + $(this).attr('id') + " :input").attr('disabled', false);
+ }
+
function changePollType(type) {
+ var container = $('#pollType' + type);
- $('.pollType').addClass('hidden');
- $('.pollType').removeClass('thispoll');
- $('#pollType' + type).removeClass('hidden');
- $('#pollType' + type).addClass('thispoll');
+ // traitement des autres containers de type
+ $('.pollType').not(container).
+ addClass('hidden').removeClass('thispoll').
+ each(disableAll);
+ // traitement du nouveau container de type
+ container.removeClass('hidden').addClass('thispoll').
+ each(undisableAll);
$('[name="poll.pollType"]').attr('checked', false);
$('[name="poll.pollType"][value="' + type + '"]').attr('checked', 'checked');
}
function changeChoiceType(type) {
- $('.choices').addClass('hidden');
- $('.choices').removeClass('thischoice');
- $('#choices' + type).removeClass('hidden');
- $('#choices' + type).addClass('thischoice');
+ var container = $('#choices' + type);
+ // traitement des autres containers de choix
+ $('.choices').not(container).
+ addClass('hidden').removeClass('thischoice').
+ each(disableAll);
+ // traitement du nouveau container de choix
+ container.removeClass('hidden').
+ addClass('thischoice').each(undisableAll);
+
$('[name="poll.choiceType"]').attr('checked', false);
$('[name="poll.choiceType"][value="' + type + '"]').attr('checked', 'checked');
}
@@ -630,6 +622,9 @@
$('[name="poll.publicResults"]').change(function () {
changePublicOption($(this).prop('checked'));
});
+ $('[name="poll.anonymous"]').change(function () {
+ changeAnonymousOption($(this).prop('checked'));
+ });
$('[name="limitChoice"]').change(function () {
changeLimitChoice($(this).prop('checked'));
@@ -639,15 +634,6 @@
changeReminder($(this).prop('checked'));
});
- $('[name="poll.anonymous"]').change(function () {
- var val = $(this).prop('checked');
- $('[name="poll.anonymousVoteAllowed"]').prop('checked', val);
- });
-// $('[name="poll.continuousResults"]').change(function () {
-// var val = $(this).prop('checked');
-// $('[name="poll.publicResults"]').prop('checked', val);
-// });
-
$('[name="poll.choiceType"]').change(function () {
changeChoiceType($(this).val());
});
1
0
r3468 - trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll
by tchemit@users.chorem.org 13 Jun '12
by tchemit@users.chorem.org 13 Jun '12
13 Jun '12
Author: tchemit
Date: 2012-06-13 17:58:45 +0200 (Wed, 13 Jun 2012)
New Revision: 3468
Url: http://chorem.org/repositories/revision/pollen/3468
Log:
readd lost options
Modified:
trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/create.jsp
Modified: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/create.jsp
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/create.jsp 2012-06-13 15:57:49 UTC (rev 3467)
+++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/create.jsp 2012-06-13 15:58:45 UTC (rev 3468)
@@ -198,6 +198,25 @@
<fieldset>
<legend>
+ <s:text name="pollen.fieldset.vote.options"/>
+ <img src="<s:url value='/img/tooltip.png'/>" class="tooltip"
+ title="<s:text name='pollen.fieldset.vote.options.help'/>"
+ alt="<s:text name='pollen.fieldset.vote.options.help'/>"/>
+ </legend>
+
+ <s:checkbox key="poll.anonymous"
+ label="%{getText('pollen.common.pollOption.anonymous')}"
+ disabled="%{voteStarted}"
+ tooltip="%{getText('pollen.common.pollOption.anonymous.help')}"
+ tooltipIconPath="/img/tooltip.png"/>
+ <s:checkbox key="poll.anonymousVoteAllowed"
+ label="%{getText('pollen.common.pollOption.anonymousVoteAllowed')}"
+ disabled="%{voteStarted}"
+ tooltip="%{getText('pollen.common.pollOption.anonymousVoteAllowed.help')}"
+ tooltipIconPath="/img/tooltip.png"/>
+ </fieldset>
+ <br/><fieldset>
+ <legend>
<s:text name="pollen.fieldset.result.options"/>
<img src="<s:url value='/img/tooltip.png'/>" class="tooltip"
title="<s:text name='pollen.fieldset.result.options.help'/>"
1
0
r3467 - trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll
by tchemit@users.chorem.org 13 Jun '12
by tchemit@users.chorem.org 13 Jun '12
13 Jun '12
Author: tchemit
Date: 2012-06-13 17:57:49 +0200 (Wed, 13 Jun 2012)
New Revision: 3467
Url: http://chorem.org/repositories/revision/pollen/3467
Log:
fixes #603: In Group poll, error with several group member
fixes #604: Cannot add an other group
Modified:
trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/SavePoll.java
Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/SavePoll.java
===================================================================
--- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/SavePoll.java 2012-06-13 14:38:19 UTC (rev 3466)
+++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/SavePoll.java 2012-06-13 15:57:49 UTC (rev 3467)
@@ -839,9 +839,8 @@
int votingListNumber = Integer.valueOf(matcher.group(2));
- votingListPrefix += "_" + votingListNumber;
buildVotingList(paramName,
- votingListPrefix,
+ votingListPrefix+ "_" + votingListNumber,
votingListNumber,
result
);
@@ -859,7 +858,6 @@
// add personToList maps to session (but just now, since votingList
// could have been reindex)
for (Map.Entry<Integer, VotingList> entry : result.entrySet()) {
-// Integer votingListNumber = entry.getKey();
VotingList votingList = entry.getValue();
if (!votingList.isPollAccountPersonToListEmpty()) {
1
0
13 Jun '12
Author: ymartel
Date: 2012-06-13 16:38:19 +0200 (Wed, 13 Jun 2012)
New Revision: 3466
Url: http://chorem.org/repositories/revision/pollen/3466
Log:
fix some i18n values
Modified:
trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties
Modified: trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties
===================================================================
--- trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-06-13 12:54:52 UTC (rev 3465)
+++ trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-06-13 14:38:19 UTC (rev 3466)
@@ -23,7 +23,7 @@
pollen.action.deletePoll=Delete the poll
pollen.action.deletePollAccount=Delete selected member
pollen.action.deleteUser=Delete selected user
-pollen.action.deleteVote=Supprimer ce vote
+pollen.action.deleteVote=Delete this vote
pollen.action.editFavoriteList=Edit a list
pollen.action.editPoll=Edit the poll
pollen.action.editPollAccount=Edit selected member
@@ -34,11 +34,11 @@
pollen.action.login=Log me In
pollen.action.modify=Modify
pollen.action.pollChoiceDelete=Delete this choice
-pollen.action.pollChoiceDown=Descendre ce choix
-pollen.action.pollChoiceUp=Monter ce choix
+pollen.action.pollChoiceDown=Down this choice
+pollen.action.pollChoiceUp=Up this choice
pollen.action.pollClone=Copy the poll to create a new one
pollen.action.pollClose=Close the poll
-pollen.action.pollCommentDelete=Supprimer le commentaire
+pollen.action.pollCommentDelete=Delete the comment
pollen.action.pollDelete=Delete the poll
pollen.action.pollEdit=Edit poll
pollen.action.pollExport=Export poll
@@ -47,8 +47,8 @@
pollen.action.pollResult=Display poll results
pollen.action.pollSummary=Poll summary
pollen.action.pollVote=Vote
-pollen.action.pollVotingListDelete=Supprimer le groupe de votants
-pollen.action.pollVotingListEdit=Editer ce groupe de votants
+pollen.action.pollVotingListDelete=Delete the voting list
+pollen.action.pollVotingListEdit=Edit that voting list
pollen.action.register=Register
pollen.action.send=Send
pollen.action.validate=Submit
1
0
r3465 - in trunk/pollen-ui-struts2/src: main/resources/i18n test/java/org/chorem/pollen/ui test/java/org/chorem/pollen/ui/its
by ymartel@users.chorem.org 13 Jun '12
by ymartel@users.chorem.org 13 Jun '12
13 Jun '12
Author: ymartel
Date: 2012-06-13 14:54:52 +0200 (Wed, 13 Jun 2012)
New Revision: 3465
Url: http://chorem.org/repositories/revision/pollen/3465
Log:
refs #606 : make only one simple package for ITs
Added:
trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/its/
trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/its/PollenBaseWebDriverIT.java
Removed:
trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/PollenBaseWebDriverIT.java
trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/WebDriverResource.java
trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/security/
Modified:
trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties
trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/its/LoginSIT.java
trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/its/SecurityAccessSIT.java
Modified: trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties
===================================================================
--- trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-06-13 12:32:09 UTC (rev 3464)
+++ trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-06-13 12:54:52 UTC (rev 3465)
@@ -209,9 +209,9 @@
pollen.error.vote.maxChoiceNb=Le nombre de choix maximal est de %d.
pollen.error.vote.percentage=La somme des valeurs doit être égale à 100.
pollen.fieldset.choice.options=Les choix
-pollen.fieldset.creator.options=Vous
pollen.fieldset.choice.options.help=Configurer les choix du sondage
pollen.fieldset.connexionInformation=Information de connexion
+pollen.fieldset.creator.options=Vous
pollen.fieldset.creator.options.help=Renseigner les informations sur le créateur du sondage
pollen.fieldset.login=Connexion
pollen.fieldset.notification.options=Notifications
Deleted: trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/PollenBaseWebDriverIT.java
===================================================================
--- trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/PollenBaseWebDriverIT.java 2012-06-13 12:32:09 UTC (rev 3464)
+++ trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/PollenBaseWebDriverIT.java 2012-06-13 12:54:52 UTC (rev 3465)
@@ -1,140 +0,0 @@
-/*
- * #%L
- * T3 :: Web
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2010 - 2011 IRD, Codelutin, Tony Chemit
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-package org.chorem.pollen.ui;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.openqa.selenium.By;
-import org.openqa.selenium.WebDriver;
-import org.openqa.selenium.WebElement;
-
-import java.util.Collection;
-import java.util.List;
-
-/**
- * Test base class for ui tests.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.4
- */
-@RunWith(value = Parameterized.class)
-public abstract class PollenBaseWebDriverIT {
-
- /** Logger. */
- protected final Log log = LogFactory.getLog(getClass());
-
- @Parameterized.Parameters
- public static Collection<Object[]> driverTypes() {
- return WebDriverResource.driverTypes();
- }
-
- @Rule
- public WebDriverResource seleniumServer;
-
- protected PollenFixtures fixtures ;
-
- protected WebDriver driver;
-
- @Before
- public void setUp() throws Exception {
- driver = seleniumServer.getDriver();
- fixtures = seleniumServer.getFixtures();
- }
-
- @AfterClass
- public static void afterClass() {
- WebDriverResource.afterClass();
-
- }
-
- protected PollenBaseWebDriverIT(Class<? extends WebDriver> driverType) {
- seleniumServer = new WebDriverResource(driverType);
- }
-
- protected void gotoUrl(String url, boolean strict) {
- gotoUrl(url, null, strict);
- }
-
- protected void gotoUrl(String url) {
- gotoUrl(url, null, true);
- }
-
- protected void gotoUrl(String url, String fallBackUrl) {
- gotoUrl(url, fallBackUrl, true);
- }
-
- protected void gotoUrl(String url, String fallBackUrl, boolean strict) {
- driver.get(url);
- String expectedUrl;
- if (fallBackUrl == null) {
- expectedUrl = url;
- } else {
- expectedUrl = fallBackUrl;
- }
-
- if (strict) {
- Assert.assertEquals(expectedUrl, driver.getCurrentUrl());
- } else {
- Assert.assertTrue(driver.getCurrentUrl().startsWith(expectedUrl));
- }
- }
-
- protected WebElement findElement(By by) {
- WebElement element = driver.findElement(by);
- return element;
- }
-
- protected List<WebElement> findElements(By by) {
- List<WebElement> result = driver.findElements(by);
- return result;
- }
-
- /** Try to log in using the given {@code username} and {@code password}. */
- protected void connect(String username, String password) {
-
- // click on tologin element (display the login form)
- WebElement loginClick = driver.findElement(By.id("tologin"));
- loginClick.click();
-
- // Find the text input element by its name
- WebElement loginElement = driver.findElement(By.name("login"));
- Assert.assertEquals("input", loginElement.getTagName());
- Assert.assertTrue(loginElement.isDisplayed());
- loginElement.sendKeys(username);
-
- WebElement passwordElement = driver.findElement(By.name("password"));
- Assert.assertTrue(passwordElement.isDisplayed());
- Assert.assertEquals("input", passwordElement.getTagName());
- passwordElement.sendKeys(password);
-
- WebElement submit = driver.findElement(By.name("action:login"));
- submit.click();
- }
-}
Deleted: trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/WebDriverResource.java
===================================================================
--- trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/WebDriverResource.java 2012-06-13 12:32:09 UTC (rev 3464)
+++ trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/WebDriverResource.java 2012-06-13 12:54:52 UTC (rev 3465)
@@ -1,184 +0,0 @@
-/*
- * #%L
- * T3 :: Web
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2010 - 2011 IRD, Codelutin, Tony Chemit
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-package org.chorem.pollen.ui;
-
-import com.google.common.collect.Lists;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.junit.rules.TestWatcher;
-import org.junit.runner.Description;
-import org.openqa.selenium.WebDriver;
-import org.openqa.selenium.chrome.ChromeDriver;
-import org.openqa.selenium.chrome.ChromeDriverService;
-import org.openqa.selenium.firefox.FirefoxDriver;
-import org.openqa.selenium.htmlunit.HtmlUnitDriver;
-import org.openqa.selenium.remote.DesiredCapabilities;
-import org.openqa.selenium.remote.RemoteWebDriver;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-
-/**
- * Web driver resource.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.4
- */
-public class WebDriverResource extends TestWatcher {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(WebDriverResource.class);
-
- private static ChromeDriverService service;
-
- protected static Collection<Object[]> safeDrivers;
-
- public static Collection<Object[]> driverTypes() {
- if (safeDrivers == null) {
-
- List<Class<? extends WebDriver>> allDrivers = Lists.newArrayList();
- allDrivers.add(HtmlUnitDriver.class);
- allDrivers.add(FirefoxDriver.class);
-// allDrivers.add(ChromeDriver.class);
-// allDrivers.add(InternetExplorerDriver.class);
-// allDrivers.add(SafariDriver.class);
-
- List<Class<?>> checkedDrivers = new ArrayList<Class<?>>();
- for (Class<? extends WebDriver> driver : allDrivers) {
- boolean ok = checkDriver(driver);
- if (ok) {
- checkedDrivers.add(driver);
- }
- }
- Object[][] data = new Object[checkedDrivers.size()][1];
- int i = 0;
- for (Class<?> checkedDriver : checkedDrivers) {
- data[i++][0] = checkedDriver;
- }
- safeDrivers = Arrays.asList(data);
- }
-
- return safeDrivers;
- }
-
- private static boolean checkDriver(Class<? extends WebDriver> driverType) {
-
- boolean result = false;
- try {
- createDriver(driverType, true);
- result = true;
- } catch (Exception e) {
-
- // can not use this driver
- if (log.isInfoEnabled()) {
- log.info("Can not use driver " + driverType.getName(), e);
- }
- }
-
- return result;
- }
-
- private final Class<? extends WebDriver> driverType;
-
- private final PollenFixtures fixtures;
-
- protected WebDriver driver;
-
- public WebDriverResource(Class<? extends WebDriver> driverType) {
- this.driverType = driverType;
- fixtures = new PollenFixtures();
- }
-
- public WebDriver getDriver() {
- return driver;
- }
-
- public PollenFixtures getFixtures() {
- return fixtures;
- }
-
- @Override
- protected void starting(Description description) {
- String testName = description.getClassName() + "#" + description.getMethodName() + " on [" + driverType.getName() + "]";
-
- if (log.isInfoEnabled()) {
- log.info("Start test " + testName);
- }
-
- try {
- driver = createDriver(driverType, false);
-
- } catch (Exception e) {
- throw new IllegalStateException("Could not begin test " + testName);
- }
- }
-
- @Override
- protected void finished(Description description) {
-
- // close current driver
- driver.quit();
- }
-
- public static void afterClass() {
-
- if (service != null) {
- service.stop();
- }
- }
-
- protected static WebDriver createDriver(Class<? extends WebDriver> driverType, boolean clear) throws Exception {
- WebDriver result;
-
- if (ChromeDriver.class == driverType) {
-
- service = new ChromeDriverService.Builder()
- .usingChromeDriverExecutable(new File("/usr/bin/chromium-browser"))
- .usingAnyFreePort()
- .build();
- service.start();
-
- result = new RemoteWebDriver(service.getUrl(), DesiredCapabilities.chrome());
-
- } else {
- result = driverType.getConstructor().newInstance();
- }
-
- if (clear) {
-
- if (result != null) {
- result.close();
- }
-
- if (service != null) {
- service.stop();
- }
-
- }
- return result;
- }
-}
Modified: trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/its/LoginSIT.java
===================================================================
--- trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/security/LoginSIT.java 2012-06-13 12:32:09 UTC (rev 3464)
+++ trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/its/LoginSIT.java 2012-06-13 12:54:52 UTC (rev 3465)
@@ -21,9 +21,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
-package org.chorem.pollen.ui.security;
+package org.chorem.pollen.ui.its;
-import org.chorem.pollen.ui.PollenBaseWebDriverIT;
import org.junit.Assert;
import org.junit.Test;
import org.openqa.selenium.By;
Copied: trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/its/PollenBaseWebDriverIT.java (from rev 3464, trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/PollenBaseWebDriverIT.java)
===================================================================
--- trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/its/PollenBaseWebDriverIT.java (rev 0)
+++ trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/its/PollenBaseWebDriverIT.java 2012-06-13 12:54:52 UTC (rev 3465)
@@ -0,0 +1,295 @@
+/*
+ * #%L
+ * T3 :: Web
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2010 - 2011 IRD, Codelutin, Tony Chemit
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package org.chorem.pollen.ui.its;
+
+import com.google.common.collect.Lists;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.pollen.ui.PollenFixtures;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.rules.TestWatcher;
+import org.junit.runner.Description;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.chrome.ChromeDriver;
+import org.openqa.selenium.chrome.ChromeDriverService;
+import org.openqa.selenium.firefox.FirefoxDriver;
+import org.openqa.selenium.htmlunit.HtmlUnitDriver;
+import org.openqa.selenium.remote.DesiredCapabilities;
+import org.openqa.selenium.remote.RemoteWebDriver;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * Test base class for ui tests.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @author ymartel <martel(a)codelutin.com>
+ * @since 1.4
+ */
+@RunWith(value = Parameterized.class)
+public abstract class PollenBaseWebDriverIT {
+
+ /** Logger. */
+ protected final Log log = LogFactory.getLog(getClass());
+
+ @Parameterized.Parameters
+ public static Collection<Object[]> driverTypes() {
+ return WebDriverResource.driverTypes();
+ }
+
+ @Rule
+ public WebDriverResource seleniumServer;
+
+ protected PollenFixtures fixtures ;
+
+ protected WebDriver driver;
+
+ @Before
+ public void setUp() throws Exception {
+ driver = seleniumServer.getDriver();
+ fixtures = seleniumServer.getFixtures();
+ }
+
+ @AfterClass
+ public static void afterClass() {
+ WebDriverResource.afterClass();
+
+ }
+
+ protected PollenBaseWebDriverIT(Class<? extends WebDriver> driverType) {
+ seleniumServer = new WebDriverResource(driverType);
+ }
+
+ protected void gotoUrl(String url, boolean strict) {
+ gotoUrl(url, null, strict);
+ }
+
+ protected void gotoUrl(String url) {
+ gotoUrl(url, null, true);
+ }
+
+ protected void gotoUrl(String url, String fallBackUrl) {
+ gotoUrl(url, fallBackUrl, true);
+ }
+
+ protected void gotoUrl(String url, String fallBackUrl, boolean strict) {
+ driver.get(url);
+ String expectedUrl;
+ if (fallBackUrl == null) {
+ expectedUrl = url;
+ } else {
+ expectedUrl = fallBackUrl;
+ }
+
+ if (strict) {
+ Assert.assertEquals(expectedUrl, driver.getCurrentUrl());
+ } else {
+ Assert.assertTrue(driver.getCurrentUrl().startsWith(expectedUrl));
+ }
+ }
+
+ protected WebElement findElement(By by) {
+ WebElement element = driver.findElement(by);
+ return element;
+ }
+
+ protected List<WebElement> findElements(By by) {
+ List<WebElement> result = driver.findElements(by);
+ return result;
+ }
+
+ /** Try to log in using the given {@code username} and {@code password}. */
+ protected void connect(String username, String password) {
+
+ // click on tologin element (display the login form)
+ WebElement loginClick = driver.findElement(By.id("tologin"));
+ loginClick.click();
+
+ // Find the text input element by its name
+ WebElement loginElement = driver.findElement(By.name("login"));
+ Assert.assertEquals("input", loginElement.getTagName());
+ Assert.assertTrue(loginElement.isDisplayed());
+ loginElement.sendKeys(username);
+
+ WebElement passwordElement = driver.findElement(By.name("password"));
+ Assert.assertTrue(passwordElement.isDisplayed());
+ Assert.assertEquals("input", passwordElement.getTagName());
+ passwordElement.sendKeys(password);
+
+ WebElement submit = driver.findElement(By.name("action:login"));
+ submit.click();
+ }
+
+ /**
+ * Web driver resource.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.4
+ */
+ public static class WebDriverResource extends TestWatcher {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(WebDriverResource.class);
+
+ private static ChromeDriverService service;
+
+ protected static Collection<Object[]> safeDrivers;
+
+ public static Collection<Object[]> driverTypes() {
+ if (safeDrivers == null) {
+
+ List<Class<? extends WebDriver>> allDrivers = Lists.newArrayList();
+ allDrivers.add(HtmlUnitDriver.class);
+ allDrivers.add(FirefoxDriver.class);
+ // allDrivers.add(ChromeDriver.class);
+ // allDrivers.add(InternetExplorerDriver.class);
+ // allDrivers.add(SafariDriver.class);
+
+ List<Class<?>> checkedDrivers = new ArrayList<Class<?>>();
+ for (Class<? extends WebDriver> driver : allDrivers) {
+ boolean ok = checkDriver(driver);
+ if (ok) {
+ checkedDrivers.add(driver);
+ }
+ }
+ Object[][] data = new Object[checkedDrivers.size()][1];
+ int i = 0;
+ for (Class<?> checkedDriver : checkedDrivers) {
+ data[i++][0] = checkedDriver;
+ }
+ safeDrivers = Arrays.asList(data);
+ }
+
+ return safeDrivers;
+ }
+
+ private static boolean checkDriver(Class<? extends WebDriver> driverType) {
+
+ boolean result = false;
+ try {
+ createDriver(driverType, true);
+ result = true;
+ } catch (Exception e) {
+
+ // can not use this driver
+ if (log.isInfoEnabled()) {
+ log.info("Can not use driver " + driverType.getName(), e);
+ }
+ }
+
+ return result;
+ }
+
+ private final Class<? extends WebDriver> driverType;
+
+ private final PollenFixtures fixtures;
+
+ protected WebDriver driver;
+
+ public WebDriverResource(Class<? extends WebDriver> driverType) {
+ this.driverType = driverType;
+ fixtures = new PollenFixtures();
+ }
+
+ public WebDriver getDriver() {
+ return driver;
+ }
+
+ public PollenFixtures getFixtures() {
+ return fixtures;
+ }
+
+ @Override
+ protected void starting(Description description) {
+ String testName = description.getClassName() + "#" + description.getMethodName() + " on [" + driverType.getName() + "]";
+
+ if (log.isInfoEnabled()) {
+ log.info("Start test " + testName);
+ }
+
+ try {
+ driver = createDriver(driverType, false);
+
+ } catch (Exception e) {
+ throw new IllegalStateException("Could not begin test " + testName);
+ }
+ }
+
+ @Override
+ protected void finished(Description description) {
+
+ // close current driver
+ driver.quit();
+ }
+
+ public static void afterClass() {
+
+ if (service != null) {
+ service.stop();
+ }
+ }
+
+ protected static WebDriver createDriver(Class<? extends WebDriver> driverType, boolean clear) throws Exception {
+ WebDriver result;
+
+ if (ChromeDriver.class == driverType) {
+
+ service = new ChromeDriverService.Builder()
+ .usingChromeDriverExecutable(new File("/usr/bin/chromium-browser"))
+ .usingAnyFreePort()
+ .build();
+ service.start();
+
+ result = new RemoteWebDriver(service.getUrl(), DesiredCapabilities.chrome());
+
+ } else {
+ result = driverType.getConstructor().newInstance();
+ }
+
+ if (clear) {
+
+ if (result != null) {
+ result.close();
+ }
+
+ if (service != null) {
+ service.stop();
+ }
+
+ }
+ return result;
+ }
+ }
+}
Property changes on: trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/its/PollenBaseWebDriverIT.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/its/SecurityAccessSIT.java
===================================================================
--- trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/security/SecurityAccessSIT.java 2012-06-13 12:32:09 UTC (rev 3464)
+++ trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/its/SecurityAccessSIT.java 2012-06-13 12:54:52 UTC (rev 3465)
@@ -20,10 +20,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
-package org.chorem.pollen.ui.security;
+package org.chorem.pollen.ui.its;
import org.chorem.pollen.bean.PollUri;
-import org.chorem.pollen.ui.PollenBaseWebDriverIT;
import org.junit.Test;
import org.openqa.selenium.WebDriver;
1
0
r3464 - in trunk/pollen-ui-struts2/src/main: java/org/chorem/pollen/ui/actions/poll resources/i18n webapp/WEB-INF/jsp/poll webapp/js
by tchemit@users.chorem.org 13 Jun '12
by tchemit@users.chorem.org 13 Jun '12
13 Jun '12
Author: tchemit
Date: 2012-06-13 14:32:09 +0200 (Wed, 13 Jun 2012)
New Revision: 3464
Url: http://chorem.org/repositories/revision/pollen/3464
Log:
fixes #610: Improve the interaction between continuous and public result options in poll form
fixes #611: Improve the interaction between anonymous and anonymousVoteAllowed options result in poll form
- improve poll form options layout
Modified:
trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/SavePoll.java
trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties
trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties
trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/create.jsp
trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp
trunk/pollen-ui-struts2/src/main/webapp/js/createPoll.js
Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/SavePoll.java
===================================================================
--- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/SavePoll.java 2012-06-13 10:23:07 UTC (rev 3463)
+++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/SavePoll.java 2012-06-13 12:32:09 UTC (rev 3464)
@@ -258,7 +258,7 @@
public String execute() throws Exception {
// Save choices and votingLists only if vote is not started
- if (!isVoteStarted()) {
+ if (!isVoteStarted()) {
//TODO-tchemit comment me 2012-06-04 A merge would be nicer but more complex to code
// Clear previous collections to save those from the form
poll.clearChoice();
@@ -284,8 +284,20 @@
} else {
// reset value
poll.setMaxChoiceNb(0);
+ }
+ if (!poll.isPublicResults()) {
+
+ // force to not have continous results
+ poll.setContinuousResults(false);
}
+
+ if (poll.isAnonymous()) {
+
+ // force to not have choice to vote anonymously
+ poll.setAnonymousVoteAllowed(false);
+ }
+
//TODO-tchemit comment me 2012-06-04 A merge would be nicer but more complex to code
poll.clearPreventRule();
Modified: trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties
===================================================================
--- trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-06-13 10:23:07 UTC (rev 3463)
+++ trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-06-13 12:32:09 UTC (rev 3464)
@@ -80,7 +80,7 @@
pollen.common.displayType-normal=Results
pollen.common.editAction=Edit
pollen.common.email=Em@il
-pollen.common.endChoiceDate=end choice date
+pollen.common.endChoiceDate=End choice date
pollen.common.endDate=End date
pollen.common.favoriteList.csvImport.help=The file to upload is a text file that contains one row per participant.<br/><br/>The first line must be <strong>votingId,email</strong>, then each next ones will define the participant's name and his email separated by a comma.<br/><br/>Here is an example \:<br/>
pollen.common.firstName=First name
@@ -139,6 +139,7 @@
pollen.common.vote.return=Back to poll
pollen.common.vote.return-help=Back to poll
pollen.common.voteAction=Vote
+pollen.common.voteAnonymous=Anonymous vote
pollen.common.voteCountingType=Response type
pollen.common.voteCountingType.help=Normal\: selecting 1 to n choices among available choices <br/><br/> Percentage\: allocating a percentage to each choice <br/><br/> Condorcet\: ranking choices in order of preference <br/><br/> Number \: Free response. Summed and the average numbers.
pollen.common.voteCountingTypeHelp.condorcet=Condorcet vote\: rank choices by preference order from 1 to N (1\=favorite). Only the rank is taken into account, not the values. Two choices can have the same value.
@@ -207,15 +208,24 @@
pollen.error.userNotAllowed=You are not allowed to count the votes for this poll.
pollen.error.vote.maxChoiceNb=The maximal number of choices is %d.
pollen.error.vote.percentage=The sum of the values must be equals to 100.
+pollen.fieldset.choice.options=Choices
+pollen.fieldset.choice.options.help=Configure choices of the poll
pollen.fieldset.connexionInformation=Connexion informations
+pollen.fieldset.creator.options=You
+pollen.fieldset.creator.options.help=To fill some informations about the creator of this poll
pollen.fieldset.login=Login
+pollen.fieldset.notification.options=Notifications
+pollen.fieldset.notification.options.help=Configure notifications of this poll
pollen.fieldset.poll.choices=Choices
pollen.fieldset.poll.general=Your poll
pollen.fieldset.poll.options=Options
-pollen.fieldset.poll.you=You
pollen.fieldset.pollAccount.toAddToFavoriteList=Add a new member
pollen.fieldset.pollAccount.toDeleteFromFavoriteList=Remove a member
pollen.fieldset.pollAccount.toEditToFavoriteList=Edit member
+pollen.fieldset.pollDate.options=Date validity of the poll
+pollen.fieldset.pollDate.options.help=Configure when vote is authorized
+pollen.fieldset.result.options=Results
+pollen.fieldset.result.options.help=Configure results of the poll
pollen.fieldset.userFavoriteList.toCreate=Create a new list
pollen.fieldset.userFavoriteList.toDelete=List de favoris à supprimer
pollen.fieldset.userInformation=User information
@@ -315,4 +325,3 @@
pollen.title.usersList=Users administration
pollen.warning.poll.is.closed.so.read.only=Poll is closed, you can not modifiy it anymore.
title=Create a poll
-vote.anonymous=Anonymous vote
Modified: trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties
===================================================================
--- trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-06-13 10:23:07 UTC (rev 3463)
+++ trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-06-13 12:32:09 UTC (rev 3464)
@@ -139,6 +139,7 @@
pollen.common.vote.return=Retour au sondage
pollen.common.vote.return-help=Retour au sondage
pollen.common.voteAction=Vote
+pollen.common.voteAnonymous=Vote anonyme
pollen.common.voteCountingType=Type de Réponse
pollen.common.voteCountingType.help=Normal \: sélection de 1 ou n choix parmis les choix possibles <br/><br/> Pourcentage \: attribution d'un pourcentage à chaque choix <br/><br/> Condorcet \: classement des choix par ordre de préférence <br/><br/> Nombre \: Réponse libre. Fait la somme et la moyenne des nombres
pollen.common.voteCountingTypeHelp.condorcet=Vote Condorcet \: classer les choix par ordre de préférence de 1 à N (1\=préféré). Seul l'ordre des choix compte, peu importe les valeurs. Deux choix peuvent avoir la même valeur.
@@ -207,15 +208,24 @@
pollen.error.userNotAllowed=Vous n'êtes pas autorisé à dépouiller ce sondage.
pollen.error.vote.maxChoiceNb=Le nombre de choix maximal est de %d.
pollen.error.vote.percentage=La somme des valeurs doit être égale à 100.
+pollen.fieldset.choice.options=Les choix
+pollen.fieldset.creator.options=Vous
+pollen.fieldset.choice.options.help=Configurer les choix du sondage
pollen.fieldset.connexionInformation=Information de connexion
+pollen.fieldset.creator.options.help=Renseigner les informations sur le créateur du sondage
pollen.fieldset.login=Connexion
+pollen.fieldset.notification.options=Notifications
+pollen.fieldset.notification.options.help=Configurer les notifications du sondage
pollen.fieldset.poll.choices=Les choix
pollen.fieldset.poll.general=Votre sondage
pollen.fieldset.poll.options=Les options
-pollen.fieldset.poll.you=Vous
pollen.fieldset.pollAccount.toAddToFavoriteList=Ajouter un membre
pollen.fieldset.pollAccount.toDeleteFromFavoriteList=Supprimer un membre
pollen.fieldset.pollAccount.toEditToFavoriteList=Editer le membre
+pollen.fieldset.pollDate.options=Plage de validité
+pollen.fieldset.pollDate.options.help=Configurer la plage de validité du sondage
+pollen.fieldset.result.options=Les résultats
+pollen.fieldset.result.options.help=Pour configurer les résultats du sondage
pollen.fieldset.userFavoriteList.toCreate=Créer une nouvelle liste
pollen.fieldset.userFavoriteList.toDelete=List de favoris à supprimer
pollen.fieldset.userInformation=Informations de l'utilisateur
@@ -315,4 +325,3 @@
pollen.title.usersList=Gestion des utilisateurs
pollen.warning.poll.is.closed.so.read.only=Le sondage est clos, vous ne pouvez plus le modifer
title=Création d'un sondage
-vote.anonymous=Vote anonyme
Modified: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/create.jsp
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/create.jsp 2012-06-13 10:23:07 UTC (rev 3463)
+++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/create.jsp 2012-06-13 12:32:09 UTC (rev 3464)
@@ -52,6 +52,8 @@
choiceAddAllowed:'<s:property value="%{poll.choiceAddAllowed}"/>',
limitChoice:'<s:property value="%{limitChoice}"/>',
reminder:'<s:property value="%{reminder}"/>',
+ publicOption:'<s:property value="%{poll.publicResults}"/>',
+ anonymousOption:'<s:property value="%{poll.anonymous}"/>',
voteCountingType:'<s:property value="%{poll.voteCountingType.name()}"/>',
choiceType:'<s:property value="%{poll.choiceType.name()}"/>',
pollType:'<s:property value="%{poll.pollType.name()}"/>',
@@ -119,7 +121,12 @@
<div id="toptions">
<fieldset>
- <legend><s:text name="pollen.fieldset.poll.you"/></legend>
+ <legend>
+ <s:text name="pollen.fieldset.creator.options"/>
+ <img src="<s:url value='/img/tooltip.png'/>" class="tooltip"
+ title="<s:text name='pollen.fieldset.creator.options.help'/>"
+ alt="<s:text name='pollen.fieldset.creator.options.help'/>"/>
+ </legend>
<s:textfield key="poll.creator.votingId" size="80"
label="%{getText('pollen.common.login')}"/>
<s:textfield key="poll.creator.email" size="80"
@@ -130,36 +137,41 @@
<s:hidden name="userId" value="%{poll.creator.userAccount.topiaId}"/>
</s:if>
</fieldset>
+ <br/>
+ <fieldset>
+ <legend>
+ <s:text name="pollen.fieldset.pollDate.options"/>
+ <img src="<s:url value='/img/tooltip.png'/>" class="tooltip"
+ title="<s:text name='pollen.fieldset.pollDate.options.help'/>"
+ alt="<s:text name='pollen.fieldset.pollDate.options.help'/>"/>
+ </legend>
+
+ <sj:datepicker key="poll.beginDate"
+ displayFormat="%{getText('pollen.common.datePickerPattern')}"
+ label="%{getText('pollen.common.beginDate')}"
+ timepicker="true"
+ disabled="%{voteStarted}"/>
+ <sj:datepicker key="poll.endDate"
+ displayFormat="%{getText('pollen.common.datePickerPattern')}"
+ timepicker="true"
+ label="%{getText('pollen.common.endDate')}"/>
+ </fieldset>
<br/>
<fieldset>
- <legend><s:text name="pollen.fieldset.poll.options"/></legend>
-
- <s:checkbox key="poll.anonymous"
- label="%{getText('pollen.common.pollOption.anonymous')}"
- disabled="%{voteStarted}"
- tooltip="%{getText('pollen.common.pollOption.anonymous.help')}"
- tooltipIconPath="/img/tooltip.png"/>
- <s:checkbox key="poll.anonymousVoteAllowed"
- label="%{getText('pollen.common.pollOption.anonymousVoteAllowed')}"
- disabled="%{voteStarted}"
- tooltip="%{getText('pollen.common.pollOption.anonymousVoteAllowed.help')}"
- tooltipIconPath="/img/tooltip.png"/>
- <s:checkbox key="poll.continuousResults"
- label="%{getText('pollen.common.pollOption.continuousResults')}"
- tooltip="%{getText('pollen.common.pollOption.continuousResults.help')}"
- tooltipIconPath="/img/tooltip.png"/>
- <s:checkbox key="poll.publicResults"
- label="%{getText('pollen.common.pollOption.publicResults')}"
- tooltip="%{getText('pollen.common.pollOption.publicResults.help')}"
- tooltipIconPath="/img/tooltip.png"/>
+ <legend>
+ <s:text name="pollen.fieldset.choice.options"/>
+ <img src="<s:url value='/img/tooltip.png'/>" class="tooltip"
+ title="<s:text name='pollen.fieldset.choice.options.help'/>"
+ alt="<s:text name='pollen.fieldset.choice.options.help'/>"/>
+ </legend>
<s:checkbox key="poll.choiceAddAllowed"
label="%{getText('pollen.common.pollOption.choiceAddAllowed')}"
disabled="%{voteStarted}"
tooltip="%{getText('pollen.common.pollOption.choiceAddAllowed.help')}"
tooltipIconPath="/img/tooltip.png"/>
- <div id='addChoiceAddAllowedPanel' class="hidden">
+ <%--<div id='addChoiceAddAllowedPanel' class="hidden">--%>
<sj:datepicker key="poll.beginChoiceDate"
label="%{getText('pollen.common.beginChoiceDate')}"
displayFormat="%{getText('pollen.common.datePickerPattern')}"
@@ -170,17 +182,48 @@
displayFormat="%{getText('pollen.common.datePickerPattern')}"
timepicker="true"
disabled="%{voteStarted}"/>
- </div>
+ <%--</div>--%>
<s:checkbox key="limitChoice"
label="%{getText('pollen.common.pollOption.limitChoice')}"
disabled="%{voteStarted}"
tooltip="%{getText('pollen.common.pollOption.limitChoice.help')}"
tooltipIconPath="/img/tooltip.png"/>
- <div id='maxChoiceNbPanel' class="hidden">
+ <%--<div id='maxChoiceNbPanel' class="hidden">--%>
<s:textfield key="maxChoices"
label="%{getText('pollen.common.pollOption.maxChoiceNb')}"
disabled="%{voteStarted}"/>
- </div>
+ <%--</div>--%>
+ </fieldset>
+ <br/>
+
+ <fieldset>
+ <legend>
+ <s:text name="pollen.fieldset.result.options"/>
+ <img src="<s:url value='/img/tooltip.png'/>" class="tooltip"
+ title="<s:text name='pollen.fieldset.result.options.help'/>"
+ alt="<s:text name='pollen.fieldset.result.options.help'/>"/>
+ </legend>
+
+ <s:checkbox key="poll.publicResults"
+ label="%{getText('pollen.common.pollOption.publicResults')}"
+ tooltip="%{getText('pollen.common.pollOption.publicResults.help')}"
+ tooltipIconPath="/img/tooltip.png"/>
+ <%--<div id='publicPanel' class="hidden">--%>
+ <s:checkbox key="poll.continuousResults"
+ label="%{getText('pollen.common.pollOption.continuousResults')}"
+ tooltip="%{getText('pollen.common.pollOption.continuousResults.help')}"
+ tooltipIconPath="/img/tooltip.png"/>
+ <%--</div>--%>
+ </fieldset>
+ <br/>
+
+ <fieldset>
+ <legend>
+ <s:text name="pollen.fieldset.notification.options"/>
+ <img src="<s:url value='/img/tooltip.png'/>" class="tooltip"
+ title="<s:text name='pollen.fieldset.notification.options.help'/>"
+ alt="<s:text name='pollen.fieldset.notification.options.help'/>"/>
+ </legend>
<s:checkbox key="notification"
label="%{getText('pollen.common.pollOption.notification')}"
tooltip="%{getText('pollen.common.pollOption.notification.help')}"
@@ -189,29 +232,13 @@
label="%{getText('pollen.common.pollOption.reminder')}"
tooltip="%{getText('pollen.common.pollOption.reminder.help')}"
tooltipIconPath="/img/tooltip.png"/>
- <div id='reminderPanel' class="hidden">
+ <%--<div id='reminderPanel' class="hidden">--%>
<s:textfield key="reminderHourCountdown"
label="%{getText('pollen.common.pollOption.reminderHourCountdown')}"/>
- </div>
+ <%--</div>--%>
</fieldset>
-
<br/>
- <fieldset>
- <legend><s:text name="pollen.fieldset.poll.general"/></legend>
- <sj:datepicker key="poll.beginDate"
- displayFormat="%{getText('pollen.common.datePickerPattern')}"
- label="%{getText('pollen.common.beginDate')}"
- timepicker="true"
- disabled="%{voteStarted}"/>
- <sj:datepicker key="poll.endDate"
- displayFormat="%{getText('pollen.common.datePickerPattern')}"
- timepicker="true"
- label="%{getText('pollen.common.endDate')}"/>
- </fieldset>
-
- <br/>
-
<fieldset>
<legend>
<s:text name="pollen.common.pollType"/>
Modified: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp 2012-06-13 10:23:07 UTC (rev 3463)
+++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp 2012-06-13 12:32:09 UTC (rev 3464)
@@ -418,7 +418,7 @@
<s:if test="voteAllowed">
<div id="buttons">
<s:if test="poll.anonymousVoteAllowed">
- <s:checkbox key="vote.anonymous"/>
+ <s:checkbox key="vote.anonymous" label='%{getText("pollen.common.voteAnonymous")}'/>
<br/>
</s:if>
<s:submit action="vote/%{uriId}" key="pollen.action.pollVote"
Modified: trunk/pollen-ui-struts2/src/main/webapp/js/createPoll.js
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/js/createPoll.js 2012-06-13 10:23:07 UTC (rev 3463)
+++ trunk/pollen-ui-struts2/src/main/webapp/js/createPoll.js 2012-06-13 12:32:09 UTC (rev 3464)
@@ -558,33 +558,51 @@
jQuery(document).ready(function () {
function changeChoiceAddAllowed(val) {
- if (val) {
- $('#addChoiceAddAllowedPanel').show();
- } else {
- $('#addChoiceAddAllowedPanel').hide();
- }
+// if (val) {
+// $('#addChoiceAddAllowedPanel').show();
+// } else {
+// $('#addChoiceAddAllowedPanel').hide();
+// }
$('[name="poll.beginChoiceDate"],[name="poll.endChoiceDate"]').attr(
'disabled', !val);
}
function changeLimitChoice(val) {
- if (val) {
- $('#maxChoiceNbPanel').show();
- } else {
- $('#maxChoiceNbPanel').hide();
- }
+// if (val) {
+// $('#maxChoiceNbPanel').show();
+// } else {
+// $('#maxChoiceNbPanel').hide();
+// }
$('[name="maxChoices"]').attr('disabled', !val);
}
function changeReminder(val) {
- if (val) {
- $('#reminderPanel').show();
- } else {
- $('#reminderPanel').hide();
- }
+// if (val) {
+// $('#reminderPanel').show();
+// } else {
+// $('#reminderPanel').hide();
+// }
$('[name="reminderHourCountdown"]').attr('disabled', !val);
}
+ function changePublicOption(val) {
+// if (val) {
+// $('#publicPanel').show();
+// } else {
+// $('#publicPanel').hide();
+// }
+ $('[name="poll.continuousResults"]').attr('disabled', !val);
+ }
+
+ function changeAnonymousOption(val) {
+// if (val) {
+// $('#anonymousPanel').show();
+// } else {
+// $('#anonymousPanel').hide();
+// }
+ $('[name="poll.anonymousVoteAllowed"]').attr('disabled', !val);
+ }
+
function changePollType(type) {
$('.pollType').addClass('hidden');
@@ -609,6 +627,10 @@
changeChoiceAddAllowed($(this).prop('checked'));
});
+ $('[name="poll.publicResults"]').change(function () {
+ changePublicOption($(this).prop('checked'));
+ });
+
$('[name="limitChoice"]').change(function () {
changeLimitChoice($(this).prop('checked'));
});
@@ -621,10 +643,10 @@
var val = $(this).prop('checked');
$('[name="poll.anonymousVoteAllowed"]').prop('checked', val);
});
- $('[name="poll.continuousResults"]').change(function () {
- var val = $(this).prop('checked');
- $('[name="poll.publicResults"]').prop('checked', val);
- });
+// $('[name="poll.continuousResults"]').change(function () {
+// var val = $(this).prop('checked');
+// $('[name="poll.publicResults"]').prop('checked', val);
+// });
$('[name="poll.choiceType"]').change(function () {
changeChoiceType($(this).val());
@@ -648,10 +670,13 @@
changeChoiceAddAllowed(datas['choiceAddAllowed'] == 'true');
changeLimitChoice(datas['limitChoice'] == 'true');
changeReminder(datas['reminder'] == 'true');
+ changePublicOption(datas['publicOption'] == 'true');
+ changeAnonymousOption(datas['anonymousOption'] == 'true');
changeChoiceType(datas['choiceType']);
changePollType(datas['pollType']);
+ $('img[src$="tooltip.png"]').addClass("tooltip");
$('.tooltip').tipTip({ defaultPosition:'top' });
});
1
0
r3463 - trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/security
by ymartel@users.chorem.org 13 Jun '12
by ymartel@users.chorem.org 13 Jun '12
13 Jun '12
Author: ymartel
Date: 2012-06-13 12:23:07 +0200 (Wed, 13 Jun 2012)
New Revision: 3463
Url: http://chorem.org/repositories/revision/pollen/3463
Log:
refs #606 : add tests for security access with a normal poll as owner and as admin
Modified:
trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/security/SecurityAccessSIT.java
Modified: trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/security/SecurityAccessSIT.java
===================================================================
--- trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/security/SecurityAccessSIT.java 2012-06-13 01:23:02 UTC (rev 3462)
+++ trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/security/SecurityAccessSIT.java 2012-06-13 10:23:07 UTC (rev 3463)
@@ -36,13 +36,17 @@
* <li>Access to "admin pages" when not connected (KO)</li>
* <li>Access to "admin pages" when not connected as admin (KO)</li>
* <li>Access to "admin pages" when connected as admin (OK)</li>
+ * <li>Access to "poll page" with a good pollId (OK)</li>
+ * <li>Access to "poll page" with a bad pollId (KO)</li>
+ * <li>Access to "poll admin page" with a good tokenId (OK)</li>
+ * <li>Access to "poll admin page" with a bad tokenId (KO)</li>
+ * <li>Access to "poll moderation page" with a good tokenId (OK)</li>
+ * <li>Access to "poll moderation page" with a bad tokenId (KO)</li>
* </ul>
* <p/>
* TODO ymartel 2012/06/12
* Should check those security access to :
* <ul>
- * <li>Access to "poll page" with a good pollId (OK)</li>
- * <li>Access to "poll page" with a bad pollId (KO)</li>
* <li>Access to "restricted poll page" with a good accountId (OK)</li>
* <li>Access to "restricted poll page" with a bad accountId (KO)</li>
* </ul>
@@ -191,7 +195,7 @@
// Go on home page
gotoUrl(fixtures.homeURL());
- // login as user
+ // login as admin
connect("admin", "admin");
// try to access to admin polls list page, current url should be good one
@@ -208,8 +212,9 @@
* <li>Try to access to normal poll with bad pollId (should be redirected)</li>
* <li>Try to access to moderation page for normal poll with good pollId & good tokenId</li>
* <li>Try to access to moderation page for normal poll with good pollId & bad tokenId (should be redirected)</li>
- * <li>Try to access to admin page for normal poll with good pollId & good tokenId</li>
- * <li>Try to access to admin page for normal poll with good pollId & bad tokenId (should be redirected)</li>
+ * <li>Try to access to modification page for normal poll with just a good pollId</li>
+ * <li>Try to access to modification page for normal poll with good pollId & good tokenId</li>
+ * <li>Try to access to modification page for normal poll with good pollId & bad tokenId (should be redirected)</li>
* </ol>
* <p/>
* All the page should be accessed.
@@ -246,4 +251,116 @@
gotoUrl(fixtures.modificationURL(PollUri.newPollUri(pollId, badCreatorId)), fixtures.poll_creator_requiredURL(), false);
}
+ /**
+ * This test :
+ * <ol>
+ * <li>Login as Admin</li>
+ * <li>Try to access to normal poll with good pollId</li>
+ * <li>Try to access to normal poll with bad pollId (should be redirected)</li>
+ * <li>Try to access to moderation page for normal poll with good pollId & good tokenId</li>
+ * <li>Try to access to moderation page for normal poll with good pollId & bad tokenId (should be redirected)</li>
+ * <li>Try to access to admin page for normal poll with good pollId & good tokenId</li>
+ * <li>Try to access to admin page for normal poll with good pollId & bad tokenId (should be redirected)</li>
+ * </ol>
+ * <p/>
+ * All the page should be accessed.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void accessNormalPoolActionsAsAdmin() throws Exception {
+
+ // Go on home page
+ gotoUrl(fixtures.homeURL());
+
+ // login as admin
+ connect("admin", "admin");
+
+ String pollId = fixtures.normalPollId();
+ String badPollId = pollId + System.nanoTime();
+ String creatorId = fixtures.normalPollCreatorId();
+ String badCreatorId = creatorId + System.nanoTime();
+
+ // try to access to poll page, current url should be good one
+ String normalPollURL = fixtures.voteforURL(PollUri.newPollUri(pollId));
+ gotoUrl(normalPollURL);
+
+ // try to access to poll page with bad pollId, current url should be the poll_required one
+ gotoUrl(fixtures.voteforURL(PollUri.newPollUri(badPollId)), fixtures.poll_requiredURL(), false);
+
+ // try to access to poll moderation page, current url should be good one
+ String moderationURL = fixtures.voteforURL(PollUri.newPollUri(pollId, creatorId));
+ gotoUrl(moderationURL);
+
+ // try to access to poll page with bad creatorId, current url should be the poll_required one
+ gotoUrl(fixtures.voteforURL(PollUri.newPollUri(pollId, badCreatorId)), fixtures.poll_access_requiredURL(), false);
+
+ // try to access to poll modification page without creator Id, current url should be good one (admin access)
+ String simpleNormalPollAdminURL = fixtures.modificationURL(PollUri.newPollUri(pollId));
+ gotoUrl(simpleNormalPollAdminURL);
+
+ // try to access to poll modification page with creator Id, current url should be good one
+ String normalPollAdminURL = fixtures.modificationURL(PollUri.newPollUri(pollId, creatorId));
+ gotoUrl(normalPollAdminURL);
+
+ // try to access to poll modifcation page with bad creatorId, current url should be the poll_creator_required one, even if we are admin
+ gotoUrl(fixtures.modificationURL(PollUri.newPollUri(pollId, badCreatorId)), fixtures.poll_creator_requiredURL(), false);
+ }
+
+ /**
+ * This test :
+ * <ol>
+ * <li>Login as "User" (owner of the poll)</li>
+ * <li>Try to access to normal poll with good pollId</li>
+ * <li>Try to access to normal poll with bad pollId (should be redirected)</li>
+ * <li>Try to access to moderation page for normal poll with good pollId & good tokenId</li>
+ * <li>Try to access to moderation page for normal poll with good pollId & bad tokenId (should be redirected)</li>
+ * <li>Try to access to admin page for normal poll with good pollId & good tokenId</li>
+ * <li>Try to access to admin page for normal poll with good pollId & bad tokenId (should be redirected)</li>
+ * </ol>
+ * <p/>
+ * All the page should be accessed.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void accessNormalPoolActionsAsOwner() throws Exception {
+
+ // Go on home page
+ gotoUrl(fixtures.homeURL());
+
+ // login as user
+ connect("user", "user");
+
+ String pollId = fixtures.normalPollId();
+ String badPollId = pollId + System.nanoTime();
+ String creatorId = fixtures.normalPollCreatorId();
+ String badCreatorId = creatorId + System.nanoTime();
+
+ // try to access to poll page, current url should be good one
+ String normalPollURL = fixtures.voteforURL(PollUri.newPollUri(pollId));
+ gotoUrl(normalPollURL);
+
+ // try to access to poll page with bad pollId, current url should be the poll_required one
+ gotoUrl(fixtures.voteforURL(PollUri.newPollUri(badPollId)), fixtures.poll_requiredURL(), false);
+
+ // try to access to poll moderation page, current url should be good one
+ String moderationURL = fixtures.voteforURL(PollUri.newPollUri(pollId, creatorId));
+ gotoUrl(moderationURL);
+
+ // try to access to poll page with bad pollId, current url should be the poll_required one
+ gotoUrl(fixtures.voteforURL(PollUri.newPollUri(pollId, badCreatorId)), fixtures.poll_access_requiredURL(), false);
+
+ // try to access to poll modification page without creator Id, current url should be good one (owner access)
+ String simpleNormalPollModificationURL = fixtures.modificationURL(PollUri.newPollUri(pollId));
+ gotoUrl(simpleNormalPollModificationURL);
+
+ // try to access to poll modification page with creator Id, current url should be good one
+ String normalPollModificationURL = fixtures.modificationURL(PollUri.newPollUri(pollId, creatorId));
+ gotoUrl(normalPollModificationURL);
+
+ // try to access to poll modifcation page with bad creatorId, current url should be the poll_creator_required one, even if we are owner
+ gotoUrl(fixtures.modificationURL(PollUri.newPollUri(pollId, badCreatorId)), fixtures.poll_creator_requiredURL(), false);
+ }
+
}
1
0
Author: tchemit
Date: 2012-06-13 03:23:02 +0200 (Wed, 13 Jun 2012)
New Revision: 3462
Url: http://chorem.org/repositories/revision/pollen/3462
Log:
refs #606: Add some ITs to prevent regression (make tests works from parent mo)
Modified:
trunk/pollen-ui-struts2/pom.xml
Modified: trunk/pollen-ui-struts2/pom.xml
===================================================================
--- trunk/pollen-ui-struts2/pom.xml 2012-06-13 01:08:53 UTC (rev 3461)
+++ trunk/pollen-ui-struts2/pom.xml 2012-06-13 01:23:02 UTC (rev 3462)
@@ -390,10 +390,10 @@
</goals>
<configuration>
<generatedClasses>
- target/pollen-embedded-temp-${project.version}/WEB-INF/classes
+ ${basedir}/target/pollen-embedded-temp-${project.version}/WEB-INF/classes
</generatedClasses>
<webXmlFragment>
- target/pollen-embedded-temp-${project.version}/WEB-INF/webfrag.xml
+ ${basedir}/target/pollen-embedded-temp-${project.version}/WEB-INF/webfrag.xml
</webXmlFragment>
<packageRoot>org.apache.jsp</packageRoot>
@@ -437,7 +437,7 @@
<configuration>
<primaryArtifact>false</primaryArtifact>
<webappDirectory>
- target/pollen-embedded-${project.version}
+ ${basedir}/target/pollen-embedded-${project.version}
</webappDirectory>
<archive>
<manifest>
@@ -569,7 +569,7 @@
<configuration>
<daemon>true</daemon>
<webAppConfig>
- <descriptor>src/test/resources/web-test.xml</descriptor>
+ <descriptor>${basedir}/src/test/resources/web-test.xml</descriptor>
<contextPath>/pollen</contextPath>
</webAppConfig>
1
0
r3461 - in trunk/pollen-ui-struts2: . src/main/java/org/chorem/pollen/ui src/test/java/org/chorem/pollen/ui src/test/resources
by tchemit@users.chorem.org 13 Jun '12
by tchemit@users.chorem.org 13 Jun '12
13 Jun '12
Author: tchemit
Date: 2012-06-13 03:08:53 +0200 (Wed, 13 Jun 2012)
New Revision: 3461
Url: http://chorem.org/repositories/revision/pollen/3461
Log:
refs #606: Add some ITs to prevent regression (utilisation d'un port 8765 pour les tests et r?\195?\169cup?\195?\169ration dans les fixtures)
Modified:
trunk/pollen-ui-struts2/pom.xml
trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenApplicationListener.java
trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/PollenFixtures.java
trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/PollenTestApplicationListener.java
trunk/pollen-ui-struts2/src/test/resources/pollen-test.properties
Modified: trunk/pollen-ui-struts2/pom.xml
===================================================================
--- trunk/pollen-ui-struts2/pom.xml 2012-06-12 23:53:35 UTC (rev 3460)
+++ trunk/pollen-ui-struts2/pom.xml 2012-06-13 01:08:53 UTC (rev 3461)
@@ -243,6 +243,9 @@
target/${project.build.finalName}.war,
target/${project.build.finalName}-bin.zip
</redmine.releaseFiles>
+
+ <defaultSiteUrl>http://localhost:8080/poll</defaultSiteUrl>
+ <defaultLogDir>${basedir}/target</defaultLogDir>
</properties>
<build>
@@ -286,7 +289,6 @@
</plugins>
-
<pluginManagement>
<plugins>
<plugin>
@@ -302,11 +304,11 @@
<systemProperties>
<systemProperty>
<name>siteUrl</name>
- <value>http://localhost:8080/pollen</value>
+ <value>${defaultSiteUrl}</value>
</systemProperty>
<systemProperty>
<name>pollen.log.dir</name>
- <value>target</value>
+ <value>${defaultLogDir}</value>
</systemProperty>
</systemProperties>
</configuration>
@@ -318,8 +320,8 @@
<configuration>
<path>/pollen</path>
<systemProperties>
- <siteUrl>http://localhost:8080/pollen</siteUrl>
- <pollen.log.dir>target</pollen.log.dir>
+ <siteUrl>${defaultSiteUrl}</siteUrl>
+ <pollen.log.dir>${defaultLogDir}</pollen.log.dir>
</systemProperties>
<uriEncoding>UTF-8</uriEncoding>
</configuration>
@@ -331,8 +333,8 @@
<configuration>
<path>/pollen</path>
<systemProperties>
- <siteUrl>http://localhost:8080/pollen</siteUrl>
- <pollen.log.dir>target</pollen.log.dir>
+ <siteUrl>${defaultSiteUrl}</siteUrl>
+ <pollen.log.dir>${defaultLogDir}</pollen.log.dir>
</systemProperties>
<uriEncoding>UTF-8</uriEncoding>
</configuration>
@@ -545,6 +547,11 @@
<value>!true</value>
</property>
</activation>
+ <properties>
+ <pollenTestServerPort>8765</pollenTestServerPort>
+ <pollenTestUrl>http://localhost:${pollenTestServerPort}/pollen</pollenTestUrl>
+ </properties>
+
<build>
<defaultGoal>post-integration-test</defaultGoal>
<plugins>
@@ -564,8 +571,19 @@
<webAppConfig>
<descriptor>src/test/resources/web-test.xml</descriptor>
<contextPath>/pollen</contextPath>
+
</webAppConfig>
<useTestClasspath>true</useTestClasspath>
+ <systemProperties>
+ <systemProperty>
+ <name>siteUrl</name>
+ <value>${pollenTestUrl}</value>
+ </systemProperty>
+ <systemProperty>
+ <name>jetty.port</name>
+ <value>${pollenTestServerPort}</value>
+ </systemProperty>
+ </systemProperties>
</configuration>
</execution>
@@ -589,6 +607,9 @@
<goal>test</goal>
</goals>
<configuration>
+ <environmentVariables>
+ <siteUrl>${pollenTestUrl}</siteUrl>
+ </environmentVariables>
<includes>
<include>**/*SIT.java</include>
</includes>
Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenApplicationListener.java
===================================================================
--- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenApplicationListener.java 2012-06-12 23:53:35 UTC (rev 3460)
+++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenApplicationListener.java 2012-06-13 01:08:53 UTC (rev 3461)
@@ -95,6 +95,9 @@
// initialize configuration
PollenConfiguration configuration = prepareConfiguration();
+ if (log.isInfoEnabled()) {
+ log.info("Base url "+configuration.getApplicationUrl());
+ }
applicationContext.setConfiguration(configuration);
File temporaryDirectory = configuration.getTemporaryDirectory();
Modified: trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/PollenFixtures.java
===================================================================
--- trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/PollenFixtures.java 2012-06-12 23:53:35 UTC (rev 3460)
+++ trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/PollenFixtures.java 2012-06-13 01:08:53 UTC (rev 3461)
@@ -22,6 +22,9 @@
*/
package org.chorem.pollen.ui;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.pollen.PollenConfiguration;
import org.chorem.pollen.bean.PollUri;
/**
@@ -32,8 +35,42 @@
*/
public class PollenFixtures {
- public static final String PREFIX_URL = "http://localhost:8080/pollen/";
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(PollenFixtures.class);
+ /**
+ * The base url of the application.
+ * <p/>
+ * This url contains also the web context. This url is obtain from
+ * the configuration.
+ * <p/>
+ * Example:
+ * <p/>
+ * <pre>http://localhost:8765/pollen</pre>
+ *
+ * @see PollenConfiguration#getApplicationUrl()
+ */
+ protected static String baseUrl;
+
+ public String baseUrl() {
+ if (baseUrl == null) {
+
+ //get it from configuration
+
+ PollenConfiguration configuration = new PollenConfiguration(
+ "pollen-test.properties",
+ null);
+ baseUrl = configuration.getApplicationUrl().toString();
+ if (!baseUrl.endsWith("/")) {
+ baseUrl += "/";
+ }
+ if (log.isInfoEnabled()) {
+ log.info("Base url = " + baseUrl);
+ }
+ }
+ return baseUrl;
+ }
+
public String normalPollId() {
return "c7082f9752844b83a1859abcae3b681c";
}
@@ -43,43 +80,43 @@
}
public String homeURL() {
- return PREFIX_URL + "home";
+ return baseUrl() + "home";
}
public String createdListURL() {
- return PREFIX_URL + "user/createdList";
+ return baseUrl() + "user/createdList";
}
public String invitedListURL() {
- return PREFIX_URL + "user/invitedList";
+ return baseUrl() + "user/invitedList";
}
public String participatedListURL() {
- return PREFIX_URL + "user/participatedList";
+ return baseUrl() + "user/participatedList";
}
public String favoriteListsURL() {
- return PREFIX_URL + "user/favoriteLists";
+ return baseUrl() + "user/favoriteLists";
}
public String pollsListURL() {
- return PREFIX_URL + "admin/pollsList";
+ return baseUrl() + "admin/pollsList";
}
public String usersListURL() {
- return PREFIX_URL + "admin/usersList";
+ return baseUrl() + "admin/usersList";
}
public String connected_requiredURL() {
- return PREFIX_URL + "security/connected_required";
+ return baseUrl() + "security/connected_required";
}
public String admin_requiredURL() {
- return PREFIX_URL + "security/admin_required";
+ return baseUrl() + "security/admin_required";
}
public String voteforURL() {
- return PREFIX_URL + "poll/votefor/";
+ return baseUrl() + "poll/votefor/";
}
public String voteforURL(PollUri pollUri) {
@@ -91,18 +128,18 @@
}
public String modificationURL() {
- return PREFIX_URL + "poll/modification/";
+ return baseUrl() + "poll/modification/";
}
public String poll_requiredURL() {
- return PREFIX_URL + "security/poll_required";
+ return baseUrl() + "security/poll_required";
}
public String poll_access_requiredURL() {
- return PREFIX_URL + "security/poll_access_required";
+ return baseUrl() + "security/poll_access_required";
}
public String poll_creator_requiredURL() {
- return PREFIX_URL + "security/poll_creator_required";
+ return baseUrl() + "security/poll_creator_required";
}
}
Modified: trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/PollenTestApplicationListener.java
===================================================================
--- trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/PollenTestApplicationListener.java 2012-06-12 23:53:35 UTC (rev 3460)
+++ trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/PollenTestApplicationListener.java 2012-06-13 01:08:53 UTC (rev 3461)
@@ -46,11 +46,10 @@
@Override
protected PollenConfiguration prepareConfiguration() {
- PollenConfiguration configuration;
+ PollenConfiguration configuration = new PollenConfiguration(
+ "pollen-test.properties",
+ null) {
- configuration = new PollenConfiguration("pollen-test.properties",
- null) {
-
@Override
protected void loadApplicationConfig(String file,
Properties defaultOptions) {
Modified: trunk/pollen-ui-struts2/src/test/resources/pollen-test.properties
===================================================================
--- trunk/pollen-ui-struts2/src/test/resources/pollen-test.properties 2012-06-12 23:53:35 UTC (rev 3460)
+++ trunk/pollen-ui-struts2/src/test/resources/pollen-test.properties 2012-06-13 01:08:53 UTC (rev 3461)
@@ -37,10 +37,8 @@
# Version de l'application
pollen.version=${project.version}
-# url de l'application
-siteUrl=http://localhost:8080/pollen
-
# répertoire des données (chaque execution utilisera un sous répertoire)
pollen.dataDirectory=${basedir}/target/surefire-workdir/pollen-data
+# emplacement de la base de test à utiliser (elle sera recopié à chaque démarrage d'un build de tests)
incomingDatabase=${basedir}/target/test-classes/pollendb.h2.db
\ No newline at end of file
1
0