roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gma...@apache.org
Subject svn commit: r1509527 - in /roller/trunk: ./ app/ it-selenium/ it-selenium/src/ it-selenium/src/test/ it-selenium/src/test/java/ it-selenium/src/test/java/org/ it-selenium/src/test/java/org/apache/ it-selenium/src/test/java/org/apache/roller/ it-seleniu...
Date Fri, 02 Aug 2013 03:45:39 GMT
Author: gmazza
Date: Fri Aug  2 03:45:39 2013
New Revision: 1509527

URL: http://svn.apache.org/r1509527
Log:
Initial check-in for Roller Selenium tests; see it-selenium/pom.xml for how to run.

Added:
    roller/trunk/it-selenium/
    roller/trunk/it-selenium/pom.xml
    roller/trunk/it-selenium/src/
    roller/trunk/it-selenium/src/test/
    roller/trunk/it-selenium/src/test/java/
    roller/trunk/it-selenium/src/test/java/org/
    roller/trunk/it-selenium/src/test/java/org/apache/
    roller/trunk/it-selenium/src/test/java/org/apache/roller/
    roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/
    roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/InitialLoginTestIT.java
    roller/trunk/it-selenium/src/test/resources/
    roller/trunk/it-selenium/src/test/resources/roller-jettyrun.properties
Modified:
    roller/trunk/app/pom.xml
    roller/trunk/pom.xml

Modified: roller/trunk/app/pom.xml
URL: http://svn.apache.org/viewvc/roller/trunk/app/pom.xml?rev=1509527&r1=1509526&r2=1509527&view=diff
==============================================================================
--- roller/trunk/app/pom.xml (original)
+++ roller/trunk/app/pom.xml Fri Aug  2 03:45:39 2013
@@ -494,7 +494,6 @@
             <plugin>
                 <groupId>org.eclipse.jetty</groupId>
                 <artifactId>jetty-maven-plugin</artifactId>
-                <version>9.0.4.v20130625</version>
                 <configuration>
                     <webApp>
                         <contextPath>/roller</contextPath>

Added: roller/trunk/it-selenium/pom.xml
URL: http://svn.apache.org/viewvc/roller/trunk/it-selenium/pom.xml?rev=1509527&view=auto
==============================================================================
--- roller/trunk/it-selenium/pom.xml (added)
+++ roller/trunk/it-selenium/pom.xml Fri Aug  2 03:45:39 2013
@@ -0,0 +1,191 @@
+<?xml version="1.0" encoding="UTF-8"?><!--
+ * 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.
+-->
+<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.apache.roller</groupId>
+        <artifactId>roller-project</artifactId>
+        <version>5.1.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>roller-selenium-tests</artifactId>
+    <packaging>war</packaging>
+
+    <properties>
+        <selenium.version>2.33.0</selenium.version>
+    </properties>
+
+    <!-- Process to run Selenium tests (actually no tests right now, just a skeleton)
+         1. Tests presently require Firefox browser, Chrome on the to-do list.
+
+         2. Run mvn clean install from the roller trunk or app folder, that will install
Roller in your
+         local Maven Repository.
+
+         3. Navigate to this directory and run mvn integration-test or clean install.  Test
results will
+            be in target/failsafe-reports.
+
+         4. Feel free to add more Selenium tests!
+    -->
+    <dependencies>
+        <dependency>
+            <groupId>org.seleniumhq.selenium</groupId>
+            <artifactId>selenium-java</artifactId>
+            <version>${selenium.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.seleniumhq.selenium</groupId>
+            <artifactId>selenium-firefox-driver</artifactId>
+            <version>${selenium.version}</version>
+        </dependency>
+        <!-- Will bring in once we configure a Chrome option -->
+        <!--dependency>
+            <groupId>org.seleniumhq.selenium</groupId>
+            <artifactId>selenium-chrome-driver</artifactId>
+            <version>${selenium.version}</version>
+        </dependency-->
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <!--
+             Type "war" listed below makes this a WAR overlay (i.e., incorporating
+             another WAR into this project in making a new WAR, with any additional
+             WAR configuration provided (here, none) going into the new WAR.
+        -->
+        <dependency>
+            <groupId>org.apache.roller</groupId>
+            <artifactId>roller-webapp</artifactId>
+            <version>${roller.version}</version>
+            <type>war</type>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <!-- Activates integration tests (by default, classes under tests
+                 that end with "IT")
+            -->
+            <plugin>
+                <artifactId>maven-failsafe-plugin</artifactId>
+                <version>2.12.4</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>integration-test</goal>
+                            <goal>verify</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <!-- Activates the Derby database during the integration test phase -->
+            <plugin>
+                <groupId>com.btmatthews.maven.plugins.inmemdb</groupId>
+                <artifactId>inmemdb-maven-plugin</artifactId>
+                <version>1.3.0</version>
+                <configuration>
+                    <monitorKey>inmemdb</monitorKey>
+                    <monitorPort>11527</monitorPort>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>run</id>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                        <configuration>
+                            <daemon>true</daemon>
+                            <type>derby</type>
+                            <database>rollerdb</database>
+                            <username>APP</username>
+                            <password>APP</password>
+                            <port>3223</port>
+                            <sources>
+                                <script>
+                                    <sourceFile>target/roller-selenium-tests-5.1.0-SNAPSHOT/WEB-INF/classes/dbscripts/derby/createdb.sql</sourceFile>
+                                </script>
+                            </sources>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>stop</id>
+                        <goals>
+                            <goal>stop</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <!-- Activates the Roller application during the integration test phase -->
+            <plugin>
+                <groupId>org.eclipse.jetty</groupId>
+                <artifactId>jetty-maven-plugin</artifactId>
+                <configuration>
+                    <webApp>
+                        <contextPath>/roller</contextPath>
+                    </webApp>
+                    <webAppSourceDirectory>target/roller-selenium-tests-5.1.0-SNAPSHOT</webAppSourceDirectory>
+                    <jettyXml>../app/src/test/resources/jetty.xml</jettyXml>
+                    <systemProperties>
+                        <systemProperty>
+                            <name>roller.custom.config</name>
+                            <value>src/test/resources/roller-jettyrun.properties</value>
+                        </systemProperty>
+                    </systemProperties>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>start-jetty</id>
+                        <phase>pre-integration-test</phase>
+                        <goals>
+                            <goal>start</goal>
+                        </goals>
+                        <configuration>
+                            <scanIntervalSeconds>0</scanIntervalSeconds>
+                            <daemon>true</daemon>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>stop-jetty</id>
+                        <phase>post-integration-test</phase>
+                        <goals>
+                            <goal>stop</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <dependencies>
+                    <dependency>
+                        <groupId>org.apache.derby</groupId>
+                        <artifactId>derby</artifactId>
+                        <version>${derby.version}</version>
+                    </dependency>
+                    <dependency>
+                        <groupId>org.apache.derby</groupId>
+                        <artifactId>derbyclient</artifactId>
+                        <version>${derby.version}</version>
+                    </dependency>
+                </dependencies>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
\ No newline at end of file

Added: roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/InitialLoginTestIT.java
URL: http://svn.apache.org/viewvc/roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/InitialLoginTestIT.java?rev=1509527&view=auto
==============================================================================
--- roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/InitialLoginTestIT.java
(added)
+++ roller/trunk/it-selenium/src/test/java/org/apache/roller/selenium/InitialLoginTestIT.java
Fri Aug  2 03:45:39 2013
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  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.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+package org.apache.roller.selenium;
+
+import java.util.regex.Pattern;
+import java.util.concurrent.TimeUnit;
+import org.junit.*;
+import static org.junit.Assert.*;
+import static org.hamcrest.CoreMatchers.*;
+import org.openqa.selenium.*;
+import org.openqa.selenium.firefox.FirefoxDriver;
+import org.openqa.selenium.support.ui.Select;
+
+public class InitialLoginTestIT {
+  private WebDriver driver;
+  private String baseUrl;
+  private boolean acceptNextAlert = true;
+  private StringBuffer verificationErrors = new StringBuffer();
+
+  @Before
+  public void setUp() throws Exception {
+    driver = new FirefoxDriver();
+    baseUrl = "http://localhost:8080/roller/";
+    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
+  }
+
+  @Test
+  public void testInitialLogin() throws Exception {
+    driver.get(baseUrl);
+    driver.findElement(By.linkText("New User Registration Page")).click();
+    driver.findElement(By.id("register_bean_userName")).clear();
+    driver.findElement(By.id("register_bean_userName")).sendKeys("bsmith");
+    driver.findElement(By.id("register_bean_screenName")).clear();
+    driver.findElement(By.id("register_bean_screenName")).sendKeys("bsmith");
+    driver.findElement(By.id("register_bean_fullName")).clear();
+    driver.findElement(By.id("register_bean_fullName")).sendKeys("Bob Smith");
+    driver.findElement(By.id("register_bean_emailAddress")).clear();
+    driver.findElement(By.id("register_bean_emailAddress")).sendKeys("bsmith@email.com");
+    driver.findElement(By.id("register_bean_passwordText")).clear();
+    driver.findElement(By.id("register_bean_passwordText")).sendKeys("roller123");
+    driver.findElement(By.id("register_bean_passwordConfirm")).clear();
+    driver.findElement(By.id("register_bean_passwordConfirm")).sendKeys("roller123");
+    driver.findElement(By.id("submit")).click();
+    driver.findElement(By.linkText("Click here")).click();
+    driver.findElement(By.id("j_username")).clear();
+    driver.findElement(By.id("j_username")).sendKeys("bsmith");
+    driver.findElement(By.id("j_password")).clear();
+    driver.findElement(By.id("j_password")).sendKeys("roller123");
+    driver.findElement(By.id("login")).click();
+    driver.findElement(By.linkText("create one?")).click();
+    driver.findElement(By.id("createWeblog_bean_name")).clear();
+    driver.findElement(By.id("createWeblog_bean_name")).sendKeys("Bob's Blog");
+    driver.findElement(By.id("createWeblog_bean_description")).clear();
+    driver.findElement(By.id("createWeblog_bean_description")).sendKeys("A blog suitable
for Selenium Testing");
+    driver.findElement(By.id("createWeblog_bean_handle")).clear();
+    driver.findElement(By.id("createWeblog_bean_handle")).sendKeys("bobsblog");
+    driver.findElement(By.id("createWeblog_0")).click();
+    driver.findElement(By.linkText("New Entry")).click();
+    driver.findElement(By.id("entry_bean_title")).clear();
+    driver.findElement(By.id("entry_bean_title")).sendKeys("My First Blog Entry");
+    driver.findElement(By.id("entry_bean_text")).clear();
+    driver.findElement(By.id("entry_bean_text")).sendKeys("<p>Hello!  I'm looking forward
to blogging lots of entries!</p>");
+    driver.findElement(By.id("entry_2")).click();
+    driver.findElement(By.linkText("http://localhost:8080/roller/bobsblog/entry/my_first_blog_entry")).click();
+  }
+
+  @After
+  public void tearDown() throws Exception {
+    driver.quit();
+    String verificationErrorString = verificationErrors.toString();
+    if (!"".equals(verificationErrorString)) {
+      fail(verificationErrorString);
+    }
+  }
+
+  private boolean isElementPresent(By by) {
+    try {
+      driver.findElement(by);
+      return true;
+    } catch (NoSuchElementException e) {
+      return false;
+    }
+  }
+
+  private boolean isAlertPresent() {
+    try {
+      driver.switchTo().alert();
+      return true;
+    } catch (NoAlertPresentException e) {
+      return false;
+    }
+  }
+
+  private String closeAlertAndGetItsText() {
+    try {
+      Alert alert = driver.switchTo().alert();
+      String alertText = alert.getText();
+      if (acceptNextAlert) {
+        alert.accept();
+      } else {
+        alert.dismiss();
+      }
+      return alertText;
+    } finally {
+      acceptNextAlert = true;
+    }
+  }
+}

Added: roller/trunk/it-selenium/src/test/resources/roller-jettyrun.properties
URL: http://svn.apache.org/viewvc/roller/trunk/it-selenium/src/test/resources/roller-jettyrun.properties?rev=1509527&view=auto
==============================================================================
--- roller/trunk/it-selenium/src/test/resources/roller-jettyrun.properties (added)
+++ roller/trunk/it-selenium/src/test/resources/roller-jettyrun.properties Fri Aug  2 03:45:39
2013
@@ -0,0 +1,56 @@
+# copied from roller-jettyrun.properties in "app" submodule,
+# Differences: no filtering done here and themes.dir location has changed.
+# Hopefully this file can be obsoleted and the one in app referenced directly
+installation.type=auto
+planet.aggregator.enabled=true
+
+database.configurationType=jdbc
+database.jdbc.driverClass=org.apache.derby.jdbc.ClientDriver
+# In-memory Derby database activated via "startdb" execution in app/pom.xml
+database.jdbc.connectionURL=jdbc:derby://localhost:3223/memory:rollerdb;create=true
+database.jdbc.username=app
+database.jdbc.password=app
+
+hibernate.dialect=org.hibernate.dialect.DerbyDialect
+hibernate.transaction.factory_class=org.hibernate.transaction.JDBCTransactionFactory
+
+#see http://wiki.eclipse.org/EclipseLink/Examples/JPA/Logging
+#eclipselink.logging.file=target/eclipselink.log
+# OFF, SEVERE, WARNING, INFO, CONFIG, FINE, FINER, ALL
+#eclipselink.logging.level=FINER
+
+# use plain text passwords in testing
+passwds.encryption.enabled=false
+
+# use src copy of themes for read-only access
+themes.dir=target/roller-selenium-tests-5.1.0-SNAPSHOT/themes
+
+# put work in work dir
+search.index.dir          =target/work/search-index
+uploads.dir               =target/work/uploadsdir
+mediafiles.storage.dir    =target/work/mediafiles
+log4j.appender.roller.File=target/work/roller.log
+
+# don't auto migrate during tests
+uploads.migrate.auto=false
+
+# override tasks.enabled so we can add a test task
+tasks.enabled=ScheduledEntriesTask,ResetHitCountsTask,TurnoverReferersTask,PingQueueTask,TestTask
+
+# test task
+tasks.TestTask.class=org.apache.roller.weblogger.business.TestTask
+tasks.TestTask.startTime=immediate
+tasks.TestTask.interval=1800
+tasks.TestTask.leaseTime=300
+
+# turn on theme reloading
+themes.reload.mode=true
+
+# turn off caching for testing/debugging
+cache.sitewide.enabled=false
+cache.weblogpage.enabled=false
+cache.weblogfeed.enabled=false
+cache.planet.enabled=false
+
+# logging - you can set Log4J properties here
+#log4j.logger.org.apache.roller.weblogger.business=DEBUG

Modified: roller/trunk/pom.xml
URL: http://svn.apache.org/viewvc/roller/trunk/pom.xml?rev=1509527&r1=1509526&r2=1509527&view=diff
==============================================================================
--- roller/trunk/pom.xml (original)
+++ roller/trunk/pom.xml Fri Aug  2 03:45:39 2013
@@ -28,6 +28,7 @@
 
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
         <roller.version>5.1.0-SNAPSHOT</roller.version>
         <derby.version>10.10.1.1</derby.version>
     </properties>
@@ -58,6 +59,11 @@
                         <downloadSources>true</downloadSources>
                     </configuration>
                 </plugin>
+                <plugin>
+                    <groupId>org.eclipse.jetty</groupId>
+                    <artifactId>jetty-maven-plugin</artifactId>
+                    <version>9.0.4.v20130625</version>
+                </plugin>
             </plugins>
         </pluginManagement>
      </build>



Mime
View raw message