r3660 - in trunk/pollen-ui-struts2/src: it/pollCommentVisibility it/pollCommentVisibility/src/test/java/org/chorem/pollen/ui/it it/pollCommentVisibility/src/test/resources/data/db it/pollCommentVisibility/src/test/resources/data/feeds main/java/org/chorem/pollen/ui/actions/poll/vote
Author: tchemit Date: 2012-08-28 20:46:32 +0200 (Tue, 28 Aug 2012) New Revision: 3660 Url: http://chorem.org/repositories/revision/pollen/3660 Log: fixes #743: Add option to allow or not comment in poll (add tests) Added: trunk/pollen-ui-struts2/src/it/pollCommentVisibility/src/test/resources/data/feeds/5b7d6a90540f4173bfb8d60778ef6dd9.xml trunk/pollen-ui-struts2/src/it/pollCommentVisibility/src/test/resources/data/feeds/6de9197bda3b4f908cf047a48ea50395.xml Modified: trunk/pollen-ui-struts2/src/it/pollCommentVisibility/README.txt trunk/pollen-ui-struts2/src/it/pollCommentVisibility/src/test/java/org/chorem/pollen/ui/it/PollWithCommentIT.java trunk/pollen-ui-struts2/src/it/pollCommentVisibility/src/test/java/org/chorem/pollen/ui/it/PollWithoutCommentIT.java trunk/pollen-ui-struts2/src/it/pollCommentVisibility/src/test/resources/data/db/pollendb.h2.db trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/vote/VoteForPoll.java Modified: trunk/pollen-ui-struts2/src/it/pollCommentVisibility/README.txt =================================================================== --- trunk/pollen-ui-struts2/src/it/pollCommentVisibility/README.txt 2012-08-28 16:58:57 UTC (rev 3659) +++ trunk/pollen-ui-struts2/src/it/pollCommentVisibility/README.txt 2012-08-28 18:46:32 UTC (rev 3660) @@ -2,149 +2,4 @@ PollVoteVisibility ================== -Pour tester la portée des commentaires (http://chorem.org/issues/743). - -anonymous free poll -------------------- - -by not connected user -~~~~~~~~~~~~~~~~~~~~~ - -admin poll/summrary/cacb52f4d49047b7a7aa24ec528fcc87:e814ba6e25174d5983ad796c400520f5 (peut voter) -vote anonyme cacb52f4d49047b7a7aa24ec528fcc87:56acbf87f3c049c2adc757ef1da88ee1 (a,b) (votes non visibles) -vote creator (interdit, votes non visibles) -vote moderate (votes non visibles) -vote user cacb52f4d49047b7a7aa24ec528fcc87:c54a12ffde5d44a4ad9e609aa644fc80 (a) (votes non visibles) (sondage non present dans sondages participes) -vote admin cacb52f4d49047b7a7aa24ec528fcc87:15500943e49842c88d6ceeefaa62e2ed (b) (votes non visibles) (sondage non present dans sondages participes) - -by connected user -~~~~~~~~~~~~~~~~~ - -admin poll/summrary/fdd43f4c8d614a9aa48047804583508a:9a8e8523f1ba404f8fde45d1844c59ac (peut voter) -vote anonyme fdd43f4c8d614a9aa48047804583508a:07dc154dce514d368441eaa9f27d21e0 (a,b) (votes non visibles) -vote creator (interdit connecté ou pas, votes non visibles) -vote moderate (votes non visibles) -vote user fdd43f4c8d614a9aa48047804583508a:e67a14d729c7440ebe4a55d589cba515 (a) (votes non visibles) (sondage non present dans sondages participes) -vote admin fdd43f4c8d614a9aa48047804583508a:29993520034a41168def96f908d2696b (b) (votes non visibles) (sondage non present dans sondages participes) -sondage crées (sondage present, peut voter) - -by admin user -~~~~~~~~~~~~~ - -admin poll/summrary/87cb5b1529374ac0b8c6b7f0b98e169c:65a3caf0bf204226bfcd259c69e56ca8 (peut voter) -vote anonyme 87cb5b1529374ac0b8c6b7f0b98e169c:a0ff6892a28b4a65809b16cd8903245e (a,b) -vote creator (interdit connecté ou pas, votes non visibles) -vote moderate (votes non visibles) -vote user 87cb5b1529374ac0b8c6b7f0b98e169c:fd47e01378354fcaa220a4ffd0974417 (a) (votes non visibles) (sondage non present dans sondages participes) -vote admin 87cb5b1529374ac0b8c6b7f0b98e169c:010f05042ff3485c834d1ecdc4d17f1e (b) (votes non visibles) (sondage non present dans sondages participes) -sondage crées (sondage present, peut voter) - -onlyCreator free poll ---------------------- - -by not connected user -~~~~~~~~~~~~~~~~~~~~~ - -admin poll/summrary/e61a350a1d714e479aad526ee85b7bc6:8517bd2f6b414072b3d9d6c4cb7e5fd0 (peut voter) -vote anonyme e61a350a1d714e479aad526ee85b7bc6:e8fd28021faa434aa466c5f6bdbc6e94 (a,b) (votes non visibles) -vote creator (vote interdit, votes visibles) -vote moderate (vote interdit, votes visibles) -vote user e61a350a1d714e479aad526ee85b7bc6:52ef06ee93dd4095ae7498edb9e1c28e (a) (votes visibles) (sondage present dans sondages participes) -vote admin e61a350a1d714e479aad526ee85b7bc6:c86b0b775e154fdeaf51ae1e5ef4074d (b) (votes visibles) (sondage present dans sondages participes) - en connecté peut admin les votes, mais pas en deconnecté -sondage crées (sondage present, peut voter) - -by connected user -~~~~~~~~~~~~~~~~~ - -admin poll/summrary/075ab18c50c74f83b894c042bba84ff5:0f51b7c953f6427f9c85807fa838d44f (peut voter) -vote anonyme 075ab18c50c74f83b894c042bba84ff5:4937a887797a4ab5ac618152383512ae (a,b) (votes non visibles) -vote creator (vote interdit mais peut admin les votes) -vote moderate (vote interdit mais peut admin les votes) -vote user 075ab18c50c74f83b894c042bba84ff5:f162acd5dd8a4242a6f38b098ecec3c3 (a) (votes visibles si connecté) (sondage present dans sondages participes) -vote user2 075ab18c50c74f83b894c042bba84ff5:320e5771bede4c64888a7254fc84a56c () (votes non visibles) (sondage present dans sondages participes) -vote admin 075ab18c50c74f83b894c042bba84ff5:02dbe56ac36d458d95f1fe07ba783f61 (b) (votes visibles si connecté) (sondage present dans sondages participes) -sondage crées (sondage present, peut voter) - -by admin user -~~~~~~~~~~~~~ - -admin poll/summrary/a04bd349d8964c4fad48ac6ececc60a0:a1346bb80bb84913983e91673c76e80c (peut voter) -vote anonyme a04bd349d8964c4fad48ac6ececc60a0:e6fa20f2afb24bdebfdc579c2574a3ab (a,b) (votes non visibles) -vote creator (vote interdit mais peut admin les votes) -vote moderate (vote interdit mais peut admin les votes) -vote user a04bd349d8964c4fad48ac6ececc60a0:01b2b146c6874593b678261f42014935 (a) (votes non visibles) (sondage present dans sondages participes) -vote admin a04bd349d8964c4fad48ac6ececc60a0:cf4f77e74b2f40428595452ce2ee6fbf (b) (sondage present dans sondages participes) -sondage crées (sondage present, peut voter) - -onlyVoter free poll --------------------- - -by not connected user -~~~~~~~~~~~~~~~~~~~~~ - -admin poll/summrary/8518ede7bf1247d2ba0dfe222575c5ba:ea5c96d4d44547f9b0717f30bfa6dd03 (peut voter) -vote anonyme 8518ede7bf1247d2ba0dfe222575c5ba:fa914a31f6c94cfa8561f48e3c45d6cf (a,b) (votes visibles) -vote creator (vote interdit mais peut admin les votes) -vote moderate (vote interdit mais peut admin les votes) -vote user 8518ede7bf1247d2ba0dfe222575c5ba:5c67d277460b4b4eb1fb59a26bf4a622 (a) (votes visibles connecté ou non) (sondage present dans sondages participes) -vote admin 8518ede7bf1247d2ba0dfe222575c5ba:28d450be407e4eabbb787739ec27ae52 (b) (votes visibles connecté ou non) (sondage present dans sondages participes) -sondage crées (sondage present, peut voter) - -by connected user -~~~~~~~~~~~~~~~~~ - -admin poll/summrary/b321ddccf7d743bf9c67b2664231d14f:a48f1b97a3f84443845009c074298bce (peut voter) -vote anonyme b321ddccf7d743bf9c67b2664231d14f:938e4831d7d547a59fd6d76c3bdfe6b5 (a,b) (votes visibles) -vote creator (vote interdit mais peut admin les votes) -vote moderate (vote interdit mais peut admin les votes) -vote user b321ddccf7d743bf9c67b2664231d14f:b3e407acc97b4911b0de470b1d45a68f (a) (votes visibles connecté ou non) (sondage present dans sondages participes) -vote admin b321ddccf7d743bf9c67b2664231d14f:6f980a4541e04edd9dec95d3dbde0830 (b) (votes visibles connecté ou non) (sondage present dans sondages participes) -sondage crées (sondage present, peut voter) - -by admin user -~~~~~~~~~~~~~ - -admin poll/summrary/7103c6d4a79246699425e99e1f344b98:717ebe61a3b64fcea453c9cba5953149 (peut voter) -vote anonyme 7103c6d4a79246699425e99e1f344b98:ad50a5d406d84aa09e3a02dd9ad0116c (a,b) (vote visibles) -vote creator (vote interdit mais peut admin les votes) -vote moderate (vote interdit mais peut admin les votes) -vote user 7103c6d4a79246699425e99e1f344b98:24abe4ba077341b489af505531ac93de (a) (sondage present dans sondages participes) -vote admin 7103c6d4a79246699425e99e1f344b98:2237dbc51f7c4268a8a7e10f6146ae87 (b) (sondage present dans sondages participes) -sondage crées (sondage present, peut voter) - -everybody free poll -------------------- - -by not connected user -~~~~~~~~~~~~~~~~~~~~~ - -admin poll/summrary/2262a31f374e4969bb3593e762c0cae6:659bb046fc06493f9909ca9f34ca6261 (peut voter) -vote anonyme 2262a31f374e4969bb3593e762c0cae6:6909131490ab4a1abae0daaf15129cdb (a,b) (votes visibles) -vote creator (vote interdit mais peut admin les votes) -vote moderate (vote interdit mais peut admin les votes) -vote user 2262a31f374e4969bb3593e762c0cae6:f058910736af48e9905f83f3f5de5b8d (a) (sondage present dans sondages participes) -vote admin 2262a31f374e4969bb3593e762c0cae6:2d97c079df054a7c9fc321b2df3488f3 (b) (sondage present dans sondages participes) -sondage crées (sondage present, peut voter) - -by connected user -~~~~~~~~~~~~~~~~~ - -admin poll/summrary/4cd79d032aa7433d9944ec9376c385c0:f26e253004d14547b465b5a414b65a7f (peut voter) -vote anonyme 4cd79d032aa7433d9944ec9376c385c0:307222b5e17442758bd23fc9d8a19f5e (a,b) (votes visibles) -vote creator (vote interdit mais peut admin les votes) -vote moderate (vote interdit mais peut admin les votes) -vote user 4cd79d032aa7433d9944ec9376c385c0:8a10f049538142669ca84bb034f7a886 (a) (sondage present dans sondages participes) -vote admin 4cd79d032aa7433d9944ec9376c385c0:6e92bf48f672429ea265a2647bef415d (b) (sondage present dans sondages participes) -sondage crées (sondage present, peut voter) - -by admin user -~~~~~~~~~~~~~ - -admin poll/summrary/3300e59939bd4c9797e360060b8e54be:c370172faf7a4108be0d76630af34c4b (peut voter) -vote anonyme 3300e59939bd4c9797e360060b8e54be:4399e0ff6dbe4544b64861d1e234ee1a (a,b) (sondage present dans sondages participes) -vote creator (vote interdit mais peut admin les votes) -vote moderate (vote interdit mais peut admin les votes) -vote user 3300e59939bd4c9797e360060b8e54be:5af1c33357084f89a56d1cde89584cb7 (a) (sondage present dans sondages participes) -vote admin 3300e59939bd4c9797e360060b8e54be:335e6a3921fb4dd5b6220c55311b7931 (b) (sondage present dans sondages participes) -sondage crées (sondage present, peut voter) \ No newline at end of file +Pour tester la portée des commentaires (http://chorem.org/issues/743). \ No newline at end of file Modified: trunk/pollen-ui-struts2/src/it/pollCommentVisibility/src/test/java/org/chorem/pollen/ui/it/PollWithCommentIT.java =================================================================== --- trunk/pollen-ui-struts2/src/it/pollCommentVisibility/src/test/java/org/chorem/pollen/ui/it/PollWithCommentIT.java 2012-08-28 16:58:57 UTC (rev 3659) +++ trunk/pollen-ui-struts2/src/it/pollCommentVisibility/src/test/java/org/chorem/pollen/ui/it/PollWithCommentIT.java 2012-08-28 18:46:32 UTC (rev 3660) @@ -1,6 +1,11 @@ package org.chorem.pollen.ui.it; +import org.apache.commons.lang.StringUtils; +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; /** * Poll with comment possible. @@ -9,7 +14,41 @@ * @since 1.4.5 */ public class PollWithCommentIT extends AbstractPollIT { - protected PollWithCommentIT(Class<? extends WebDriver> driverType) { - super(driverType, ""); + + public PollWithCommentIT(Class<? extends WebDriver> driverType) { + super(driverType, "6de9197bda3b4f908cf047a48ea50395:70505c6db78c4fcd8218a9fa6a543853"); } + + @Test + public void checkEditPage() { + + // access to edit page + gotoUrl(urlFixtures.editPoll(creatorUri), true); + + // Go to option panel : click on it + WebElement optionsClick = findElement(By.xpath("//a[@href=\"#toptions\"]")); + optionsClick.click(); + + // get pollCommentVisibility checkbox + + WebElement checkBox = findElement(By.name("pollCommentVisible")); + Assert.assertEquals("input", checkBox.getTagName()); + + // check checked attribute exists and is not blank + Assert.assertTrue(StringUtils.isNotBlank(checkBox.getAttribute("checked"))); + } + + @Test + public void checkVotePage() { + + // access to votefor page with no accountId + gotoUrl(urlFixtures.voteforPoll(pollUri), true); + + // comment zone found + findElement(By.id("commentZone")); + + // comment button found + findElement(By.id("addCommentForm_pollen_action_addComment")); + + } } Modified: trunk/pollen-ui-struts2/src/it/pollCommentVisibility/src/test/java/org/chorem/pollen/ui/it/PollWithoutCommentIT.java =================================================================== --- trunk/pollen-ui-struts2/src/it/pollCommentVisibility/src/test/java/org/chorem/pollen/ui/it/PollWithoutCommentIT.java 2012-08-28 16:58:57 UTC (rev 3659) +++ trunk/pollen-ui-struts2/src/it/pollCommentVisibility/src/test/java/org/chorem/pollen/ui/it/PollWithoutCommentIT.java 2012-08-28 18:46:32 UTC (rev 3660) @@ -1,6 +1,10 @@ package org.chorem.pollen.ui.it; +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; /** * Poll with no comment possible. @@ -9,7 +13,36 @@ * @since 1.4.5 */ public class PollWithoutCommentIT extends AbstractPollIT { - protected PollWithoutCommentIT(Class<? extends WebDriver> driverType) { - super(driverType, ""); + + public PollWithoutCommentIT(Class<? extends WebDriver> driverType) { + super(driverType, "5b7d6a90540f4173bfb8d60778ef6dd9:b4b3fa093b68418eaff755e8f9dac97d"); } + + @Test + public void checkEditPage() { + + // access to edit page + gotoUrl(urlFixtures.editPoll(creatorUri), true); + + // Go to option panel : click on it + WebElement optionsClick = findElement(By.xpath("//a[@href=\"#toptions\"]")); + optionsClick.click(); + + // get pollCommentVisible checkbox + WebElement checkBox = findElement(By.name("pollCommentVisible")); + Assert.assertEquals("input", checkBox.getTagName()); + + // check no checked attribute + Assert.assertNull(checkBox.getAttribute("checked")); + } + + @Test + public void checkVotePage() { + + // access to votefor page with no accountId + gotoUrl(urlFixtures.voteforPoll(pollUri), true); + + // no comment zone + checkNoElement(By.id("commentZone")); + } } Modified: trunk/pollen-ui-struts2/src/it/pollCommentVisibility/src/test/resources/data/db/pollendb.h2.db =================================================================== (Binary files differ) Added: trunk/pollen-ui-struts2/src/it/pollCommentVisibility/src/test/resources/data/feeds/5b7d6a90540f4173bfb8d60778ef6dd9.xml =================================================================== --- trunk/pollen-ui-struts2/src/it/pollCommentVisibility/src/test/resources/data/feeds/5b7d6a90540f4173bfb8d60778ef6dd9.xml (rev 0) +++ trunk/pollen-ui-struts2/src/it/pollCommentVisibility/src/test/resources/data/feeds/5b7d6a90540f4173bfb8d60778ef6dd9.xml 2012-08-28 18:46:32 UTC (rev 3660) @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/"> + <title>Pollen : poll with no comment</title> + <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/5b7d6a90540f4173bfb8d60778ef6dd9" /> + <subtitle /> + <entry> + <title /> + <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/5b7d6a90540f4173bfb8d60778ef6dd9" /> + <author> + <name /> + </author> + <updated>2012-08-28T18:28:46Z</updated> + <published>2012-08-28T18:28:46Z</published> + <summary type="text" /> + <dc:date>2012-08-28T18:28:46Z</dc:date> + </entry> +</feed> + Property changes on: trunk/pollen-ui-struts2/src/it/pollCommentVisibility/src/test/resources/data/feeds/5b7d6a90540f4173bfb8d60778ef6dd9.xml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/pollen-ui-struts2/src/it/pollCommentVisibility/src/test/resources/data/feeds/6de9197bda3b4f908cf047a48ea50395.xml =================================================================== --- trunk/pollen-ui-struts2/src/it/pollCommentVisibility/src/test/resources/data/feeds/6de9197bda3b4f908cf047a48ea50395.xml (rev 0) +++ trunk/pollen-ui-struts2/src/it/pollCommentVisibility/src/test/resources/data/feeds/6de9197bda3b4f908cf047a48ea50395.xml 2012-08-28 18:46:32 UTC (rev 3660) @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/"> + <title>Pollen : pollWithComments</title> + <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/6de9197bda3b4f908cf047a48ea50395" /> + <subtitle /> + <entry> + <title /> + <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/6de9197bda3b4f908cf047a48ea50395" /> + <author> + <name /> + </author> + <updated>2012-08-28T18:26:50Z</updated> + <published>2012-08-28T18:26:50Z</published> + <summary type="text" /> + <dc:date>2012-08-28T18:26:50Z</dc:date> + </entry> +</feed> + Property changes on: trunk/pollen-ui-struts2/src/it/pollCommentVisibility/src/test/resources/data/feeds/6de9197bda3b4f908cf047a48ea50395.xml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/vote/VoteForPoll.java =================================================================== --- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/vote/VoteForPoll.java 2012-08-28 16:58:57 UTC (rev 3659) +++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/vote/VoteForPoll.java 2012-08-28 18:46:32 UTC (rev 3660) @@ -71,15 +71,12 @@ addFlashWarning(_("pollen.information.pollFinished")); } else if (!isVoteAllowed()) { - addFlashWarning(_("pollen.information.pollCanNotVote")); + addFlashWarning(_("pollen.information.pollCanNotVote")); } if (isPollChoiceRunning()) { addFlashMessage(_("pollen.information.pollChoiceRunning")); } - if (!isCommentAllowed()) { - addFlashMessage(_("pollen.information.pollCommentNotAuthorized")); - } } @Override
participants (1)
-
tchemit@users.chorem.org