[seam-commits] Seam SVN: r9982 - in trunk: src/test/ftest and 10 other directories.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Tue Jan 27 09:28:12 EST 2009
Author: jharting
Date: 2009-01-27 09:28:12 -0500 (Tue, 27 Jan 2009)
New Revision: 9982
Added:
trunk/src/test/ftest/examples/todo/
trunk/src/test/ftest/examples/todo/build.xml
trunk/src/test/ftest/examples/todo/jboss-embedded.xml
trunk/src/test/ftest/examples/todo/jboss.xml
trunk/src/test/ftest/examples/todo/src/
trunk/src/test/ftest/examples/todo/src/org/
trunk/src/test/ftest/examples/todo/src/org/jboss/
trunk/src/test/ftest/examples/todo/src/org/jboss/seam/
trunk/src/test/ftest/examples/todo/src/org/jboss/seam/example/
trunk/src/test/ftest/examples/todo/src/org/jboss/seam/example/todo/
trunk/src/test/ftest/examples/todo/src/org/jboss/seam/example/todo/test/
trunk/src/test/ftest/examples/todo/src/org/jboss/seam/example/todo/test/selenium/
trunk/src/test/ftest/examples/todo/src/org/jboss/seam/example/todo/test/selenium/SeleniumTodoTest.java
Modified:
trunk/examples/todo/view/login.jsp
trunk/examples/todo/view/todo.jsp
trunk/src/test/ftest/build.xml
Log:
JBSEAM-3690 Added tests for todo example
Modified: trunk/examples/todo/view/login.jsp
===================================================================
--- trunk/examples/todo/view/login.jsp 2009-01-26 22:16:12 UTC (rev 9981)
+++ trunk/examples/todo/view/login.jsp 2009-01-27 14:28:12 UTC (rev 9982)
@@ -7,10 +7,10 @@
<body>
<h1>Login</h1>
<f:view>
- <h:form>
+ <h:form id="login">
<div>
- <h:inputText value="#{login.user}"/>
- <h:commandButton value="Login" action="#{login.login}"/>
+ <h:inputText id="username" value="#{login.user}"/>
+ <h:commandButton id="submit" value="Login" action="#{login.login}"/>
</div>
</h:form>
</f:view>
Modified: trunk/examples/todo/view/todo.jsp
===================================================================
--- trunk/examples/todo/view/todo.jsp 2009-01-26 22:16:12 UTC (rev 9981)
+++ trunk/examples/todo/view/todo.jsp 2009-01-27 14:28:12 UTC (rev 9982)
@@ -10,13 +10,13 @@
<f:view>
<h:form id="list">
<div>
- <h:outputText value="There are no todo items." rendered="#{empty taskInstancePriorityList}"/>
- <h:dataTable value="#{taskInstancePriorityList}" var="task" rendered="#{not empty taskInstancePriorityList}">
+ <h:outputText id="noItems" value="There are no todo items." rendered="#{empty taskInstancePriorityList}"/>
+ <h:dataTable id="items" value="#{taskInstancePriorityList}" var="task" rendered="#{not empty taskInstancePriorityList}">
<h:column>
<f:facet name="header">
<h:outputText value="Description"/>
</f:facet>
- <h:inputText value="#{task.description}" style="width: 400"/>
+ <h:inputText id="description" value="#{task.description}" style="width: 400"/>
</h:column>
<h:column>
<f:facet name="header">
@@ -30,18 +30,18 @@
<f:facet name="header">
<h:outputText value="Priority"/>
</f:facet>
- <h:inputText value="#{task.priority}" style="width: 30"/>
+ <h:inputText id="priority" value="#{task.priority}" style="width: 30"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Due Date"/>
</f:facet>
- <h:inputText value="#{task.dueDate}" style="width: 100">
+ <h:inputText id="dueDate" value="#{task.dueDate}" style="width: 100">
<s:convertDateTime type="date" dateStyle="short"/>
</h:inputText>
</h:column>
<h:column>
- <s:button action="#{todoList.done}" taskInstance="#{task}" value="Done"/>
+ <s:button id="done" action="#{todoList.done}" taskInstance="#{task}" value="Done"/>
</h:column>
</h:dataTable>
</div>
@@ -49,13 +49,13 @@
<h:messages/>
</div>
<div>
- <h:commandButton value="Update Items" rendered="#{not empty taskInstanceList}"/>
+ <h:commandButton id="update" value="Update Items" rendered="#{not empty taskInstanceList}"/>
</div>
</h:form>
<h:form id="new">
<div>
- <h:inputText value="#{todoList.description}" style="width: 400"/>
- <h:commandButton value="Create New Item" action="#{todoList.createTodo}"/>
+ <h:inputText id="description" value="#{todoList.description}" style="width: 400"/>
+ <h:commandButton id="create" value="Create New Item" action="#{todoList.createTodo}"/>
</div>
</h:form>
</f:view>
Modified: trunk/src/test/ftest/build.xml
===================================================================
--- trunk/src/test/ftest/build.xml 2009-01-26 22:16:12 UTC (rev 9981)
+++ trunk/src/test/ftest/build.xml 2009-01-27 14:28:12 UTC (rev 9982)
@@ -68,6 +68,7 @@
<testexample name="seampay" />
<testexample name="seamspace" />
<testexample name="spring" />
+ <testexample name="todo" />
<testexample name="wicket" />
<antcall target="stop.selenium.server"/>
</target>
@@ -83,6 +84,7 @@
<testexample name="registration" />
<testexample name="seambay" />
<testexample name="seampay" />
+ <testexample name="todo" />
<testexample name="booking" />
<testexample name="jpa" />
<testexample name="hibernate" />
@@ -147,6 +149,7 @@
<cleanexample name="seampay" />
<cleanexample name="seamspace" />
<cleanexample name="spring" />
+ <cleanexample name="todo" />
<cleanexample name="wicket" />
</target>
@@ -169,6 +172,7 @@
<undeployexample name="seampay" />
<undeployexample name="seamspace" />
<undeployexample name="spring" />
+ <undeployexample name="todo" />
<undeployexample name="wicket" />
</target>
Added: trunk/src/test/ftest/examples/todo/build.xml
===================================================================
--- trunk/src/test/ftest/examples/todo/build.xml (rev 0)
+++ trunk/src/test/ftest/examples/todo/build.xml 2009-01-27 14:28:12 UTC (rev 9982)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+JBoss, Home of Professional Open Source
+Copyright 2008, Red Hat Middleware LLC, and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software 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
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+-->
+<project name="todo.ftest.build" basedir="." default="build">
+ <property name="example.name" value="todo"/>
+ <property name="jboss.deploy.target" value="deploy"/>
+ <property name="jboss.undeploy.target" value="undeploy"/>
+ <property name="jboss.example.ready.check.url" value="seam-todo/login.seam"/>
+ <property name="jboss-embedded.deploy.target" value="tomcat.deploy"/>
+ <property name="jboss-embedded.undeploy.target" value="tomcat.undeploy"/>
+ <property name="jboss-embedded.example.ready.check.url" value="jboss-seam-todo/login.seam"/>
+
+ <import file="../build.xml" />
+</project>
Property changes on: trunk/src/test/ftest/examples/todo/build.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/src/test/ftest/examples/todo/jboss-embedded.xml
===================================================================
--- trunk/src/test/ftest/examples/todo/jboss-embedded.xml (rev 0)
+++ trunk/src/test/ftest/examples/todo/jboss-embedded.xml 2009-01-27 14:28:12 UTC (rev 9982)
@@ -0,0 +1,31 @@
+<!--
+JBoss, Home of Professional Open Source
+Copyright 2008, Red Hat Middleware LLC, and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software 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
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+-->
+<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" >
+<suite name="Todo example" verbose="2" parallel="false">
+ <test name="todo_jboss-embedded">
+ <parameter name="PROPERTY_FILE" value="" />
+ <parameter name="CONTEXT_PATH" value="/jboss-seam-todo" />
+ <classes>
+ <class name="org.jboss.seam.example.todo.test.selenium.SeleniumTodoTest" />
+ </classes>
+ </test>
+</suite>
Property changes on: trunk/src/test/ftest/examples/todo/jboss-embedded.xml
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ text/plain
Added: trunk/src/test/ftest/examples/todo/jboss.xml
===================================================================
--- trunk/src/test/ftest/examples/todo/jboss.xml (rev 0)
+++ trunk/src/test/ftest/examples/todo/jboss.xml 2009-01-27 14:28:12 UTC (rev 9982)
@@ -0,0 +1,31 @@
+<!--
+JBoss, Home of Professional Open Source
+Copyright 2008, Red Hat Middleware LLC, and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software 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
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+-->
+<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" >
+<suite name="Todo example" verbose="2" parallel="false">
+ <test name="todo_jboss">
+ <parameter name="PROPERTY_FILE" value="" />
+ <parameter name="CONTEXT_PATH" value="/seam-todo" />
+ <classes>
+ <class name="org.jboss.seam.example.todo.test.selenium.SeleniumTodoTest" />
+ </classes>
+ </test>
+</suite>
Property changes on: trunk/src/test/ftest/examples/todo/jboss.xml
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ text/plain
Added: trunk/src/test/ftest/examples/todo/src/org/jboss/seam/example/todo/test/selenium/SeleniumTodoTest.java
===================================================================
--- trunk/src/test/ftest/examples/todo/src/org/jboss/seam/example/todo/test/selenium/SeleniumTodoTest.java (rev 0)
+++ trunk/src/test/ftest/examples/todo/src/org/jboss/seam/example/todo/test/selenium/SeleniumTodoTest.java 2009-01-27 14:28:12 UTC (rev 9982)
@@ -0,0 +1,109 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.example.todo.test.selenium;
+
+import java.text.MessageFormat;
+
+import org.jboss.seam.example.common.test.selenium.SeamSeleniumTest;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import static org.testng.AssertJUnit.assertTrue;
+import static org.testng.AssertJUnit.assertFalse;
+import static org.testng.AssertJUnit.assertEquals;
+
+/**
+ * This is a base class for todo example selenium tests
+ * @author Jozef Hartinger
+ *
+ */
+public class SeleniumTodoTest extends SeamSeleniumTest
+{
+
+ public static final String LOGIN_URL = "/login.seam";
+ public static final String TODO_URL = "/todo.seam";
+ public static final String LOGIN_USERNAME = "id=login:username";
+ public static final String LOGIN_SUBMIT = "id=login:submit";
+ public static final String NEW_ITEM_DESCRIPTION = "id=new:description";
+ public static final String NEW_ITEM_CREATE = "id=new:create";
+
+ public static final String NO_ITEMS_FOUND = "id=list:noItems";
+ public static final String FIRST_ITEM_DESCRIPTION = "id=list:items:0:description";
+ public static final String FIRST_ITEM_PRIORITY = "id=list:items:0:priority";
+ public static final String FIRST_ITEM_DONE = "id=list:items:0:done";
+ public static final String NTH_ITEM_DESCRIPTION = "id=list:items:{0}:description";
+ public static final String NTH_ITEM_PRIORITY = "id=list:items:{0}:priority";
+ public static final String NTH_ITEM_DONE = "id=list:items:{0}:done";
+ public static final String ITEMS_COUNT = "//table[@id=\"list:items\"]/tbody/tr";
+ public static final String ITEMS_UPDATE = "list:update";
+
+
+ public static final String DEFAULT_USERNAME = "tester";
+
+ @BeforeClass
+ public void prepareTestFixture() {
+ String[] fixture = {"selenium test for todo example", "buy milk", "clean the bathroom"};
+ setUp();
+ assertTrue("Item list should be empty", browser.isElementPresent(NO_ITEMS_FOUND));
+ for (String item : fixture) {
+ browser.type(NEW_ITEM_DESCRIPTION, item);
+ browser.clickAndWait(NEW_ITEM_CREATE);
+ }
+ assertEquals("Unexpected count of items.", fixture.length, browser.getXpathCount(ITEMS_COUNT));
+ super.tearDown();
+ }
+
+ @BeforeMethod
+ @Override
+ public void setUp() {
+ super.setUp();
+ browser.open(CONTEXT_PATH + LOGIN_URL);
+ browser.type(LOGIN_USERNAME, DEFAULT_USERNAME);
+ browser.clickAndWait(LOGIN_SUBMIT);
+ assertTrue("Navigation failure. Todo page expected.", browser.getLocation().contains(TODO_URL));
+ }
+
+ @Test
+ public void getEntryDoneTest() {
+ String description = browser.getValue(FIRST_ITEM_DESCRIPTION);
+ int itemCount = browser.getXpathCount(ITEMS_COUNT).intValue();
+ browser.clickAndWait(FIRST_ITEM_DONE);
+ assertFalse("Item should disappear from item list when done.", browser.isTextPresent(description));
+ assertEquals("Unexpected count of items.", --itemCount, browser.getXpathCount(ITEMS_COUNT));
+ }
+
+ /**
+ * This test sets high priority to first item and verifies that the item is be moved to the bottom and the priority number is kept.
+ */
+ @Test
+ public void priorityTest() {
+ String description = browser.getValue(FIRST_ITEM_DESCRIPTION);
+ String priority = "10";
+ int itemCount = browser.getXpathCount(ITEMS_COUNT).intValue();
+ int lastItemRowId = itemCount - 1;
+ browser.type(FIRST_ITEM_PRIORITY, priority);
+ browser.clickAndWait(ITEMS_UPDATE);
+ assertEquals("Message should move to the end of item list after priority change.", description, browser.getValue(MessageFormat.format(NTH_ITEM_DESCRIPTION, lastItemRowId)));
+ assertEquals("Unexpected priority.", priority, browser.getValue(MessageFormat.format(NTH_ITEM_PRIORITY, lastItemRowId)));
+ }
+}
Property changes on: trunk/src/test/ftest/examples/todo/src/org/jboss/seam/example/todo/test/selenium/SeleniumTodoTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
More information about the seam-commits
mailing list