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
August 2012
- 1 participants
- 83 discussions
r3639 - in trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it: . anonymousPoll creatorOnly everybody voterOnly
by tchemit@users.chorem.org 26 Aug '12
by tchemit@users.chorem.org 26 Aug '12
26 Aug '12
Author: tchemit
Date: 2012-08-27 01:15:33 +0200 (Mon, 27 Aug 2012)
New Revision: 3639
Url: http://chorem.org/repositories/revision/pollen/3639
Log:
refs #742: Option to allow all users to show voting of others users (tests are ok for free polls)
Added:
trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/AbstractIT.java
trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/anonymousPoll/
trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/anonymousPoll/AnonymousFreePollByAdminIT.java
trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/anonymousPoll/AnonymousFreePollByConnectedIT.java
trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/anonymousPoll/AnonymousFreePollByNotConnectedIT.java
trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/creatorOnly/
trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/creatorOnly/CreatorOnlyFreePollByAdminIT.java
trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/creatorOnly/CreatorOnlyFreePollByConnectedIT.java
trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/creatorOnly/CreatorOnlyFreePollByNotConnectedIT.java
trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/everybody/
trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/everybody/EverybodyFreePollByAdminIT.java
trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/everybody/EverybodyFreePollByConnectedIT.java
trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/everybody/EverybodyFreePollByNotConnectedIT.java
trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/voterOnly/
trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/voterOnly/VoterOnlyFreePollByAdminIT.java
trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/voterOnly/VoterOnlyFreePollByConnectedIT.java
trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/voterOnly/VoterOnlyFreePollByNotConnectedIT.java
Removed:
trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/AnonymousFreePollByAnonymousIT.java
Added: trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/AbstractIT.java
===================================================================
--- trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/AbstractIT.java (rev 0)
+++ trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/AbstractIT.java 2012-08-26 23:15:33 UTC (rev 3639)
@@ -0,0 +1,162 @@
+package org.chorem.pollen.ui.it;
+
+import org.chorem.pollen.bean.PollUri;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+
+/**
+ * Abstrac it for this it.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.4.5
+ */
+public abstract class AbstractIT extends AbstractPollIT {
+
+ /** Not connected vote uri. */
+ protected final PollUri notConnectedVotePollUri;
+
+ /** Connected user voter uri. */
+ protected final PollUri connectedVotePollUri;
+
+ /** Admin user voter uri. */
+ protected final PollUri adminVotePollUri;
+
+ protected AbstractIT(Class<? extends WebDriver> driverType,
+ String pollId,
+ String creatorId,
+ String notConnectedVoteId,
+ String userVoteId,
+ String adminVoteId) {
+ super(driverType, pollId, creatorId);
+
+ notConnectedVotePollUri = newPollUri(notConnectedVoteId);
+ connectedVotePollUri = newPollUri(userVoteId);
+ adminVotePollUri = newPollUri(adminVoteId);
+ }
+
+ protected final void canNotModifyAnyVote() {
+ checkCanNotModifiyVote(notConnectedVotePollUri);
+ checkCanNotModifiyVote(connectedVotePollUri);
+ checkCanNotModifiyVote(adminVotePollUri);
+ }
+
+ protected final void canNotDeleteAnyVote() {
+ checkCanNotDeleteVote(notConnectedVotePollUri);
+ checkCanNotDeleteVote(connectedVotePollUri);
+ checkCanNotDeleteVote(adminVotePollUri);
+ }
+
+ protected final void canSeeOnlyAdminVote() {
+ checkCanSeeVote(adminVotePollUri);
+ checkCanNotSeeVote(notConnectedVotePollUri);
+ checkCanNotSeeVote(connectedVotePollUri);
+ }
+
+ protected final void canSeeOnlyConnectedVote() {
+ checkCanSeeVote(connectedVotePollUri);
+ checkCanNotSeeVote(notConnectedVotePollUri);
+ checkCanNotSeeVote(adminVotePollUri);
+ }
+
+ protected final void canSeeOnlyNotConnectedVote() {
+ checkCanSeeVote(notConnectedVotePollUri);
+ checkCanNotSeeVote(connectedVotePollUri);
+ checkCanNotSeeVote(adminVotePollUri);
+ }
+
+ protected final void canDeleteAdminVote() {
+ checkCanDeleteVote(adminVotePollUri);
+ checkCanNotDeleteVote(notConnectedVotePollUri);
+ checkCanNotDeleteVote(connectedVotePollUri);
+ }
+
+ protected final void canDeleteConnectedVote() {
+ checkCanDeleteVote(connectedVotePollUri);
+ checkCanNotDeleteVote(notConnectedVotePollUri);
+ checkCanNotDeleteVote(adminVotePollUri);
+ }
+
+ protected final void canDeleteNotConnectedVote() {
+ checkCanDeleteVote(notConnectedVotePollUri);
+ checkCanNotDeleteVote(connectedVotePollUri);
+ checkCanNotDeleteVote(adminVotePollUri);
+ }
+
+ protected final void canModifyNotConnectedVote() {
+ checkCanModifiyVote(notConnectedVotePollUri);
+ checkCanNotModifiyVote(connectedVotePollUri);
+ checkCanNotModifiyVote(adminVotePollUri);
+ }
+
+ protected final void canModifyUserVote() {
+ checkCanModifiyVote(connectedVotePollUri);
+ checkCanNotModifiyVote(notConnectedVotePollUri);
+ checkCanNotModifiyVote(adminVotePollUri);
+ }
+
+ protected final void canModifyAdminVote() {
+ checkCanModifiyVote(adminVotePollUri);
+ checkCanNotModifiyVote(notConnectedVotePollUri);
+ checkCanNotModifiyVote(connectedVotePollUri);
+ }
+
+ protected final void canNotSeeAnyVote() {
+ checkCanNotSeeVote(notConnectedVotePollUri);
+ checkCanNotSeeVote(connectedVotePollUri);
+ checkCanNotSeeVote(adminVotePollUri);
+ }
+
+ protected final void canSeeAllVotes() {
+ checkCanSeeVote(notConnectedVotePollUri);
+ checkCanSeeVote(connectedVotePollUri);
+ checkCanSeeVote(adminVotePollUri);
+ }
+
+ protected final void canDeleteAllVotes() {
+ checkCanDeleteVote(notConnectedVotePollUri);
+ checkCanDeleteVote(connectedVotePollUri);
+ checkCanDeleteVote(adminVotePollUri);
+ }
+
+ protected void checkPollNotFoundInGrid(String pollId) {
+ checkNoElement(By.xpath("//td[@title=\"" + pollId + "\"]"));
+ }
+
+ protected void checkPollFoundInGrid(String pollId) {
+ findElement(By.xpath("//td[@title=\"" + pollId + "\"]"));
+ }
+
+ protected void checkCanNotSeeVote(PollUri uri) {
+ checkNoElement(By.id("vote_" + uri.getAccountId()));
+ }
+
+ protected void checkCanSeeVote(PollUri uri) {
+ findElement(By.id("vote_" + uri.getAccountId()));
+ }
+
+ protected void checkCanModifiyVote(PollUri uri) {
+ findElement(By.id("modifyVote_" + uri.getAccountId()));
+ }
+
+ protected void checkCanNotModifiyVote(PollUri uri) {
+ checkNoElement(By.id("modifyVote_" + uri.getAccountId()));
+ }
+
+ protected void checkCanDeleteVote(PollUri uri) {
+ findElement(By.id("deleteVote_" + uri.getAccountId()));
+ }
+
+ protected void checkCanNotDeleteVote(PollUri uri) {
+ checkNoElement(By.id("deleteVote_" + uri.getAccountId()));
+ }
+
+ protected void checkCanNotVote(PollUri uri) {
+ checkNoElement(By.id("voteForm_pollen_action_pollVote"));
+ checkNoElement(By.name("vote.choiceVoteToChoice[0].voteValue"));
+ }
+
+ protected void checkCanVote(PollUri uri) {
+ findElement(By.id("voteForm_pollen_action_pollVote"));
+ findElement(By.name("vote.choiceVoteToChoice[0].voteValue"));
+ }
+}
Property changes on: trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/AbstractIT.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Deleted: trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/AnonymousFreePollByAnonymousIT.java
===================================================================
--- trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/AnonymousFreePollByAnonymousIT.java 2012-08-26 23:14:26 UTC (rev 3638)
+++ trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/AnonymousFreePollByAnonymousIT.java 2012-08-26 23:15:33 UTC (rev 3639)
@@ -1,103 +0,0 @@
-package org.chorem.pollen.ui.it;
-
-import org.junit.Test;
-import org.openqa.selenium.By;
-import org.openqa.selenium.WebDriver;
-
-/**
- * Test a anonymous free poll created by a anonymous user.
- * <p/>
- * For that poll nobody can see votes.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.4.5
- */
-public class AnonymousFreePollByAnonymousIT extends AbstractPollIT {
-
- public AnonymousFreePollByAnonymousIT(Class<? extends WebDriver> driverType) {
- super(driverType,
- "cacb52f4d49047b7a7aa24ec528fcc87",
- "e814ba6e25174d5983ad796c400520f5");
- }
-
- @Test
- public void checkSummaryPollPage() {
-
- // can not access to summary page with no pollId
- gotoUrl(urlFixtures.summaryPoll(), urlFixtures.poll_required(), false);
-
- // can not access to summary page with no creatorId
- gotoUrl(urlFixtures.summaryPoll(pollUri), urlFixtures.poll_creator_required(), false);
-
- // access to summary page
- gotoUrl(urlFixtures.summaryPoll(adminPollUri), true);
-
- // user can vote (#voteUrl)
- findElement(By.id("voteUrl"));
- }
-
- @Test
- public void checkModeratePollPage() {
-
- // can not access to moderate page with no pollId
- gotoUrl(urlFixtures.moderatePoll(), urlFixtures.poll_required(), false);
-
- // can not access to moderate page with no creatorId
- gotoUrl(urlFixtures.moderatePoll(pollUri), urlFixtures.poll_creator_required(), false);
-
- // access to moderate page
- gotoUrl(urlFixtures.moderatePoll(adminPollUri), true);
-
- // can not vote
- checkCanNotVote();
-
- // can not see votes
- checkCanNotSeeVote();
- }
-
- @Test
- public void checkVoteForPage() {
-
- // access to votefor page with no accountId
- gotoUrl(urlFixtures.voteforPoll(pollUri), true);
-
- // can vote
- checkCanVote();
-
- // can not see votes
- checkCanNotSeeVote();
- }
-
- @Test
- public void checkVoteForPageWithCreatorId() {
-
- // access to votefor page with creatorId
- gotoUrl(urlFixtures.voteforPoll(adminPollUri), true);
-
- // can not vote
- checkCanNotVote();
-
- // can not see votes
- checkCanNotSeeVote();
- }
-
- protected void checkCanNotSeeVote() {
- checkNoElement(By.className("voted"));
- checkNoElement(By.className("notVoted"));
- }
-
- protected void checkCanSeeVote() {
- findElement(By.className("voted"));
- findElement(By.className("notVoted"));
- }
-
- protected void checkCanNotVote() {
- checkNoElement(By.id("voteForm_pollen_action_pollVote"));
- checkNoElement(By.name("vote.choiceVoteToChoice[0].voteValue"));
- }
-
- protected void checkCanVote() {
- findElement(By.id("voteForm_pollen_action_pollVote"));
- findElement(By.name("vote.choiceVoteToChoice[0].voteValue"));
- }
-}
Added: trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/anonymousPoll/AnonymousFreePollByAdminIT.java
===================================================================
--- trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/anonymousPoll/AnonymousFreePollByAdminIT.java (rev 0)
+++ trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/anonymousPoll/AnonymousFreePollByAdminIT.java 2012-08-26 23:15:33 UTC (rev 3639)
@@ -0,0 +1,197 @@
+package org.chorem.pollen.ui.it.anonymousPoll;
+
+import org.chorem.pollen.ui.it.AbstractIT;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+
+/**
+ * Test a anonymous free poll created by an administrator.
+ * <p/>
+ * For that poll nobody can see votes.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.4.5
+ */
+public class AnonymousFreePollByAdminIT extends AbstractIT {
+
+ public AnonymousFreePollByAdminIT(Class<? extends WebDriver> driverType) {
+ super(driverType,
+ "87cb5b1529374ac0b8c6b7f0b98e169c",
+ "65a3caf0bf204226bfcd259c69e56ca8",
+ "a0ff6892a28b4a65809b16cd8903245e",
+ "fd47e01378354fcaa220a4ffd0974417",
+ "010f05042ff3485c834d1ecdc4d17f1e");
+ }
+
+ @Test
+ public void checkSummaryPollPage() {
+
+ // can not access to summary page with no pollId
+ gotoUrl(urlFixtures.summaryPoll(), urlFixtures.poll_required(), false);
+
+ // can not access to summary page with no creatorId
+ gotoUrl(urlFixtures.summaryPoll(pollUri), urlFixtures.poll_creator_required(), false);
+
+ // access to summary page
+ gotoUrl(urlFixtures.summaryPoll(creatorUri), true);
+
+ // user can vote (#voteUrl)
+ findElement(By.id("voteUrl"));
+ }
+
+ @Test
+ public void checkModeratePollPage() {
+
+ // can not access to moderate page with no pollId
+ gotoUrl(urlFixtures.moderatePoll(), urlFixtures.poll_required(), false);
+
+ // can not access to moderate page with no creatorId
+ gotoUrl(urlFixtures.moderatePoll(pollUri), urlFixtures.poll_creator_required(), false);
+
+ // access to moderate page
+ gotoUrl(urlFixtures.moderatePoll(creatorUri), true);
+
+ // can not vote
+ checkCanNotVote(creatorUri);
+
+ // can not see votes
+ canNotSeeAnyVote();
+
+ // connect as user
+ adminLogin();
+
+ // can not access to moderate page with no creatorId
+ gotoUrl(urlFixtures.moderatePoll(pollUri), false);
+ }
+
+ @Test
+ public void checkVoteForPageWithCreatorId() {
+
+ // access to votefor page with creatorId
+ gotoUrl(urlFixtures.voteforPoll(creatorUri), true);
+
+ // can not vote
+ checkCanNotVote(creatorUri);
+
+ // can not see votes
+ canNotSeeAnyVote();
+ }
+
+ @Test
+ public void checkVoteForPageWithNoAccountId() {
+
+ // access to votefor page with no accountId
+ gotoUrl(urlFixtures.voteforPoll(pollUri), true);
+
+ // can vote
+ checkCanVote(pollUri);
+
+ // can not see votes
+ canNotSeeAnyVote();
+ }
+
+ @Test
+ public void checkVoteWithNotConnectedVoteAccountId() {
+
+ // access to votefor page with notConnected voter
+ gotoUrl(urlFixtures.voteforPoll(notConnectedVotePollUri), true);
+
+ // can not see votes
+ canNotSeeAnyVote();
+
+ // can vote
+ checkCanVote(notConnectedVotePollUri);
+
+ //TODO Fix this with http://chorem.org/issues/795
+ // can modifiy his vote
+// checkCanModifiyVote(notConnectedVotePollUri);
+ }
+
+ @Test
+ public void checkVoteWithConnectedVoteAccountId() {
+
+ // access to votefor page with no accountId
+ gotoUrl(urlFixtures.voteforPoll(connectedVotePollUri), true);
+
+ // can not see votes
+ canNotSeeAnyVote();
+
+ // can vote
+ checkCanVote(connectedVotePollUri);
+
+ //TODO Fix this with http://chorem.org/issues/795
+ // can modifiy his vote
+// checkCanModifiyVote(connectedVotePollUri);
+
+ //TODO Fix this with http://chorem.org/issues/795
+// // can delete his vote
+// checkCanDeleteVote(connectedVotePollUri);
+ // connect as user
+ userLogin();
+
+ // access to votefor page with no accountId (will use the userAccount)
+ gotoUrl(urlFixtures.voteforPoll(pollUri), true);
+
+ // can not see votes
+ canNotSeeAnyVote();
+
+ // can vote
+ checkCanVote(connectedVotePollUri);
+
+ // can not modifiy his vote (with no accountId, anonymous poll can not find the vote)
+ canNotModifyAnyVote();
+
+ // can not his vote (with no accountId, anonymous poll can not find the vote)
+ canNotDeleteAnyVote();
+
+ // poll not present in participant poll (anonymous poll)
+ gotoUrl(urlFixtures.participatedList(), true);
+
+ checkPollNotFoundInGrid(pollId);
+ }
+
+ @Test
+ public void checkVoteWithAdminVoteAccountId() {
+
+ // access to votefor page with no accountId
+ gotoUrl(urlFixtures.voteforPoll(adminVotePollUri), true);
+
+ // can not see votes
+ canNotSeeAnyVote();
+
+ // can vote
+ checkCanVote(adminVotePollUri);
+
+ //TODO Fix this with http://chorem.org/issues/795
+// // can modifiy his vote
+// checkCanModifiyVote(adminVotePollUri);
+
+ //TODO Fix this with http://chorem.org/issues/795
+// // can delete his vote
+// checkCanDeleteVote(adminVotePollUri);
+
+ // connect as admin
+ adminLogin();
+
+ // access to votefor page with no accountId (will use the userAccount)
+ gotoUrl(urlFixtures.voteforPoll(pollUri), true);
+
+ // can not see votes
+ canNotSeeAnyVote();
+
+ // can vote
+ checkCanVote(adminVotePollUri);
+
+ // can not modifiy his vote (with no accountId, anonymous poll can not find the vote)
+ canNotModifyAnyVote();
+
+ // can not delete his vote (with no accountId, anonymous poll can not find the vote)
+ canNotDeleteAnyVote();
+
+ // poll not present in participant poll (anonymous poll)
+ gotoUrl(urlFixtures.participatedList(), true);
+
+ checkPollNotFoundInGrid(pollId);
+ }
+}
Property changes on: trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/anonymousPoll/AnonymousFreePollByAdminIT.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/anonymousPoll/AnonymousFreePollByConnectedIT.java
===================================================================
--- trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/anonymousPoll/AnonymousFreePollByConnectedIT.java (rev 0)
+++ trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/anonymousPoll/AnonymousFreePollByConnectedIT.java 2012-08-26 23:15:33 UTC (rev 3639)
@@ -0,0 +1,197 @@
+package org.chorem.pollen.ui.it.anonymousPoll;
+
+import org.chorem.pollen.ui.it.AbstractIT;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+
+/**
+ * Test a anonymous free poll created by a connected user.
+ * <p/>
+ * For that poll nobody can see votes.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.4.5
+ */
+public class AnonymousFreePollByConnectedIT extends AbstractIT {
+
+ public AnonymousFreePollByConnectedIT(Class<? extends WebDriver> driverType) {
+ super(driverType,
+ "fdd43f4c8d614a9aa48047804583508a",
+ "9a8e8523f1ba404f8fde45d1844c59ac",
+ "07dc154dce514d368441eaa9f27d21e0",
+ "e67a14d729c7440ebe4a55d589cba515",
+ "29993520034a41168def96f908d2696b");
+ }
+
+ @Test
+ public void checkSummaryPollPage() {
+
+ // can not access to summary page with no pollId
+ gotoUrl(urlFixtures.summaryPoll(), urlFixtures.poll_required(), false);
+
+ // can not access to summary page with no creatorId
+ gotoUrl(urlFixtures.summaryPoll(pollUri), urlFixtures.poll_creator_required(), false);
+
+ // access to summary page
+ gotoUrl(urlFixtures.summaryPoll(creatorUri), true);
+
+ // user can vote (#voteUrl)
+ findElement(By.id("voteUrl"));
+ }
+
+ @Test
+ public void checkModeratePollPage() {
+
+ // can not access to moderate page with no pollId
+ gotoUrl(urlFixtures.moderatePoll(), urlFixtures.poll_required(), false);
+
+ // can not access to moderate page with no creatorId
+ gotoUrl(urlFixtures.moderatePoll(pollUri), urlFixtures.poll_creator_required(), false);
+
+ // access to moderate page
+ gotoUrl(urlFixtures.moderatePoll(creatorUri), true);
+
+ // can not vote
+ checkCanNotVote(creatorUri);
+
+ // can not see votes
+ canNotSeeAnyVote();
+
+ // connect as user
+ userLogin();
+
+ // can access to moderate page with no creatorId
+ gotoUrl(urlFixtures.moderatePoll(pollUri), false);
+ }
+
+ @Test
+ public void checkVoteForPageWithCreatorId() {
+
+ // access to votefor page with creatorId
+ gotoUrl(urlFixtures.voteforPoll(creatorUri), true);
+
+ // can not vote
+ checkCanNotVote(creatorUri);
+
+ // can not see votes
+ canNotSeeAnyVote();
+ }
+
+ @Test
+ public void checkVoteForPageWithNoAccountId() {
+
+ // access to votefor page with no accountId
+ gotoUrl(urlFixtures.voteforPoll(pollUri), true);
+
+ // can vote
+ checkCanVote(pollUri);
+
+ // can not see votes
+ canNotSeeAnyVote();
+ }
+
+ @Test
+ public void checkVoteWithNotConnectedVoteAccountId() {
+
+ // access to votefor page with notConnected voter
+ gotoUrl(urlFixtures.voteforPoll(notConnectedVotePollUri), true);
+
+ // can not see votes
+ canNotSeeAnyVote();
+
+ // can vote
+ checkCanVote(notConnectedVotePollUri);
+
+ //TODO Fix this with http://chorem.org/issues/795
+ // can modifiy his vote
+// checkCanModifiyVote(notConnectedVotePollUri);
+ }
+
+ @Test
+ public void checkVoteWithConnectedVoteAccountId() {
+
+ // access to votefor page with no accountId
+ gotoUrl(urlFixtures.voteforPoll(connectedVotePollUri), true);
+
+ // can not see votes
+ canNotSeeAnyVote();
+
+ // can vote
+ checkCanVote(connectedVotePollUri);
+
+ //TODO Fix this with http://chorem.org/issues/795
+ // can modifiy his vote
+// checkCanModifiyVote(connectedVotePollUri);
+
+ //TODO Fix this with http://chorem.org/issues/795
+// // can delete his vote
+// checkCanDeleteVote(connectedVotePollUri);
+ // connect as user
+ userLogin();
+
+ // access to votefor page with no accountId (will use the userAccount)
+ gotoUrl(urlFixtures.voteforPoll(pollUri), true);
+
+ // can not see votes
+ canNotSeeAnyVote();
+
+ // can vote
+ checkCanVote(pollUri);
+
+ // can not modifiy his vote (with no accountId, anonymous poll can not find the vote)
+ canNotModifyAnyVote();
+
+ // can not his vote (with no accountId, anonymous poll can not find the vote)
+ canNotDeleteAnyVote();
+
+ // poll not present in participant poll (anonymous poll)
+ gotoUrl(urlFixtures.participatedList(), true);
+
+ checkPollNotFoundInGrid(pollId);
+ }
+
+ @Test
+ public void checkVoteWithAdminVoteAccountId() {
+
+ // access to votefor page with no accountId
+ gotoUrl(urlFixtures.voteforPoll(adminVotePollUri), true);
+
+ // can not see votes
+ canNotSeeAnyVote();
+
+ // can vote
+ checkCanVote(adminVotePollUri);
+
+ //TODO Fix this with http://chorem.org/issues/795
+// // can modifiy his vote
+// checkCanModifiyVote(adminVotePollUri);
+
+ //TODO Fix this with http://chorem.org/issues/795
+// // can delete his vote
+// checkCanDeleteVote(adminVotePollUri);
+
+ // connect as admin
+ adminLogin();
+
+ // access to votefor page with no accountId (will use the userAccount)
+ gotoUrl(urlFixtures.voteforPoll(pollUri), true);
+
+ // can not see votes
+ canNotSeeAnyVote();
+
+ // can vote
+ checkCanVote(adminVotePollUri);
+
+ // can not modifiy his vote (with no accountId, anonymous poll can not find the vote)
+ canNotModifyAnyVote();
+
+ // can not delete his vote (with no accountId, anonymous poll can not find the vote)
+ canNotDeleteAnyVote();
+
+ // poll not present in participant poll (anonymous poll)
+ gotoUrl(urlFixtures.participatedList(), true);
+
+ checkPollNotFoundInGrid(pollId);
+ }
+}
Property changes on: trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/anonymousPoll/AnonymousFreePollByConnectedIT.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Copied: trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/anonymousPoll/AnonymousFreePollByNotConnectedIT.java (from rev 3632, trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/AnonymousFreePollByAnonymousIT.java)
===================================================================
--- trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/anonymousPoll/AnonymousFreePollByNotConnectedIT.java (rev 0)
+++ trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/anonymousPoll/AnonymousFreePollByNotConnectedIT.java 2012-08-26 23:15:33 UTC (rev 3639)
@@ -0,0 +1,191 @@
+package org.chorem.pollen.ui.it.anonymousPoll;
+
+import org.chorem.pollen.ui.it.AbstractIT;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+
+/**
+ * Test a anonymous free poll created by a not connected user.
+ * <p/>
+ * For that poll nobody can see votes.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.4.5
+ */
+public class AnonymousFreePollByNotConnectedIT extends AbstractIT {
+
+ public AnonymousFreePollByNotConnectedIT(Class<? extends WebDriver> driverType) {
+ super(driverType,
+ "cacb52f4d49047b7a7aa24ec528fcc87",
+ "e814ba6e25174d5983ad796c400520f5",
+ "56acbf87f3c049c2adc757ef1da88ee1",
+ "c54a12ffde5d44a4ad9e609aa644fc80",
+ "15500943e49842c88d6ceeefaa62e2ed");
+ }
+
+ @Test
+ public void checkSummaryPollPage() {
+
+ // can not access to summary page with no pollId
+ gotoUrl(urlFixtures.summaryPoll(), urlFixtures.poll_required(), false);
+
+ // can not access to summary page with no creatorId
+ gotoUrl(urlFixtures.summaryPoll(pollUri), urlFixtures.poll_creator_required(), false);
+
+ // access to summary page
+ gotoUrl(urlFixtures.summaryPoll(creatorUri), true);
+
+ // user can vote (#voteUrl)
+ findElement(By.id("voteUrl"));
+ }
+
+ @Test
+ public void checkModeratePollPage() {
+
+ // can not access to moderate page with no pollId
+ gotoUrl(urlFixtures.moderatePoll(), urlFixtures.poll_required(), false);
+
+ // can not access to moderate page with no creatorId
+ gotoUrl(urlFixtures.moderatePoll(pollUri), urlFixtures.poll_creator_required(), false);
+
+ // access to moderate page
+ gotoUrl(urlFixtures.moderatePoll(creatorUri), true);
+
+ // can not vote
+ checkCanNotVote(creatorUri);
+
+ // can not see votes
+ canNotSeeAnyVote();
+ }
+
+ @Test
+ public void checkVoteForPageWithCreatorId() {
+
+ // access to votefor page with creatorId
+ gotoUrl(urlFixtures.voteforPoll(creatorUri), true);
+
+ // can not vote
+ checkCanNotVote(creatorUri);
+
+ // can not see votes
+ canNotSeeAnyVote();
+ }
+
+ @Test
+ public void checkVoteForPageWithNoAccountId() {
+
+ // access to votefor page with no accountId
+ gotoUrl(urlFixtures.voteforPoll(pollUri), true);
+
+ // can vote
+ checkCanVote(pollUri);
+
+ // can not see votes
+ canNotSeeAnyVote();
+ }
+
+ @Test
+ public void checkVoteWithNotConnectedVoteAccountId() {
+
+ // access to votefor page with notConnected voter
+ gotoUrl(urlFixtures.voteforPoll(notConnectedVotePollUri), true);
+
+ // can not see votes
+ canNotSeeAnyVote();
+
+ // can vote
+ checkCanVote(notConnectedVotePollUri);
+
+ //TODO Fix this with http://chorem.org/issues/795
+ // can modifiy his vote
+// checkCanModifiyVote(notConnectedVotePollUri);
+ }
+
+ @Test
+ public void checkVoteWithConnectedVoteAccountId() {
+
+ // access to votefor page with no accountId
+ gotoUrl(urlFixtures.voteforPoll(connectedVotePollUri), true);
+
+ // can not see votes
+ canNotSeeAnyVote();
+
+ // can vote
+ checkCanVote(connectedVotePollUri);
+
+ //TODO Fix this with http://chorem.org/issues/795
+ // can modifiy his vote
+// checkCanModifiyVote(connectedVotePollUri);
+
+ //TODO Fix this with http://chorem.org/issues/795
+// // can delete his vote
+// checkCanDeleteVote(connectedVotePollUri);
+ // connect as user
+ userLogin();
+
+ // access to votefor page with no accountId (will use the userAccount)
+ gotoUrl(urlFixtures.voteforPoll(pollUri), true);
+
+ // can not see votes
+ canNotSeeAnyVote();
+
+ // can vote
+ checkCanVote(pollUri);
+
+ // can not modifiy his vote (with no accountId, anonymous poll can not find the vote)
+ canNotModifyAnyVote();
+
+ // can not his vote (with no accountId, anonymous poll can not find the vote)
+ canNotDeleteAnyVote();
+
+ // poll not present in participant poll (anonymous poll)
+ gotoUrl(urlFixtures.participatedList(), true);
+
+ checkPollNotFoundInGrid(pollId);
+ }
+
+ @Test
+ public void checkVoteWithAdminVoteAccountId() {
+
+ // access to votefor page with no accountId
+ gotoUrl(urlFixtures.voteforPoll(adminVotePollUri), true);
+
+ // can not see votes
+ canNotSeeAnyVote();
+
+ // can vote
+ checkCanVote(adminVotePollUri);
+
+ //TODO Fix this with http://chorem.org/issues/795
+// // can modifiy his vote
+// checkCanModifiyVote(adminVotePollUri);
+
+ //TODO Fix this with http://chorem.org/issues/795
+// // can delete his vote
+// checkCanDeleteVote(adminVotePollUri);
+
+ // connect as admin
+ adminLogin();
+
+ // access to votefor page with no accountId (will use the userAccount)
+ gotoUrl(urlFixtures.voteforPoll(pollUri), true);
+
+ // can not see votes
+ canNotSeeAnyVote();
+
+ // can vote
+ checkCanVote(adminVotePollUri);
+
+ // can not modifiy his vote (with no accountId, anonymous poll can not find the vote)
+ canNotModifyAnyVote();
+
+ // can not delete his vote (with no accountId, anonymous poll can not find the vote)
+ canNotDeleteAnyVote();
+
+ // poll not present in participant poll (anonymous poll)
+ gotoUrl(urlFixtures.participatedList(), true);
+
+ checkPollNotFoundInGrid(pollId);
+ }
+}
Property changes on: trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/anonymousPoll/AnonymousFreePollByNotConnectedIT.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/creatorOnly/CreatorOnlyFreePollByAdminIT.java
===================================================================
--- trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/creatorOnly/CreatorOnlyFreePollByAdminIT.java (rev 0)
+++ trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/creatorOnly/CreatorOnlyFreePollByAdminIT.java 2012-08-26 23:15:33 UTC (rev 3639)
@@ -0,0 +1,201 @@
+package org.chorem.pollen.ui.it.creatorOnly;
+
+import org.chorem.pollen.ui.it.AbstractIT;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+
+/**
+ * Test a creator only free poll created by an administrator.
+ * <p/>
+ * For that poll only creator or administrator can see votes.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.4.5
+ */
+public class CreatorOnlyFreePollByAdminIT extends AbstractIT {
+
+ public CreatorOnlyFreePollByAdminIT(Class<? extends WebDriver> driverType) {
+ super(driverType,
+ "a04bd349d8964c4fad48ac6ececc60a0",
+ "a1346bb80bb84913983e91673c76e80c",
+ "e6fa20f2afb24bdebfdc579c2574a3ab",
+ "01b2b146c6874593b678261f42014935",
+ "cf4f77e74b2f40428595452ce2ee6fbf");
+ }
+
+ @Test
+ public void checkSummaryPollPage() {
+
+ // can not access to summary page with no pollId
+ gotoUrl(urlFixtures.summaryPoll(), urlFixtures.poll_required(), false);
+
+ // can not access to summary page with no creatorId
+ gotoUrl(urlFixtures.summaryPoll(pollUri), urlFixtures.poll_creator_required(), false);
+
+ // access to summary page
+ gotoUrl(urlFixtures.summaryPoll(creatorUri), true);
+
+ // user can vote (#voteUrl)
+ findElement(By.id("voteUrl"));
+ }
+
+ @Test
+ public void checkModeratePollPage() {
+
+ // can not access to moderate page with no pollId
+ gotoUrl(urlFixtures.moderatePoll(), urlFixtures.poll_required(), false);
+
+ // can not access to moderate page with no creatorId
+ gotoUrl(urlFixtures.moderatePoll(pollUri), urlFixtures.poll_creator_required(), false);
+
+ // access to moderate page
+ gotoUrl(urlFixtures.moderatePoll(creatorUri), true);
+
+ // can not vote
+ checkCanNotVote(creatorUri);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can delete all votes
+ canDeleteAllVotes();
+ }
+
+ @Test
+ public void checkVoteForPageWithCreatorId() {
+
+ // access to votefor page with creatorId
+ gotoUrl(urlFixtures.voteforPoll(creatorUri), true);
+
+ // can not vote
+ checkCanNotVote(creatorUri);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can delete all votes
+ canDeleteAllVotes();
+ }
+
+ @Test
+ public void checkVoteForPageWithNoAccountId() {
+
+ // access to votefor page with no accountId
+ gotoUrl(urlFixtures.voteforPoll(pollUri), true);
+
+ // can vote
+ checkCanVote(pollUri);
+
+ // can not see votes
+ canNotSeeAnyVote();
+ }
+
+ @Test
+ public void checkVoteWithNotConnectedVoteAccountId() {
+
+ // access to votefor page with notConnected voter
+ gotoUrl(urlFixtures.voteforPoll(notConnectedVotePollUri), true);
+
+ // can see his own vote
+ canSeeOnlyNotConnectedVote();
+
+ // can vote
+ checkCanVote(notConnectedVotePollUri);
+
+ // can modifiy his vote
+ canModifyNotConnectedVote();
+
+ // can delete his vote
+ canDeleteNotConnectedVote();
+ }
+
+ @Test
+ public void checkVoteWithConnectedVoteAccountId() {
+
+ // access to votefor page with no accountId
+ gotoUrl(urlFixtures.voteforPoll(connectedVotePollUri), true);
+
+ // can see votes his own vote
+ canSeeOnlyConnectedVote();
+
+ // can vote
+ checkCanVote(connectedVotePollUri);
+
+ // can modifiy his vote
+ canModifyUserVote();
+
+ // can delete his vote
+ canDeleteConnectedVote();
+
+ // connect as user (he is the creator)
+ userLogin();
+
+ // access to votefor page with no accountId (will use the userAccount)
+ gotoUrl(urlFixtures.voteforPoll(pollUri), true);
+
+ // can see his own vote
+ canSeeOnlyConnectedVote();
+
+ // can vote
+ checkCanVote(connectedVotePollUri);
+
+ // can modifiy his vote
+ canModifyUserVote();
+
+ // can delete his votes
+ canDeleteConnectedVote();
+
+ // poll present in participant poll
+ gotoUrl(urlFixtures.participatedList(), true);
+
+ //FIXME Find out how to wait until jquery is done (or can direct call the json query)
+ // found poll in grid
+// checkPollFoundInGrid(pollId);
+ }
+
+ @Test
+ public void checkVoteWithAdminVoteAccountId() {
+
+ // access to votefor page with no accountId
+ gotoUrl(urlFixtures.voteforPoll(adminVotePollUri), true);
+
+ // can see ony his own vote
+ canSeeOnlyAdminVote();
+
+ // can vote
+ checkCanVote(adminVotePollUri);
+
+ // can modifiy his vote
+ canModifyAdminVote();
+
+ // can delete his vote
+ canDeleteAdminVote();
+
+ // connect as admin
+ adminLogin();
+
+ // access to votefor page with no accountId (will use the userAccount)
+ gotoUrl(urlFixtures.voteforPoll(pollUri), true);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can vote
+ checkCanVote(adminVotePollUri);
+
+ // can modifiy his vote
+ canModifyAdminVote();
+
+ // can delete all votes
+ canDeleteAllVotes();
+
+ // poll present in participant poll
+ gotoUrl(urlFixtures.participatedList(), true);
+
+ //FIXME Find out how to wait until jquery is done (or can direct call the json query)
+ // found poll in grid
+// checkPollFoundInGrid(pollId);
+ }
+
+}
Property changes on: trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/creatorOnly/CreatorOnlyFreePollByAdminIT.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/creatorOnly/CreatorOnlyFreePollByConnectedIT.java
===================================================================
--- trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/creatorOnly/CreatorOnlyFreePollByConnectedIT.java (rev 0)
+++ trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/creatorOnly/CreatorOnlyFreePollByConnectedIT.java 2012-08-26 23:15:33 UTC (rev 3639)
@@ -0,0 +1,201 @@
+package org.chorem.pollen.ui.it.creatorOnly;
+
+import org.chorem.pollen.ui.it.AbstractIT;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+
+/**
+ * Test a creator only free poll created by an connected user.
+ * <p/>
+ * For that poll only creator or administrator can see votes.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.4.5
+ */
+public class CreatorOnlyFreePollByConnectedIT extends AbstractIT {
+
+ public CreatorOnlyFreePollByConnectedIT(Class<? extends WebDriver> driverType) {
+ super(driverType,
+ "075ab18c50c74f83b894c042bba84ff5",
+ "0f51b7c953f6427f9c85807fa838d44f",
+ "4937a887797a4ab5ac618152383512ae",
+ "f162acd5dd8a4242a6f38b098ecec3c3",
+ "02dbe56ac36d458d95f1fe07ba783f61");
+ }
+
+ @Test
+ public void checkSummaryPollPage() {
+
+ // can not access to summary page with no pollId
+ gotoUrl(urlFixtures.summaryPoll(), urlFixtures.poll_required(), false);
+
+ // can not access to summary page with no creatorId
+ gotoUrl(urlFixtures.summaryPoll(pollUri), urlFixtures.poll_creator_required(), false);
+
+ // access to summary page
+ gotoUrl(urlFixtures.summaryPoll(creatorUri), true);
+
+ // user can vote (#voteUrl)
+ findElement(By.id("voteUrl"));
+ }
+
+ @Test
+ public void checkModeratePollPage() {
+
+ // can not access to moderate page with no pollId
+ gotoUrl(urlFixtures.moderatePoll(), urlFixtures.poll_required(), false);
+
+ // can not access to moderate page with no creatorId
+ gotoUrl(urlFixtures.moderatePoll(pollUri), urlFixtures.poll_creator_required(), false);
+
+ // access to moderate page
+ gotoUrl(urlFixtures.moderatePoll(creatorUri), true);
+
+ // can not vote
+ checkCanNotVote(creatorUri);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can delete all votes
+ canDeleteAllVotes();
+ }
+
+ @Test
+ public void checkVoteForPageWithCreatorId() {
+
+ // access to votefor page with creatorId
+ gotoUrl(urlFixtures.voteforPoll(creatorUri), true);
+
+ // can not vote
+ checkCanNotVote(creatorUri);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can delete all votes
+ canDeleteAllVotes();
+ }
+
+ @Test
+ public void checkVoteForPageWithNoAccountId() {
+
+ // access to votefor page with no accountId
+ gotoUrl(urlFixtures.voteforPoll(pollUri), true);
+
+ // can vote
+ checkCanVote(pollUri);
+
+ // can not see votes
+ canNotSeeAnyVote();
+ }
+
+ @Test
+ public void checkVoteWithNotConnectedVoteAccountId() {
+
+ // access to votefor page with notConnected voter
+ gotoUrl(urlFixtures.voteforPoll(notConnectedVotePollUri), true);
+
+ // can see his own vote
+ canSeeOnlyNotConnectedVote();
+
+ // can vote
+ checkCanVote(notConnectedVotePollUri);
+
+ // can modifiy his vote
+ canModifyNotConnectedVote();
+
+ // can delete his vote
+ canDeleteNotConnectedVote();
+ }
+
+ @Test
+ public void checkVoteWithConnectedVoteAccountId() {
+
+ // access to votefor page with no accountId
+ gotoUrl(urlFixtures.voteforPoll(connectedVotePollUri), true);
+
+ // can see votes his own vote
+ canSeeOnlyConnectedVote();
+
+ // can vote
+ checkCanVote(connectedVotePollUri);
+
+ // can modifiy his vote
+ canModifyUserVote();
+
+ // can delete his vote
+ canDeleteConnectedVote();
+
+ // connect as user (he is the creator)
+ userLogin();
+
+ // access to votefor page with no accountId (will use the userAccount)
+ gotoUrl(urlFixtures.voteforPoll(pollUri), true);
+
+ // can see all votes (user is creator)
+ canSeeAllVotes();
+
+ // can vote
+ checkCanVote(connectedVotePollUri);
+
+ // can modifiy his vote
+ canModifyUserVote();
+
+ // can delete all votes
+ canDeleteAllVotes();
+
+ // poll present in participant poll
+ gotoUrl(urlFixtures.participatedList(), true);
+
+ //FIXME Find out how to wait until jquery is done (or can direct call the json query)
+ // found poll in grid
+// checkPollFoundInGrid(pollId);
+ }
+
+ @Test
+ public void checkVoteWithAdminVoteAccountId() {
+
+ // access to votefor page with no accountId
+ gotoUrl(urlFixtures.voteforPoll(adminVotePollUri), true);
+
+ // can see ony his own vote
+ canSeeOnlyAdminVote();
+
+ // can vote
+ checkCanVote(adminVotePollUri);
+
+ // can modifiy his vote
+ canModifyAdminVote();
+
+ // can delete his vote
+ canDeleteAdminVote();
+
+ // connect as admin
+ adminLogin();
+
+ // access to votefor page with no accountId (will use the userAccount)
+ gotoUrl(urlFixtures.voteforPoll(pollUri), true);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can vote
+ checkCanVote(adminVotePollUri);
+
+ // can modifiy his vote
+ canModifyAdminVote();
+
+ // can delete all votes
+ canDeleteAllVotes();
+
+ // poll present in participant poll
+ gotoUrl(urlFixtures.participatedList(), true);
+
+ //FIXME Find out how to wait until jquery is done (or can direct call the json query)
+ // found poll in grid
+// checkPollFoundInGrid(pollId);
+ }
+
+}
Property changes on: trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/creatorOnly/CreatorOnlyFreePollByConnectedIT.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/creatorOnly/CreatorOnlyFreePollByNotConnectedIT.java
===================================================================
--- trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/creatorOnly/CreatorOnlyFreePollByNotConnectedIT.java (rev 0)
+++ trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/creatorOnly/CreatorOnlyFreePollByNotConnectedIT.java 2012-08-26 23:15:33 UTC (rev 3639)
@@ -0,0 +1,200 @@
+package org.chorem.pollen.ui.it.creatorOnly;
+
+import org.chorem.pollen.ui.it.AbstractIT;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+
+/**
+ * Test a creator only free poll created by a not connected user.
+ * <p/>
+ * For that poll only creator or administrator can see votes.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.4.5
+ */
+public class CreatorOnlyFreePollByNotConnectedIT extends AbstractIT {
+
+ public CreatorOnlyFreePollByNotConnectedIT(Class<? extends WebDriver> driverType) {
+ super(driverType,
+ "e61a350a1d714e479aad526ee85b7bc6",
+ "8517bd2f6b414072b3d9d6c4cb7e5fd0",
+ "e8fd28021faa434aa466c5f6bdbc6e94",
+ "52ef06ee93dd4095ae7498edb9e1c28e",
+ "c86b0b775e154fdeaf51ae1e5ef4074d");
+ }
+
+ @Test
+ public void checkSummaryPollPage() {
+
+ // can not access to summary page with no pollId
+ gotoUrl(urlFixtures.summaryPoll(), urlFixtures.poll_required(), false);
+
+ // can not access to summary page with no creatorId
+ gotoUrl(urlFixtures.summaryPoll(pollUri), urlFixtures.poll_creator_required(), false);
+
+ // access to summary page
+ gotoUrl(urlFixtures.summaryPoll(creatorUri), true);
+
+ // user can vote (#voteUrl)
+ findElement(By.id("voteUrl"));
+ }
+
+ @Test
+ public void checkModeratePollPage() {
+
+ // can not access to moderate page with no pollId
+ gotoUrl(urlFixtures.moderatePoll(), urlFixtures.poll_required(), false);
+
+ // can not access to moderate page with no creatorId
+ gotoUrl(urlFixtures.moderatePoll(pollUri), urlFixtures.poll_creator_required(), false);
+
+ // access to moderate page
+ gotoUrl(urlFixtures.moderatePoll(creatorUri), true);
+
+ // can not vote
+ checkCanNotVote(creatorUri);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can delete all votes
+ canDeleteAllVotes();
+ }
+
+ @Test
+ public void checkVoteForPageWithCreatorId() {
+
+ // access to votefor page with creatorId
+ gotoUrl(urlFixtures.voteforPoll(creatorUri), true);
+
+ // can not vote
+ checkCanNotVote(creatorUri);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can delete all votes
+ canDeleteAllVotes();
+ }
+
+ @Test
+ public void checkVoteForPageWithNoAccountId() {
+
+ // access to votefor page with no accountId
+ gotoUrl(urlFixtures.voteforPoll(pollUri), true);
+
+ // can vote
+ checkCanVote(pollUri);
+
+ // can not see votes
+ canNotSeeAnyVote();
+ }
+
+ @Test
+ public void checkVoteWithNotConnectedVoteAccountId() {
+
+ // access to votefor page with notConnected voter
+ gotoUrl(urlFixtures.voteforPoll(notConnectedVotePollUri), true);
+
+ // can see his own vote
+ canSeeOnlyNotConnectedVote();
+
+ // can vote
+ checkCanVote(notConnectedVotePollUri);
+
+ // can modifiy his vote
+ canModifyNotConnectedVote();
+
+ // can delete his vote
+ canDeleteNotConnectedVote();
+ }
+
+ @Test
+ public void checkVoteWithConnectedVoteAccountId() {
+
+ // access to votefor page with no accountId
+ gotoUrl(urlFixtures.voteforPoll(connectedVotePollUri), true);
+
+ // can see votes his own vote
+ canSeeOnlyConnectedVote();
+
+ // can vote
+ checkCanVote(connectedVotePollUri);
+
+ // can modifiy his vote
+ canModifyUserVote();
+
+ // can delete his vote
+ canDeleteConnectedVote();
+
+ // connect as user
+ userLogin();
+
+ // access to votefor page with no accountId (will use the userAccount)
+ gotoUrl(urlFixtures.voteforPoll(pollUri), true);
+
+ // can see vote his own vote
+ canSeeOnlyConnectedVote();
+
+ // can vote
+ checkCanVote(connectedVotePollUri);
+
+ // can modifiy his vote
+ canModifyUserVote();
+
+ // can delete his vote
+ canDeleteConnectedVote();
+
+ // poll present in participant poll
+ gotoUrl(urlFixtures.participatedList(), true);
+
+ //FIXME Find out how to wait until jquery is done (or can direct call the json query)
+ // found poll in grid
+// checkPollFoundInGrid(pollId);
+ }
+
+ @Test
+ public void checkVoteWithAdminVoteAccountId() {
+
+ // access to votefor page with no accountId
+ gotoUrl(urlFixtures.voteforPoll(adminVotePollUri), true);
+
+ // can see ony his own vote
+ canSeeOnlyAdminVote();
+
+ // can vote
+ checkCanVote(adminVotePollUri);
+
+ // can modifiy his vote
+ canModifyAdminVote();
+
+ // can delete his vote
+ canDeleteAdminVote();
+
+ // connect as admin
+ adminLogin();
+
+ // access to votefor page with no accountId (will use the userAccount)
+ gotoUrl(urlFixtures.voteforPoll(pollUri), true);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can vote
+ checkCanVote(adminVotePollUri);
+
+ // can modifiy his vote
+ canModifyAdminVote();
+
+ // can delete all votes
+ canDeleteAllVotes();
+
+ // poll present in participant poll
+ gotoUrl(urlFixtures.participatedList(), true);
+
+ //FIXME Find out how to wait until jquery is done (or can direct call the json query)
+ // found poll in grid
+// checkPollFoundInGrid(pollId);
+ }
+}
Property changes on: trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/creatorOnly/CreatorOnlyFreePollByNotConnectedIT.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/everybody/EverybodyFreePollByAdminIT.java
===================================================================
--- trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/everybody/EverybodyFreePollByAdminIT.java (rev 0)
+++ trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/everybody/EverybodyFreePollByAdminIT.java 2012-08-26 23:15:33 UTC (rev 3639)
@@ -0,0 +1,201 @@
+package org.chorem.pollen.ui.it.everybody;
+
+import org.chorem.pollen.ui.it.AbstractIT;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+
+/**
+ * Test a everybody free poll created by a administrator user.
+ * <p/>
+ * For that poll everybody can see votes.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.4.5
+ */
+public class EverybodyFreePollByAdminIT extends AbstractIT {
+
+ public EverybodyFreePollByAdminIT(Class<? extends WebDriver> driverType) {
+ super(driverType,
+ "3300e59939bd4c9797e360060b8e54be",
+ "c370172faf7a4108be0d76630af34c4b",
+ "4399e0ff6dbe4544b64861d1e234ee1a",
+ "5af1c33357084f89a56d1cde89584cb7",
+ "335e6a3921fb4dd5b6220c55311b7931");
+ }
+
+ @Test
+ public void checkSummaryPollPage() {
+
+ // can not access to summary page with no pollId
+ gotoUrl(urlFixtures.summaryPoll(), urlFixtures.poll_required(), false);
+
+ // can not access to summary page with no creatorId
+ gotoUrl(urlFixtures.summaryPoll(pollUri), urlFixtures.poll_creator_required(), false);
+
+ // access to summary page
+ gotoUrl(urlFixtures.summaryPoll(creatorUri), true);
+
+ // user can vote (#voteUrl)
+ findElement(By.id("voteUrl"));
+ }
+
+ @Test
+ public void checkModeratePollPage() {
+
+ // can not access to moderate page with no pollId
+ gotoUrl(urlFixtures.moderatePoll(), urlFixtures.poll_required(), false);
+
+ // can not access to moderate page with no creatorId
+ gotoUrl(urlFixtures.moderatePoll(pollUri), urlFixtures.poll_creator_required(), false);
+
+ // access to moderate page
+ gotoUrl(urlFixtures.moderatePoll(creatorUri), true);
+
+ // can not vote
+ checkCanNotVote(creatorUri);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can delete all votes
+ canDeleteAllVotes();
+ }
+
+ @Test
+ public void checkVoteForPageWithCreatorId() {
+
+ // access to votefor page with creatorId
+ gotoUrl(urlFixtures.voteforPoll(creatorUri), true);
+
+ // can not vote
+ checkCanNotVote(creatorUri);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can delete all votes
+ canDeleteAllVotes();
+ }
+
+ @Test
+ public void checkVoteForPageWithNoAccountId() {
+
+ // access to votefor page with no accountId
+ gotoUrl(urlFixtures.voteforPoll(pollUri), true);
+
+ // can vote
+ checkCanVote(pollUri);
+
+ // can see all votes
+ canSeeAllVotes();
+ }
+
+ @Test
+ public void checkVoteWithNotConnectedVoteAccountId() {
+
+ // access to votefor page with notConnected voter
+ gotoUrl(urlFixtures.voteforPoll(notConnectedVotePollUri), true);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can vote
+ checkCanVote(notConnectedVotePollUri);
+
+ // can modifiy his vote
+ canModifyNotConnectedVote();
+
+ // can delete his vote
+ canDeleteNotConnectedVote();
+ }
+
+ @Test
+ public void checkVoteWithConnectedVoteAccountId() {
+
+ // access to votefor page with no accountId
+ gotoUrl(urlFixtures.voteforPoll(connectedVotePollUri), true);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can vote
+ checkCanVote(connectedVotePollUri);
+
+ // can modifiy his vote
+ canModifyUserVote();
+
+ // can delete his vote
+ canDeleteConnectedVote();
+
+ // connect as user (he is the creator)
+ userLogin();
+
+ // access to votefor page with no accountId (will use the userAccount)
+ gotoUrl(urlFixtures.voteforPoll(pollUri), true);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can vote
+ checkCanVote(connectedVotePollUri);
+
+ // can modifiy his vote
+ canModifyUserVote();
+
+ // can delete his votes
+ canDeleteConnectedVote();
+
+ // poll present in participant poll
+ gotoUrl(urlFixtures.participatedList(), true);
+
+ //FIXME Find out how to wait until jquery is done (or can direct call the json query)
+ // found poll in grid
+// checkPollFoundInGrid(pollId);
+ }
+
+ @Test
+ public void checkVoteWithAdminVoteAccountId() {
+
+ // access to votefor page with no accountId
+ gotoUrl(urlFixtures.voteforPoll(adminVotePollUri), true);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can vote
+ checkCanVote(adminVotePollUri);
+
+ // can modifiy his vote
+ canModifyAdminVote();
+
+ // can delete his vote
+ canDeleteAdminVote();
+
+ // connect as admin
+ adminLogin();
+
+ // access to votefor page with no accountId (will use the userAccount)
+ gotoUrl(urlFixtures.voteforPoll(pollUri), true);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can vote
+ checkCanVote(adminVotePollUri);
+
+ // can modifiy his vote
+ canModifyAdminVote();
+
+ // can delete all votes
+ canDeleteAllVotes();
+
+ // poll present in participant poll
+ gotoUrl(urlFixtures.participatedList(), true);
+
+ //FIXME Find out how to wait until jquery is done (or can direct call the json query)
+ // found poll in grid
+// checkPollFoundInGrid(pollId);
+ }
+
+}
Property changes on: trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/everybody/EverybodyFreePollByAdminIT.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/everybody/EverybodyFreePollByConnectedIT.java
===================================================================
--- trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/everybody/EverybodyFreePollByConnectedIT.java (rev 0)
+++ trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/everybody/EverybodyFreePollByConnectedIT.java 2012-08-26 23:15:33 UTC (rev 3639)
@@ -0,0 +1,201 @@
+package org.chorem.pollen.ui.it.everybody;
+
+import org.chorem.pollen.ui.it.AbstractIT;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+
+/**
+ * Test a everybody free poll created by a connected user.
+ * <p/>
+ * For that poll everybody can see votes.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.4.5
+ */
+public class EverybodyFreePollByConnectedIT extends AbstractIT {
+
+ public EverybodyFreePollByConnectedIT(Class<? extends WebDriver> driverType) {
+ super(driverType,
+ "4cd79d032aa7433d9944ec9376c385c0",
+ "f26e253004d14547b465b5a414b65a7f",
+ "307222b5e17442758bd23fc9d8a19f5e",
+ "8a10f049538142669ca84bb034f7a886",
+ "6e92bf48f672429ea265a2647bef415d");
+ }
+
+ @Test
+ public void checkSummaryPollPage() {
+
+ // can not access to summary page with no pollId
+ gotoUrl(urlFixtures.summaryPoll(), urlFixtures.poll_required(), false);
+
+ // can not access to summary page with no creatorId
+ gotoUrl(urlFixtures.summaryPoll(pollUri), urlFixtures.poll_creator_required(), false);
+
+ // access to summary page
+ gotoUrl(urlFixtures.summaryPoll(creatorUri), true);
+
+ // user can vote (#voteUrl)
+ findElement(By.id("voteUrl"));
+ }
+
+ @Test
+ public void checkModeratePollPage() {
+
+ // can not access to moderate page with no pollId
+ gotoUrl(urlFixtures.moderatePoll(), urlFixtures.poll_required(), false);
+
+ // can not access to moderate page with no creatorId
+ gotoUrl(urlFixtures.moderatePoll(pollUri), urlFixtures.poll_creator_required(), false);
+
+ // access to moderate page
+ gotoUrl(urlFixtures.moderatePoll(creatorUri), true);
+
+ // can not vote
+ checkCanNotVote(creatorUri);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can delete all votes
+ canDeleteAllVotes();
+ }
+
+ @Test
+ public void checkVoteForPageWithCreatorId() {
+
+ // access to votefor page with creatorId
+ gotoUrl(urlFixtures.voteforPoll(creatorUri), true);
+
+ // can not vote
+ checkCanNotVote(creatorUri);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can delete all votes
+ canDeleteAllVotes();
+ }
+
+ @Test
+ public void checkVoteForPageWithNoAccountId() {
+
+ // access to votefor page with no accountId
+ gotoUrl(urlFixtures.voteforPoll(pollUri), true);
+
+ // can vote
+ checkCanVote(pollUri);
+
+ // can see all votes
+ canSeeAllVotes();
+ }
+
+ @Test
+ public void checkVoteWithNotConnectedVoteAccountId() {
+
+ // access to votefor page with notConnected voter
+ gotoUrl(urlFixtures.voteforPoll(notConnectedVotePollUri), true);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can vote
+ checkCanVote(notConnectedVotePollUri);
+
+ // can modifiy his vote
+ canModifyNotConnectedVote();
+
+ // can delete his vote
+ canDeleteNotConnectedVote();
+ }
+
+ @Test
+ public void checkVoteWithConnectedVoteAccountId() {
+
+ // access to votefor page with no accountId
+ gotoUrl(urlFixtures.voteforPoll(connectedVotePollUri), true);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can vote
+ checkCanVote(connectedVotePollUri);
+
+ // can modifiy his vote
+ canModifyUserVote();
+
+ // can delete his vote
+ canDeleteConnectedVote();
+
+ // connect as user (he is the creator)
+ userLogin();
+
+ // access to votefor page with no accountId (will use the userAccount)
+ gotoUrl(urlFixtures.voteforPoll(pollUri), true);
+
+ // can see all votes (user is creator)
+ canSeeAllVotes();
+
+ // can vote
+ checkCanVote(connectedVotePollUri);
+
+ // can modifiy his vote
+ canModifyUserVote();
+
+ // can delete all votes
+ canDeleteAllVotes();
+
+ // poll present in participant poll
+ gotoUrl(urlFixtures.participatedList(), true);
+
+ //FIXME Find out how to wait until jquery is done (or can direct call the json query)
+ // found poll in grid
+// checkPollFoundInGrid(pollId);
+ }
+
+ @Test
+ public void checkVoteWithAdminVoteAccountId() {
+
+ // access to votefor page with no accountId
+ gotoUrl(urlFixtures.voteforPoll(adminVotePollUri), true);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can vote
+ checkCanVote(adminVotePollUri);
+
+ // can modifiy his vote
+ canModifyAdminVote();
+
+ // can delete his vote
+ canDeleteAdminVote();
+
+ // connect as admin
+ adminLogin();
+
+ // access to votefor page with no accountId (will use the userAccount)
+ gotoUrl(urlFixtures.voteforPoll(pollUri), true);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can vote
+ checkCanVote(adminVotePollUri);
+
+ // can modifiy his vote
+ canModifyAdminVote();
+
+ // can delete all votes
+ canDeleteAllVotes();
+
+ // poll present in participant poll
+ gotoUrl(urlFixtures.participatedList(), true);
+
+ //FIXME Find out how to wait until jquery is done (or can direct call the json query)
+ // found poll in grid
+// checkPollFoundInGrid(pollId);
+ }
+
+}
Property changes on: trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/everybody/EverybodyFreePollByConnectedIT.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/everybody/EverybodyFreePollByNotConnectedIT.java
===================================================================
--- trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/everybody/EverybodyFreePollByNotConnectedIT.java (rev 0)
+++ trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/everybody/EverybodyFreePollByNotConnectedIT.java 2012-08-26 23:15:33 UTC (rev 3639)
@@ -0,0 +1,201 @@
+package org.chorem.pollen.ui.it.everybody;
+
+import org.chorem.pollen.ui.it.AbstractIT;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+
+/**
+ * Test a everybody free poll created by a not connected user.
+ * <p/>
+ * For that poll everybody can see votes.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.4.5
+ */
+public class EverybodyFreePollByNotConnectedIT extends AbstractIT {
+
+ public EverybodyFreePollByNotConnectedIT(Class<? extends WebDriver> driverType) {
+ super(driverType,
+ "2262a31f374e4969bb3593e762c0cae6",
+ "659bb046fc06493f9909ca9f34ca6261",
+ "6909131490ab4a1abae0daaf15129cdb",
+ "f058910736af48e9905f83f3f5de5b8d",
+ "2d97c079df054a7c9fc321b2df3488f3");
+ }
+
+ @Test
+ public void checkSummaryPollPage() {
+
+ // can not access to summary page with no pollId
+ gotoUrl(urlFixtures.summaryPoll(), urlFixtures.poll_required(), false);
+
+ // can not access to summary page with no creatorId
+ gotoUrl(urlFixtures.summaryPoll(pollUri), urlFixtures.poll_creator_required(), false);
+
+ // access to summary page
+ gotoUrl(urlFixtures.summaryPoll(creatorUri), true);
+
+ // user can vote (#voteUrl)
+ findElement(By.id("voteUrl"));
+ }
+
+ @Test
+ public void checkModeratePollPage() {
+
+ // can not access to moderate page with no pollId
+ gotoUrl(urlFixtures.moderatePoll(), urlFixtures.poll_required(), false);
+
+ // can not access to moderate page with no creatorId
+ gotoUrl(urlFixtures.moderatePoll(pollUri), urlFixtures.poll_creator_required(), false);
+
+ // access to moderate page
+ gotoUrl(urlFixtures.moderatePoll(creatorUri), true);
+
+ // can not vote
+ checkCanNotVote(creatorUri);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can delete all votes
+ canDeleteAllVotes();
+ }
+
+ @Test
+ public void checkVoteForPageWithCreatorId() {
+
+ // access to votefor page with creatorId
+ gotoUrl(urlFixtures.voteforPoll(creatorUri), true);
+
+ // can not vote
+ checkCanNotVote(creatorUri);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can delete all votes
+ canDeleteAllVotes();
+ }
+
+ @Test
+ public void checkVoteForPageWithNoAccountId() {
+
+ // access to votefor page with no accountId
+ gotoUrl(urlFixtures.voteforPoll(pollUri), true);
+
+ // can vote
+ checkCanVote(pollUri);
+
+ // can see all votes
+ canSeeAllVotes();
+ }
+
+ @Test
+ public void checkVoteWithNotConnectedVoteAccountId() {
+
+ // access to votefor page with notConnected voter
+ gotoUrl(urlFixtures.voteforPoll(notConnectedVotePollUri), true);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can vote
+ checkCanVote(notConnectedVotePollUri);
+
+ // can modifiy his vote
+ canModifyNotConnectedVote();
+
+ // can delete his vote
+ canDeleteNotConnectedVote();
+ }
+
+ @Test
+ public void checkVoteWithConnectedVoteAccountId() {
+
+ // access to votefor page with no accountId
+ gotoUrl(urlFixtures.voteforPoll(connectedVotePollUri), true);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can vote
+ checkCanVote(connectedVotePollUri);
+
+ // can modifiy his vote
+ canModifyUserVote();
+
+ // can delete his vote
+ canDeleteConnectedVote();
+
+ // connect as user
+ userLogin();
+
+ // access to votefor page with no accountId (will use the userAccount)
+ gotoUrl(urlFixtures.voteforPoll(pollUri), true);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can vote
+ checkCanVote(connectedVotePollUri);
+
+ // can modifiy his vote
+ canModifyUserVote();
+
+ // can delete his vote
+ canDeleteConnectedVote();
+
+ // poll present in participant poll
+ gotoUrl(urlFixtures.participatedList(), true);
+
+ //FIXME Find out how to wait until jquery is done (or can direct call the json query)
+ // found poll in grid
+// checkPollFoundInGrid(pollId);
+ }
+
+ @Test
+ public void checkVoteWithAdminVoteAccountId() {
+
+ // access to votefor page with no accountId
+ gotoUrl(urlFixtures.voteforPoll(adminVotePollUri), true);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can vote
+ checkCanVote(adminVotePollUri);
+
+ // can modifiy his vote
+ canModifyAdminVote();
+
+ // can delete his vote
+ canDeleteAdminVote();
+
+ // connect as admin
+ adminLogin();
+
+ // access to votefor page with no accountId (will use the userAccount)
+ gotoUrl(urlFixtures.voteforPoll(pollUri), true);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can vote
+ checkCanVote(adminVotePollUri);
+
+ // can modifiy his vote
+ canModifyAdminVote();
+
+ // can delete all votes
+ canDeleteAllVotes();
+
+ // poll present in participant poll
+ gotoUrl(urlFixtures.participatedList(), true);
+
+ //FIXME Find out how to wait until jquery is done (or can direct call the json query)
+ // found poll in grid
+// checkPollFoundInGrid(pollId);
+ }
+
+}
Property changes on: trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/everybody/EverybodyFreePollByNotConnectedIT.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/voterOnly/VoterOnlyFreePollByAdminIT.java
===================================================================
--- trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/voterOnly/VoterOnlyFreePollByAdminIT.java (rev 0)
+++ trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/voterOnly/VoterOnlyFreePollByAdminIT.java 2012-08-26 23:15:33 UTC (rev 3639)
@@ -0,0 +1,201 @@
+package org.chorem.pollen.ui.it.voterOnly;
+
+import org.chorem.pollen.ui.it.AbstractIT;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+
+/**
+ * Test a voter only free poll created by a administrator user.
+ * <p/>
+ * For that poll only voter, creator or administrator can see votes.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.4.5
+ */
+public class VoterOnlyFreePollByAdminIT extends AbstractIT {
+
+ public VoterOnlyFreePollByAdminIT(Class<? extends WebDriver> driverType) {
+ super(driverType,
+ "7103c6d4a79246699425e99e1f344b98",
+ "717ebe61a3b64fcea453c9cba5953149",
+ "ad50a5d406d84aa09e3a02dd9ad0116c",
+ "24abe4ba077341b489af505531ac93de",
+ "2237dbc51f7c4268a8a7e10f6146ae87");
+ }
+
+ @Test
+ public void checkSummaryPollPage() {
+
+ // can not access to summary page with no pollId
+ gotoUrl(urlFixtures.summaryPoll(), urlFixtures.poll_required(), false);
+
+ // can not access to summary page with no creatorId
+ gotoUrl(urlFixtures.summaryPoll(pollUri), urlFixtures.poll_creator_required(), false);
+
+ // access to summary page
+ gotoUrl(urlFixtures.summaryPoll(creatorUri), true);
+
+ // user can vote (#voteUrl)
+ findElement(By.id("voteUrl"));
+ }
+
+ @Test
+ public void checkModeratePollPage() {
+
+ // can not access to moderate page with no pollId
+ gotoUrl(urlFixtures.moderatePoll(), urlFixtures.poll_required(), false);
+
+ // can not access to moderate page with no creatorId
+ gotoUrl(urlFixtures.moderatePoll(pollUri), urlFixtures.poll_creator_required(), false);
+
+ // access to moderate page
+ gotoUrl(urlFixtures.moderatePoll(creatorUri), true);
+
+ // can not vote
+ checkCanNotVote(creatorUri);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can delete all votes
+ canDeleteAllVotes();
+ }
+
+ @Test
+ public void checkVoteForPageWithCreatorId() {
+
+ // access to votefor page with creatorId
+ gotoUrl(urlFixtures.voteforPoll(creatorUri), true);
+
+ // can not vote
+ checkCanNotVote(creatorUri);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can delete all votes
+ canDeleteAllVotes();
+ }
+
+ @Test
+ public void checkVoteForPageWithNoAccountId() {
+
+ // access to votefor page with no accountId
+ gotoUrl(urlFixtures.voteforPoll(pollUri), true);
+
+ // can vote
+ checkCanVote(pollUri);
+
+ // can not see votes
+ canNotSeeAnyVote();
+ }
+
+ @Test
+ public void checkVoteWithNotConnectedVoteAccountId() {
+
+ // access to votefor page with notConnected voter
+ gotoUrl(urlFixtures.voteforPoll(notConnectedVotePollUri), true);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can vote
+ checkCanVote(notConnectedVotePollUri);
+
+ // can modifiy his vote
+ canModifyNotConnectedVote();
+
+ // can delete his vote
+ canDeleteNotConnectedVote();
+ }
+
+ @Test
+ public void checkVoteWithConnectedVoteAccountId() {
+
+ // access to votefor page with no accountId
+ gotoUrl(urlFixtures.voteforPoll(connectedVotePollUri), true);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can vote
+ checkCanVote(connectedVotePollUri);
+
+ // can modifiy his vote
+ canModifyUserVote();
+
+ // can delete his vote
+ canDeleteConnectedVote();
+
+ // connect as user (he is the creator)
+ userLogin();
+
+ // access to votefor page with no accountId (will use the userAccount)
+ gotoUrl(urlFixtures.voteforPoll(pollUri), true);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can vote
+ checkCanVote(connectedVotePollUri);
+
+ // can modifiy his vote
+ canModifyUserVote();
+
+ // can delete his votes
+ canDeleteConnectedVote();
+
+ // poll present in participant poll
+ gotoUrl(urlFixtures.participatedList(), true);
+
+ //FIXME Find out how to wait until jquery is done (or can direct call the json query)
+ // found poll in grid
+// checkPollFoundInGrid(pollId);
+ }
+
+ @Test
+ public void checkVoteWithAdminVoteAccountId() {
+
+ // access to votefor page with no accountId
+ gotoUrl(urlFixtures.voteforPoll(adminVotePollUri), true);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can vote
+ checkCanVote(adminVotePollUri);
+
+ // can modifiy his vote
+ canModifyAdminVote();
+
+ // can delete his vote
+ canDeleteAdminVote();
+
+ // connect as admin
+ adminLogin();
+
+ // access to votefor page with no accountId (will use the userAccount)
+ gotoUrl(urlFixtures.voteforPoll(pollUri), true);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can vote
+ checkCanVote(adminVotePollUri);
+
+ // can modifiy his vote
+ canModifyAdminVote();
+
+ // can delete all votes
+ canDeleteAllVotes();
+
+ // poll present in participant poll
+ gotoUrl(urlFixtures.participatedList(), true);
+
+ //FIXME Find out how to wait until jquery is done (or can direct call the json query)
+ // found poll in grid
+// checkPollFoundInGrid(pollId);
+ }
+
+}
Property changes on: trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/voterOnly/VoterOnlyFreePollByAdminIT.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/voterOnly/VoterOnlyFreePollByConnectedIT.java
===================================================================
--- trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/voterOnly/VoterOnlyFreePollByConnectedIT.java (rev 0)
+++ trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/voterOnly/VoterOnlyFreePollByConnectedIT.java 2012-08-26 23:15:33 UTC (rev 3639)
@@ -0,0 +1,200 @@
+package org.chorem.pollen.ui.it.voterOnly;
+
+import org.chorem.pollen.ui.it.AbstractIT;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+
+/**
+ * Test a voter only free poll created by a connected user.
+ * <p/>
+ * For that poll only voter, creator or administrator can see votes.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.4.5
+ */
+public class VoterOnlyFreePollByConnectedIT extends AbstractIT {
+
+ public VoterOnlyFreePollByConnectedIT(Class<? extends WebDriver> driverType) {
+ super(driverType,
+ "b321ddccf7d743bf9c67b2664231d14f",
+ "a48f1b97a3f84443845009c074298bce",
+ "938e4831d7d547a59fd6d76c3bdfe6b5",
+ "b3e407acc97b4911b0de470b1d45a68f",
+ "6f980a4541e04edd9dec95d3dbde0830");
+ }
+
+ @Test
+ public void checkSummaryPollPage() {
+
+ // can not access to summary page with no pollId
+ gotoUrl(urlFixtures.summaryPoll(), urlFixtures.poll_required(), false);
+
+ // can not access to summary page with no creatorId
+ gotoUrl(urlFixtures.summaryPoll(pollUri), urlFixtures.poll_creator_required(), false);
+
+ // access to summary page
+ gotoUrl(urlFixtures.summaryPoll(creatorUri), true);
+
+ // user can vote (#voteUrl)
+ findElement(By.id("voteUrl"));
+ }
+
+ @Test
+ public void checkModeratePollPage() {
+
+ // can not access to moderate page with no pollId
+ gotoUrl(urlFixtures.moderatePoll(), urlFixtures.poll_required(), false);
+
+ // can not access to moderate page with no creatorId
+ gotoUrl(urlFixtures.moderatePoll(pollUri), urlFixtures.poll_creator_required(), false);
+
+ // access to moderate page
+ gotoUrl(urlFixtures.moderatePoll(creatorUri), true);
+
+ // can not vote
+ checkCanNotVote(creatorUri);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can delete all votes
+ canDeleteAllVotes();
+ }
+
+ @Test
+ public void checkVoteForPageWithCreatorId() {
+
+ // access to votefor page with creatorId
+ gotoUrl(urlFixtures.voteforPoll(creatorUri), true);
+
+ // can not vote
+ checkCanNotVote(creatorUri);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can delete all votes
+ canDeleteAllVotes();
+ }
+
+ @Test
+ public void checkVoteForPageWithNoAccountId() {
+
+ // access to votefor page with no accountId
+ gotoUrl(urlFixtures.voteforPoll(pollUri), true);
+
+ // can vote
+ checkCanVote(pollUri);
+
+ // can not see votes
+ canNotSeeAnyVote();
+ }
+
+ @Test
+ public void checkVoteWithNotConnectedVoteAccountId() {
+
+ // access to votefor page with notConnected voter
+ gotoUrl(urlFixtures.voteforPoll(notConnectedVotePollUri), true);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can vote
+ checkCanVote(notConnectedVotePollUri);
+
+ // can modifiy his vote
+ canModifyNotConnectedVote();
+
+ // can delete his vote
+ canDeleteNotConnectedVote();
+ }
+
+ @Test
+ public void checkVoteWithConnectedVoteAccountId() {
+
+ // access to votefor page with no accountId
+ gotoUrl(urlFixtures.voteforPoll(connectedVotePollUri), true);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can vote
+ checkCanVote(connectedVotePollUri);
+
+ // can modifiy his vote
+ canModifyUserVote();
+
+ // can delete his vote
+ canDeleteConnectedVote();
+
+ // connect as user (he is the creator)
+ userLogin();
+
+ // access to votefor page with no accountId (will use the userAccount)
+ gotoUrl(urlFixtures.voteforPoll(pollUri), true);
+
+ // can see all votes (user is creator)
+ canSeeAllVotes();
+
+ // can vote
+ checkCanVote(connectedVotePollUri);
+
+ // can modifiy his vote
+ canModifyUserVote();
+
+ // can delete all votes
+ canDeleteAllVotes();
+
+ // poll present in participant poll
+ gotoUrl(urlFixtures.participatedList(), true);
+
+ //FIXME Find out how to wait until jquery is done (or can direct call the json query)
+ // found poll in grid
+// checkPollFoundInGrid(pollId);
+ }
+
+ @Test
+ public void checkVoteWithAdminVoteAccountId() {
+
+ // access to votefor page with no accountId
+ gotoUrl(urlFixtures.voteforPoll(adminVotePollUri), true);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can vote
+ checkCanVote(adminVotePollUri);
+
+ // can modifiy his vote
+ canModifyAdminVote();
+
+ // can delete his vote
+ canDeleteAdminVote();
+
+ // connect as admin
+ adminLogin();
+
+ // access to votefor page with no accountId (will use the userAccount)
+ gotoUrl(urlFixtures.voteforPoll(pollUri), true);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can vote
+ checkCanVote(adminVotePollUri);
+
+ // can modifiy his vote
+ canModifyAdminVote();
+
+ // can delete all votes
+ canDeleteAllVotes();
+
+ // poll present in participant poll
+ gotoUrl(urlFixtures.participatedList(), true);
+
+ //FIXME Find out how to wait until jquery is done (or can direct call the json query)
+ // found poll in grid
+// checkPollFoundInGrid(pollId);
+ }
+}
Property changes on: trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/voterOnly/VoterOnlyFreePollByConnectedIT.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/voterOnly/VoterOnlyFreePollByNotConnectedIT.java
===================================================================
--- trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/voterOnly/VoterOnlyFreePollByNotConnectedIT.java (rev 0)
+++ trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/voterOnly/VoterOnlyFreePollByNotConnectedIT.java 2012-08-26 23:15:33 UTC (rev 3639)
@@ -0,0 +1,201 @@
+package org.chorem.pollen.ui.it.voterOnly;
+
+import org.chorem.pollen.ui.it.AbstractIT;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+
+/**
+ * Test a voter only free poll created by a not connected user.
+ * <p/>
+ * For that poll only voter, creator or administrator can see votes.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.4.5
+ */
+public class VoterOnlyFreePollByNotConnectedIT extends AbstractIT {
+
+ public VoterOnlyFreePollByNotConnectedIT(Class<? extends WebDriver> driverType) {
+ super(driverType,
+ "8518ede7bf1247d2ba0dfe222575c5ba",
+ "ea5c96d4d44547f9b0717f30bfa6dd03",
+ "fa914a31f6c94cfa8561f48e3c45d6cf",
+ "5c67d277460b4b4eb1fb59a26bf4a622",
+ "28d450be407e4eabbb787739ec27ae52");
+ }
+
+ @Test
+ public void checkSummaryPollPage() {
+
+ // can not access to summary page with no pollId
+ gotoUrl(urlFixtures.summaryPoll(), urlFixtures.poll_required(), false);
+
+ // can not access to summary page with no creatorId
+ gotoUrl(urlFixtures.summaryPoll(pollUri), urlFixtures.poll_creator_required(), false);
+
+ // access to summary page
+ gotoUrl(urlFixtures.summaryPoll(creatorUri), true);
+
+ // user can vote (#voteUrl)
+ findElement(By.id("voteUrl"));
+ }
+
+ @Test
+ public void checkModeratePollPage() {
+
+ // can not access to moderate page with no pollId
+ gotoUrl(urlFixtures.moderatePoll(), urlFixtures.poll_required(), false);
+
+ // can not access to moderate page with no creatorId
+ gotoUrl(urlFixtures.moderatePoll(pollUri), urlFixtures.poll_creator_required(), false);
+
+ // access to moderate page
+ gotoUrl(urlFixtures.moderatePoll(creatorUri), true);
+
+ // can not vote
+ checkCanNotVote(creatorUri);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can delete all votes
+ canDeleteAllVotes();
+ }
+
+ @Test
+ public void checkVoteForPageWithCreatorId() {
+
+ // access to votefor page with creatorId
+ gotoUrl(urlFixtures.voteforPoll(creatorUri), true);
+
+ // can not vote
+ checkCanNotVote(creatorUri);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can delete all votes
+ canDeleteAllVotes();
+ }
+
+ @Test
+ public void checkVoteForPageWithNoAccountId() {
+
+ // access to votefor page with no accountId
+ gotoUrl(urlFixtures.voteforPoll(pollUri), true);
+
+ // can vote
+ checkCanVote(pollUri);
+
+ // can not see votes
+ canNotSeeAnyVote();
+ }
+
+ @Test
+ public void checkVoteWithNotConnectedVoteAccountId() {
+
+ // access to votefor page with notConnected voter
+ gotoUrl(urlFixtures.voteforPoll(notConnectedVotePollUri), true);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can vote
+ checkCanVote(notConnectedVotePollUri);
+
+ // can modifiy his vote
+ canModifyNotConnectedVote();
+
+ // can delete his vote
+ canDeleteNotConnectedVote();
+ }
+
+ @Test
+ public void checkVoteWithConnectedVoteAccountId() {
+
+ // access to votefor page with no accountId
+ gotoUrl(urlFixtures.voteforPoll(connectedVotePollUri), true);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can vote
+ checkCanVote(connectedVotePollUri);
+
+ // can modifiy his vote
+ canModifyUserVote();
+
+ // can delete his vote
+ canDeleteConnectedVote();
+
+ // connect as user
+ userLogin();
+
+ // access to votefor page with no accountId (will use the userAccount)
+ gotoUrl(urlFixtures.voteforPoll(pollUri), true);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can vote
+ checkCanVote(connectedVotePollUri);
+
+ // can modifiy his vote
+ canModifyUserVote();
+
+ // can delete his vote
+ canDeleteConnectedVote();
+
+ // poll present in participant poll
+ gotoUrl(urlFixtures.participatedList(), true);
+
+ //FIXME Find out how to wait until jquery is done (or can direct call the json query)
+ // found poll in grid
+// checkPollFoundInGrid(pollId);
+ }
+
+ @Test
+ public void checkVoteWithAdminVoteAccountId() {
+
+ // access to votefor page with no accountId
+ gotoUrl(urlFixtures.voteforPoll(adminVotePollUri), true);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can vote
+ checkCanVote(adminVotePollUri);
+
+ // can modifiy his vote
+ canModifyAdminVote();
+
+ // can delete his vote
+ canDeleteAdminVote();
+
+ // connect as admin
+ adminLogin();
+
+ // access to votefor page with no accountId (will use the userAccount)
+ gotoUrl(urlFixtures.voteforPoll(pollUri), true);
+
+ // can see all votes
+ canSeeAllVotes();
+
+ // can vote
+ checkCanVote(adminVotePollUri);
+
+ // can modifiy his vote
+ canModifyAdminVote();
+
+ // can delete all votes
+ canDeleteAllVotes();
+
+ // poll present in participant poll
+ gotoUrl(urlFixtures.participatedList(), true);
+
+ //FIXME Find out how to wait until jquery is done (or can direct call the json query)
+ // found poll in grid
+// checkPollFoundInGrid(pollId);
+ }
+
+}
Property changes on: trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/voterOnly/VoterOnlyFreePollByNotConnectedIT.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
1
0
Author: tchemit
Date: 2012-08-27 01:14:26 +0200 (Mon, 27 Aug 2012)
New Revision: 3638
Url: http://chorem.org/repositories/revision/pollen/3638
Log:
split prepare-its and run-its
Modified:
trunk/pollen-ui-struts2/pom.xml
Modified: trunk/pollen-ui-struts2/pom.xml
===================================================================
--- trunk/pollen-ui-struts2/pom.xml 2012-08-26 23:13:45 UTC (rev 3637)
+++ trunk/pollen-ui-struts2/pom.xml 2012-08-26 23:14:26 UTC (rev 3638)
@@ -556,10 +556,10 @@
</profile>
<profile>
- <id>run-its</id>
+ <id>prepare-its</id>
<activation>
<property>
- <name>performRelease</name>
+ <name>runIts</name>
<value>true</value>
</property>
</activation>
@@ -589,7 +589,33 @@
</pomIncludes>
</configuration>
</execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>run-its</id>
+ <activation>
+ <property>
+ <name>runIts</name>
+ <value>true</value>
+ </property>
+ </activation>
+ <build>
+ <defaultGoal>integration-test</defaultGoal>
+ <plugins>
+ <plugin>
+ <artifactId>maven-invoker-plugin</artifactId>
+ <configuration>
+ <localRepositoryPath>
+ ${project.build.directory}/it-repo
+ </localRepositoryPath>
+ <settingsFile>src/it/settings.xml</settingsFile>
+ <cloneProjectsTo>${project.build.directory}/its</cloneProjectsTo>
+ </configuration>
+ <executions>
<execution>
<id>integration-test</id>
<goals>
@@ -604,11 +630,18 @@
</pomIncludes>
</configuration>
</execution>
-
</executions>
</plugin>
</plugins>
</build>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <artifactId>maven-invoker-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </reporting>
</profile>
<profile>
@@ -620,14 +653,6 @@
</property>
</activation>
- <reporting>
- <plugins>
- <plugin>
- <artifactId>maven-invoker-plugin</artifactId>
- </plugin>
- </plugins>
- </reporting>
-
<build>
<plugins>
<plugin>
1
0
r3637 - in trunk/pollen-ui-struts2/src: it/security/src/test/java/org/chorem/pollen/ui/it test/java/org/chorem/pollen/ui/it
by tchemit@users.chorem.org 26 Aug '12
by tchemit@users.chorem.org 26 Aug '12
26 Aug '12
Author: tchemit
Date: 2012-08-27 01:13:45 +0200 (Mon, 27 Aug 2012)
New Revision: 3637
Url: http://chorem.org/repositories/revision/pollen/3637
Log:
improve abstract test it
Modified:
trunk/pollen-ui-struts2/src/it/security/src/test/java/org/chorem/pollen/ui/it/LoginSIT.java
trunk/pollen-ui-struts2/src/it/security/src/test/java/org/chorem/pollen/ui/it/SecurityAccessSIT.java
trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/AbstractPollIT.java
trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/AbstractPollenIT.java
Modified: trunk/pollen-ui-struts2/src/it/security/src/test/java/org/chorem/pollen/ui/it/LoginSIT.java
===================================================================
--- trunk/pollen-ui-struts2/src/it/security/src/test/java/org/chorem/pollen/ui/it/LoginSIT.java 2012-08-26 23:10:57 UTC (rev 3636)
+++ trunk/pollen-ui-struts2/src/it/security/src/test/java/org/chorem/pollen/ui/it/LoginSIT.java 2012-08-26 23:13:45 UTC (rev 3637)
@@ -23,10 +23,8 @@
@Test
public void loginAdmin() {
-// gotoUrl(urlFixtures.home());
+ adminLogin();
- connect("admin", "admin");
-
// check info_success is on
findElement(By.className("info_success"));
@@ -38,10 +36,8 @@
@Test
public void loginUser() {
-// gotoUrl(urlFixtures.home());
+ userLogin();
- connect("user", "user");
-
// check info_success is on
findElement(By.className("info_success"));
Modified: trunk/pollen-ui-struts2/src/it/security/src/test/java/org/chorem/pollen/ui/it/SecurityAccessSIT.java
===================================================================
--- trunk/pollen-ui-struts2/src/it/security/src/test/java/org/chorem/pollen/ui/it/SecurityAccessSIT.java 2012-08-26 23:10:57 UTC (rev 3636)
+++ trunk/pollen-ui-struts2/src/it/security/src/test/java/org/chorem/pollen/ui/it/SecurityAccessSIT.java 2012-08-26 23:13:45 UTC (rev 3637)
@@ -205,25 +205,22 @@
public void accessNormalPollActionsAsAnonymous() {
String badPollId = pollId + System.nanoTime();
- String badCreatorId = accountId + System.nanoTime();
+ String badCreatorId = creatorId + System.nanoTime();
// try to access to poll page, current url should be good one
- String normalPollURL = urlFixtures.voteforPoll(pollUri);
- gotoUrl(normalPollURL);
+ gotoUrl(urlFixtures.voteforPoll(pollUri));
// try to access to poll page with bad pollId, current url should be the poll_required one
gotoUrl(urlFixtures.voteforPoll(PollUri.newPollUri(badPollId)), urlFixtures.poll_required(), false);
// try to access to poll moderation page, current url should be good one
- String moderationURL = urlFixtures.voteforPoll(adminPollUri);
- gotoUrl(moderationURL);
+ gotoUrl(urlFixtures.voteforPoll(creatorUri));
// try to access to poll page with bad pollId, current url should be the poll_required one
gotoUrl(urlFixtures.voteforPoll(newPollUri(badCreatorId)), urlFixtures.poll_access_required(), false);
// try to access to poll moderation page, current url should be good one
- String normalPollAdminURL = urlFixtures.editPoll(adminPollUri);
- gotoUrl(normalPollAdminURL);
+ gotoUrl(urlFixtures.editPoll(creatorUri));
// try to access to poll page with bad pollId, current url should be the poll_required one
gotoUrl(urlFixtures.editPoll(newPollUri(badCreatorId)), urlFixtures.poll_creator_required(), false);
@@ -250,29 +247,25 @@
connect("admin", "admin");
String badPollId = pollId + System.nanoTime();
- String badCreatorId = accountId + System.nanoTime();
+ String badCreatorId = creatorId + System.nanoTime();
// try to access to poll page, current url should be good one
- String normalPollURL = urlFixtures.voteforPoll(pollUri);
- gotoUrl(normalPollURL);
+ gotoUrl(urlFixtures.voteforPoll(pollUri));
// try to access to poll page with bad pollId, current url should be the poll_required one
gotoUrl(urlFixtures.voteforPoll(PollUri.newPollUri(badPollId)), urlFixtures.poll_required(), false);
// try to access to poll moderation page, current url should be good one
- String moderationURL = urlFixtures.voteforPoll(adminPollUri);
- gotoUrl(moderationURL);
+ gotoUrl(urlFixtures.voteforPoll(creatorUri));
// try to access to poll page with bad creatorId, current url should be the poll_required one
gotoUrl(urlFixtures.voteforPoll(newPollUri(badCreatorId)), urlFixtures.poll_access_required(), false);
// try to access to poll modification page without creator Id, current url should be good one (admin access)
- String simpleNormalPollAdminURL = urlFixtures.editPoll(pollUri);
- gotoUrl(simpleNormalPollAdminURL);
+ gotoUrl(urlFixtures.editPoll(pollUri));
// try to access to poll modification page with creator Id, current url should be good one
- String normalPollAdminURL = urlFixtures.editPoll(adminPollUri);
- gotoUrl(normalPollAdminURL);
+ gotoUrl(urlFixtures.editPoll(creatorUri));
// 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(urlFixtures.editPoll(newPollUri(badCreatorId)), urlFixtures.poll_creator_required(), false);
@@ -299,29 +292,25 @@
connect("user", "user");
String badPollId = pollId + System.nanoTime();
- String badCreatorId = accountId + System.nanoTime();
+ String badCreatorId = creatorId + System.nanoTime();
// try to access to poll page, current url should be good one
- String normalPollURL = urlFixtures.voteforPoll(pollUri);
- gotoUrl(normalPollURL);
+ gotoUrl(urlFixtures.voteforPoll(pollUri));
// try to access to poll page with bad pollId, current url should be the poll_required one
gotoUrl(urlFixtures.voteforPoll(PollUri.newPollUri(badPollId)), urlFixtures.poll_required(), false);
// try to access to poll moderation page, current url should be good one
- String moderationURL = urlFixtures.voteforPoll(adminPollUri);
- gotoUrl(moderationURL);
+ gotoUrl(urlFixtures.voteforPoll(creatorUri));
// try to access to poll page with bad pollId, current url should be the poll_required one
gotoUrl(urlFixtures.voteforPoll(newPollUri(badCreatorId)), urlFixtures.poll_access_required(), false);
// try to access to poll modification page without creator Id, current url should be good one (owner access)
- String simpleNormalPollModificationURL = urlFixtures.editPoll(pollUri);
- gotoUrl(simpleNormalPollModificationURL);
+ gotoUrl(urlFixtures.editPoll(pollUri));
// try to access to poll modification page with creator Id, current url should be good one
- String normalPollModificationURL = urlFixtures.editPoll(adminPollUri);
- gotoUrl(normalPollModificationURL);
+ gotoUrl(urlFixtures.editPoll(creatorUri));
// 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(urlFixtures.editPoll(newPollUri(badCreatorId)), urlFixtures.poll_creator_required(), false);
Modified: trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/AbstractPollIT.java
===================================================================
--- trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/AbstractPollIT.java 2012-08-26 23:10:57 UTC (rev 3636)
+++ trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/AbstractPollIT.java 2012-08-26 23:13:45 UTC (rev 3637)
@@ -16,22 +16,22 @@
protected final String pollId;
/** {@link Poll#getCreator()#accountId} */
- protected final String accountId;
+ protected final String creatorId;
/** {@link PollUri} of the poll (with no accountId) */
protected final PollUri pollUri;
- /** {@link PollUri} of the poll (with admin accountId ) */
- protected final PollUri adminPollUri;
+ /** {@link PollUri} of the poll (with admin accountId) */
+ protected final PollUri creatorUri;
protected AbstractPollIT(Class<? extends WebDriver> driverType,
- String pollId, String accountId) {
+ String pollId, String creatorId) {
super(driverType);
this.pollId = pollId;
- this.accountId = accountId;
+ this.creatorId = creatorId;
pollUri = PollUri.newPollUri(pollId);
- adminPollUri = PollUri.newPollUri(pollId, accountId);
+ creatorUri = PollUri.newPollUri(pollId, creatorId);
}
protected PollUri newPollUri(String accountId) {
Modified: trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/AbstractPollenIT.java
===================================================================
--- trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/AbstractPollenIT.java 2012-08-26 23:10:57 UTC (rev 3636)
+++ trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/AbstractPollenIT.java 2012-08-26 23:13:45 UTC (rev 3637)
@@ -238,4 +238,16 @@
protected String date(int year, int month, int day) {
return date(year, month, day, 0, 0);
}
+
+ protected void userLogin() {
+ connect("user", "user");
+ }
+
+ protected void user2Login() {
+ connect("user2", "user2");
+ }
+
+ protected void adminLogin() {
+ connect("admin", "admin");
+ }
}
1
0
26 Aug '12
Author: tchemit
Date: 2012-08-27 01:10:57 +0200 (Mon, 27 Aug 2012)
New Revision: 3636
Url: http://chorem.org/repositories/revision/pollen/3636
Log:
not very usefull to precompile jps
Modified:
trunk/pollen-ui-struts2/src/it/pollen-ui-it/pom.xml
Modified: trunk/pollen-ui-struts2/src/it/pollen-ui-it/pom.xml
===================================================================
--- trunk/pollen-ui-struts2/src/it/pollen-ui-it/pom.xml 2012-08-26 23:01:29 UTC (rev 3635)
+++ trunk/pollen-ui-struts2/src/it/pollen-ui-it/pom.xml 2012-08-26 23:10:57 UTC (rev 3636)
@@ -113,6 +113,34 @@
<outputDirectory>
${project.build.directory}/war
</outputDirectory>
+ <excludes>**/lib/*.jar</excludes>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!--plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <inherited>false</inherited>
+ <executions>
+ <execution>
+ <id>default-unpack</id>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.chorem.pollen</groupId>
+ <artifactId>pollen-ui-struts2</artifactId>
+ <version>${project.version}</version>
+ <type>war</type>
+ <overWrite>true</overWrite>
+ <outputDirectory>
+ ${project.build.directory}/war
+ </outputDirectory>
<excludes>**/lib/*.jar,**/*.jsp</excludes>
</artifactItem>
<artifactItem>
@@ -144,7 +172,6 @@
<goal>jspc</goal>
</goals>
<configuration>
- <!--<verbose>true</verbose>-->
<webAppSourceDirectory>
${project.build.directory}/toprocess
</webAppSourceDirectory>
@@ -184,7 +211,7 @@
<version>${struts2Version}</version>
</dependency>
</dependencies>
- </plugin>
+ </plugin-->
</plugins>
1
0
r3635 - trunk/pollen-persistence/src/main/java/org/chorem/pollen/business/persistence
by tchemit@users.chorem.org 26 Aug '12
by tchemit@users.chorem.org 26 Aug '12
26 Aug '12
Author: tchemit
Date: 2012-08-27 01:01:29 +0200 (Mon, 27 Aug 2012)
New Revision: 3635
Url: http://chorem.org/repositories/revision/pollen/3635
Log:
fix request when user is connected + have a account id then result is not unique
Modified:
trunk/pollen-persistence/src/main/java/org/chorem/pollen/business/persistence/PollAccountDAOImpl.java
Modified: trunk/pollen-persistence/src/main/java/org/chorem/pollen/business/persistence/PollAccountDAOImpl.java
===================================================================
--- trunk/pollen-persistence/src/main/java/org/chorem/pollen/business/persistence/PollAccountDAOImpl.java 2012-08-26 21:41:13 UTC (rev 3634)
+++ trunk/pollen-persistence/src/main/java/org/chorem/pollen/business/persistence/PollAccountDAOImpl.java 2012-08-26 23:01:29 UTC (rev 3635)
@@ -111,7 +111,7 @@
Preconditions.checkArgument(StringUtils.isNotBlank(accountId) ||
user != null);
- String hql = "SELECT e FROM PollAccountImpl e, PollImpl p, VoteImpl v WHERE " +
+ String hql = "SELECT distinct(e) FROM PollAccountImpl e, PollImpl p, VoteImpl v WHERE " +
"p.pollId = :pollId AND " +
"v in elements (p.vote) AND " +
"e = v.pollAccount AND ";
1
0
r3634 - trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll
by tchemit@users.chorem.org 26 Aug '12
by tchemit@users.chorem.org 26 Aug '12
26 Aug '12
Author: tchemit
Date: 2012-08-26 23:41:13 +0200 (Sun, 26 Aug 2012)
New Revision: 3634
Url: http://chorem.org/repositories/revision/pollen/3634
Log:
add marking id
Modified:
trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp
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-08-26 17:04:35 UTC (rev 3633)
+++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp 2012-08-26 21:41:13 UTC (rev 3634)
@@ -309,7 +309,7 @@
<tbody>
<s:if test="!poll.anonymous">
<s:iterator value="votes" var="vote">
- <tr>
+ <tr id='vote_<s:property value="%{#vote.pollAccount.accountId}"/>'>
<td>
<s:if test="accountFieldDisplayed">
<s:if test="!#vote.anonymous">
@@ -321,7 +321,7 @@
</s:if>
<s:if test="isModifyVoteAllowed(#vote)">
<s:a action="votefor/%{poll.pollId}:%{#vote.pollAccount.accountId}"
- namespace="/poll">
+ namespace="/poll" id='modifyVote_%{#vote.pollAccount.accountId}'>
<img src="<s:url value="/img/editSmall.png"/>"
title="<s:text name="pollen.action.editVote"/>"
alt="<s:text name="pollen.action.editVote"/>"/>
@@ -329,7 +329,8 @@
</s:if>
<s:if test="isDeleteVoteAllowed(#vote)">
<s:a action="deleteVote/%{pollUri}" namespace="/poll" href="#"
- onclick="return openDeleteVoteDialog('%{#vote.topiaId}');">
+ onclick="return openDeleteVoteDialog('%{#vote.topiaId}');"
+ id='deleteVote_%{#vote.pollAccount.accountId}'>
<img src="<s:url value="/img/delete.png"/>"
title="<s:text name="pollen.action.deleteVote"/>"
alt="<s:text name="pollen.action.deleteVote"/>"/>
1
0
Author: tchemit
Date: 2012-08-26 19:04:35 +0200 (Sun, 26 Aug 2012)
New Revision: 3633
Url: http://chorem.org/repositories/revision/pollen/3633
Log:
remove old selenium configuration + add it reporting
Modified:
trunk/pollen-ui-struts2/pom.xml
Modified: trunk/pollen-ui-struts2/pom.xml
===================================================================
--- trunk/pollen-ui-struts2/pom.xml 2012-08-26 16:34:56 UTC (rev 3632)
+++ trunk/pollen-ui-struts2/pom.xml 2012-08-26 17:04:35 UTC (rev 3633)
@@ -620,6 +620,14 @@
</property>
</activation>
+ <reporting>
+ <plugins>
+ <plugin>
+ <artifactId>maven-invoker-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </reporting>
+
<build>
<plugins>
<plugin>
@@ -648,237 +656,6 @@
</profile>
- <profile>
- <id>selenium</id>
- <!--activation>
- <property>
- <name>maven.test.skip</name>
- <value>!true</value>
- </property>
- </activation-->
- <properties>
- <pollenTestServerPort>8765</pollenTestServerPort>
- <pollenTestUrl>
- http://localhost:${pollenTestServerPort}/${defaultWebContextPath}
- </pollenTestUrl>
- </properties>
-
- <build>
- <defaultGoal>post-integration-test</defaultGoal>
- <plugins>
- <plugin>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty-maven-plugin</artifactId>
- <executions>
-
- <execution>
- <id>start-pollen</id>
- <phase>pre-integration-test</phase>
- <goals>
- <goal>start</goal>
- </goals>
- <configuration>
- <daemon>true</daemon>
- <webAppConfig>
- <descriptor>
- ${basedir}/src/test/resources/web-test.xml
- </descriptor>
- <contextPath>/${defaultWebContextPath}</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>
-
- <execution>
- <id>stop-pollen</id>
- <phase>post-integration-test</phase>
- <goals>
- <goal>stop</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <executions>
-
- <execution>
- <phase>integration-test</phase>
- <goals>
- <goal>test</goal>
- </goals>
- <configuration>
- <environmentVariables>
- <siteUrl>${pollenTestUrl}</siteUrl>
- </environmentVariables>
- <includes>
- <include>**/LoginSIT.java</include>
- </includes>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- </plugins>
- </build>
- </profile>
-
- <profile>
- <id>selenium2</id>
- <!--activation>
- <property>
- <name>maven.test.skip</name>
- <value>!true</value>
- </property>
- </activation-->
- <properties>
- <pollenTestServerPort>8765</pollenTestServerPort>
- <pollenTestUrl>
- http://localhost:${pollenTestServerPort}/${defaultWebContextPath}
- </pollenTestUrl>
- </properties>
-
- <build>
- <defaultGoal>post-integration-test</defaultGoal>
- <plugins>
- <plugin>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty-maven-plugin</artifactId>
- <executions>
-
- <execution>
- <id>start-pollen</id>
- <phase>pre-integration-test</phase>
- <goals>
- <goal>start</goal>
- </goals>
- <configuration>
- <daemon>true</daemon>
- <webAppConfig>
- <descriptor>
- ${basedir}/src/test/resources/web-test.xml
- </descriptor>
- <contextPath>/${defaultWebContextPath}</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>
-
- <execution>
- <id>stop-pollen</id>
- <phase>post-integration-test</phase>
- <goals>
- <goal>stop</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <executions>
-
- <execution>
- <phase>integration-test</phase>
- <goals>
- <goal>test</goal>
- </goals>
- <configuration>
- <environmentVariables>
- <siteUrl>${pollenTestUrl}</siteUrl>
- </environmentVariables>
- <includes>
- <include>**/*T.java</include>
- </includes>
- <excludes>
- <exclude>**/*SIT.java</exclude>
- </excludes>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- </plugins>
- </build>
- </profile>
-
- <profile>
- <id>selenium-server</id>
- <properties>
- <pollenTestServerPort>8765</pollenTestServerPort>
- <pollenTestUrl>
- http://localhost:${pollenTestServerPort}/${defaultWebContextPath}
- </pollenTestUrl>
- <maven.test.skip>true</maven.test.skip>
- </properties>
-
- <build>
- <defaultGoal>pre-integration-test</defaultGoal>
- <plugins>
- <plugin>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty-maven-plugin</artifactId>
- <executions>
-
- <execution>
- <id>start-pollen</id>
- <phase>pre-integration-test</phase>
- <goals>
- <goal>start</goal>
- </goals>
- <configuration>
- <daemon>false</daemon>
- <webAppConfig>
- <descriptor>
- ${basedir}/src/test/resources/web-test.xml
- </descriptor>
- <contextPath>/${defaultWebContextPath}</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>
-
- </executions>
- </plugin>
-
- </plugins>
- </build>
- </profile>
-
</profiles>
</project>
1
0
Author: tchemit
Date: 2012-08-26 18:34:56 +0200 (Sun, 26 Aug 2012)
New Revision: 3632
Url: http://chorem.org/repositories/revision/pollen/3632
Log:
refs #606: Add some ITs to prevent regression : move old its as real it
Added:
trunk/pollen-ui-struts2/src/it/createPoll/
trunk/pollen-ui-struts2/src/it/createPoll/LICENSE.txt
trunk/pollen-ui-struts2/src/it/createPoll/README.txt
trunk/pollen-ui-struts2/src/it/createPoll/changelog.txt
trunk/pollen-ui-struts2/src/it/createPoll/goals.txt
trunk/pollen-ui-struts2/src/it/createPoll/pom.xml
trunk/pollen-ui-struts2/src/it/createPoll/src/
trunk/pollen-ui-struts2/src/it/createPoll/src/jetty/
trunk/pollen-ui-struts2/src/it/createPoll/src/jetty/jetty-context.xml
trunk/pollen-ui-struts2/src/it/createPoll/src/test/
trunk/pollen-ui-struts2/src/it/createPoll/src/test/java/
trunk/pollen-ui-struts2/src/it/createPoll/src/test/java/org/
trunk/pollen-ui-struts2/src/it/createPoll/src/test/java/org/chorem/
trunk/pollen-ui-struts2/src/it/createPoll/src/test/java/org/chorem/pollen/
trunk/pollen-ui-struts2/src/it/createPoll/src/test/java/org/chorem/pollen/ui/
trunk/pollen-ui-struts2/src/it/createPoll/src/test/java/org/chorem/pollen/ui/it/
trunk/pollen-ui-struts2/src/it/createPoll/src/test/java/org/chorem/pollen/ui/it/CreateFreeDatePollSIT.java
trunk/pollen-ui-struts2/src/it/createPoll/src/test/java/org/chorem/pollen/ui/it/CreateFreeTextPollSIT.java
trunk/pollen-ui-struts2/src/it/createPoll/src/test/java/org/chorem/pollen/ui/it/CreateRestrictedTextPollSIT.java
trunk/pollen-ui-struts2/src/it/createPoll/src/test/java/org/chorem/pollen/ui/it/CreateTextPollForGroupSIT.java
trunk/pollen-ui-struts2/src/it/createPoll/src/test/resources/
trunk/pollen-ui-struts2/src/it/createPoll/src/test/resources/data/
trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/
trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/
trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/
trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/AnonymousFreePollByAnonymousIT.java
trunk/pollen-ui-struts2/src/it/security/
trunk/pollen-ui-struts2/src/it/security/LICENSE.txt
trunk/pollen-ui-struts2/src/it/security/README.txt
trunk/pollen-ui-struts2/src/it/security/changelog.txt
trunk/pollen-ui-struts2/src/it/security/goals.txt
trunk/pollen-ui-struts2/src/it/security/pom.xml
trunk/pollen-ui-struts2/src/it/security/src/
trunk/pollen-ui-struts2/src/it/security/src/jetty/
trunk/pollen-ui-struts2/src/it/security/src/jetty/jetty-context.xml
trunk/pollen-ui-struts2/src/it/security/src/test/
trunk/pollen-ui-struts2/src/it/security/src/test/java/
trunk/pollen-ui-struts2/src/it/security/src/test/java/org/
trunk/pollen-ui-struts2/src/it/security/src/test/java/org/chorem/
trunk/pollen-ui-struts2/src/it/security/src/test/java/org/chorem/pollen/
trunk/pollen-ui-struts2/src/it/security/src/test/java/org/chorem/pollen/ui/
trunk/pollen-ui-struts2/src/it/security/src/test/java/org/chorem/pollen/ui/it/
trunk/pollen-ui-struts2/src/it/security/src/test/java/org/chorem/pollen/ui/it/LoginSIT.java
trunk/pollen-ui-struts2/src/it/security/src/test/java/org/chorem/pollen/ui/it/SecurityAccessSIT.java
trunk/pollen-ui-struts2/src/it/security/src/test/resources/
trunk/pollen-ui-struts2/src/it/security/src/test/resources/data/
trunk/pollen-ui-struts2/src/it/security/src/test/resources/data/db/
trunk/pollen-ui-struts2/src/it/security/src/test/resources/data/db/pollendb.h2.db
trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/AbstractPollenIT.java
Removed:
trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/poll/
trunk/pollen-ui-struts2/src/it/pollen-ui-it/src/
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/java/org/chorem/pollen/ui/it/AbstractPollenWebDriverIT.java
trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/LoginT.java
trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/its/
trunk/pollen-ui-struts2/src/test/resources/its/
trunk/pollen-ui-struts2/src/test/resources/log4j.properties
trunk/pollen-ui-struts2/src/test/resources/pollen-test.properties
trunk/pollen-ui-struts2/src/test/resources/pollendb.h2.db
trunk/pollen-ui-struts2/src/test/resources/web-test.xml
Modified:
trunk/pollen-ui-struts2/pom.xml
trunk/pollen-ui-struts2/src/it/pollVoteVisibility/
trunk/pollen-ui-struts2/src/it/pollVoteVisibility/goals.txt
trunk/pollen-ui-struts2/src/it/pollVoteVisibility/pom.xml
trunk/pollen-ui-struts2/src/it/pollen-ui-it/
trunk/pollen-ui-struts2/src/it/pollen-ui-it/pom.xml
trunk/pollen-ui-struts2/src/main/resources/config/struts-poll.xml
trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/AbstractPollIT.java
trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/PollenUrlFixtures.java
trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/WebDriverResources.java
Modified: trunk/pollen-ui-struts2/pom.xml
===================================================================
--- trunk/pollen-ui-struts2/pom.xml 2012-08-26 16:34:10 UTC (rev 3631)
+++ trunk/pollen-ui-struts2/pom.xml 2012-08-26 16:34:56 UTC (rev 3632)
@@ -207,6 +207,7 @@
<scope>runtime</scope>
</dependency>
+ <!-- test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
@@ -227,26 +228,32 @@
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-chrome-driver</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-firefox-driver</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-htmlunit-driver</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-ie-driver</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-safari-driver</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-remote-driver</artifactId>
+ <scope>provided</scope>
</dependency>
</dependencies>
@@ -323,7 +330,6 @@
</plugin>
<plugin>
-
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
@@ -593,6 +599,8 @@
<configuration>
<pomIncludes>
<pomInclude>pollVoteVisibility/pom.xml</pomInclude>
+ <pomInclude>createPoll/pom.xml</pomInclude>
+ <pomInclude>security/pom.xml</pomInclude>
</pomIncludes>
</configuration>
</execution>
Property changes on: trunk/pollen-ui-struts2/src/it/createPoll
___________________________________________________________________
Added: svn:ignore
+ target
*.ipr
*.iws
*.iml
.idea
Property changes on: trunk/pollen-ui-struts2/src/it/createPoll/LICENSE.txt
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/pollen-ui-struts2/src/it/createPoll/README.txt
===================================================================
--- trunk/pollen-ui-struts2/src/it/createPoll/README.txt (rev 0)
+++ trunk/pollen-ui-struts2/src/it/createPoll/README.txt 2012-08-26 16:34:56 UTC (rev 3632)
@@ -0,0 +1,7 @@
+==========
+CreatePoll
+==========
+
+Pour tester la création d'un sondage.
+
+TODO expliquer les differents scénarios testés.
\ No newline at end of file
Property changes on: trunk/pollen-ui-struts2/src/it/createPoll/README.txt
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Property changes on: trunk/pollen-ui-struts2/src/it/createPoll/changelog.txt
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/pollen-ui-struts2/src/it/createPoll/goals.txt
===================================================================
--- trunk/pollen-ui-struts2/src/it/createPoll/goals.txt (rev 0)
+++ trunk/pollen-ui-struts2/src/it/createPoll/goals.txt 2012-08-26 16:34:56 UTC (rev 3632)
@@ -0,0 +1 @@
+clean post-integration-test -DrunIts
\ No newline at end of file
Property changes on: trunk/pollen-ui-struts2/src/it/createPoll/goals.txt
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/pollen-ui-struts2/src/it/createPoll/pom.xml
===================================================================
--- trunk/pollen-ui-struts2/src/it/createPoll/pom.xml (rev 0)
+++ trunk/pollen-ui-struts2/src/it/createPoll/pom.xml 2012-08-26 16:34:56 UTC (rev 3632)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.chorem.pollen.it</groupId>
+ <artifactId>pollen-ui-it</artifactId>
+ <version>1.4.5-SNAPSHOT</version>
+ <relativePath>../pollen-ui-it/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>createPoll</artifactId>
+ <name>Pollen :: IT createPoll</name>
+ <description>createPoll</description>
+
+</project>
+
Property changes on: trunk/pollen-ui-struts2/src/it/createPoll/pom.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/pollen-ui-struts2/src/it/createPoll/src/jetty/jetty-context.xml
===================================================================
--- trunk/pollen-ui-struts2/src/it/createPoll/src/jetty/jetty-context.xml (rev 0)
+++ trunk/pollen-ui-struts2/src/it/createPoll/src/jetty/jetty-context.xml 2012-08-26 16:34:56 UTC (rev 3632)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ #%L
+ Pollen :: UI (struts2)
+ $Id$
+ $HeadURL: http://svn.chorem.org/svn/pollen/trunk/pollen-ui-struts2/src/jetty/jetty-co… $
+ %%
+ Copyright (C) 2009 - 2012 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%
+ -->
+
+<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
+
+<Configure class="org.eclipse.jetty.webapp.WebAppContext">
+ <Call name="setAttribute">
+ <Arg>org.eclipse.jetty.server.webapp.WebInfIncludeJarPattern</Arg>
+ <Arg>.*/.*jsp-api-[^/]\.jar$|./.*jsp-[^/]\.jar$|./.*taglibs[^/]*\.jar$</Arg>
+ </Call>
+</Configure>
\ No newline at end of file
Property changes on: trunk/pollen-ui-struts2/src/it/createPoll/src/jetty/jetty-context.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Copied: trunk/pollen-ui-struts2/src/it/createPoll/src/test/java/org/chorem/pollen/ui/it/CreateFreeDatePollSIT.java (from rev 3629, trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/its/CreateFreeDatePollSIT.java)
===================================================================
--- trunk/pollen-ui-struts2/src/it/createPoll/src/test/java/org/chorem/pollen/ui/it/CreateFreeDatePollSIT.java (rev 0)
+++ trunk/pollen-ui-struts2/src/it/createPoll/src/test/java/org/chorem/pollen/ui/it/CreateFreeDatePollSIT.java 2012-08-26 16:34:56 UTC (rev 3632)
@@ -0,0 +1,307 @@
+/*
+ * #%L
+ * Pollen :: UI (struts2)
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2012 CodeLutin
+ * %%
+ * 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.it;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+
+import java.util.List;
+
+/**
+ * Test the well work of a Free Date poll creation page.
+ * <p/>
+ * Tested cases :
+ * <ul>
+ * <li>Classic creation with filled mandatory fields (a title and at least 2 choices(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 invalid date format for one of the choices (KO)</li>
+ * </ul>
+ *
+ * @author ymartel <martel(a)codelutin.com>
+ * @since 1.4
+ */
+public class CreateFreeDatePollSIT extends AbstractPollenIT {
+
+ public CreateFreeDatePollSIT(Class<? extends WebDriver> driverType) {
+ super(driverType);
+ }
+
+ /**
+ * This test create a simple free text poll.
+ * At the end, should be on summary page.
+ */
+ @Test
+ public void createSimpleFreeDatePoll() {
+
+ // Go on home page
+ gotoUrl(urlFixtures.createPoll());
+
+ // Set title
+ WebElement titleElement = findElement(By.name("poll.title"));
+ Assert.assertEquals("input", titleElement.getTagName());
+ Assert.assertTrue(titleElement.isDisplayed());
+ titleElement.sendKeys("My Date Poll");
+
+ // Switch to Date choices
+ List<WebElement> choiceTypesElement = findElements(By.name("poll.choiceType"));
+ Assert.assertEquals(3, choiceTypesElement.size());
+ WebElement dateChoiceTypeElement = choiceTypesElement.get(1);
+ Assert.assertEquals("input", dateChoiceTypeElement.getTagName());
+ Assert.assertEquals("DATE", dateChoiceTypeElement.getAttribute("value"));
+ Assert.assertTrue(dateChoiceTypeElement.isDisplayed());
+ dateChoiceTypeElement.click();
+
+ // Set first choice
+ WebElement choiceOneElement = findElement(By.name("dateChoice_0.name"));
+ Assert.assertEquals("input", choiceOneElement.getTagName());
+ Assert.assertTrue(choiceOneElement.isDisplayed());
+ choiceOneElement.sendKeys(date(1431, 5, 30));
+
+ // Set second choice
+ WebElement choiceTwoElement = findElement(By.name("dateChoice_1.name"));
+ Assert.assertEquals("input", choiceTwoElement.getTagName());
+ Assert.assertTrue(choiceTwoElement.isDisplayed());
+ choiceTwoElement.sendKeys(date(1789, 8, 26));
+
+ // Submit form
+ WebElement submit = findElement(By.name("action:create"));
+ submit.click();
+
+ // All good, should be on summary page !
+ checkCurrentUrl(urlFixtures.summaryPoll(), false);
+ }
+
+ /**
+ * This test create a free date poll with two choices but no title.
+ * At the end, should be still on create page, with an error message.
+ */
+ @Test
+ public void createSimpleFreeDatePollWithoutTitle() {
+
+ // Go on home page
+ gotoUrl(urlFixtures.createPoll());
+
+ // Switch to Date choices
+ List<WebElement> choiceTypesElement = findElements(By.name("poll.choiceType"));
+ Assert.assertEquals(3, choiceTypesElement.size());
+ WebElement dateChoiceTypeElement = choiceTypesElement.get(1);
+ Assert.assertEquals("input", dateChoiceTypeElement.getTagName());
+ Assert.assertEquals("DATE", dateChoiceTypeElement.getAttribute("value"));
+ Assert.assertTrue(dateChoiceTypeElement.isDisplayed());
+ dateChoiceTypeElement.click();
+
+ // Set first choice
+ WebElement choiceOneElement = findElement(By.name("dateChoice_0.name"));
+ Assert.assertEquals("input", choiceOneElement.getTagName());
+ Assert.assertTrue(choiceOneElement.isDisplayed());
+ String choiceOneValue = date(1431, 5, 30);
+ choiceOneElement.sendKeys(choiceOneValue);
+
+ // Set second choice
+ WebElement choiceTwoElement = findElement(By.name("dateChoice_1.name"));
+ Assert.assertEquals("input", choiceTwoElement.getTagName());
+ Assert.assertTrue(choiceTwoElement.isDisplayed());
+ String choiceTwoValue = date(1789, 8, 26);
+ choiceTwoElement.sendKeys(choiceTwoValue);
+
+ // Submit form
+ WebElement submit = findElement(By.name("action:create"));
+ submit.click();
+
+ // Title is missing, should stay on create poll page
+ checkCurrentUrl(urlFixtures.createPoll(), false);
+
+ // Check an error message has been displayed
+ WebElement titleError = findElement(By.className("errorMessage"));
+ Assert.assertNotNull(titleError);
+
+ // Check that choice fields are not lost
+ choiceOneElement = findElement(By.name("dateChoice_0.name"));
+ Assert.assertEquals("input", choiceOneElement.getTagName());
+ Assert.assertTrue(choiceOneElement.isDisplayed());
+ Assert.assertEquals(choiceOneValue, choiceOneElement.getAttribute("value"));
+ choiceTwoElement = findElement(By.name("dateChoice_1.name"));
+ Assert.assertEquals("input", choiceTwoElement.getTagName());
+ Assert.assertTrue(choiceTwoElement.isDisplayed());
+ Assert.assertEquals(choiceTwoValue, choiceTwoElement.getAttribute("value"));
+
+ }
+
+ /**
+ * This test create a free date poll without choices.
+ * At the end, should be still on create page, with an error message.
+ */
+ @Test
+ public void createSimpleFreeDatePollWithoutChoice() {
+
+ // Go on home page
+ gotoUrl(urlFixtures.createPoll());
+
+ // Set title
+ WebElement titleElement = findElement(By.name("poll.title"));
+ Assert.assertEquals("input", titleElement.getTagName());
+ Assert.assertTrue(titleElement.isDisplayed());
+ String pollTitle = "My Date Poll";
+ titleElement.sendKeys(pollTitle);
+
+ // Switch to Date choices
+ List<WebElement> choiceTypesElement = findElements(By.name("poll.choiceType"));
+ Assert.assertEquals(3, choiceTypesElement.size());
+ WebElement dateChoiceTypeElement = choiceTypesElement.get(1);
+ Assert.assertEquals("input", dateChoiceTypeElement.getTagName());
+ Assert.assertEquals("DATE", dateChoiceTypeElement.getAttribute("value"));
+ Assert.assertTrue(dateChoiceTypeElement.isDisplayed());
+ dateChoiceTypeElement.click();
+
+ // Submit form
+ WebElement submit = findElement(By.name("action:create"));
+ submit.click();
+
+ // No choices, should stay on create poll page
+ checkCurrentUrl(urlFixtures.createPoll(), false);
+
+ // Check that title field is not lost
+ titleElement = 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 = findElement(By.id("poll_choices_error"));
+ Assert.assertNotNull(choicesError);
+
+ // Check that we are still on Date choices
+ choiceTypesElement = findElements(By.name("poll.choiceType"));
+ Assert.assertEquals(3, choiceTypesElement.size());
+ dateChoiceTypeElement = choiceTypesElement.get(1);
+ Assert.assertEquals("input", dateChoiceTypeElement.getTagName());
+ Assert.assertEquals("DATE", dateChoiceTypeElement.getAttribute("value"));
+ Assert.assertEquals("true", dateChoiceTypeElement.getAttribute("checked"));
+
+ }
+
+ /**
+ * This test create a free date poll with a same value for two choices.
+ * At the end, should be still on create page, with an error message.
+ */
+ @Test
+ public void createSimpleFreeDatePollWithTwoSameDate() {
+
+ // Go on home page
+ gotoUrl(urlFixtures.createPoll());
+
+ // Set title
+ WebElement titleElement = findElement(By.name("poll.title"));
+ Assert.assertEquals("input", titleElement.getTagName());
+ Assert.assertTrue(titleElement.isDisplayed());
+ titleElement.sendKeys("My Date Poll");
+
+ // Switch to Date choices
+ List<WebElement> choiceTypesElement = findElements(By.name("poll.choiceType"));
+ Assert.assertEquals(3, choiceTypesElement.size());
+ WebElement dateChoiceTypeElement = choiceTypesElement.get(1);
+ Assert.assertEquals("input", dateChoiceTypeElement.getTagName());
+ Assert.assertEquals("DATE", dateChoiceTypeElement.getAttribute("value"));
+ Assert.assertTrue(dateChoiceTypeElement.isDisplayed());
+ dateChoiceTypeElement.click();
+
+ // Set first choice
+ WebElement choiceOneElement = findElement(By.name("dateChoice_0.name"));
+ Assert.assertEquals("input", choiceOneElement.getTagName());
+ Assert.assertTrue(choiceOneElement.isDisplayed());
+ String date = date(1431, 5, 30);
+ choiceOneElement.sendKeys(date);
+
+ // Set second choice
+ WebElement choiceTwoElement = findElement(By.name("dateChoice_1.name"));
+ Assert.assertEquals("input", choiceTwoElement.getTagName());
+ Assert.assertTrue(choiceTwoElement.isDisplayed());
+ choiceTwoElement.sendKeys(date);
+
+ // Submit form
+ WebElement submit = findElement(By.name("action:create"));
+ submit.click();
+
+ // An error, should stay on create page
+ checkCurrentUrl(urlFixtures.createPoll(), false);
+
+ // Check an error message has been displayed for choices
+ WebElement choicesError = findElement(By.className("errorMessage"));
+ Assert.assertNotNull(choicesError);
+ }
+
+ /**
+ * This test create a free date poll with a bas format for one of the choices.
+ * At the end, should be still on create page, with an error message.
+ */
+ @Test
+ public void createSimpleFreeDatePollWithBadFormatDate() {
+
+ // Go on home page
+ gotoUrl(urlFixtures.createPoll());
+
+ // Set title
+ WebElement titleElement = findElement(By.name("poll.title"));
+ Assert.assertEquals("input", titleElement.getTagName());
+ Assert.assertTrue(titleElement.isDisplayed());
+ titleElement.sendKeys("My Date Poll");
+
+ // Switch to Date choices
+ List<WebElement> choiceTypesElement = findElements(By.name("poll.choiceType"));
+ Assert.assertEquals(3, choiceTypesElement.size());
+ WebElement dateChoiceTypeElement = choiceTypesElement.get(1);
+ Assert.assertEquals("input", dateChoiceTypeElement.getTagName());
+ Assert.assertEquals("DATE", dateChoiceTypeElement.getAttribute("value"));
+ Assert.assertTrue(dateChoiceTypeElement.isDisplayed());
+ dateChoiceTypeElement.click();
+
+ // Set first choice
+ WebElement choiceOneElement = findElement(By.name("dateChoice_0.name"));
+ Assert.assertEquals("input", choiceOneElement.getTagName());
+ Assert.assertTrue(choiceOneElement.isDisplayed());
+ choiceOneElement.sendKeys(date(1431, 5, 30));
+
+ // Set second choice
+ WebElement choiceTwoElement = findElement(By.name("dateChoice_1.name"));
+ Assert.assertEquals("input", choiceTwoElement.getTagName());
+ Assert.assertTrue(choiceTwoElement.isDisplayed());
+ choiceTwoElement.sendKeys("28 08 1789");
+
+ // Submit form
+ WebElement submit = findElement(By.name("action:create"));
+ submit.click();
+
+ // An error, should stay on create page
+ checkCurrentUrl(urlFixtures.createPoll(), false);
+
+ // Check an error message has been displayed for choices
+ WebElement choicesError = findElement(By.className("errorMessage"));
+ Assert.assertNotNull(choicesError);
+ }
+
+}
Property changes on: trunk/pollen-ui-struts2/src/it/createPoll/src/test/java/org/chorem/pollen/ui/it/CreateFreeDatePollSIT.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/pollen-ui-struts2/src/it/createPoll/src/test/java/org/chorem/pollen/ui/it/CreateFreeTextPollSIT.java (from rev 3629, trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/its/CreateFreeTextPollSIT.java)
===================================================================
--- trunk/pollen-ui-struts2/src/it/createPoll/src/test/java/org/chorem/pollen/ui/it/CreateFreeTextPollSIT.java (rev 0)
+++ trunk/pollen-ui-struts2/src/it/createPoll/src/test/java/org/chorem/pollen/ui/it/CreateFreeTextPollSIT.java 2012-08-26 16:34:56 UTC (rev 3632)
@@ -0,0 +1,462 @@
+/*
+ * #%L
+ * Pollen :: UI (struts2)
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2012 CodeLutin
+ * %%
+ * 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.it;
+
+import org.apache.commons.lang3.time.DateUtils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.nuiton.util.DateUtil;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+
+import java.util.Date;
+
+/**
+ * Test the well work of a Free text poll creation page.
+ * <p/>
+ * 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 AbstractPollenIT {
+
+ public CreateFreeTextPollSIT(Class<? extends WebDriver> driverType) {
+ super(driverType);
+ }
+
+ /**
+ * This test create a simple free text poll.
+ * At the end, should be on summary page.
+ */
+ @Test
+ public void createSimpleFreeTextPoll() {
+
+ // Go on home page
+ gotoUrl(urlFixtures.createPoll());
+
+ // Set title
+ WebElement titleElement = findElement(By.name("poll.title"));
+ Assert.assertEquals("input", titleElement.getTagName());
+ Assert.assertTrue(titleElement.isDisplayed());
+ titleElement.sendKeys("My Poll");
+
+ // Set first choice
+ WebElement choiceOneElement = 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 = findElement(By.name("textChoice_1.name"));
+ Assert.assertEquals("input", choiceTwoElement.getTagName());
+ Assert.assertTrue(choiceTwoElement.isDisplayed());
+ choiceTwoElement.sendKeys("Choix numero deux");
+
+ // Submit form
+ WebElement submit = findElement(By.name("action:create"));
+ submit.click();
+
+ // All good, should be on summary page !
+ checkCurrentUrl(urlFixtures.summaryPoll(), false);
+ }
+
+ /**
+ * This test create a simple free text poll without a title.
+ * When submit, an error text should be displayed : title is mandatory
+ */
+ @Test
+ public void createSimpleFreeTextPollWithoutTitle() {
+
+ // Go on home page
+ gotoUrl(urlFixtures.createPoll());
+
+ // Set first choice
+ WebElement choiceOneElement = 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 = 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 = findElement(By.name("action:create"));
+ submit.click();
+
+ // Title is missing, should stay on create poll page
+ checkCurrentUrl(urlFixtures.createPoll(), false);
+
+ // Check an error message has been displayed
+ WebElement titleError = findElement(By.className("errorMessage"));
+ Assert.assertNotNull(titleError);
+
+ // Check that choice fields are not lost
+ choiceOneElement = findElement(By.name("textChoice_0.name"));
+ Assert.assertEquals("input", choiceOneElement.getTagName());
+ Assert.assertTrue(choiceOneElement.isDisplayed());
+ Assert.assertEquals(choiceOneValue, choiceOneElement.getAttribute("value"));
+ choiceTwoElement = 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
+ */
+ @Test
+ public void createSimpleFreeTextPollWithoutChoice() {
+
+ // Go on home page
+ gotoUrl(urlFixtures.createPoll());
+
+ // Set title
+ WebElement titleElement = 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 = findElement(By.name("action:create"));
+ submit.click();
+
+ // No choices, should stay on create poll page
+ checkCurrentUrl(urlFixtures.createPoll(), false);
+
+ // Check that title field is not lost
+ titleElement = 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 = findElement(By.id("poll_choices_error"));
+ Assert.assertNotNull(choicesError);
+ }
+
+ /**
+ * This test create a free text poll with a ending date in the past.
+ * When submit, an error text should be displayed : the poll cannot end before starting !
+ */
+ @Test
+ public void createFreeTextPollWithAnteriorEndingDateThanToday() {
+
+ // Go on create poll page
+ gotoUrl(urlFixtures.createPoll());
+
+ // Set title
+ WebElement titleElement = findElement(By.name("poll.title"));
+ Assert.assertEquals("input", titleElement.getTagName());
+ Assert.assertTrue(titleElement.isDisplayed());
+ String pollTitle = "My Poll";
+ titleElement.sendKeys(pollTitle);
+
+ // Set first choice
+ WebElement choiceOneElement = findElement(By.name("textChoice_0.name"));
+ Assert.assertEquals("input", choiceOneElement.getTagName());
+ Assert.assertTrue(choiceOneElement.isDisplayed());
+ String choiceOne = "Choix numero un";
+ choiceOneElement.sendKeys(choiceOne);
+
+ // Go to option panel : click on it
+ WebElement optionsClick = findElement(By.xpath("//a[@href=\"#toptions\"]"));
+ optionsClick.click();
+
+ // Set end date
+ WebElement endDateElement = findElement(By.name("poll.endDate"));
+ Assert.assertEquals("input", endDateElement.getTagName());
+ Assert.assertTrue(endDateElement.isDisplayed());
+ //FIXME ymartel 2012/06/14 : review way to get DAte ?
+ Date aMonthAgo = DateUtils.addMonths(new Date(), -1);
+ String formatMonthAgo = DateUtil.formatDate(aMonthAgo, "dd/MM/yyyy HH:mm");
+ endDateElement.sendKeys(formatMonthAgo);
+
+ // Submit form
+ WebElement submit = findElement(By.name("action:create"));
+ submit.click();
+
+ // No choices, should stay on create poll page
+ checkCurrentUrl(urlFixtures.createPoll(), false);
+
+ // Check an error message has been displayed
+ WebElement dateError = findElement(By.className("errorMessage"));
+ Assert.assertNotNull(dateError);
+
+ // Check that title is not displayed cause not in the tab in error
+ titleElement = findElement(By.name("poll.title"));
+ Assert.assertFalse(titleElement.isDisplayed());
+
+ // Go on general tab and check that Title and and choice fields values are not lost
+ WebElement generalClick = findElement(By.xpath("//a[@href=\"#tgeneral\"]"));
+ generalClick.click();
+
+ titleElement = findElement(By.name("poll.title"));
+ Assert.assertTrue(titleElement.isDisplayed());
+ Assert.assertEquals(pollTitle, titleElement.getAttribute("value"));
+
+ choiceOneElement = findElement(By.name("textChoice_0.name"));
+ Assert.assertTrue(choiceOneElement.isDisplayed());
+ Assert.assertEquals(choiceOne, choiceOneElement.getAttribute("value"));
+ }
+
+ /**
+ * This test create a free text poll with a ending date before the starting date.
+ * When submit, an error text should be displayed : the poll cannot end before starting !
+ */
+ @Test
+ public void createFreeTextPollWithAnteriorEndDateThanStartDate() {
+
+ // Go on create poll page
+ gotoUrl(urlFixtures.createPoll());
+
+ // Set title
+ WebElement titleElement = findElement(By.name("poll.title"));
+ Assert.assertEquals("input", titleElement.getTagName());
+ Assert.assertTrue(titleElement.isDisplayed());
+ String pollTitle = "My Poll";
+ titleElement.sendKeys(pollTitle);
+
+ // Set first choice
+ WebElement choiceOneElement = findElement(By.name("textChoice_0.name"));
+ Assert.assertEquals("input", choiceOneElement.getTagName());
+ Assert.assertTrue(choiceOneElement.isDisplayed());
+ String choiceOne = "Choix numero un";
+ choiceOneElement.sendKeys(choiceOne);
+
+ // Go to option panel : click on it
+ WebElement optionsClick = findElement(By.xpath("//a[@href=\"#toptions\"]"));
+ optionsClick.click();
+
+ // Set start date to two month ago
+ WebElement startDateElement = findElement(By.name("poll.endDate"));
+ Assert.assertEquals("input", startDateElement.getTagName());
+ Assert.assertTrue(startDateElement.isDisplayed());
+ //FIXME ymartel 2012/06/14 : review way to get Date ?
+ Date twoMonthsAgo = DateUtils.addMonths(new Date(), -2);
+ String formatTwoMonthsAgo = DateUtil.formatDate(twoMonthsAgo, "dd/MM/yyyy HH:mm");
+ startDateElement.sendKeys(formatTwoMonthsAgo);
+
+ // Set end date to one months ago
+ WebElement endDateElement = findElement(By.name("poll.endDate"));
+ Assert.assertEquals("input", endDateElement.getTagName());
+ Assert.assertTrue(endDateElement.isDisplayed());
+ //FIXME ymartel 2012/06/14 : review way to get DAte ?
+ Date oneMonthAgo = DateUtils.addMonths(new Date(), -1);
+ String formatOneMonthAgo = DateUtil.formatDate(oneMonthAgo, "dd/MM/yyyy HH:mm");
+ endDateElement.sendKeys(formatOneMonthAgo);
+
+ // Submit form
+ WebElement submit = findElement(By.name("action:create"));
+ submit.click();
+
+ // No choices, should stay on create poll page
+ checkCurrentUrl(urlFixtures.createPoll(), false);
+
+ // Check an error message has been displayed
+ WebElement dateError = findElement(By.className("errorMessage"));
+ Assert.assertNotNull(dateError);
+
+ // Go on general tab and check that Title and and choice fields values are not lost
+ WebElement generalClick = findElement(By.xpath("//a[@href=\"#tgeneral\"]"));
+ generalClick.click();
+
+ titleElement = findElement(By.name("poll.title"));
+ Assert.assertTrue(titleElement.isDisplayed());
+ Assert.assertEquals(pollTitle, titleElement.getAttribute("value"));
+
+ choiceOneElement = findElement(By.name("textChoice_0.name"));
+ Assert.assertTrue(choiceOneElement.isDisplayed());
+ Assert.assertEquals(choiceOne, choiceOneElement.getAttribute("value"));
+ }
+
+ /**
+ * This test create a free text poll with an invalid email.
+ * When submit, an error text should be displayed : email should be valid
+ */
+ @Test
+ public void createFreeTextPollWithInvalidEmail() {
+
+ // Go on create poll page
+ gotoUrl(urlFixtures.createPoll());
+
+ // Set title
+ WebElement titleElement = findElement(By.name("poll.title"));
+ Assert.assertEquals("input", titleElement.getTagName());
+ Assert.assertTrue(titleElement.isDisplayed());
+ String pollTitle = "My Poll";
+ titleElement.sendKeys(pollTitle);
+
+ // Set first choice
+ WebElement choiceOneElement = findElement(By.name("textChoice_0.name"));
+ Assert.assertEquals("input", choiceOneElement.getTagName());
+ Assert.assertTrue(choiceOneElement.isDisplayed());
+ String choiceOne = "Choix numero un";
+ choiceOneElement.sendKeys(choiceOne);
+
+ // Go to option panel : click on it
+ WebElement optionsClick = findElement(By.xpath("//a[@href=\"#toptions\"]"));
+ optionsClick.click();
+
+ WebElement emailElement = findElement(By.name("poll.creator.email"));
+ Assert.assertEquals("input", emailElement.getTagName());
+ Assert.assertTrue(emailElement.isDisplayed());
+ emailElement.sendKeys("i@minvalid");
+
+ // Submit form
+ WebElement submit = findElement(By.name("action:create"));
+ submit.click();
+
+ // No choices, should stay on create poll page
+ checkCurrentUrl(urlFixtures.createPoll(), false);
+
+ // Check an error message has been displayed
+ WebElement dateError = findElement(By.className("errorMessage"));
+ Assert.assertNotNull(dateError);
+
+ // Go on general tab and check that Title and and choice fields values are not lost
+ WebElement generalClick = findElement(By.xpath("//a[@href=\"#tgeneral\"]"));
+ generalClick.click();
+
+ titleElement = findElement(By.name("poll.title"));
+ Assert.assertTrue(titleElement.isDisplayed());
+ Assert.assertEquals(pollTitle, titleElement.getAttribute("value"));
+
+ choiceOneElement = findElement(By.name("textChoice_0.name"));
+ Assert.assertTrue(choiceOneElement.isDisplayed());
+ Assert.assertEquals(choiceOne, choiceOneElement.getAttribute("value"));
+ }
+
+ /**
+ * This test create a free text poll with an invalid email.
+ * When submit, an error text should be displayed : email should be valid
+ */
+ @Test
+ public void createFreeTextPollWithInvalidMaxVotedChoices() {
+
+ // Go on create poll page
+ gotoUrl(urlFixtures.createPoll());
+
+ // Set title
+ WebElement titleElement = findElement(By.name("poll.title"));
+ Assert.assertEquals("input", titleElement.getTagName());
+ Assert.assertTrue(titleElement.isDisplayed());
+ String pollTitle = "My Poll";
+ titleElement.sendKeys(pollTitle);
+
+ // Set first choice
+ WebElement choiceOneElement = findElement(By.name("textChoice_0.name"));
+ Assert.assertEquals("input", choiceOneElement.getTagName());
+ Assert.assertTrue(choiceOneElement.isDisplayed());
+ String choiceOne = "Choix numero un";
+ choiceOneElement.sendKeys(choiceOne);
+
+ // Go to option panel : click on it
+ WebElement optionsClick = findElement(By.xpath("//a[@href=\"#toptions\"]"));
+ optionsClick.click();
+
+ // Get the maxChoice element : should be disable while limitChoice is not selected
+ WebElement maxChoiceElement = findElement(By.name("maxChoices"));
+ Assert.assertEquals("input", maxChoiceElement.getTagName());
+ Assert.assertTrue(maxChoiceElement.isDisplayed());
+ // Get the checkbox and check it to set number of max choice after
+ WebElement limitChoiceElement = findElement(By.name("limitChoice"));
+ Assert.assertEquals("input", limitChoiceElement.getTagName());
+ Assert.assertTrue(limitChoiceElement.isEnabled());
+ limitChoiceElement.click();
+ // Set a negative number of max choice
+ maxChoiceElement = findElement(By.name("maxChoices"));
+ Assert.assertTrue(maxChoiceElement.isEnabled());
+ maxChoiceElement.clear();
+ maxChoiceElement.sendKeys("-1");
+
+ // Submit form
+ WebElement submit = findElement(By.name("action:create"));
+ submit.click();
+
+ // No choices, should stay on create poll page
+ checkCurrentUrl(urlFixtures.createPoll(), false);
+
+ // Check an error message has been displayed
+ WebElement maxChoicesError = findElement(By.className("errorMessage"));
+ Assert.assertNotNull(maxChoicesError);
+
+ // Go on general tab and check that Title and and choice fields values are not lost
+ WebElement generalClick = findElement(By.xpath("//a[@href=\"#tgeneral\"]"));
+ generalClick.click();
+
+ titleElement = findElement(By.name("poll.title"));
+ Assert.assertTrue(titleElement.isDisplayed());
+ Assert.assertEquals(pollTitle, titleElement.getAttribute("value"));
+
+ choiceOneElement = findElement(By.name("textChoice_0.name"));
+ Assert.assertTrue(choiceOneElement.isDisplayed());
+ Assert.assertEquals(choiceOne, choiceOneElement.getAttribute("value"));
+
+ // Second part: try to set "0" for max choice
+
+ // Go back to option panel : click on it
+ optionsClick = findElement(By.xpath("//a[@href=\"#toptions\"]"));
+ optionsClick.click();
+
+ // Set a negative number of max choice
+ maxChoiceElement = findElement(By.name("maxChoices"));
+ Assert.assertEquals("input", maxChoiceElement.getTagName());
+ Assert.assertTrue(maxChoiceElement.isEnabled());
+ maxChoiceElement.clear();
+ maxChoiceElement.sendKeys("0");
+
+ // Submit form
+ submit = findElement(By.name("action:create"));
+ submit.click();
+
+ // No choices, should stay on create poll page
+ checkCurrentUrl(urlFixtures.createPoll(), false);
+ // Check an error message has been displayed
+ maxChoicesError = findElement(By.className("errorMessage"));
+ Assert.assertNotNull(maxChoicesError);
+ }
+
+}
Property changes on: trunk/pollen-ui-struts2/src/it/createPoll/src/test/java/org/chorem/pollen/ui/it/CreateFreeTextPollSIT.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/pollen-ui-struts2/src/it/createPoll/src/test/java/org/chorem/pollen/ui/it/CreateRestrictedTextPollSIT.java (from rev 3629, trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/its/CreateRestrictedTextPollSIT.java)
===================================================================
--- trunk/pollen-ui-struts2/src/it/createPoll/src/test/java/org/chorem/pollen/ui/it/CreateRestrictedTextPollSIT.java (rev 0)
+++ trunk/pollen-ui-struts2/src/it/createPoll/src/test/java/org/chorem/pollen/ui/it/CreateRestrictedTextPollSIT.java 2012-08-26 16:34:56 UTC (rev 3632)
@@ -0,0 +1,308 @@
+/*
+ * #%L
+ * Pollen :: UI (struts2)
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2012 CodeLutin
+ * %%
+ * 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.it;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+
+import java.util.List;
+
+/**
+ * Test the well work of a text poll creation page with a restricted list of participant.
+ * <p/>
+ * Tested cases :
+ * <ul>
+ * <li>Creation without participant (KO)</li>
+ * <li>Creation with two participants with same name (KO)</li>
+ * <li>Creation with two participants with same email (KO)</li>
+ * <li>Creation with a participant without email (KO)</li>
+ * <li>Creation with a participant with only an email (no name) (KO)</li>
+ * </ul>
+ *
+ * @author ymartel <martel(a)codelutin.com>
+ * @since 1.4
+ */
+public class CreateRestrictedTextPollSIT extends AbstractPollenIT {
+
+ public CreateRestrictedTextPollSIT(Class<? extends WebDriver> driverType) {
+ super(driverType);
+ }
+
+ /**
+ * This test create a text poll with restriction on participant but no participant.
+ * At the end, should stay on create poll page, cause at least one participant is needed.
+ */
+ @Test
+ public void createRestrictedTextPollWithoutParticipant() {
+
+ // Prepare the poll
+ preparePoll();
+
+ // Go to option panel : click on it
+ WebElement optionsClick = findElement(By.xpath("//a[@href=\"#toptions\"]"));
+ optionsClick.click();
+
+ // Switch to restricted type
+ List<WebElement> pollTypesElement = findElements(By.name("poll.pollType"));
+ Assert.assertEquals(3, pollTypesElement.size());
+ WebElement restrictedTypeElement = pollTypesElement.get(1);
+ Assert.assertEquals("input", restrictedTypeElement.getTagName());
+ Assert.assertEquals("RESTRICTED", restrictedTypeElement.getAttribute("value"));
+ Assert.assertTrue(restrictedTypeElement.isDisplayed());
+ restrictedTypeElement.click();
+
+ // Check that the participant form is displayed
+ WebElement participantOneNameElement = findElement(By.id("votingListRESTRICTED_0PersonToList_0.votingId"));
+ Assert.assertEquals("input", participantOneNameElement.getTagName());
+ Assert.assertTrue(participantOneNameElement.isDisplayed());
+
+ // Submit form
+ WebElement submit = findElement(By.name("action:create"));
+ submit.click();
+
+ // All good, should be on summary page !
+ checkCurrentUrl(urlFixtures.createPoll(), false);
+ // Check an error message has been displayed
+ WebElement errorMessage = findElement(By.className("errorMessage"));
+ Assert.assertNotNull(errorMessage);
+ // Check we are in good table
+ participantOneNameElement = findElement(By.id("votingListRESTRICTED_0PersonToList_0.votingId"));
+ Assert.assertEquals("input", participantOneNameElement.getTagName());
+ Assert.assertTrue(participantOneNameElement.isDisplayed());
+ }
+
+ /**
+ * This test create a restricted text poll, with two participant with same name.
+ * At the end, should stay on create poll page, cause the name should be unique.
+ */
+ @Test
+ public void createRestrictedTextPollWithParticipantsWithSameName() {
+
+ // Prepare the poll
+ preparePoll();
+
+ // Go to option panel : click on it
+ WebElement optionsClick = findElement(By.xpath("//a[@href=\"#toptions\"]"));
+ optionsClick.click();
+
+ // Switch to restricted type
+ List<WebElement> pollTypesElement = findElements(By.name("poll.pollType"));
+ Assert.assertEquals(3, pollTypesElement.size());
+ WebElement restrictedTypeElement = pollTypesElement.get(1);
+ Assert.assertEquals("input", restrictedTypeElement.getTagName());
+ Assert.assertEquals("RESTRICTED", restrictedTypeElement.getAttribute("value"));
+ Assert.assertTrue(restrictedTypeElement.isDisplayed());
+ restrictedTypeElement.click();
+
+ // Set first participant
+ // send name
+ String participantOneName = "toto";
+ sendKeysById("votingListRESTRICTED_0PersonToList_0.votingId", participantOneName);
+ // send email
+ String participantOneEmail = "toto(a)codelutin.com";
+ sendKeysById("votingListRESTRICTED_0PersonToList_0.email", participantOneEmail);
+ // Set second participant
+ // send name
+ sendKeysById("votingListRESTRICTED_0PersonToList_1.votingId", participantOneName);
+ // send email
+ String participantTwoEmail = "toto2(a)codelutin.com";
+ sendKeysById("votingListRESTRICTED_0PersonToList_1.email", participantTwoEmail);
+
+ // Submit form
+ WebElement submit = findElement(By.name("action:create"));
+ submit.click();
+
+ // All good, should be on summary page !
+ checkCurrentUrl(urlFixtures.createPoll(), false);
+ // Check an error message has been displayed
+ WebElement errorMessage = findElement(By.className("errorMessage"));
+ Assert.assertNotNull(errorMessage);
+ // Check we are in good table
+ checkWebElementValue(By.id("votingListRESTRICTED_0PersonToList_0.votingId"), participantOneName);
+ checkWebElementValue(By.id("votingListRESTRICTED_0PersonToList_0.email"), participantOneEmail);
+ checkWebElementValue(By.id("votingListRESTRICTED_0PersonToList_1.votingId"), participantOneName);
+ checkWebElementValue(By.id("votingListRESTRICTED_0PersonToList_1.email"), participantTwoEmail);
+ }
+
+ /**
+ * This test create a restricted text poll, with two participant with same email.
+ * At the end, should stay on create poll page, cause the email should be unique.
+ */
+ @Test
+ public void createRestrictedTextPollWithParticipantsWithSameEmail() {
+
+ // Prepare the poll
+ preparePoll();
+
+ // Go to option panel : click on it
+ WebElement optionsClick = findElement(By.xpath("//a[@href=\"#toptions\"]"));
+ optionsClick.click();
+
+ // Switch to restricted type
+ List<WebElement> pollTypesElement = findElements(By.name("poll.pollType"));
+ Assert.assertEquals(3, pollTypesElement.size());
+ WebElement restrictedTypeElement = pollTypesElement.get(1);
+ Assert.assertEquals("input", restrictedTypeElement.getTagName());
+ Assert.assertEquals("RESTRICTED", restrictedTypeElement.getAttribute("value"));
+ Assert.assertTrue(restrictedTypeElement.isDisplayed());
+ restrictedTypeElement.click();
+
+ // Set first participant
+ // send name
+ String participantOneName = "toto";
+ sendKeysById("votingListRESTRICTED_0PersonToList_0.votingId", participantOneName);
+ // send email
+ String participantOneEmail = "toto(a)codelutin.com";
+ sendKeysById("votingListRESTRICTED_0PersonToList_0.email", participantOneEmail);
+ // Set second participant
+ // send name
+ String participantTwoName = "toto2";
+ sendKeysById("votingListRESTRICTED_0PersonToList_1.votingId", participantTwoName);
+ // send email
+ sendKeysById("votingListRESTRICTED_0PersonToList_1.email", participantOneEmail);
+
+ // Submit form
+ WebElement submit = findElement(By.name("action:create"));
+ submit.click();
+
+ // All good, should be on summary page !
+ checkCurrentUrl(urlFixtures.createPoll(), false);
+ // Check an error message has been displayed
+ WebElement errorMessage = findElement(By.className("errorMessage"));
+ Assert.assertNotNull(errorMessage);
+ // Check we are in good table
+ checkWebElementValue(By.id("votingListRESTRICTED_0PersonToList_0.votingId"), participantOneName);
+ checkWebElementValue(By.id("votingListRESTRICTED_0PersonToList_0.email"), participantOneEmail);
+ checkWebElementValue(By.id("votingListRESTRICTED_0PersonToList_1.votingId"), participantTwoName);
+ checkWebElementValue(By.id("votingListRESTRICTED_0PersonToList_1.email"), participantOneEmail);
+ }
+
+ /**
+ * This test create a restricted text poll, with one participant without email.
+ * At the end, should stay on create poll page, cause the mail is mandatory.
+ */
+ @Test
+ public void createRestrictedTextPollWithParticipantWithoutMail() {
+
+ // Prepare the poll
+ preparePoll();
+
+ // Go to option panel : click on it
+ WebElement optionsClick = findElement(By.xpath("//a[@href=\"#toptions\"]"));
+ optionsClick.click();
+
+ // Switch to restricted type
+ List<WebElement> pollTypesElement = findElements(By.name("poll.pollType"));
+ Assert.assertEquals(3, pollTypesElement.size());
+ WebElement restrictedTypeElement = pollTypesElement.get(1);
+ Assert.assertEquals("input", restrictedTypeElement.getTagName());
+ Assert.assertEquals("RESTRICTED", restrictedTypeElement.getAttribute("value"));
+ Assert.assertTrue(restrictedTypeElement.isDisplayed());
+ restrictedTypeElement.click();
+
+ // Set first participant
+ // send name
+ String participantOneName = "toto";
+ sendKeysById("votingListRESTRICTED_0PersonToList_0.votingId", participantOneName);
+ // send email
+ String participantOneEmail = " ";
+ sendKeysById("votingListRESTRICTED_0PersonToList_0.email", participantOneEmail);
+
+ // Submit form
+ WebElement submit = findElement(By.name("action:create"));
+ submit.click();
+
+ // All good, should be on summary page !
+ checkCurrentUrl(urlFixtures.createPoll(), false);
+ // Check an error message has been displayed
+ WebElement errorMessage = findElement(By.className("errorMessage"));
+ Assert.assertNotNull(errorMessage);
+ // Check we are in good table
+ checkWebElementValue(By.id("votingListRESTRICTED_0PersonToList_0.votingId"), participantOneName);
+ checkWebElementValue(By.id("votingListRESTRICTED_0PersonToList_0.email"), participantOneEmail);
+ }
+
+ /**
+ * This test create a restricted text poll, with one participant without email.
+ * At the end, should stay on create poll page, cause the mail is mandatory.
+ */
+ @Test
+ public void createRestrictedTextPollWithParticipantWithoutName() {
+
+ // Prepare the poll
+ preparePoll();
+
+ // Go to option panel : click on it
+ WebElement optionsClick = findElement(By.xpath("//a[@href=\"#toptions\"]"));
+ optionsClick.click();
+
+ // Switch to restricted type
+ List<WebElement> pollTypesElement = findElements(By.name("poll.pollType"));
+ Assert.assertEquals(3, pollTypesElement.size());
+ WebElement restrictedTypeElement = pollTypesElement.get(1);
+ Assert.assertEquals("input", restrictedTypeElement.getTagName());
+ Assert.assertEquals("RESTRICTED", restrictedTypeElement.getAttribute("value"));
+ Assert.assertTrue(restrictedTypeElement.isDisplayed());
+ restrictedTypeElement.click();
+
+ // Set first participant
+ // send name
+ String participantOneName = "";
+ sendKeysById("votingListRESTRICTED_0PersonToList_0.votingId", participantOneName);
+ // send email
+ String participantOneEmail = "toto(a)codelutin.com";
+ sendKeysById("votingListRESTRICTED_0PersonToList_0.email", participantOneEmail);
+
+ // Submit form
+ WebElement submit = findElement(By.name("action:create"));
+ submit.click();
+
+ // All good, should be on summary page !
+ checkCurrentUrl(urlFixtures.createPoll(), false);
+ // Check an error message has been displayed
+ WebElement errorMessage = findElement(By.className("errorMessage"));
+ Assert.assertNotNull(errorMessage);
+ // Check we are in good table
+ checkWebElementValue(By.id("votingListRESTRICTED_0PersonToList_0.votingId"), participantOneName);
+ checkWebElementValue(By.id("votingListRESTRICTED_0PersonToList_0.email"), participantOneEmail);
+ }
+
+ /** Prepare the poll with general data : one title and two choices */
+ void preparePoll() {
+ // Go on home page
+ gotoUrl(urlFixtures.createPoll());
+
+ // Set title
+ sendKeysByName("poll.title", "My Poll");
+
+ // Set first choice
+ sendKeysByName("textChoice_0.name", "Choix numero un");
+
+ // Set second choice
+ sendKeysByName("textChoice_1.name", "Choix numero deux");
+ }
+
+}
Property changes on: trunk/pollen-ui-struts2/src/it/createPoll/src/test/java/org/chorem/pollen/ui/it/CreateRestrictedTextPollSIT.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/pollen-ui-struts2/src/it/createPoll/src/test/java/org/chorem/pollen/ui/it/CreateTextPollForGroupSIT.java (from rev 3629, trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/its/CreateTextPollForGroupSIT.java)
===================================================================
--- trunk/pollen-ui-struts2/src/it/createPoll/src/test/java/org/chorem/pollen/ui/it/CreateTextPollForGroupSIT.java (rev 0)
+++ trunk/pollen-ui-struts2/src/it/createPoll/src/test/java/org/chorem/pollen/ui/it/CreateTextPollForGroupSIT.java 2012-08-26 16:34:56 UTC (rev 3632)
@@ -0,0 +1,484 @@
+/*
+ * #%L
+ * Pollen :: UI (struts2)
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2012 CodeLutin
+ * %%
+ * 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.it;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+
+import java.util.List;
+
+/**
+ * Test the well work of a text poll creation page with the use of groups.
+ * <p/>
+ * Tested cases :
+ * <ul>
+ * <li>Creation with a nonamed group (KO)</li>
+ * <li>Creation with two group with same name (KO)</li>
+ * <li>Creation with a participant without email (KO)</li>
+ * <li>Creation with a participant with only an email (no name) (KO)</li>
+ * <li>Creation with two participants with same name in same group (KO)</li>
+ * <li>Creation with two participants with same email (KO)</li>
+ * <li>Creation with two participants with same name in different group (KO)</li>
+ * <li>Creation with two participants with same email in different group (KO)</li>
+ * </ul>
+ *
+ * @author ymartel <martel(a)codelutin.com>
+ * @since 1.4
+ */
+public class CreateTextPollForGroupSIT extends AbstractPollenIT {
+
+ public CreateTextPollForGroupSIT(Class<? extends WebDriver> driverType) {
+ super(driverType);
+ }
+
+ /**
+ * This test create a text poll with group of participant but with no name on group.
+ * At the end, should stay on create page cause the group name is mandatory
+ */
+ @Test
+ public void createTextPollWithNoNamedGroup() {
+
+ // Prepare the poll
+ preparePoll();
+
+ // Go to option panel and display group form
+ goToGroupForm();
+
+ // Check that the group form is displayed
+ WebElement groupNameElement = findElement(By.id("votingListGROUP_0.name"));
+ Assert.assertEquals("input", groupNameElement.getTagName());
+ Assert.assertTrue(groupNameElement.isDisplayed());
+
+ // Set a participant in the group
+ // send name
+ String participantOneName = "toto";
+ sendKeysById("votingListGROUP_0PersonToList_0.votingId", participantOneName);
+ // send email
+ String participantOneEmail = "toto(a)codelutin.com";
+ sendKeysById("votingListGROUP_0PersonToList_0.email", participantOneEmail);
+
+ // Submit form
+ WebElement submit = findElement(By.name("action:create"));
+ submit.click();
+
+ // All good, should be on summary page !
+ checkCurrentUrl(urlFixtures.createPoll(), false);
+ // Check an error message has been displayed
+ WebElement errorMessage = findElement(By.className("errorMessage"));
+ Assert.assertNotNull(errorMessage);
+ // Check we are in good table, and group form is still displayed
+ groupNameElement = findElement(By.id("votingListGROUP_0.name"));
+ Assert.assertEquals("input", groupNameElement.getTagName());
+ Assert.assertTrue(groupNameElement.isDisplayed());
+ // check the participant is still here
+ checkWebElementValue(By.id("votingListGROUP_0PersonToList_0.votingId"), participantOneName);
+ checkWebElementValue(By.id("votingListGROUP_0PersonToList_0.email"), participantOneEmail);
+ }
+
+ /**
+ * This test create a group text poll, with two groups with same name.
+ * At the end, should stay on create poll page, cause the group name should be unique.
+ * The group names and participants should not be lost.
+ */
+ @Test
+ public void createGroupTextPollWithGroupsWithSameName() {
+
+ // Prepare the poll
+ preparePoll();
+
+ // Go to option panel and display group form
+ goToGroupForm();
+
+ // Set First group name
+ String groupOneName = "my group";
+ sendKeysById("votingListGROUP_0.name", groupOneName);
+ // Set first participant in Group 1
+ // send name
+ String participantOneName = "toto";
+ sendKeysById("votingListGROUP_0PersonToList_0.votingId", participantOneName);
+ // send email
+ String participantOneEmail = "toto(a)codelutin.com";
+ sendKeysById("votingListGROUP_0PersonToList_0.email", participantOneEmail);
+
+ // Add a group
+ WebElement addGroupElement = findElement(By.name("pollen.action.addVotingList"));
+ Assert.assertEquals("input", addGroupElement.getTagName());
+ Assert.assertTrue(addGroupElement.isDisplayed());
+ addGroupElement.click();
+
+ // Set name of the second group: same as first one
+ sendKeysById("votingListGROUP_1.name", groupOneName);
+ // Set second participant in second group
+ // send name
+ String participantTwoName = "toto2";
+ sendKeysById("votingListGROUP_1PersonToList_0.votingId", participantTwoName);
+ // send email
+ String participantTwoEmail = "toto2(a)codelutin.com";
+ sendKeysById("votingListGROUP_1PersonToList_0.email", participantTwoEmail);
+
+ // Submit form
+ WebElement submit = findElement(By.name("action:create"));
+ submit.click();
+
+ // All good, should be on summary page !
+ checkCurrentUrl(urlFixtures.createPoll(), false);
+ // Check an error message has been displayed
+ WebElement errorMessage = findElement(By.className("errorMessage"));
+ Assert.assertNotNull(errorMessage);
+ // Check we are in good table
+ checkWebElementValue(By.id("votingListGROUP_0.name"), groupOneName);
+ checkWebElementValue(By.id("votingListGROUP_0PersonToList_0.votingId"), participantOneName);
+ checkWebElementValue(By.id("votingListGROUP_0PersonToList_0.email"), participantOneEmail);
+ checkWebElementValue(By.id("votingListGROUP_1.name"), groupOneName);
+ checkWebElementValue(By.id("votingListGROUP_1PersonToList_0.votingId"), participantTwoName);
+ checkWebElementValue(By.id("votingListGROUP_1PersonToList_0.email"), participantTwoEmail);
+ }
+
+ /**
+ * This test create a group text poll, with one participant without email.
+ * At the end, should stay on create poll page, cause the mail is mandatory.
+ */
+ @Test
+ public void createGroupTextPollWithParticipantWithoutMail() {
+
+ // Prepare the poll
+ preparePoll();
+
+ // Go to option panel and display group form
+ goToGroupForm();
+
+ // Set group name
+ String groupName = "my group";
+ sendKeysById("votingListGROUP_0.name", groupName);
+
+ // Set first participant
+ // send name
+ String participantName = "toto";
+ sendKeysById("votingListGROUP_0PersonToList_0.votingId", participantName);
+ // send an empty email
+ sendKeysById("votingListGROUP_0PersonToList_0.email", "");
+
+ // Submit form
+ WebElement submit = findElement(By.name("action:create"));
+ submit.click();
+
+ // All good, should be on summary page !
+ checkCurrentUrl(urlFixtures.createPoll(), false);
+ // Check an error message has been displayed
+ WebElement errorMessage = findElement(By.className("errorMessage"));
+ Assert.assertNotNull(errorMessage);
+ // Check we are in good table
+ checkWebElementValue(By.id("votingListGROUP_0.name"), groupName); // group name still here
+ checkWebElementValue(By.id("votingListGROUP_0PersonToList_0.votingId"), participantName); // participant name still here
+ checkWebElementValue(By.id("votingListGROUP_0PersonToList_0.email"), ""); // still no email
+ }
+
+ /**
+ * This test create a group text poll, with one participant without name.
+ * At the end, should stay on create poll page, cause the mail is mandatory.
+ */
+ @Test
+ public void createGroupTextPollWithParticipantWithoutName() {
+
+ // Prepare the poll
+ preparePoll();
+ // Go to option panel and display group form
+ goToGroupForm();
+
+
+ // Set group name
+ String groupName = "my group";
+ sendKeysById("votingListGROUP_0.name", groupName);
+
+ // Set a participant
+ // send name
+ sendKeysById("votingListGROUP_0PersonToList_0.votingId", "");
+ // send an empty email
+ String participantEmail = "toto(a)codelutin.com";
+ sendKeysById("votingListGROUP_0PersonToList_0.email", participantEmail);
+
+ // Submit form
+ WebElement submit = findElement(By.name("action:create"));
+ submit.click();
+
+ // All good, should be on summary page !
+ checkCurrentUrl(urlFixtures.createPoll(), false);
+ // Check an error message has been displayed
+ WebElement errorMessage = findElement(By.className("errorMessage"));
+ Assert.assertNotNull(errorMessage);
+ // Check we are in good table
+ checkWebElementValue(By.id("votingListGROUP_0.name"), groupName); // group name still here
+ checkWebElementValue(By.id("votingListGROUP_0PersonToList_0.votingId"), ""); // participant name still empty
+ checkWebElementValue(By.id("votingListGROUP_0PersonToList_0.email"), participantEmail); // still the mail
+ }
+
+ /**
+ * This test create a group text poll, with two participants with same email in same group.
+ * At the end, should stay on create poll page, cause the email should be unique.
+ */
+ @Test
+ public void createTextPollWithSameGroupParticipantsWithSameEmail() {
+
+ // Prepare the poll
+ preparePoll();
+
+ // Go to option panel and display group form
+ goToGroupForm();
+
+ // Set group name
+ String groupName = "my group";
+ sendKeysById("votingListGROUP_0.name", groupName);
+ // Set first participant in Group
+ // send name
+ String participantOneName = "toto";
+ sendKeysById("votingListGROUP_0PersonToList_0.votingId", participantOneName);
+ // send email
+ String participantEmail = "toto(a)codelutin.com";
+ sendKeysById("votingListGROUP_0PersonToList_0.email", participantEmail);
+
+ // Set second participant in Group with same email
+ // send name
+ String participantTwoName = "toto2";
+ sendKeysById("votingListGROUP_0PersonToList_1.votingId", participantTwoName);
+ // send email
+ sendKeysById("votingListGROUP_0PersonToList_1.email", participantEmail);
+
+ // Submit form
+ WebElement submit = findElement(By.name("action:create"));
+ submit.click();
+
+ // All good, should be on summary page !
+ checkCurrentUrl(urlFixtures.createPoll(), false);
+ // Check an error message has been displayed
+ WebElement errorMessage = findElement(By.className("errorMessage"));
+ Assert.assertNotNull(errorMessage);
+ // Check we are in good table
+ checkWebElementValue(By.id("votingListGROUP_0.name"), groupName);
+ checkWebElementValue(By.id("votingListGROUP_0PersonToList_0.votingId"), participantOneName);
+ checkWebElementValue(By.id("votingListGROUP_0PersonToList_0.email"), participantEmail);
+ checkWebElementValue(By.id("votingListGROUP_0PersonToList_1.votingId"), participantTwoName);
+ checkWebElementValue(By.id("votingListGROUP_0PersonToList_1.email"), participantEmail);
+ }
+
+ /**
+ * This test create a group text poll, with two participants on different group with same email.
+ * At the end, should stay on create poll page, cause the participant names should be unique.
+ * The group names and participants should not be lost.
+ */
+ @Test
+ public void createGroupTextPollWithParticipantsWithSameEmail() {
+
+ // Prepare the poll
+ preparePoll();
+
+ // Go to option panel and display group form
+ goToGroupForm();
+
+ // Set First group name
+ String groupOneName = "my group";
+ sendKeysById("votingListGROUP_0.name", groupOneName);
+ // Set first participant in Group 1
+ // send name
+ String participantOneName = "toto";
+ sendKeysById("votingListGROUP_0PersonToList_0.votingId", participantOneName);
+ // send email
+ String participantEmail = "toto(a)codelutin.com";
+ sendKeysById("votingListGROUP_0PersonToList_0.email", participantEmail);
+
+ // Add a group
+ WebElement addGroupElement = findElement(By.name("pollen.action.addVotingList"));
+ Assert.assertEquals("input", addGroupElement.getTagName());
+ Assert.assertTrue(addGroupElement.isDisplayed());
+ addGroupElement.click();
+
+ // Set name of the second group
+ String groupTwoName = "my other group";
+ sendKeysById("votingListGROUP_1.name", groupTwoName);
+ // Set second participant in second group
+ // send name
+ String participantTwoName = "toto2";
+ sendKeysById("votingListGROUP_1PersonToList_0.votingId", participantTwoName);
+ // send email
+ sendKeysById("votingListGROUP_1PersonToList_0.email", participantEmail);
+
+ // Submit form
+ WebElement submit = findElement(By.name("action:create"));
+ submit.click();
+
+ // All good, should be on summary page !
+ checkCurrentUrl(urlFixtures.createPoll(), false);
+ // Check an error message has been displayed
+ WebElement errorMessage = findElement(By.className("errorMessage"));
+ Assert.assertNotNull(errorMessage);
+ // Check we are in good table
+ checkWebElementValue(By.id("votingListGROUP_0.name"), groupOneName);
+ checkWebElementValue(By.id("votingListGROUP_0PersonToList_0.votingId"), participantOneName);
+ checkWebElementValue(By.id("votingListGROUP_0PersonToList_0.email"), participantEmail);
+ checkWebElementValue(By.id("votingListGROUP_1.name"), groupTwoName);
+ checkWebElementValue(By.id("votingListGROUP_1PersonToList_0.votingId"), participantTwoName);
+ checkWebElementValue(By.id("votingListGROUP_1PersonToList_0.email"), participantEmail);
+ }
+
+ /**
+ * This test create a group text poll, with two participant with same name in a group.
+ * At the end, should stay on create poll page, cause the email should be unique.
+ * The group name and participant info must be not lost
+ */
+ @Test
+ public void createTextPollWithSameGroupParticipantsWithSameName() {
+
+ // Prepare the poll
+ preparePoll();
+
+ // Go to option panel and display option panel
+ goToGroupForm();
+
+ // Set group name
+ String groupName = "my group";
+ sendKeysById("votingListGROUP_0.name", groupName);
+ // Set first participant in Group
+ // send name
+ String participantName = "toto";
+ sendKeysById("votingListGROUP_0PersonToList_0.votingId", participantName);
+ // send email
+ String participantOneEmail = "toto(a)codelutin.com";
+ sendKeysById("votingListGROUP_0PersonToList_0.email", participantOneEmail);
+
+ // Set second participant in Group with same email
+ // send name
+ sendKeysById("votingListGROUP_0PersonToList_1.votingId", participantName);
+ // send email
+ String participantTwoEmail = "toto(a)codelutin.com";
+ sendKeysById("votingListGROUP_0PersonToList_1.email", participantTwoEmail);
+
+ // Submit form
+ WebElement submit = findElement(By.name("action:create"));
+ submit.click();
+
+ // All good, should be on summary page !
+ checkCurrentUrl(urlFixtures.createPoll(), false);
+ // Check an error message has been displayed
+ WebElement errorMessage = findElement(By.className("errorMessage"));
+ Assert.assertNotNull(errorMessage);
+ // Check we are in good table
+ checkWebElementValue(By.id("votingListGROUP_0.name"), groupName);
+ checkWebElementValue(By.id("votingListGROUP_0PersonToList_0.votingId"), participantName);
+ checkWebElementValue(By.id("votingListGROUP_0PersonToList_0.email"), participantOneEmail);
+ checkWebElementValue(By.id("votingListGROUP_0PersonToList_1.votingId"), participantName);
+ checkWebElementValue(By.id("votingListGROUP_0PersonToList_1.email"), participantTwoEmail);
+ }
+
+ /**
+ * This test create a group text poll, with two participants of different group with same name.
+ * At the end, should stay on create poll page, cause the participant name should be unique.
+ * The group names and participants should not be lost.
+ */
+ @Test
+ public void createGroupTextPollWithParticipantsWithSameName() {
+
+ // Prepare the poll
+ preparePoll();
+
+ // Go to option panel and group form
+ goToGroupForm();
+
+ // Set First group name
+ String groupOneName = "my group";
+ sendKeysById("votingListGROUP_0.name", groupOneName);
+ // Set first participant in Group 1
+ // send name
+ String participantName = "toto";
+ sendKeysById("votingListGROUP_0PersonToList_0.votingId", participantName);
+ // send email
+ String participantOneEmail = "toto(a)codelutin.com";
+ sendKeysById("votingListGROUP_0PersonToList_0.email", participantOneEmail);
+
+ // Add a group
+ WebElement addGroupElement = findElement(By.name("pollen.action.addVotingList"));
+ Assert.assertEquals("input", addGroupElement.getTagName());
+ Assert.assertTrue(addGroupElement.isDisplayed());
+ addGroupElement.click();
+
+ // Set name of the second group
+ String groupTwoName = "my other group";
+ sendKeysById("votingListGROUP_1.name", groupTwoName);
+ // Set second participant in second group
+ // send name
+ sendKeysById("votingListGROUP_1PersonToList_0.votingId", participantName);
+ // send email
+ String participantTwoEmail = "toto(a)codelutin.com";
+ sendKeysById("votingListGROUP_1PersonToList_0.email", participantTwoEmail);
+
+ // Submit form
+ WebElement submit = findElement(By.name("action:create"));
+ submit.click();
+
+ // All good, should be on summary page !
+ checkCurrentUrl(urlFixtures.createPoll(), false);
+ // Check an error message has been displayed
+ WebElement errorMessage = findElement(By.className("errorMessage"));
+ Assert.assertNotNull(errorMessage);
+ // Check we are in good table
+ checkWebElementValue(By.id("votingListGROUP_0.name"), groupOneName);
+ checkWebElementValue(By.id("votingListGROUP_0PersonToList_0.votingId"), participantName);
+ checkWebElementValue(By.id("votingListGROUP_0PersonToList_0.email"), participantOneEmail);
+ checkWebElementValue(By.id("votingListGROUP_1.name"), groupTwoName);
+ checkWebElementValue(By.id("votingListGROUP_1PersonToList_0.votingId"), participantName);
+ checkWebElementValue(By.id("votingListGROUP_1PersonToList_0.email"), participantTwoEmail);
+ }
+
+ /** Click on option panel, and select Group type to restrict the poll participation */
+ void goToGroupForm() {
+ // Go to option panel : click on it
+ WebElement optionsClick = findElement(By.xpath("//a[@href=\"#toptions\"]"));
+ optionsClick.click();
+
+ // Switch to group type
+ List<WebElement> pollTypesElement = findElements(By.name("poll.pollType"));
+ Assert.assertEquals(3, pollTypesElement.size());
+ WebElement restrictedTypeElement = pollTypesElement.get(2);
+ Assert.assertEquals("input", restrictedTypeElement.getTagName());
+ Assert.assertEquals("GROUP", restrictedTypeElement.getAttribute("value"));
+ Assert.assertTrue(restrictedTypeElement.isDisplayed());
+ restrictedTypeElement.click();
+ }
+
+ /** Prepare the poll with general data : one title and two choices */
+ void preparePoll() {
+ // Go on home page
+ gotoUrl(urlFixtures.createPoll());
+
+ // Set title
+ sendKeysByName("poll.title", "My Poll");
+
+ // Set first choice
+ sendKeysByName("textChoice_0.name", "Choix numero un");
+
+ // Set second choice
+ sendKeysByName("textChoice_1.name", "Choix numero deux");
+ }
+
+}
Property changes on: trunk/pollen-ui-struts2/src/it/createPoll/src/test/java/org/chorem/pollen/ui/it/CreateTextPollForGroupSIT.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Property changes on: trunk/pollen-ui-struts2/src/it/pollVoteVisibility
___________________________________________________________________
Modified: svn:ignore
- *.ipr
*.iws
*.iml
+ *.ipr
*.iws
*.iml
.idea
target
Modified: trunk/pollen-ui-struts2/src/it/pollVoteVisibility/goals.txt
===================================================================
--- trunk/pollen-ui-struts2/src/it/pollVoteVisibility/goals.txt 2012-08-26 16:34:10 UTC (rev 3631)
+++ trunk/pollen-ui-struts2/src/it/pollVoteVisibility/goals.txt 2012-08-26 16:34:56 UTC (rev 3632)
@@ -1 +1 @@
-clean post-integration-test -Prun-it
\ No newline at end of file
+clean post-integration-test -DrunIts
\ No newline at end of file
Modified: trunk/pollen-ui-struts2/src/it/pollVoteVisibility/pom.xml
===================================================================
--- trunk/pollen-ui-struts2/src/it/pollVoteVisibility/pom.xml 2012-08-26 16:34:10 UTC (rev 3631)
+++ trunk/pollen-ui-struts2/src/it/pollVoteVisibility/pom.xml 2012-08-26 16:34:56 UTC (rev 3632)
@@ -9,6 +9,7 @@
<groupId>org.chorem.pollen.it</groupId>
<artifactId>pollen-ui-it</artifactId>
<version>1.4.5-SNAPSHOT</version>
+ <relativePath>../pollen-ui-it/pom.xml</relativePath>
</parent>
<artifactId>pollVoteVisibility</artifactId>
Copied: trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/AnonymousFreePollByAnonymousIT.java (from rev 3629, trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/poll/ui/it/AnonymousFreePollByAnonymousIT.java)
===================================================================
--- trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/AnonymousFreePollByAnonymousIT.java (rev 0)
+++ trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/AnonymousFreePollByAnonymousIT.java 2012-08-26 16:34:56 UTC (rev 3632)
@@ -0,0 +1,103 @@
+package org.chorem.pollen.ui.it;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+
+/**
+ * Test a anonymous free poll created by a anonymous user.
+ * <p/>
+ * For that poll nobody can see votes.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.4.5
+ */
+public class AnonymousFreePollByAnonymousIT extends AbstractPollIT {
+
+ public AnonymousFreePollByAnonymousIT(Class<? extends WebDriver> driverType) {
+ super(driverType,
+ "cacb52f4d49047b7a7aa24ec528fcc87",
+ "e814ba6e25174d5983ad796c400520f5");
+ }
+
+ @Test
+ public void checkSummaryPollPage() {
+
+ // can not access to summary page with no pollId
+ gotoUrl(urlFixtures.summaryPoll(), urlFixtures.poll_required(), false);
+
+ // can not access to summary page with no creatorId
+ gotoUrl(urlFixtures.summaryPoll(pollUri), urlFixtures.poll_creator_required(), false);
+
+ // access to summary page
+ gotoUrl(urlFixtures.summaryPoll(adminPollUri), true);
+
+ // user can vote (#voteUrl)
+ findElement(By.id("voteUrl"));
+ }
+
+ @Test
+ public void checkModeratePollPage() {
+
+ // can not access to moderate page with no pollId
+ gotoUrl(urlFixtures.moderatePoll(), urlFixtures.poll_required(), false);
+
+ // can not access to moderate page with no creatorId
+ gotoUrl(urlFixtures.moderatePoll(pollUri), urlFixtures.poll_creator_required(), false);
+
+ // access to moderate page
+ gotoUrl(urlFixtures.moderatePoll(adminPollUri), true);
+
+ // can not vote
+ checkCanNotVote();
+
+ // can not see votes
+ checkCanNotSeeVote();
+ }
+
+ @Test
+ public void checkVoteForPage() {
+
+ // access to votefor page with no accountId
+ gotoUrl(urlFixtures.voteforPoll(pollUri), true);
+
+ // can vote
+ checkCanVote();
+
+ // can not see votes
+ checkCanNotSeeVote();
+ }
+
+ @Test
+ public void checkVoteForPageWithCreatorId() {
+
+ // access to votefor page with creatorId
+ gotoUrl(urlFixtures.voteforPoll(adminPollUri), true);
+
+ // can not vote
+ checkCanNotVote();
+
+ // can not see votes
+ checkCanNotSeeVote();
+ }
+
+ protected void checkCanNotSeeVote() {
+ checkNoElement(By.className("voted"));
+ checkNoElement(By.className("notVoted"));
+ }
+
+ protected void checkCanSeeVote() {
+ findElement(By.className("voted"));
+ findElement(By.className("notVoted"));
+ }
+
+ protected void checkCanNotVote() {
+ checkNoElement(By.id("voteForm_pollen_action_pollVote"));
+ checkNoElement(By.name("vote.choiceVoteToChoice[0].voteValue"));
+ }
+
+ protected void checkCanVote() {
+ findElement(By.id("voteForm_pollen_action_pollVote"));
+ findElement(By.name("vote.choiceVoteToChoice[0].voteValue"));
+ }
+}
Property changes on: trunk/pollen-ui-struts2/src/it/pollVoteVisibility/src/test/java/org/chorem/pollen/ui/it/AnonymousFreePollByAnonymousIT.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Property changes on: trunk/pollen-ui-struts2/src/it/pollen-ui-it
___________________________________________________________________
Modified: svn:ignore
- *.iml
*.ipr
*.iws
.idea
+ *.iml
*.ipr
*.iws
.idea
target
Modified: trunk/pollen-ui-struts2/src/it/pollen-ui-it/pom.xml
===================================================================
--- trunk/pollen-ui-struts2/src/it/pollen-ui-it/pom.xml 2012-08-26 16:34:10 UTC (rev 3631)
+++ trunk/pollen-ui-struts2/src/it/pollen-ui-it/pom.xml 2012-08-26 16:34:56 UTC (rev 3632)
@@ -13,7 +13,7 @@
<groupId>org.chorem.pollen.it</groupId>
<artifactId>pollen-ui-it</artifactId>
- <name>Pollen :: UI (IT)</name>
+ <name>Pollen :: IT</name>
<description>Super Pom des ITs</description>
<packaging>pom</packaging>
@@ -24,7 +24,8 @@
<explodedWarPath>../pollen-ui-it/target/war</explodedWarPath>
<pollenConfigurationFile>pollen-it.properties</pollenConfigurationFile>
- <pollenDataDirectory>${project.build.testOutputDirectory}/data</pollenDataDirectory>
+ <pollenDataDirectory>${project.build.testOutputDirectory}/data
+ </pollenDataDirectory>
</properties>
<dependencies>
@@ -112,14 +113,79 @@
<outputDirectory>
${project.build.directory}/war
</outputDirectory>
- <excludes>**/lib/*.jar</excludes>
+ <excludes>**/lib/*.jar,**/*.jsp</excludes>
</artifactItem>
+ <artifactItem>
+ <groupId>org.chorem.pollen</groupId>
+ <artifactId>pollen-ui-struts2</artifactId>
+ <version>${project.version}</version>
+ <type>war</type>
+ <overWrite>true</overWrite>
+ <outputDirectory>
+ ${project.build.directory}/toprocess
+ </outputDirectory>
+ <includes>WEB-INF/web.xml,WEB-INF/**/*.jsp,WEB-INF/**/*.class</includes>
+ </artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty-jspc-maven-plugin</artifactId>
+ <version>${jettyPluginVersion}</version>
+ <inherited>false</inherited>
+ <executions>
+ <execution>
+ <id>jspc</id>
+ <goals>
+ <goal>jspc</goal>
+ </goals>
+ <configuration>
+ <!--<verbose>true</verbose>-->
+ <webAppSourceDirectory>
+ ${project.build.directory}/toprocess
+ </webAppSourceDirectory>
+ <generatedClasses>
+ ${project.build.directory}/war/WEB-INF/classes
+ </generatedClasses>
+ <webXmlFragment>
+ ${project.build.directory}/war/WEB-INF/webfrag.xml
+ </webXmlFragment>
+ <webXml>
+ ${project.build.directory}/toprocess/WEB-INF/web.xml
+ </webXml>
+ <packageRoot>org.apache.jsp</packageRoot>
+
+ </configuration>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.struts</groupId>
+ <artifactId>struts2-core</artifactId>
+ <version>${struts2Version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.jgeppert.struts2.jquery</groupId>
+ <artifactId>struts2-jquery-plugin</artifactId>
+ <version>${jqueryPluginVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.jgeppert.struts2.jquery</groupId>
+ <artifactId>struts2-jquery-grid-plugin</artifactId>
+ <version>${jqueryPluginVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.struts</groupId>
+ <artifactId>struts2-sitemesh-plugin</artifactId>
+ <version>${struts2Version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+
</plugins>
<pluginManagement>
@@ -186,17 +252,25 @@
<profiles>
<profile>
- <id>run-it</id>
+ <id>start-server</id>
+ <activation>
+ <property>
+ <name>runIts</name>
+ <value>true</value>
+ </property>
+ </activation>
+ <properties>
+ <jetty.daemon>${runIts}</jetty.daemon>
+ </properties>
<build>
- <defaultGoal>post-integration-test</defaultGoal>
+ <defaultGoal>pre-integration-test</defaultGoal>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<executions>
-
<execution>
<id>start-pollen</id>
<phase>pre-integration-test</phase>
@@ -204,7 +278,7 @@
<goal>run</goal>
</goals>
<configuration>
- <daemon>true</daemon>
+ <!--<daemon>true</daemon>-->
<webAppSourceDirectory>
${explodedWarPath}
</webAppSourceDirectory>
@@ -219,17 +293,23 @@
<useTestScope>true</useTestScope>
</configuration>
</execution>
-
- <execution>
- <id>stop-pollen</id>
- <phase>post-integration-test</phase>
- <goals>
- <goal>stop</goal>
- </goals>
- </execution>
</executions>
</plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>run-tests</id>
+ <activation>
+ <property>
+ <name>runIts</name>
+ <value>true</value>
+ </property>
+ </activation>
+ <build>
+ <defaultGoal>integration-test</defaultGoal>
+ <plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
@@ -261,6 +341,35 @@
</build>
</profile>
+ <profile>
+ <id>stop-server</id>
+ <activation>
+ <property>
+ <name>runIts</name>
+ <value>true</value>
+ </property>
+ </activation>
+ <build>
+ <defaultGoal>post-integration-test</defaultGoal>
+ <plugins>
+
+ <plugin>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>stop-pollen</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
</profiles>
</project>
Property changes on: trunk/pollen-ui-struts2/src/it/security
___________________________________________________________________
Added: svn:ignore
+ target
*.ipr
*.iws
*.iml
.idea
Property changes on: trunk/pollen-ui-struts2/src/it/security/LICENSE.txt
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/pollen-ui-struts2/src/it/security/README.txt
===================================================================
--- trunk/pollen-ui-struts2/src/it/security/README.txt (rev 0)
+++ trunk/pollen-ui-struts2/src/it/security/README.txt 2012-08-26 16:34:56 UTC (rev 3632)
@@ -0,0 +1,7 @@
+========
+security
+========
+
+Pour tester la sécurité dans Pollen.
+
+TODO expliquer les differents scénarios testés.
\ No newline at end of file
Property changes on: trunk/pollen-ui-struts2/src/it/security/README.txt
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Property changes on: trunk/pollen-ui-struts2/src/it/security/changelog.txt
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/pollen-ui-struts2/src/it/security/goals.txt
===================================================================
--- trunk/pollen-ui-struts2/src/it/security/goals.txt (rev 0)
+++ trunk/pollen-ui-struts2/src/it/security/goals.txt 2012-08-26 16:34:56 UTC (rev 3632)
@@ -0,0 +1 @@
+clean post-integration-test -DrunIts
\ No newline at end of file
Property changes on: trunk/pollen-ui-struts2/src/it/security/goals.txt
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/pollen-ui-struts2/src/it/security/pom.xml
===================================================================
--- trunk/pollen-ui-struts2/src/it/security/pom.xml (rev 0)
+++ trunk/pollen-ui-struts2/src/it/security/pom.xml 2012-08-26 16:34:56 UTC (rev 3632)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.chorem.pollen.it</groupId>
+ <artifactId>pollen-ui-it</artifactId>
+ <version>1.4.5-SNAPSHOT</version>
+ <relativePath>../pollen-ui-it/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>security</artifactId>
+ <name>Pollen :: IT security</name>
+ <description>security</description>
+
+</project>
+
Property changes on: trunk/pollen-ui-struts2/src/it/security/pom.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/pollen-ui-struts2/src/it/security/src/jetty/jetty-context.xml
===================================================================
--- trunk/pollen-ui-struts2/src/it/security/src/jetty/jetty-context.xml (rev 0)
+++ trunk/pollen-ui-struts2/src/it/security/src/jetty/jetty-context.xml 2012-08-26 16:34:56 UTC (rev 3632)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ #%L
+ Pollen :: UI (struts2)
+ $Id$
+ $HeadURL: http://svn.chorem.org/svn/pollen/trunk/pollen-ui-struts2/src/jetty/jetty-co… $
+ %%
+ Copyright (C) 2009 - 2012 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%
+ -->
+
+<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
+
+<Configure class="org.eclipse.jetty.webapp.WebAppContext">
+ <Call name="setAttribute">
+ <Arg>org.eclipse.jetty.server.webapp.WebInfIncludeJarPattern</Arg>
+ <Arg>.*/.*jsp-api-[^/]\.jar$|./.*jsp-[^/]\.jar$|./.*taglibs[^/]*\.jar$</Arg>
+ </Call>
+</Configure>
\ No newline at end of file
Property changes on: trunk/pollen-ui-struts2/src/it/security/src/jetty/jetty-context.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Copied: trunk/pollen-ui-struts2/src/it/security/src/test/java/org/chorem/pollen/ui/it/LoginSIT.java (from rev 3629, trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/its/LoginSIT.java)
===================================================================
--- trunk/pollen-ui-struts2/src/it/security/src/test/java/org/chorem/pollen/ui/it/LoginSIT.java (rev 0)
+++ trunk/pollen-ui-struts2/src/it/security/src/test/java/org/chorem/pollen/ui/it/LoginSIT.java 2012-08-26 16:34:56 UTC (rev 3632)
@@ -0,0 +1,60 @@
+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;
+
+import java.util.List;
+
+/**
+ * Test the login action.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.4
+ */
+public class LoginSIT extends AbstractPollenIT {
+
+ public LoginSIT(Class<? extends WebDriver> driverType) {
+ super(driverType);
+ }
+
+ @Test
+ public void loginAdmin() {
+
+// gotoUrl(urlFixtures.home());
+
+ connect("admin", "admin");
+
+ // check info_success is on
+ findElement(By.className("info_success"));
+
+ // check there is a admin menu (so 4 menus)
+ List<WebElement> menus = findElements(By.className("menu_elt"));
+ Assert.assertEquals(4, menus.size());
+ }
+
+ @Test
+ public void loginUser() {
+
+// gotoUrl(urlFixtures.home());
+
+ connect("user", "user");
+
+ // check info_success is on
+ findElement(By.className("info_success"));
+
+ // check there is not a admin menu (so 3 menus)
+ List<WebElement> menus = findElements(By.className("menu_elt"));
+ Assert.assertEquals(3, menus.size());
+ }
+
+ @Test
+ public void badLogin() {
+
+ connect("admin", "admin" + System.currentTimeMillis());
+
+ findElement(By.className("info_error"));
+ }
+}
Property changes on: trunk/pollen-ui-struts2/src/it/security/src/test/java/org/chorem/pollen/ui/it/LoginSIT.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/pollen-ui-struts2/src/it/security/src/test/java/org/chorem/pollen/ui/it/SecurityAccessSIT.java (from rev 3629, trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/its/SecurityAccessSIT.java)
===================================================================
--- trunk/pollen-ui-struts2/src/it/security/src/test/java/org/chorem/pollen/ui/it/SecurityAccessSIT.java (rev 0)
+++ trunk/pollen-ui-struts2/src/it/security/src/test/java/org/chorem/pollen/ui/it/SecurityAccessSIT.java 2012-08-26 16:34:56 UTC (rev 3632)
@@ -0,0 +1,330 @@
+/*
+ * #%L
+ * Pollen :: UI (struts2)
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2012 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.it;
+
+import org.chorem.pollen.bean.PollUri;
+import org.junit.Test;
+import org.openqa.selenium.WebDriver;
+
+/**
+ * Test the security on some restricted pages :
+ * <p/>
+ * <ul>
+ * <li>Access to "connected pages" when connected (OK)</li>
+ * <li>Access to "connected pages" when not connected (KO)</li>
+ * <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 "restricted poll page" with a good accountId (OK)</li>
+ * <li>Access to "restricted poll page" with a bad accountId (KO)</li>
+ * </ul>
+ *
+ * @author ymartel <martel(a)codelutin.com>
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.4
+ */
+public class SecurityAccessSIT extends AbstractPollIT {
+
+ public SecurityAccessSIT(Class<? extends WebDriver> driverType) {
+ super(driverType,
+ "c7082f9752844b83a1859abcae3b681c",
+ "b9b434acd58d42fca083d473ee021fce");
+ }
+
+ /**
+ * This test :
+ * <ol>
+ * <li>Connect the user "user"</li>
+ * <li>Try to access to createdList page</li>
+ * <li>Try to access to invitedList page</li>
+ * <li>Try to access to participatedList page</li>
+ * <li>Try to access to favoriteLists page</li>
+ * </ol>
+ * <p/>
+ * All the page should be accessed.
+ */
+ @Test
+ public void accessConnectedPageAsUser() {
+
+ // login as user
+ connect("user", "user");
+
+ // try to access to createdList page, current url should be good one
+ gotoUrl(urlFixtures.createdList());
+
+ // try to access to participatedList page, current url should be good one
+ gotoUrl(urlFixtures.participatedList());
+
+ // try to access to invitedList page, current url should be good one
+ gotoUrl(urlFixtures.invitedList());
+
+ // try to access to favoriteLists page, current url should be good one
+ gotoUrl(urlFixtures.favoriteLists());
+ }
+
+ /**
+ * This test :
+ * <ol>
+ * <li>Don't login</li>
+ * <li>Try to access to createdList page</li>
+ * <li>Try to access to invitedList page</li>
+ * <li>Try to access to participatedList page</li>
+ * <li>Try to access to favoriteLists page</li>
+ * </ol>
+ * <p/>
+ * All the page should be redirected to connected_required page.
+ */
+ @Test
+ public void accessConnectedPageAsAnonymous() {
+
+ // try to access to createdList page, current url should be the connected_required one
+ gotoUrl(urlFixtures.createdList(), urlFixtures.connected_required(), false);
+
+ // try to access to participatedList page, current url should be the connected_required one
+ gotoUrl(urlFixtures.participatedList(), urlFixtures.connected_required(), false);
+
+ // try to access to invitedList page, current url should be the connected_required one
+ gotoUrl(urlFixtures.invitedList(), urlFixtures.connected_required(), false);
+
+ // try to access to favoriteLists page, current url should be the connected_required one
+ gotoUrl(urlFixtures.favoriteLists(), urlFixtures.connected_required(), false);
+ }
+
+ /**
+ * This test :
+ * <ol>
+ * <li>Don't login</li>
+ * <li>Try to access to admin polls list page</li>
+ * <li>Try to access to admin users list page</li>
+ * </ol>
+ * <p/>
+ * All the page should be redirected to connected_required page.
+ */
+ @Test
+ public void accessAdminPageAsAnonymous() {
+
+ // try to access to admin polls list page, current url should be the connected_required one
+ gotoUrl(urlFixtures.pollsList(), urlFixtures.connected_required(), false);
+
+ // try to access to admin users list page, current url should be the connected_required one
+ gotoUrl(urlFixtures.usersList(), urlFixtures.connected_required(), false);
+ }
+
+ /**
+ * This test :
+ * <ol>
+ * <li>Login as lambda user</li>
+ * <li>Try to access to admin polls list page</li>
+ * <li>Try to access to admin users list page</li>
+ * </ol>
+ * <p/>
+ * All the page should be redirected to admin_required page.
+ */
+ @Test
+ public void accessAdminPageAsUser() {
+
+ // login as user
+ connect("user", "user");
+
+ // try to access to admin polls list page, current url should be the admin_required one
+ gotoUrl(urlFixtures.pollsList(), urlFixtures.admin_required(), false);
+
+ // try to access to admin users list page, current url should be the admin_required one
+ gotoUrl(urlFixtures.usersList(), urlFixtures.admin_required(), false);
+ }
+
+ /**
+ * This test :
+ * <ol>
+ * <li>Login as admin</li>
+ * <li>Try to access to admin polls list page</li>
+ * <li>Try to access to admin users list page</li>
+ * </ol>
+ * <p/>
+ * All the page should be accessed.
+ */
+ @Test
+ public void accessAdminPageAsAdmin() {
+
+ // login as admin
+ connect("admin", "admin");
+
+ // try to access to admin polls list page, current url should be good one
+ gotoUrl(urlFixtures.pollsList());
+
+ // try to access to admin users list page, current url should be good one
+ gotoUrl(urlFixtures.usersList());
+ }
+
+ /**
+ * This test :
+ * <ol>
+ * <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 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.
+ */
+ @Test
+ public void accessNormalPollActionsAsAnonymous() {
+
+ String badPollId = pollId + System.nanoTime();
+ String badCreatorId = accountId + System.nanoTime();
+
+ // try to access to poll page, current url should be good one
+ String normalPollURL = urlFixtures.voteforPoll(pollUri);
+ gotoUrl(normalPollURL);
+
+ // try to access to poll page with bad pollId, current url should be the poll_required one
+ gotoUrl(urlFixtures.voteforPoll(PollUri.newPollUri(badPollId)), urlFixtures.poll_required(), false);
+
+ // try to access to poll moderation page, current url should be good one
+ String moderationURL = urlFixtures.voteforPoll(adminPollUri);
+ gotoUrl(moderationURL);
+
+ // try to access to poll page with bad pollId, current url should be the poll_required one
+ gotoUrl(urlFixtures.voteforPoll(newPollUri(badCreatorId)), urlFixtures.poll_access_required(), false);
+
+ // try to access to poll moderation page, current url should be good one
+ String normalPollAdminURL = urlFixtures.editPoll(adminPollUri);
+ gotoUrl(normalPollAdminURL);
+
+ // try to access to poll page with bad pollId, current url should be the poll_required one
+ gotoUrl(urlFixtures.editPoll(newPollUri(badCreatorId)), urlFixtures.poll_creator_required(), 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.
+ */
+ @Test
+ public void accessNormalPollActionsAsAdmin() {
+
+ // login as admin
+ connect("admin", "admin");
+
+ String badPollId = pollId + System.nanoTime();
+ String badCreatorId = accountId + System.nanoTime();
+
+ // try to access to poll page, current url should be good one
+ String normalPollURL = urlFixtures.voteforPoll(pollUri);
+ gotoUrl(normalPollURL);
+
+ // try to access to poll page with bad pollId, current url should be the poll_required one
+ gotoUrl(urlFixtures.voteforPoll(PollUri.newPollUri(badPollId)), urlFixtures.poll_required(), false);
+
+ // try to access to poll moderation page, current url should be good one
+ String moderationURL = urlFixtures.voteforPoll(adminPollUri);
+ gotoUrl(moderationURL);
+
+ // try to access to poll page with bad creatorId, current url should be the poll_required one
+ gotoUrl(urlFixtures.voteforPoll(newPollUri(badCreatorId)), urlFixtures.poll_access_required(), false);
+
+ // try to access to poll modification page without creator Id, current url should be good one (admin access)
+ String simpleNormalPollAdminURL = urlFixtures.editPoll(pollUri);
+ gotoUrl(simpleNormalPollAdminURL);
+
+ // try to access to poll modification page with creator Id, current url should be good one
+ String normalPollAdminURL = urlFixtures.editPoll(adminPollUri);
+ 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(urlFixtures.editPoll(newPollUri(badCreatorId)), urlFixtures.poll_creator_required(), 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.
+ */
+ @Test
+ public void accessNormalPollActionsAsOwner() {
+
+ // login as user
+ connect("user", "user");
+
+ String badPollId = pollId + System.nanoTime();
+ String badCreatorId = accountId + System.nanoTime();
+
+ // try to access to poll page, current url should be good one
+ String normalPollURL = urlFixtures.voteforPoll(pollUri);
+ gotoUrl(normalPollURL);
+
+ // try to access to poll page with bad pollId, current url should be the poll_required one
+ gotoUrl(urlFixtures.voteforPoll(PollUri.newPollUri(badPollId)), urlFixtures.poll_required(), false);
+
+ // try to access to poll moderation page, current url should be good one
+ String moderationURL = urlFixtures.voteforPoll(adminPollUri);
+ gotoUrl(moderationURL);
+
+ // try to access to poll page with bad pollId, current url should be the poll_required one
+ gotoUrl(urlFixtures.voteforPoll(newPollUri(badCreatorId)), urlFixtures.poll_access_required(), false);
+
+ // try to access to poll modification page without creator Id, current url should be good one (owner access)
+ String simpleNormalPollModificationURL = urlFixtures.editPoll(pollUri);
+ gotoUrl(simpleNormalPollModificationURL);
+
+ // try to access to poll modification page with creator Id, current url should be good one
+ String normalPollModificationURL = urlFixtures.editPoll(adminPollUri);
+ 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(urlFixtures.editPoll(newPollUri(badCreatorId)), urlFixtures.poll_creator_required(), false);
+ }
+
+}
Property changes on: trunk/pollen-ui-struts2/src/it/security/src/test/java/org/chorem/pollen/ui/it/SecurityAccessSIT.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/pollen-ui-struts2/src/it/security/src/test/resources/data/db/pollendb.h2.db (from rev 3629, trunk/pollen-ui-struts2/src/test/resources/pollendb.h2.db)
===================================================================
(Binary files differ)
Property changes on: trunk/pollen-ui-struts2/src/it/security/src/test/resources/data/db/pollendb.h2.db
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/pollen-ui-struts2/src/main/resources/config/struts-poll.xml
===================================================================
--- trunk/pollen-ui-struts2/src/main/resources/config/struts-poll.xml 2012-08-26 16:34:10 UTC (rev 3631)
+++ trunk/pollen-ui-struts2/src/main/resources/config/struts-poll.xml 2012-08-26 16:34:56 UTC (rev 3632)
@@ -214,7 +214,7 @@
<!-- display * -->
<action name="display*"
- class="org.chorem.pollen.ui.actions.poll.Display{1}">
+ class="org.chorem.pollen.ui.actions.poll.form.Display{1}">
<result>/WEB-INF/jsp/poll/display{1}.jsp</result>
</action>
Deleted: 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-08-26 16:34:10 UTC (rev 3631)
+++ trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/PollenFixtures.java 2012-08-26 16:34:56 UTC (rev 3632)
@@ -1,169 +0,0 @@
-/*
- * #%L
- * Pollen :: UI (struts2)
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2009 - 2012 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.chorem.pollen.PollenConfiguration;
-import org.chorem.pollen.bean.PollUri;
-import org.nuiton.util.DateUtil;
-
-import java.util.Calendar;
-import java.util.Date;
-
-/**
- * Some fixtures for tests.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.4
- */
-public class PollenFixtures {
-
- /** 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";
- }
-
- public String normalPollCreatorId() {
- return "b9b434acd58d42fca083d473ee021fce";
- }
-
- public String datePattern() {
- return "dd/MM/yyyy HH:mm";
- }
-
- public String homeURL() {
- return baseUrl() + "home";
- }
-
- public String createdListURL() {
- return baseUrl() + "user/createdList";
- }
-
- public String invitedListURL() {
- return baseUrl() + "user/invitedList";
- }
-
- public String participatedListURL() {
- return baseUrl() + "user/participatedList";
- }
-
- public String favoriteListsURL() {
- return baseUrl() + "user/favoriteLists";
- }
-
- public String pollsListURL() {
- return baseUrl() + "admin/pollsList";
- }
-
- public String usersListURL() {
- return baseUrl() + "admin/usersList";
- }
-
- public String connected_requiredURL() {
- return baseUrl() + "security/connected_required";
- }
-
- public String admin_requiredURL() {
- return baseUrl() + "security/admin_required";
- }
-
- public String poll_requiredURL() {
- return baseUrl() + "security/illegal_access";
- }
-
- public String poll_access_requiredURL() {
- return baseUrl() + "security/illegal_access";
- }
-
- public String poll_creator_requiredURL() {
- return baseUrl() + "security/illegal_access";
- }
-
- public String voteforURL(PollUri pollUri) {
- return baseUrl() + "poll/votefor/" + pollUri.toString();
- }
-
- public String editURL(PollUri pollUri) {
- return baseUrl() + "poll/edit/" + pollUri.toString() + "!input";
- }
-
- public String createPollURL() {
- return baseUrl() + "poll/create";
- }
-
- public String summaryURL() {
- return baseUrl() + "poll/summary";
- }
-
- public String date(int year, int month, int day, int hour, int minute) {
- Calendar instance = Calendar.getInstance();
- instance.set(year, month, day, hour, minute);
- Date date = instance.getTime();
- String dateString = DateUtil.formatDate(date, datePattern());
- return dateString;
- }
-
- public String date(int year, int month, int day) {
- return date(year, month, day, 0, 0);
- }
-
- public String logoutURL() {
- return baseUrl() + "user/logout";
- }
-}
Deleted: 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-08-26 16:34:10 UTC (rev 3631)
+++ trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/PollenTestApplicationListener.java 2012-08-26 16:34:56 UTC (rev 3632)
@@ -1,93 +0,0 @@
-/*
- * #%L
- * Pollen :: UI (struts2)
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2009 - 2012 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.io.FileUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.chorem.pollen.PollenConfiguration;
-import org.chorem.pollen.PollenConfigurationOption;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Properties;
-
-/**
- * Pollen application listener used for test purposes.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.4
- */
-public class PollenTestApplicationListener extends PollenApplicationListener {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(PollenTestApplicationListener.class);
-
- @Override
- protected PollenConfiguration prepareConfiguration() {
- PollenConfiguration configuration = new PollenConfiguration(
- "pollen-test.properties",
- null) {
-
- @Override
- protected void loadApplicationConfig(String file,
- Properties defaultOptions) {
- super.loadApplicationConfig(file, defaultOptions);
-
- // let's add a suffix (to isolate this data dir)
- File dataDirectory = new File(getDataDirectory(),
- String.valueOf(System.nanoTime()));
- if (log.isInfoEnabled()) {
- log.info("Data directory = " + dataDirectory);
- }
- setOption(PollenConfigurationOption.DATA_DIR.getKey(),
- dataDirectory.getAbsolutePath());
-
-
- File incomingDatabase = getOptionAsFile("incomingDatabase");
-
- if (log.isInfoEnabled()) {
- log.info("Incoming db = " + incomingDatabase);
- }
- // copy db to correct path
- File dbDirectory = new File(dataDirectory, "db");
-
- try {
- if (log.isInfoEnabled()) {
- log.info("Copy incoming db [" + incomingDatabase +
- "] to [" + dbDirectory + "]");
- }
- FileUtils.copyFileToDirectory(
- incomingDatabase, dbDirectory);
- } catch (IOException e) {
- throw new IllegalStateException(
- "Could not copy db to " + dbDirectory);
- }
-
- }
- };
-
- return configuration;
- }
-}
Modified: trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/AbstractPollIT.java
===================================================================
--- trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/AbstractPollIT.java 2012-08-26 16:34:10 UTC (rev 3631)
+++ trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/AbstractPollIT.java 2012-08-26 16:34:56 UTC (rev 3632)
@@ -1,49 +1,17 @@
package org.chorem.pollen.ui.it;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.chorem.pollen.bean.PollUri;
import org.chorem.pollen.business.persistence.Poll;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.ClassRule;
-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;
-
/**
* Base class test for a it on a specific poll.
*
* @author tchemit <chemit(a)codelutin.com>
* @since 1.4.5
*/
-@RunWith(value = Parameterized.class)
-public class AbstractPollIT {
+public class AbstractPollIT extends AbstractPollenIT {
- /** Logger. */
- protected final Log log = LogFactory.getLog(getClass());
-
- @Parameterized.Parameters
- public static Collection<Object[]> driverTypes() {
- return WebDriverResources.driverTypes();
- }
-
- /** Selenium driver to use for all tests of this class. */
- @ClassRule
- public static final WebDriverResources seleniumServer = new WebDriverResources();
-
- /** URL fixtures. */
- protected static final PollenUrlFixtures urlFixtures = new PollenUrlFixtures();
-
- /** Type of driver used by currenttest. */
- protected final Class<? extends WebDriver> driverType;
-
/** {@link Poll#getPollId()}. */
protected final String pollId;
@@ -56,169 +24,17 @@
/** {@link PollUri} of the poll (with admin accountId ) */
protected final PollUri adminPollUri;
- /** Driver used by current test. */
- protected WebDriver driver;
-
protected AbstractPollIT(Class<? extends WebDriver> driverType,
String pollId, String accountId) {
+ super(driverType);
this.pollId = pollId;
this.accountId = accountId;
- this.driverType = driverType;
pollUri = PollUri.newPollUri(pollId);
adminPollUri = PollUri.newPollUri(pollId, accountId);
}
- @Before
- public void setUp() throws Exception {
- driver = seleniumServer.getDriver(driverType);
- }
-
- @After
- public void after() {
-
- // make sure driver came back in original state:
- // go back to home page and logout if was loggued in
- logout();
- }
-
protected PollUri newPollUri(String accountId) {
return PollUri.newPollUri(pollId, accountId);
}
-
- protected void logout() {
- gotoUrl(urlFixtures.logout(), urlFixtures.home(), true);
- }
-
- 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;
- }
- checkCurrentUrl(expectedUrl, strict);
- }
-
- /**
- * Check that the current URL is the expected one.
- * If it is a strict comparison, the URL should be the same that the wanted.
- * If not, it only checks that the current URL start with the wanted url.
- */
- protected void checkCurrentUrl(String expectedUrl, boolean strict) {
- if (strict) {
- Assert.assertEquals("Current url [" + driver.getCurrentUrl() + "] should be " + expectedUrl, expectedUrl, driver.getCurrentUrl());
- } else {
- Assert.assertTrue("Current url [" + driver.getCurrentUrl() + "] should starts with " + expectedUrl, 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();
- }
-
- /**
- * Set a value for a WebElement.
- * <p/>
- * This operations does 3 steps :
- * <ul>
- * <li>Get the WebElement thanks to its id (given in parameter)</li>
- * <li>check the element is an input</li>
- * <li>check the element is displayed</li>
- * <li>clear the element</li>
- * <li>send the wanted keys</li>
- * </ul>
- */
- protected void sendKeysById(String webElementId, String value) {
- sendKeysBy(By.id(webElementId), value);
- }
-
- /**
- * Set a value for a WebElement.
- * <p/>
- * This operations does 3 steps :
- * <ul>
- * <li>Get the WebElement thanks to its name (given in parameter)</li>
- * <li>check the element is an input</li>
- * <li>check the element is displayed</li>
- * <li>clear the element</li>
- * <li>send the wanted keys</li>
- * </ul>
- */
- protected void sendKeysByName(String webElementName, String value) {
- By byName = By.name(webElementName);
- sendKeysBy(byName, value);
- }
-
- /**
- * Set a value for a WebElement.
- * <p/>
- * This operations does 3 steps :
- * <ul>
- * <li>Get the WebElement thanks to a {@link By} locator</li>
- * <li>check the element is an input</li>
- * <li>check the element is displayed</li>
- * <li>clear the element</li>
- * <li>send the wanted keys</li>
- * </ul>
- */
- protected void sendKeysBy(By by, String value) {
- WebElement webElement = findElement(by);
- Assert.assertEquals("input", webElement.getTagName());
- Assert.assertTrue(webElement.isDisplayed());
- webElement.sendKeys(value);
- Assert.assertEquals(value, webElement.getAttribute("value"));
- }
-
- /**
- * Get a WebElement with a {@link By} locator, and check it is an input
- * and that is value is the one expected.
- */
- protected void checkWebElementValue(By by, String expectedValue) {
- WebElement webElement = findElement(by);
- Assert.assertEquals("input", webElement.getTagName());
- Assert.assertTrue(webElement.isDisplayed());
- Assert.assertEquals(expectedValue, webElement.getAttribute("value"));
- }
}
Added: trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/AbstractPollenIT.java
===================================================================
--- trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/AbstractPollenIT.java (rev 0)
+++ trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/AbstractPollenIT.java 2012-08-26 16:34:56 UTC (rev 3632)
@@ -0,0 +1,241 @@
+package org.chorem.pollen.ui.it;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.rules.TestName;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.nuiton.util.DateUtil;
+import org.openqa.selenium.By;
+import org.openqa.selenium.NoSuchElementException;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Base it test.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.4.5
+ */
+@RunWith(value = Parameterized.class)
+public abstract class AbstractPollenIT {
+
+ /** Logger. */
+ protected Log log = LogFactory.getLog(getClass());
+
+ @Parameterized.Parameters
+ public static Collection<Object[]> driverTypes() {
+ return WebDriverResources.driverTypes();
+ }
+
+ /** Selenium driver to use for all tests of this class. */
+ @ClassRule
+ public static final WebDriverResources seleniumServer = new WebDriverResources();
+
+ /** URL fixtures. */
+ protected static final PollenUrlFixtures urlFixtures = new PollenUrlFixtures();
+
+ /** Type of driver used by currenttest. */
+ protected final Class<? extends WebDriver> driverType;
+
+ @Rule
+ public final TestName testName = new TestName();
+
+ /** Driver used by current test. */
+ protected WebDriver driver;
+
+ protected AbstractPollenIT(Class<? extends WebDriver> driverType) {
+ this.driverType = driverType;
+ }
+
+ @Before
+ public void setUp() throws Exception {
+ driver = seleniumServer.getDriver(driverType);
+ if (log.isInfoEnabled()) {
+ log.info("start test " + getClass().getName() + "#" +
+ testName.getMethodName() +
+ " (" + driverType.getSimpleName() + ")");
+ }
+
+ gotoUrl(urlFixtures.home(), false);
+ }
+
+ @After
+ public void after() {
+
+ // make sure driver came back in original state:
+ // go back to home page and logout if was loggued in
+ logout();
+ }
+
+ protected void logout() {
+ gotoUrl(urlFixtures.logout(), urlFixtures.home(), false);
+ }
+
+ 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;
+ }
+ checkCurrentUrl(expectedUrl, strict);
+ }
+
+ /**
+ * Check that the current URL is the expected one.
+ * If it is a strict comparison, the URL should be the same that the wanted.
+ * If not, it only checks that the current URL start with the wanted url.
+ */
+ protected void checkCurrentUrl(String expectedUrl, boolean strict) {
+ if (strict) {
+ Assert.assertEquals("Current url [" + driver.getCurrentUrl() + "] should be " + expectedUrl, expectedUrl, driver.getCurrentUrl());
+ } else {
+ Assert.assertTrue("Current url [" + driver.getCurrentUrl() + "] should starts with " + expectedUrl, driver.getCurrentUrl().startsWith(expectedUrl));
+ }
+ }
+
+ protected void checkNoElement(By by) {
+ try {
+ findElement(by);
+ Assert.fail();
+ } catch (NoSuchElementException e) {
+ Assert.assertTrue(true);
+ }
+ }
+
+ 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 = findElement(By.id("tologin"));
+ loginClick.click();
+
+ // Find the text input element by its name
+ WebElement loginElement = findElement(By.name("login"));
+ Assert.assertEquals("input", loginElement.getTagName());
+ Assert.assertTrue(loginElement.isDisplayed());
+ loginElement.sendKeys(username);
+
+ WebElement passwordElement = findElement(By.name("password"));
+ Assert.assertTrue(passwordElement.isDisplayed());
+ Assert.assertEquals("input", passwordElement.getTagName());
+ passwordElement.sendKeys(password);
+
+ WebElement submit = findElement(By.name("action:login"));
+ submit.click();
+ }
+
+ /**
+ * Set a value for a WebElement.
+ * <p/>
+ * This operations does 3 steps :
+ * <ul>
+ * <li>Get the WebElement thanks to its id (given in parameter)</li>
+ * <li>check the element is an input</li>
+ * <li>check the element is displayed</li>
+ * <li>clear the element</li>
+ * <li>send the wanted keys</li>
+ * </ul>
+ */
+ protected void sendKeysById(String webElementId, String value) {
+ sendKeysBy(By.id(webElementId), value);
+ }
+
+ /**
+ * Set a value for a WebElement.
+ * <p/>
+ * This operations does 3 steps :
+ * <ul>
+ * <li>Get the WebElement thanks to its name (given in parameter)</li>
+ * <li>check the element is an input</li>
+ * <li>check the element is displayed</li>
+ * <li>clear the element</li>
+ * <li>send the wanted keys</li>
+ * </ul>
+ */
+ protected void sendKeysByName(String webElementName, String value) {
+ By byName = By.name(webElementName);
+ sendKeysBy(byName, value);
+ }
+
+ /**
+ * Set a value for a WebElement.
+ * <p/>
+ * This operations does 3 steps :
+ * <ul>
+ * <li>Get the WebElement thanks to a {@link By} locator</li>
+ * <li>check the element is an input</li>
+ * <li>check the element is displayed</li>
+ * <li>clear the element</li>
+ * <li>send the wanted keys</li>
+ * </ul>
+ */
+ protected void sendKeysBy(By by, String value) {
+ WebElement webElement = findElement(by);
+ Assert.assertEquals("input", webElement.getTagName());
+ Assert.assertTrue(webElement.isDisplayed());
+ webElement.sendKeys(value);
+ Assert.assertEquals(value, webElement.getAttribute("value"));
+ }
+
+ /**
+ * Get a WebElement with a {@link By} locator, and check it is an input
+ * and that is value is the one expected.
+ */
+ protected void checkWebElementValue(By by, String expectedValue) {
+ WebElement webElement = findElement(by);
+ Assert.assertEquals("input", webElement.getTagName());
+ Assert.assertTrue(webElement.isDisplayed());
+ Assert.assertEquals(expectedValue, webElement.getAttribute("value"));
+ }
+
+ protected String datePattern() {
+ return "dd/MM/yyyy HH:mm";
+ }
+
+ protected String date(int year, int month, int day, int hour, int minute) {
+ Calendar instance = Calendar.getInstance();
+ instance.set(year, month, day, hour, minute);
+ Date date = instance.getTime();
+ String dateString = DateUtil.formatDate(date, datePattern());
+ return dateString;
+ }
+
+ protected String date(int year, int month, int day) {
+ return date(year, month, day, 0, 0);
+ }
+}
Property changes on: trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/AbstractPollenIT.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Deleted: trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/AbstractPollenWebDriverIT.java
===================================================================
--- trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/AbstractPollenWebDriverIT.java 2012-08-26 16:34:10 UTC (rev 3631)
+++ trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/AbstractPollenWebDriverIT.java 2012-08-26 16:34:56 UTC (rev 3632)
@@ -1,205 +0,0 @@
-package org.chorem.pollen.ui.it;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.chorem.pollen.ui.PollenFixtures;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.ClassRule;
-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;
-
-/**
- * TODO
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since TODO
- */
-@RunWith(value = Parameterized.class)
-public abstract class AbstractPollenWebDriverIT {
-
- /** Logger. */
- protected final Log log = LogFactory.getLog(getClass());
-
- @Parameterized.Parameters
- public static Collection<Object[]> driverTypes() {
- return WebDriverResources.driverTypes();
- }
-
- @ClassRule
- public static final WebDriverResources seleniumServer = new WebDriverResources();
-
- protected final Class<? extends WebDriver> driverType;
-
- protected WebDriver driver;
-
- protected PollenFixtures fixtures;
-
- @Before
- public void setUp() throws Exception {
- driver = seleniumServer.getDriver(driverType);
- fixtures = new PollenFixtures();
- }
-
- @After
- public void after() {
-
- // make sure driver came back in original state:
- // go back to home page and logout if was loggued in
-
- gotoUrl(fixtures.logoutURL(), fixtures.homeURL(), true);
-
- }
-
- protected AbstractPollenWebDriverIT(Class<? extends WebDriver> driverType) {
- this.driverType = 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;
- }
- checkCurrentUrl(expectedUrl, strict);
- }
-
- /**
- * Check that the current URL is the expected one.
- * If it is a strict comparison, the URL should be the same that the wanted.
- * If not, it only checks that the current URL start with the wanted url.
- */
- protected void checkCurrentUrl(String expectedUrl, boolean strict) {
- if (strict) {
- Assert.assertEquals("Current url [" + driver.getCurrentUrl() + "] should be " + expectedUrl, expectedUrl, driver.getCurrentUrl());
- } else {
- Assert.assertTrue("Current url [" + driver.getCurrentUrl() + "] should starts with " + expectedUrl, 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();
- }
-
- /** Prepare the poll with general data : one title and two choices */
- void preparePoll() {
- // Go on home page
- gotoUrl(fixtures.createPollURL());
-
- // Set title
- sendKeysByName("poll.title", "My Poll");
-
- // Set first choice
- sendKeysByName("textChoice_0.name", "Choix numero un");
-
- // Set second choice
- sendKeysByName("textChoice_1.name", "Choix numero deux");
- }
-
- /**
- * Set a value for a WebElement.
- * This operations does 3 steps :
- * <ul>
- * <li>Get the WebElement thanks to its id (given in parameter)</li>
- * <li>check the element is an input</li>
- * <li>check the element is displayed</li>
- * <li>clear the element</li>
- * <li>send the wanted keys</li>
- * </ul>
- */
- protected void sendKeysById(String webElementId, String value) {
- sendKeysBy(By.id(webElementId), value);
- }
-
- /**
- * Set a value for a WebElement.
- * This operations does 3 steps :
- * <ul>
- * <li>Get the WebElement thanks to its name (given in parameter)</li>
- * <li>check the element is an input</li>
- * <li>check the element is displayed</li>
- * <li>clear the element</li>
- * <li>send the wanted keys</li>
- * </ul>
- */
- protected void sendKeysByName(String webElementName, String value) {
- By byName = By.name(webElementName);
- sendKeysBy(byName, value);
- }
-
- /**
- * Set a value for a WebElement.
- * This operations does 3 steps :
- * <ul>
- * <li>Get the WebElement thanks to a {@link By} locator</li>
- * <li>check the element is an input</li>
- * <li>check the element is displayed</li>
- * <li>clear the element</li>
- * <li>send the wanted keys</li>
- * </ul>
- */
- protected void sendKeysBy(By by, String value) {
- WebElement webElement = findElement(by);
- Assert.assertEquals("input", webElement.getTagName());
- Assert.assertTrue(webElement.isDisplayed());
- webElement.sendKeys(value);
- Assert.assertEquals(value, webElement.getAttribute("value"));
- }
-
- /** Get a WebElement with a {@link By} locator, and check it is an input and that is value is the one expected. */
- protected void checkWebElementValue(By by, String expectedValue) {
- WebElement webElement = findElement(by);
- Assert.assertEquals("input", webElement.getTagName());
- Assert.assertTrue(webElement.isDisplayed());
- Assert.assertEquals(expectedValue, webElement.getAttribute("value"));
- }
-}
Deleted: trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/LoginT.java
===================================================================
--- trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/LoginT.java 2012-08-26 16:34:10 UTC (rev 3631)
+++ trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/LoginT.java 2012-08-26 16:34:56 UTC (rev 3632)
@@ -1,62 +0,0 @@
-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;
-
-import java.util.List;
-
-/**
- * TODO
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since TODO
- */
-public class LoginT extends AbstractPollenWebDriverIT {
-
- public LoginT(Class<? extends WebDriver> driverType) {
- super(driverType);
- }
-
- @Test
- public void loginAdmin() throws Exception {
-
- gotoUrl(fixtures.homeURL());
-
- connect("admin", "admin");
-
- // check info_success is on
- findElement(By.className("info_success"));
-
- // check there is a admin menu (so 4 menus)
- List<WebElement> menus = findElements(By.className("menu_elt"));
- Assert.assertEquals(4, menus.size());
- }
-
- @Test
- public void loginUser() throws Exception {
-
- gotoUrl(fixtures.homeURL());
-
- connect("user", "user");
-
- // check info_success is on
- findElement(By.className("info_success"));
-
- // check there is not a admin menu (so 3 menus)
- List<WebElement> menus = findElements(By.className("menu_elt"));
- Assert.assertEquals(3, menus.size());
- }
-
- @Test
- public void badLogin() throws Exception {
-
- gotoUrl(fixtures.homeURL());
-
- connect("admin", "admin" + System.currentTimeMillis());
-
- findElement(By.className("info_error"));
- }
-}
Modified: trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/PollenUrlFixtures.java
===================================================================
--- trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/PollenUrlFixtures.java 2012-08-26 16:34:10 UTC (rev 3631)
+++ trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/PollenUrlFixtures.java 2012-08-26 16:34:56 UTC (rev 3632)
@@ -25,12 +25,14 @@
*/
private static enum POLLEN_URL {
+ //-- Security urls --//
poll_creator_required("security/illegal_access"),
poll_access_required("security/illegal_access"),
poll_required("security/illegal_access"),
- admin_required("security/illegal_access"),
- connected_required("security/illegal_access"),
+ admin_required("security/admin_required"),
+ connected_required("security/connected_required"),
+ //-- user urls --//
home("home"),
createdList("user/createdList"),
invitedList("user/invitedList"),
@@ -38,12 +40,15 @@
favoriteLists("user/favoriteLists"),
logout("user/logout"),
+ //-- admin urls --//
pollsList("admin/pollsList"),
usersList("admin/usersList"),
+ //-- poll urls --//
createPoll("poll/create"),
editPoll("poll/edit", "!input"),
voteforPoll("poll/votefor"),
+ moderatePoll("poll/moderate"),
summaryPoll("poll/summary");
private final String path;
@@ -180,13 +185,21 @@
}
public String summaryPoll(PollUri pollUri) {
- return POLLEN_URL.summaryPoll.toURL(this,pollUri);
+ return POLLEN_URL.summaryPoll.toURL(this, pollUri);
}
public String summaryPoll() {
return POLLEN_URL.summaryPoll.toURL(this);
}
+ public String moderatePoll(PollUri pollUri) {
+ return POLLEN_URL.moderatePoll.toURL(this, pollUri);
+ }
+
+ public String moderatePoll() {
+ return POLLEN_URL.moderatePoll.toURL(this);
+ }
+
public String logout() {
return POLLEN_URL.logout.toURL(this);
}
Modified: trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/WebDriverResources.java
===================================================================
--- trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/WebDriverResources.java 2012-08-26 16:34:10 UTC (rev 3631)
+++ trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/WebDriverResources.java 2012-08-26 16:34:56 UTC (rev 3632)
@@ -92,11 +92,8 @@
@Override
protected void starting(Description description) {
- String testName =
- description.getClassName() + "#" + description.getMethodName();
-
if (log.isInfoEnabled()) {
- log.info("Start test " + testName);
+ log.info("Start class test " + description.getClassName());
}
}
@@ -105,14 +102,20 @@
// close all servers
- for (WebDriver webDriver : servers.values()) {
- try {
- webDriver.quit();
- } catch (Exception e) {
- if (log.isErrorEnabled()) {
- log.error("Could not close nicely driver " + webDriver, e);
+ try {
+ for (WebDriver webDriver : servers.values()) {
+ try {
+ webDriver.quit();
+ } catch (Exception e) {
+ if (log.isErrorEnabled()) {
+ log.error("Could not close nicely driver " + webDriver, e);
+ }
}
}
+ } finally {
+
+ // clear servers
+ servers.clear();
}
}
Deleted: trunk/pollen-ui-struts2/src/test/resources/log4j.properties
===================================================================
--- trunk/pollen-ui-struts2/src/test/resources/log4j.properties 2012-08-26 16:34:10 UTC (rev 3631)
+++ trunk/pollen-ui-struts2/src/test/resources/log4j.properties 2012-08-26 16:34:56 UTC (rev 3632)
@@ -1,39 +0,0 @@
-###
-# #%L
-# Pollen :: UI (struts2)
-# $Id$
-# $HeadURL$
-# %%
-# Copyright (C) 2009 - 2012 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%
-###
-log4j.rootCategory=ERROR, console, file
-
-log4j.appender.console=org.apache.log4j.ConsoleAppender
-log4j.appender.console.layout=org.apache.log4j.PatternLayout
-log4j.appender.console.layout.ConversionPattern=[%p] %c %m%n
-
-log4j.logger.org.chorem.pollen=INFO
-log4j.logger.org.chorem.pollen.ui.PollenShiroIsAdministratorFilter=DEBUG
-log4j.logger.org.nuiton=INFO
-
-# FileAppender : need to have pollen.log.dir in system properties at application startup
-log4j.appender.file=org.apache.log4j.RollingFileAppender
-log4j.appender.file.File=${basedir}/target/pollen.log
-log4j.appender.file.MaxFileSize=10MB
-log4j.appender.file.MaxBackupIndex=4
-log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=%d{yyyy/MM/dd hh:mm:ss} %5p (%F:%L) %m%n
Deleted: trunk/pollen-ui-struts2/src/test/resources/pollen-test.properties
===================================================================
--- trunk/pollen-ui-struts2/src/test/resources/pollen-test.properties 2012-08-26 16:34:10 UTC (rev 3631)
+++ trunk/pollen-ui-struts2/src/test/resources/pollen-test.properties 2012-08-26 16:34:56 UTC (rev 3632)
@@ -1,44 +0,0 @@
-###
-# #%L
-# Pollen :: UI (struts2) Test
-# $Id$
-# $HeadURL$
-# %%
-# Copyright (C) 2009 - 2012 CodeLutin
-# %%
-# 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%
-###
-
-# Db configuration
-hibernate.dialect=org.hibernate.dialect.H2Dialect
-hibernate.connection.username=sa
-hibernate.connection.password=sa
-hibernate.connection.driver_class=org.h2.Driver
-hibernate.show_sql=false
-hibernate.hbm2ddl.auto=update
-
-# Database migration configuration
-topia.service.migration=org.nuiton.topia.migration.TopiaMigrationEngine
-topia.service.migration.callback=org.chorem.pollen.entities.migration.PollenMigrationCallback
-topia.service.migration.showSql=false
-
-# Version de l'application
-pollen.version=${project.version}
-
-# 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
Deleted: trunk/pollen-ui-struts2/src/test/resources/pollendb.h2.db
===================================================================
(Binary files differ)
Deleted: trunk/pollen-ui-struts2/src/test/resources/web-test.xml
===================================================================
--- trunk/pollen-ui-struts2/src/test/resources/web-test.xml 2012-08-26 16:34:10 UTC (rev 3631)
+++ trunk/pollen-ui-struts2/src/test/resources/web-test.xml 2012-08-26 16:34:56 UTC (rev 3632)
@@ -1,103 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- #%L
- Pollen :: UI (struts2)
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2009 - 2012 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%
- -->
-
-<web-app id="Pollen" version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
-
- <display-name>Pollen</display-name>
-
- <filter>
- <filter-name>topiaTransaction</filter-name>
- <filter-class>org.chorem.pollen.ui.PollenTopiaTransactionFilter</filter-class>
- </filter>
-
- <filter>
- <filter-name>struts-prepare</filter-name>
- <filter-class>
- org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter
- </filter-class>
- </filter>
- <filter>
- <filter-name>ShiroFilter</filter-name>
- <filter-class>org.apache.shiro.web.servlet.ShiroFilter</filter-class>
- </filter>
-
- <filter>
- <filter-name>sitemesh</filter-name>
- <filter-class>com.opensymphony.sitemesh.webapp.SiteMeshFilter</filter-class>
- </filter>
-
- <filter>
- <filter-name>struts-execute</filter-name>
- <filter-class>
- org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter
- </filter-class>
- </filter>
-
- <filter-mapping>
- <filter-name>topiaTransaction</filter-name>
- <url-pattern>/*</url-pattern>
- </filter-mapping>
-
- <filter-mapping>
- <filter-name>ShiroFilter</filter-name>
- <url-pattern>/*</url-pattern>
- <dispatcher>REQUEST</dispatcher>
- <dispatcher>FORWARD</dispatcher>
- <dispatcher>INCLUDE</dispatcher>
- <dispatcher>ERROR</dispatcher>
- </filter-mapping>
-
- <filter-mapping>
- <filter-name>struts-prepare</filter-name>
- <url-pattern>/*</url-pattern>
- </filter-mapping>
-
- <filter-mapping>
- <filter-name>sitemesh</filter-name>
- <url-pattern>/*</url-pattern>
- </filter-mapping>
-
- <filter-mapping>
- <filter-name>struts-execute</filter-name>
- <url-pattern>/*</url-pattern>
- </filter-mapping>
-
- <listener>
- <description>Init</description>
- <listener-class>org.chorem.pollen.ui.PollenTestApplicationListener</listener-class>
- </listener>
-
- <listener>
- <description>Shiro security layer</description>
- <listener-class>org.apache.shiro.web.env.EnvironmentLoaderListener</listener-class>
- </listener>
-
- <welcome-file-list>
- <welcome-file>/</welcome-file>
- <welcome-file>index.jsp</welcome-file>
- <welcome-file>home</welcome-file>
- </welcome-file-list>
-</web-app>
1
0
r3631 - trunk/pollen-services/src/main/java/org/chorem/pollen/services/impl
by tchemit@users.chorem.org 26 Aug '12
by tchemit@users.chorem.org 26 Aug '12
26 Aug '12
Author: tchemit
Date: 2012-08-26 18:34:10 +0200 (Sun, 26 Aug 2012)
New Revision: 3631
Url: http://chorem.org/repositories/revision/pollen/3631
Log:
refs #746: Improve security model (check accountId exists when in url
Modified:
trunk/pollen-services/src/main/java/org/chorem/pollen/services/impl/SecurityService.java
Modified: trunk/pollen-services/src/main/java/org/chorem/pollen/services/impl/SecurityService.java
===================================================================
--- trunk/pollen-services/src/main/java/org/chorem/pollen/services/impl/SecurityService.java 2012-08-26 16:33:47 UTC (rev 3630)
+++ trunk/pollen-services/src/main/java/org/chorem/pollen/services/impl/SecurityService.java 2012-08-26 16:34:10 UTC (rev 3631)
@@ -539,4 +539,21 @@
"from poll '" + pollId + "'", e);
}
}
+
+ public boolean isAccountExist(String accountId) {
+
+ try {
+
+ PollAccountDAO dao = getDAO(PollAccount.class);
+
+ PollAccount result = dao.findByAccountId(accountId);
+
+ return result != null;
+
+ } catch (TopiaException e) {
+ throw new PollenTechnicalException(
+ "Could not check pollAccount existence " +
+ "from account '" + accountId + "'", e);
+ }
+ }
}
1
0
r3630 - trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/security
by tchemit@users.chorem.org 26 Aug '12
by tchemit@users.chorem.org 26 Aug '12
26 Aug '12
Author: tchemit
Date: 2012-08-26 18:33:47 +0200 (Sun, 26 Aug 2012)
New Revision: 3630
Url: http://chorem.org/repositories/revision/pollen/3630
Log:
refs #746: Improve security model (check accountId exists when in url
Modified:
trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/security/AbstractPollenAuthorization.java
Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/security/AbstractPollenAuthorization.java
===================================================================
--- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/security/AbstractPollenAuthorization.java 2012-08-26 11:19:25 UTC (rev 3629)
+++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/security/AbstractPollenAuthorization.java 2012-08-26 16:33:47 UTC (rev 3630)
@@ -161,8 +161,25 @@
securityContext.setPoll(poll);
- // load user roles
- securityContext.loadUserRoles(securityService);
+ if (securityContext.isWithAccountId()) {
+
+ boolean accountExist = securityService.isAccountExist(
+ securityContext.getAccountId());
+
+ if (!accountExist) {
+
+ // bad accountId
+ errorMessage = n_("pollen.security.error.bad.accountId");
+ registerError(request, errorMessage);
+ }
+
+ }
+
+ if (errorMessage == null) {
+
+ // load user roles
+ securityContext.loadUserRoles(securityService);
+ }
}
if (log.isInfoEnabled()) {
1
0