You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rave.apache.org by ja...@apache.org on 2012/05/29 21:59:25 UTC

svn commit: r1343952 - in /rave/trunk/rave-integration-tests/rave-default-account-tests/src/main: java/org/apache/rave/integrationtests/steps/DefaultAccountSteps.java stories/johnDoe.story

Author: jasha
Date: Tue May 29 19:59:25 2012
New Revision: 1343952

URL: http://svn.apache.org/viewvc?rev=1343952&view=rev
Log:
(Long) story to test edit profile page

Modified:
    rave/trunk/rave-integration-tests/rave-default-account-tests/src/main/java/org/apache/rave/integrationtests/steps/DefaultAccountSteps.java
    rave/trunk/rave-integration-tests/rave-default-account-tests/src/main/stories/johnDoe.story

Modified: rave/trunk/rave-integration-tests/rave-default-account-tests/src/main/java/org/apache/rave/integrationtests/steps/DefaultAccountSteps.java
URL: http://svn.apache.org/viewvc/rave/trunk/rave-integration-tests/rave-default-account-tests/src/main/java/org/apache/rave/integrationtests/steps/DefaultAccountSteps.java?rev=1343952&r1=1343951&r2=1343952&view=diff
==============================================================================
--- rave/trunk/rave-integration-tests/rave-default-account-tests/src/main/java/org/apache/rave/integrationtests/steps/DefaultAccountSteps.java (original)
+++ rave/trunk/rave-integration-tests/rave-default-account-tests/src/main/java/org/apache/rave/integrationtests/steps/DefaultAccountSteps.java Tue May 29 19:59:25 2012
@@ -19,14 +19,13 @@
 
 package org.apache.rave.integrationtests.steps;
 
+import org.apache.rave.integrationtests.pages.Portal;
 import org.jbehave.core.annotations.Then;
 import org.jbehave.core.annotations.When;
 import org.openqa.selenium.By;
 import org.openqa.selenium.WebElement;
 import org.springframework.beans.factory.annotation.Autowired;
 
-import org.apache.rave.integrationtests.pages.Portal;
-
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.hamcrest.MatcherAssert.assertThat;
 
@@ -90,4 +89,60 @@ public class DefaultAccountSteps {
         final WebElement title = portal.findElement(By.tagName("title"));
         assertThat(title.getText().trim(), equalTo("Login - Rave"));
 	 }
+
+    @Then("I see the email address \"$email\" on the profile page")
+    public void getEmailOnProfilePage(String email) {
+        final WebElement emailField = portal.findElement(By.id("email"));
+        assertThat(emailField.getText().trim(), equalTo(email));
+    }
+
+    @Then("I see the about me \"$aboutMe\" on the profile page")
+    public void getAboutMeOnProfilePage(String aboutMe) {
+        final WebElement aboutMeField = portal.findElement(By.id("aboutMe"));
+        assertThat(aboutMeField.getText().trim(), equalTo(aboutMe));
+    }
+
+    @Then("I see the status \"$status\" on the profile page")
+    public void getStatusOnProfilePage(String status) {
+        final WebElement statusField = portal.findElement(By.id("status"));
+        assertThat(statusField.getText().trim(), equalTo(status));
+    }
+
+    @When("I click on the \"$buttonId\" button")
+    public void clickButton(String buttonId) {
+        final WebElement button = portal.findElement(By.id(buttonId));
+        button.click();
+    }
+
+    @Then("I can edit the email address")
+    public void editEmailFieldIsVisible() {
+        final WebElement editEmailField = portal.findElement(By.id("emailField"));
+        editEmailField.isDisplayed();
+    }
+
+    @When("I change the email address to \"$email\"")
+    public void changeEmailAddress(String email) {
+        changeFieldValue("emailField", email);
+    }
+
+    @When("I change the about me to \"$aboutMe\"")
+    public void changeAboutMe(String aboutMe) {
+        changeFieldValue("aboutMeField", aboutMe);
+    }
+
+    @When("I change the status to \"$status\"")
+    public void changeStatus(String status) {
+        changeFieldValue("statusField", status);
+    }
+    private void changeFieldValue(String fieldId, String value) {
+        final WebElement field = portal.findElement(By.id(fieldId));
+        field.clear();
+        field.sendKeys(value);
+    }
+
+    @When("I submit the edit profile form")
+    public void submitProfileForm() {
+        final WebElement editAccountForm = portal.findElement(By.id("editAccountForm"));
+        editAccountForm.submit();
+    }
 }

Modified: rave/trunk/rave-integration-tests/rave-default-account-tests/src/main/stories/johnDoe.story
URL: http://svn.apache.org/viewvc/rave/trunk/rave-integration-tests/rave-default-account-tests/src/main/stories/johnDoe.story?rev=1343952&r1=1343951&r2=1343952&view=diff
==============================================================================
--- rave/trunk/rave-integration-tests/rave-default-account-tests/src/main/stories/johnDoe.story (original)
+++ rave/trunk/rave-integration-tests/rave-default-account-tests/src/main/stories/johnDoe.story Tue May 29 19:59:25 2012
@@ -12,3 +12,30 @@ When I log in with username "john.doe" a
 Then I see the message "Hello John Doe, welcome to Rave!" for the user "john.doe"
 When I log out
 Then I see the Rave login page
+
+Scenario: John Doe updates and reverts his profile
+When I log in with username "john.doe" and password "john.doe"
+And I go to "http://localhost:8080/portal/app/person/john.doe"
+Then I see the email address "john.doe@example.com" on the profile page
+And I see the about me "" on the profile page
+And I see the status "" on the profile page
+When I click on the "profileEdit" button
+Then I can edit the email address
+When I change the email address to "john.doe@example.net"
+And I change the about me to "I'm a test user"
+And I change the status to "It's complicated"
+And I submit the edit profile form
+Then I see the email address "john.doe@example.net" on the profile page
+And I see the about me "I'm a test user" on the profile page
+And I see the status "It's complicated" on the profile page
+When I click on the "profileEdit" button
+Then I can edit the email address
+When I change the email address to "john.doe@example.com"
+And I change the about me to ""
+And I change the status to ""
+And I submit the edit profile form
+Then I see the email address "john.doe@example.com" on the profile page
+And I see the about me "" on the profile page
+And I see the status "" on the profile page
+When I log out
+Then I see the Rave login page