r3637 - in trunk/pollen-ui-struts2/src: it/security/src/test/java/org/chorem/pollen/ui/it test/java/org/chorem/pollen/ui/it
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"); + } }
participants (1)
-
tchemit@users.chorem.org