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/05 14:33:46 UTC

svn commit: r1334415 [2/2] - in /rave/trunk: ./ rave-integration-tests/ rave-integration-tests/rave-admin-tests/ rave-integration-tests/rave-admin-tests/src/ rave-integration-tests/rave-admin-tests/src/main/ rave-integration-tests/rave-admin-tests/src/...

Propchange: rave/trunk/rave-integration-tests/rave-newuser-tests/src/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat May  5 12:33:44 2012
@@ -0,0 +1,6 @@
+.classpath
+.project
+target
+catalog.xml
+.settings
+*.iml

Propchange: rave/trunk/rave-integration-tests/rave-newuser-tests/src/main/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat May  5 12:33:44 2012
@@ -0,0 +1,6 @@
+.classpath
+.project
+target
+catalog.xml
+.settings
+*.iml

Propchange: rave/trunk/rave-integration-tests/rave-newuser-tests/src/main/java/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat May  5 12:33:44 2012
@@ -0,0 +1,6 @@
+.classpath
+.project
+target
+catalog.xml
+.settings
+*.iml

Propchange: rave/trunk/rave-integration-tests/rave-newuser-tests/src/main/java/org/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat May  5 12:33:44 2012
@@ -0,0 +1,6 @@
+.classpath
+.project
+target
+catalog.xml
+.settings
+*.iml

Propchange: rave/trunk/rave-integration-tests/rave-newuser-tests/src/main/java/org/apache/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat May  5 12:33:44 2012
@@ -0,0 +1,6 @@
+.classpath
+.project
+target
+catalog.xml
+.settings
+*.iml

Propchange: rave/trunk/rave-integration-tests/rave-newuser-tests/src/main/java/org/apache/rave/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat May  5 12:33:44 2012
@@ -0,0 +1,6 @@
+.classpath
+.project
+target
+catalog.xml
+.settings
+*.iml

Propchange: rave/trunk/rave-integration-tests/rave-newuser-tests/src/main/java/org/apache/rave/integrationtests/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat May  5 12:33:44 2012
@@ -0,0 +1,6 @@
+.classpath
+.project
+target
+catalog.xml
+.settings
+*.iml

Propchange: rave/trunk/rave-integration-tests/rave-newuser-tests/src/main/java/org/apache/rave/integrationtests/steps/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat May  5 12:33:44 2012
@@ -0,0 +1,6 @@
+.classpath
+.project
+target
+catalog.xml
+.settings
+*.iml

Added: rave/trunk/rave-integration-tests/rave-newuser-tests/src/main/java/org/apache/rave/integrationtests/steps/NewUserSteps.java
URL: http://svn.apache.org/viewvc/rave/trunk/rave-integration-tests/rave-newuser-tests/src/main/java/org/apache/rave/integrationtests/steps/NewUserSteps.java?rev=1334415&view=auto
==============================================================================
--- rave/trunk/rave-integration-tests/rave-newuser-tests/src/main/java/org/apache/rave/integrationtests/steps/NewUserSteps.java (added)
+++ rave/trunk/rave-integration-tests/rave-newuser-tests/src/main/java/org/apache/rave/integrationtests/steps/NewUserSteps.java Sat May  5 12:33:44 2012
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.rave.integrationtests.steps;
+
+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;
+
+/**
+ * Steps for the new user stories
+ */
+@Step
+public class NewUserSteps {
+
+    @Autowired
+    private Portal portal;
+
+    @When("I go to \"$url\"")
+    public void goTo(String url) {
+        portal.go(url);
+    }
+
+    @Then("I see the login page")
+    public void isLoginPage() {
+        final WebElement title = portal.findElement(By.tagName("title"));
+        assertThat(title.getText().trim(), equalTo("Login - Rave"));
+    }
+
+    @When("I follow the new account link")
+    public void followNewAccountLink() {
+        portal.pressNewAccountButton();
+    }
+
+    @Then("I get the new account form")
+    public void isNewAccountForm() {
+        // throws exception if id is not present
+        portal.getNewAccountForm();
+    }
+
+    @When("I fill in the form with username \"$username\" password \"$password\" confirmpassword \"$confirmPassword\" email \"$email\"")
+    public void populateNewAccountForm(String username, String password, String confirmpassword, String email) {
+        final WebElement newAccountForm = portal.getNewAccountForm();
+        newAccountForm.findElement(By.id("userNameField")).sendKeys(username);
+        newAccountForm.findElement(By.id("passwordField")).sendKeys(password);
+        newAccountForm.findElement(By.id("passwordConfirmField")).sendKeys(confirmpassword);
+        newAccountForm.findElement(By.id("emailField")).sendKeys(email);
+    }
+
+    @When("I submit the new account form")
+    public void submitNewAccountForm() {
+        portal.getNewAccountForm().submit();
+    }
+
+    @Then("A message appears \"$message\"")
+    public void messagePresent(String message) {
+        final WebElement messageBox = portal.findElement(By.className("alert"));
+        assertThat(message, equalTo(messageBox.getText().trim()));
+    }
+
+    @When("I fill in the login form with username \"$username\" password \"$password\"")
+    public void login(String username, String password) {
+        final WebElement loginForm = portal.getLoginForm();
+        loginForm.findElement(By.id("usernameField")).sendKeys(username);
+        loginForm.findElement(By.id("passwordField")).sendKeys(password);
+        loginForm.submit();
+    }
+
+    @Then("I see my portal page with the add new widgets box")
+    public void iSeeMyEmptyPortalPage() {
+        final WebElement emptyPageBox = portal.getEmptyPageBox();
+        assertThat(emptyPageBox.isDisplayed(), equalTo(Boolean.TRUE));
+    }
+
+
+}

Propchange: rave/trunk/rave-integration-tests/rave-newuser-tests/src/main/java/org/apache/rave/integrationtests/stories/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat May  5 12:33:44 2012
@@ -0,0 +1,6 @@
+.classpath
+.project
+target
+catalog.xml
+.settings
+*.iml

Added: rave/trunk/rave-integration-tests/rave-newuser-tests/src/main/java/org/apache/rave/integrationtests/stories/NewUserStories.java
URL: http://svn.apache.org/viewvc/rave/trunk/rave-integration-tests/rave-newuser-tests/src/main/java/org/apache/rave/integrationtests/stories/NewUserStories.java?rev=1334415&view=auto
==============================================================================
--- rave/trunk/rave-integration-tests/rave-newuser-tests/src/main/java/org/apache/rave/integrationtests/stories/NewUserStories.java (added)
+++ rave/trunk/rave-integration-tests/rave-newuser-tests/src/main/java/org/apache/rave/integrationtests/stories/NewUserStories.java Sat May  5 12:33:44 2012
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.rave.integrationtests.stories;
+
+import java.util.List;
+
+import org.jbehave.core.io.StoryFinder;
+
+import static java.util.Arrays.asList;
+import static org.jbehave.core.io.CodeLocations.codeLocationFromClass;
+
+/**
+ * Handles story for new users
+ */
+public class NewUserStories extends PortalStories {
+
+  @Override
+  protected List<String> storyPaths() {
+    return new StoryFinder().findPaths(codeLocationFromClass(this.getClass()).getFile(), asList("**/newuser.story"), null);
+  }
+}

Propchange: rave/trunk/rave-integration-tests/rave-newuser-tests/src/main/stories/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat May  5 12:33:44 2012
@@ -0,0 +1,6 @@
+.classpath
+.project
+target
+catalog.xml
+.settings
+*.iml

Added: rave/trunk/rave-integration-tests/rave-newuser-tests/src/main/stories/newuser.story
URL: http://svn.apache.org/viewvc/rave/trunk/rave-integration-tests/rave-newuser-tests/src/main/stories/newuser.story?rev=1334415&view=auto
==============================================================================
--- rave/trunk/rave-integration-tests/rave-newuser-tests/src/main/stories/newuser.story (added)
+++ rave/trunk/rave-integration-tests/rave-newuser-tests/src/main/stories/newuser.story Sat May  5 12:33:44 2012
@@ -0,0 +1,18 @@
+Meta:
+
+Narrative:
+As a new user
+I want to create an account
+So that I can login into the portal
+
+Scenario: User creates a new account and logs in into the portal
+When I go to "http://localhost:8080/portal"
+Then I see the login page
+When I follow the new account link
+Then I get the new account form
+When I fill in the form with username "newuser" password "password" confirmpassword "password" email "newuser@example.com"
+And I submit the new account form
+Then I see the login page
+And A message appears "Account successfully created"
+When I fill in the login form with username "newuser" password "password"
+Then I see my portal page with the add new widgets box

Modified: rave/trunk/rave-portal/pom.xml
URL: http://svn.apache.org/viewvc/rave/trunk/rave-portal/pom.xml?rev=1334415&r1=1334414&r2=1334415&view=diff
==============================================================================
--- rave/trunk/rave-portal/pom.xml (original)
+++ rave/trunk/rave-portal/pom.xml Sat May  5 12:33:44 2012
@@ -47,7 +47,7 @@
 
     <dependencies>
 
-    	<dependency>
+        <dependency>
             <groupId>org.apache.wookie</groupId>
             <artifactId>wookie</artifactId>
             <type>war</type>
@@ -70,11 +70,11 @@
             <type>war</type>
             <scope>provided</scope>
         </dependency>
-         <dependency>
+        <dependency>
             <groupId>org.apache.rave</groupId>
             <artifactId>rave-demo-gadgets</artifactId>
             <type>war</type>
-   	    <scope>provided</scope>
+            <scope>provided</scope>
         </dependency>
 
         <!-- Default database -->
@@ -83,7 +83,7 @@
             <artifactId>h2</artifactId>
         </dependency>
 
-        <!-- log4j logging -->        
+        <!-- log4j logging -->
         <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-log4j12</artifactId>
@@ -168,7 +168,7 @@
                                 <groupId>org.apache.rave</groupId>
                                 <artifactId>rave-demo-gadgets</artifactId>
                                 <type>war</type>
-                                <!-- I tried giving this name gagdets and it did not work. -->
+                                <!-- /gadgets is already taken in Shindig which runs on the ROOT context (/) -->
                                 <properties>
                                     <context>/demogadgets</context>
                                 </properties>