Author: mgencur(a)redhat.com
Date: 2010-01-05 09:04:44 -0500 (Tue, 05 Jan 2010)
New Revision: 5379
Added:
ftest/permalink/
ftest/permalink/branches/
ftest/permalink/tags/
ftest/permalink/trunk/
ftest/permalink/trunk/pom.xml
ftest/permalink/trunk/src/
ftest/permalink/trunk/src/main/
ftest/permalink/trunk/src/main/java/
ftest/permalink/trunk/src/main/java/org/
ftest/permalink/trunk/src/main/java/org/jboss/
ftest/permalink/trunk/src/main/java/org/jboss/weld/
ftest/permalink/trunk/src/main/java/org/jboss/weld/example/
ftest/permalink/trunk/src/main/java/org/jboss/weld/example/permalink/
ftest/permalink/trunk/src/main/java/org/jboss/weld/example/permalink/test/
ftest/permalink/trunk/src/main/java/org/jboss/weld/example/permalink/test/selenium/
ftest/permalink/trunk/src/main/java/org/jboss/weld/example/permalink/test/selenium/PermalinkTest.java
Modified:
ftest/trunk/checkout.sh
Log:
WELD-345 functinal test for weld permalink example
Added: ftest/permalink/trunk/pom.xml
===================================================================
--- ftest/permalink/trunk/pom.xml (rev 0)
+++ ftest/permalink/trunk/pom.xml 2010-01-05 14:04:44 UTC (rev 5379)
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.jboss.weld.examples.ftest</groupId>
+ <artifactId>ftest-parent</artifactId>
+ <version>0.1</version>
+ </parent>
+
+ <groupId>org.jboss.weld.examples.ftest</groupId>
+ <artifactId>ftest-permalink</artifactId>
+ <version>0.1</version>
+ <packaging>jar</packaging>
+ <name>Weld Examples Ftest: Permalink</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.weld.examples.ftest</groupId>
+ <artifactId>ftest-common</artifactId>
+ <version>0.1</version>
+ </dependency>
+ </dependencies>
+
+</project>
+
Added:
ftest/permalink/trunk/src/main/java/org/jboss/weld/example/permalink/test/selenium/PermalinkTest.java
===================================================================
---
ftest/permalink/trunk/src/main/java/org/jboss/weld/example/permalink/test/selenium/PermalinkTest.java
(rev 0)
+++
ftest/permalink/trunk/src/main/java/org/jboss/weld/example/permalink/test/selenium/PermalinkTest.java 2010-01-05
14:04:44 UTC (rev 5379)
@@ -0,0 +1,80 @@
+/*
+ * 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.weld.example.permalink.test.selenium;
+
+import static org.testng.Assert.assertTrue;
+
+import org.jboss.weld.example.common.test.selenium.WeldSeleniumTest;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/**
+ * Tests permalink example in Weld. The first test just adds comment on the first
+ * topic and returns back. Second test tests permanent link from jsf2.
+ *
+ * @author mgencur
+ */
+public class PermalinkTest extends WeldSeleniumTest
+{
+ protected String MAIN_PAGE = "/home.jsf";
+ protected String PAGE_TITLE = "Direct links to the news you crave";
+ protected String VIEW_ENTRY_LINK = "xpath=//a[contains(text(),'View
Entry')][1]";
+ protected String TOPIC_TITLE = "Mojarra == RI";
+ protected String PERMALINK_LINK = "xpath=//a[@title='A bookmarkable link for
this entry.'][1]";
+ protected String AUTHOR_INPUT = "id=author";
+ protected String COMMENT_INPUT = "id=body";
+ protected String SUBMIT_BUTTON = "id=post";
+ protected String BACK_BUTTON =
"xpath=//input[@type='button'][@value='Back to main page']";
+ protected String COMMENT_TEXT = "This is my first comment on Mojarra
project";
+ protected String AUTHOR_NAME = "Martin";
+ protected String TEXT_ON_HOME_PAGE = "Annotation nation";
+
+
+ @BeforeMethod(dependsOnGroups = "seleniumSetUp")
+ public void open()
+ {
+ browser.open(contextPath + MAIN_PAGE);
+ browser.waitForPageToLoad();
+ }
+
+ @Test
+ public void addCommentOnTopicTest()
+ {
+ browser.clickAndWait(VIEW_ENTRY_LINK);
+ assertTrue(browser.isTextPresent(TOPIC_TITLE), "Topic title expected on the
page");
+ browser.type(AUTHOR_INPUT, AUTHOR_NAME);
+ browser.type(COMMENT_INPUT, COMMENT_TEXT);
+ browser.clickAndWait(SUBMIT_BUTTON);
+ assertTrue(browser.isTextPresent(AUTHOR_NAME), "A name of comment's author
expected");
+ assertTrue(browser.isTextPresent(COMMENT_TEXT), "A text of entered comment
expected");
+ browser.clickAndWait(BACK_BUTTON);
+ assertTrue(browser.isTextPresent(TEXT_ON_HOME_PAGE), "Home page
expected");
+ }
+
+ @Test(dependsOnMethods="addCommentOnTopicTest")
+ public void permanentLinkTest()
+ {
+ browser.clickAndWait(PERMALINK_LINK);
+ assertTrue(browser.isTextPresent(AUTHOR_NAME), "A name of comment's author
expected");
+ assertTrue(browser.isTextPresent(COMMENT_TEXT), "A text of entered comment
expected");
+ }
+}
Modified: ftest/trunk/checkout.sh
===================================================================
--- ftest/trunk/checkout.sh 2010-01-05 13:54:14 UTC (rev 5378)
+++ ftest/trunk/checkout.sh 2010-01-05 14:04:44 UTC (rev 5379)
@@ -23,7 +23,7 @@
SVNARGS=
SVNUPDATE=1
-MODULES="common login numberguess translator"
+MODULES="common login numberguess translator permalink"
while getopts “h:r:d:v” OPTION
do