Author: hlship
Date: Thu Feb 28 11:52:03 2008
New Revision: 632102
URL: http://svn.apache.org/viewvc?rev=632102&view=rev
Log:
TAPESTRY-2204: Upgrade tapestry-test to use Selenium 0.9.2
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/site/apt/upgrade.apt
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java
tapestry/tapestry5/trunk/tapestry-test/pom.xml
tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry/test/AbstractIntegrationTestSuite.java
Modified: tapestry/tapestry5/trunk/tapestry-core/src/site/apt/upgrade.apt
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/site/apt/upgrade.apt?rev=632102&r1=632101&r2=632102&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/site/apt/upgrade.apt (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/site/apt/upgrade.apt Thu Feb 28
11:52:03 2008
@@ -9,6 +9,9 @@
It is always advised to perform a full and complete build after upgrading.
+ You should also check the {{{../release-notes.html}project-wide release
notes}} for information
+ about bugs fixes and other improvements.
+
Release 5.0.11
* Field.getElementName()
@@ -40,9 +43,9 @@
* Grid Interfaces
- The {{{../apidocs/org/apache/tapestry/grid/GridModel.html}GridModel}} and
+ The {{{../apidocs/org/apache/tapestry/grid/GridModel.html}GridModel}}
interface and
the <<<prepare()>>> method of
- {{{../apidocs/org/apache/tapestry/grid/GridDataSource.html}GridDataSource}}
have changed to accomidate
+ {{{../apidocs/org/apache/tapestry/grid/GridDataSource.html}GridDataSource}}
have changed to accommodate
the ability to sort using multiple columns.
* PropertyModel
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java?rev=632102&r1=632101&r2=632102&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java
(original)
+++
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java
Thu Feb 28 11:52:03 2008
@@ -48,14 +48,14 @@
assertSourcePresent("<link href=\"/css/app.css\" rel=\"stylesheet\"
type=\"text/css\">");
- assertText("//[EMAIL PROTECTED]'icon']/@src",
"/images/tapestry_banner.gif");
+ assertAttribute("//[EMAIL PROTECTED]'icon']/@src",
"/images/tapestry_banner.gif");
// doesn't prove that the image shows up in the client browser (it
does, but
// it could just as easily be a broken image). Haven't figured out how
Selenium
// allows to be verified. Note that the path below represents some
aliasing
// of the raw classpath resource path.
- assertText("//[EMAIL PROTECTED]'button']/@src",
"/assets/app1/pages/nested/tapestry-button.png");
+ assertAttribute("//[EMAIL PROTECTED]'button']/@src",
"/assets/app1/pages/nested/tapestry-button.png");
// Read the byte stream for the asset and compare to the real copy.
@@ -317,10 +317,10 @@
// Check on decorations via the default validation decorator:
- assertText("//label[1]/@class", "t-error");
- assertText("//label[2]/@class", "t-error");
- assertText("//[EMAIL PROTECTED]'email']/@class", "t-error");
- assertText("//[EMAIL PROTECTED]'message']/@class", "t-error");
+ assertAttribute("//label[1]/@class", "t-error");
+ assertAttribute("//label[2]/@class", "t-error");
+ assertAttribute("//[EMAIL PROTECTED]'email']/@class", "t-error");
+ assertAttribute("//[EMAIL PROTECTED]'message']/@class", "t-error");
type("email", "[EMAIL PROTECTED]");
type("message", "Show me the money!");
@@ -331,7 +331,7 @@
assertTextPresent("[false]");
assertTextPresent("The input value 'foo' is not parseable as an
integer value.");
- assertText("//[EMAIL PROTECTED]'hours']/@value", "foo");
+ assertAttribute("//[EMAIL PROTECTED]'hours']/@value", "foo");
type("hours", " 19 ");
click("//[EMAIL PROTECTED]'urgent']");
@@ -521,15 +521,15 @@
// Part of the override for the firstName property
- assertText("//[EMAIL PROTECTED]'firstName']/@size", "40");
+ assertAttribute("//[EMAIL PROTECTED]'firstName']/@size", "40");
// Check that the @Width annotation works
- assertText("//[EMAIL PROTECTED]'birthYear']/@size", "4");
+ assertAttribute("//[EMAIL PROTECTED]'birthYear']/@size", "4");
// Check override of the submit label
- assertText("//[EMAIL PROTECTED]'submit']/@value", "Register");
+ assertAttribute("//[EMAIL PROTECTED]'submit']/@value", "Register");
type("firstName", "a");
@@ -643,8 +643,8 @@
// The lack of a leading slash indicates that the path was optimized,
see TAPESTRY-1502
- assertText("//[EMAIL PROTECTED]'title:sort']/@src",
"assets/tapestry/corelib/components/sort-asc.png");
- assertText("//[EMAIL PROTECTED]'title:sort']/@alt", "[Asc]");
+ assertAttribute("//[EMAIL PROTECTED]'title:sort']/@src",
"assets/tapestry/corelib/components/sort-asc.png");
+ assertAttribute("//[EMAIL PROTECTED]'title:sort']/@alt", "[Asc]");
clickAndWait("link=1");
@@ -652,8 +652,8 @@
clickAndWait("link=Title");
- assertText("//[EMAIL PROTECTED]'title:sort']/@src",
"assets/tapestry/corelib/components/sort-desc.png");
- assertText("//[EMAIL PROTECTED]'title:sort']/@alt", "[Desc]");
+ assertAttribute("//[EMAIL PROTECTED]'title:sort']/@src",
"assets/tapestry/corelib/components/sort-desc.png");
+ assertAttribute("//[EMAIL PROTECTED]'title:sort']/@alt", "[Desc]");
}
@Test
@@ -795,7 +795,7 @@
// The lack of a leading slash indicates that the path was optimized,
see TAPESTRY-1502
- assertTextSeries("//script[%d]/@src", 1,
"assets/scriptaculous/prototype.js",
+ assertAttributeSeries("//script[%d]/@src", 1,
"assets/scriptaculous/prototype.js",
"assets/scriptaculous/scriptaculous.js");
clickAndWait("link=Clear Data");
@@ -899,11 +899,11 @@
{
start("Attribute Expansions Demo");
- assertText("//[EMAIL PROTECTED]'mixed-expansion']/@style", "color:
blue;");
- assertText("//[EMAIL PROTECTED]'single']/@class", "red");
- assertText("//[EMAIL PROTECTED]'consecutive']/@class", "goober-red");
- assertText("//[EMAIL PROTECTED]'trailer']/@class", "goober-green");
- assertText("//[EMAIL PROTECTED]'formal']/text()", "ALERT-expansions
work inside formal component parameters as well");
+ assertAttribute("//[EMAIL PROTECTED]'mixed-expansion']/@style",
"color: blue;");
+ assertAttribute("//[EMAIL PROTECTED]'single']/@class", "red");
+ assertAttribute("//[EMAIL PROTECTED]'consecutive']/@class",
"goober-red");
+ assertAttribute("//[EMAIL PROTECTED]'trailer']/@class",
"goober-green");
+ assertText("//[EMAIL PROTECTED]'formal']", "ALERT-expansions work
inside formal component parameters as well");
// An unrelated test, but fills in a bunch of minor gaps.
@@ -1027,7 +1027,7 @@
{
start("Form Encoding Type");
- assertText("//form/@enctype", "x-override");
+ assertAttribute("//form/@enctype", "x-override");
}
@Test
@@ -1296,7 +1296,7 @@
{
start("Inherit Informal Parameters Demo");
- assertText("//[EMAIL PROTECTED]'target']/@class", "inherit");
+ assertAttribute("//[EMAIL PROTECTED]'target']/@class", "inherit");
}
@Test
@@ -1334,7 +1334,7 @@
{
String locator = String.format("%s/@disabled", path);
- assertText(locator, "disabled");
+ assertAttribute(locator, "disabled");
}
}
@@ -1448,7 +1448,7 @@
assertText(locator, "");
- assertText("//[EMAIL PROTECTED]'number']/@value", "0");
+ assertAttribute("//[EMAIL PROTECTED]'number']/@value", "0");
type("number", "");
Modified: tapestry/tapestry5/trunk/tapestry-test/pom.xml
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-test/pom.xml?rev=632102&r1=632101&r2=632102&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-test/pom.xml (original)
+++ tapestry/tapestry5/trunk/tapestry-test/pom.xml Thu Feb 28 11:52:03 2008
@@ -17,13 +17,13 @@
<dependency>
<groupId>org.openqa.selenium.client-drivers</groupId>
<artifactId>selenium-java-client-driver</artifactId>
- <version>0.8.1</version>
+ <version>0.9.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openqa.selenium.server</groupId>
<artifactId>selenium-server</artifactId>
- <version>0.8.1</version>
+ <version>0.9.2</version>
<scope>compile</scope>
</dependency>
<dependency>
Modified:
tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry/test/AbstractIntegrationTestSuite.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry/test/AbstractIntegrationTestSuite.java?rev=632102&r1=632101&r2=632102&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry/test/AbstractIntegrationTestSuite.java
(original)
+++
tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry/test/AbstractIntegrationTestSuite.java
Thu Feb 28 11:52:03 2008
@@ -38,7 +38,7 @@
*
* @see org.apache.tapestry.test.JettyRunner
*/
-public abstract class AbstractIntegrationTestSuite extends Assert implements
Selenium
+public class AbstractIntegrationTestSuite extends Assert implements Selenium
{
/**
* Default directory containing the web application to be tested (this
conforms to Maven's default folder).
@@ -117,6 +117,42 @@
}
}
+ /**
+ * Used when the locator identifies an attribute, not an element.
+ *
+ * @param locator identifies the attribute whose value is to be asserted
+ * @param expected expected value for the attribute
+ */
+ protected final void assertAttribute(String locator, String expected)
+ {
+ String actual = null;
+
+ try
+ {
+ actual = getAttribute(locator);
+ }
+ catch (RuntimeException ex)
+ {
+ System.err.printf("Error accessing %s: %s, in:\n\n%s\n\n",
locator, ex.getMessage(),
+ _selenium.getHtmlSource());
+
+ throw ex;
+ }
+
+ if (actual.equals(expected)) return;
+
+ System.err.printf("Text for attribute %s should be '%s' but is '%s',
in:\n\n%s\n\n", locator, expected, actual,
+ getHtmlSource());
+
+ throw new AssertionError(String.format("%s was '%s' not '%s'",
locator, actual, expected));
+ }
+
+ /**
+ * Asserts the text of an element, identified by the locator.
+ *
+ * @param locator identifies the element whose text value is to be
asserted
+ * @param expected expected value for the element's text
+ */
protected final void assertText(String locator, String expected)
{
String actual = null;
@@ -175,6 +211,17 @@
}
}
+ protected final void assertAttributeSeries(String idFormat, int
startIndex, String... values)
+ {
+ for (int i = 0; i < values.length; i++)
+ {
+ String id = String.format(idFormat, startIndex + i);
+
+ assertAttribute(id, values[i]);
+ }
+ }
+
+
protected final void assertFieldValueSeries(String idFormat, int
startIndex, String... values)
{
for (int i = 0; i < values.length; i++)
@@ -235,11 +282,31 @@
_selenium.chooseCancelOnNextConfirmation();
}
+ public void chooseOkOnNextConfirmation()
+ {
+ _selenium.chooseOkOnNextConfirmation();
+ }
+
public void click(String locator)
{
_selenium.click(locator);
}
+ public void doubleClick(String locator)
+ {
+ _selenium.doubleClick(locator);
+ }
+
+ public void clickAt(String locator, String coordString)
+ {
+ _selenium.clickAt(locator, coordString);
+ }
+
+ public void doubleClickAt(String locator, String coordString)
+ {
+ _selenium.doubleClickAt(locator, coordString);
+ }
+
public void close()
{
_selenium.close();
@@ -265,6 +332,61 @@
return _selenium.getAllFields();
}
+ public String[] getAttributeFromAllWindows(String attributeName)
+ {
+ return _selenium.getAttributeFromAllWindows(attributeName);
+ }
+
+ public void dragdrop(String locator, String movementsString)
+ {
+ _selenium.dragdrop(locator, movementsString);
+ }
+
+ public void setMouseSpeed(String pixels)
+ {
+ _selenium.setMouseSpeed(pixels);
+ }
+
+ public Number getMouseSpeed()
+ {
+ return _selenium.getMouseSpeed();
+ }
+
+ public void dragAndDrop(String locator, String movementsString)
+ {
+ _selenium.dragAndDrop(locator, movementsString);
+ }
+
+ public void dragAndDropToObject(String locatorOfObjectToBeDragged, String
locatorOfDragDestinationObject)
+ {
+ _selenium.dragAndDropToObject(locatorOfObjectToBeDragged,
locatorOfDragDestinationObject);
+ }
+
+ public void windowFocus()
+ {
+ _selenium.windowFocus();
+ }
+
+ public void windowMaximize()
+ {
+ _selenium.windowMaximize();
+ }
+
+ public String[] getAllWindowIds()
+ {
+ return _selenium.getAllWindowIds();
+ }
+
+ public String[] getAllWindowNames()
+ {
+ return _selenium.getAllWindowNames();
+ }
+
+ public String[] getAllWindowTitles()
+ {
+ return _selenium.getAllWindowTitles();
+ }
+
public String[] getAllLinks()
{
return _selenium.getAllLinks();
@@ -300,6 +422,21 @@
return _selenium.getExpression(expression);
}
+ public Number getXpathCount(String xpath)
+ {
+ return _selenium.getXpathCount(xpath);
+ }
+
+ public void assignId(String locator, String identifier)
+ {
+ _selenium.assignId(locator, identifier);
+ }
+
+ public void allowNativeXpath(String allow)
+ {
+ _selenium.allowNativeXpath(allow);
+ }
+
public String getHtmlSource()
{
return _selenium.getHtmlSource();
@@ -370,6 +507,11 @@
return _selenium.getText(locator);
}
+ public void highlight(String locator)
+ {
+ _selenium.highlight(locator);
+ }
+
public String getTitle()
{
return _selenium.getTitle();
@@ -440,6 +582,46 @@
_selenium.keyPress(locator, keycode);
}
+ public void shiftKeyDown()
+ {
+ _selenium.shiftKeyDown();
+ }
+
+ public void shiftKeyUp()
+ {
+ _selenium.shiftKeyUp();
+ }
+
+ public void metaKeyDown()
+ {
+ _selenium.metaKeyDown();
+ }
+
+ public void metaKeyUp()
+ {
+ _selenium.metaKeyUp();
+ }
+
+ public void altKeyDown()
+ {
+ _selenium.altKeyDown();
+ }
+
+ public void altKeyUp()
+ {
+ _selenium.altKeyUp();
+ }
+
+ public void controlKeyDown()
+ {
+ _selenium.controlKeyDown();
+ }
+
+ public void controlKeyUp()
+ {
+ _selenium.controlKeyUp();
+ }
+
public void keyUp(String locator, String keycode)
{
_selenium.keyUp(locator, keycode);
@@ -450,11 +632,41 @@
_selenium.mouseDown(locator);
}
+ public void mouseDownAt(String locator, String coordString)
+ {
+ _selenium.mouseDownAt(locator, coordString);
+ }
+
+ public void mouseUp(String locator)
+ {
+ _selenium.mouseUp(locator);
+ }
+
+ public void mouseUpAt(String locator, String coordString)
+ {
+ _selenium.mouseUpAt(locator, coordString);
+ }
+
+ public void mouseMove(String locator)
+ {
+ _selenium.mouseMove(locator);
+ }
+
+ public void mouseMoveAt(String locator, String coordString)
+ {
+ _selenium.mouseMoveAt(locator, coordString);
+ }
+
public void mouseOver(String locator)
{
_selenium.mouseOver(locator);
}
+ public void mouseOut(String locator)
+ {
+ _selenium.mouseOut(locator);
+ }
+
public void open(String url)
{
_selenium.open(url);
@@ -462,6 +674,11 @@
waitForPageToLoad(PAGE_LOAD_TIMEOUT);
}
+ public void openWindow(String url, String windowID)
+ {
+ _selenium.openWindow(url, windowID);
+ }
+
public void refresh()
{
_selenium.refresh();
@@ -472,6 +689,11 @@
_selenium.removeSelection(locator, optionLocator);
}
+ public void removeAllSelections(String locator)
+ {
+ _selenium.removeAllSelections(locator);
+ }
+
public void select(String selectLocator, String optionLocator)
{
_selenium.select(selectLocator, optionLocator);
@@ -482,9 +704,19 @@
_selenium.selectWindow(windowID);
}
- public void setContext(String context, String logLevelThreshold)
+ public void selectFrame(String locator)
+ {
+ _selenium.selectFrame(locator);
+ }
+
+ public boolean getWhetherThisFrameMatchFrameExpression(String
currentFrameString, String target)
+ {
+ return
_selenium.getWhetherThisFrameMatchFrameExpression(currentFrameString, target);
+ }
+
+ public boolean getWhetherThisWindowMatchWindowExpression(String
currentWindowString, String target)
{
- _selenium.setContext(context, logLevelThreshold);
+ return
_selenium.getWhetherThisWindowMatchWindowExpression(currentWindowString,
target);
}
public void setCursorPosition(String locator, String position)
@@ -492,6 +724,36 @@
_selenium.setCursorPosition(locator, position);
}
+ public Number getElementIndex(String locator)
+ {
+ return _selenium.getElementIndex(locator);
+ }
+
+ public boolean isOrdered(String locator1, String locator2)
+ {
+ return _selenium.isOrdered(locator1, locator2);
+ }
+
+ public Number getElementPositionLeft(String locator)
+ {
+ return _selenium.getElementPositionLeft(locator);
+ }
+
+ public Number getElementPositionTop(String locator)
+ {
+ return _selenium.getElementPositionTop(locator);
+ }
+
+ public Number getElementWidth(String locator)
+ {
+ return _selenium.getElementWidth(locator);
+ }
+
+ public Number getElementHeight(String locator)
+ {
+ return _selenium.getElementHeight(locator);
+ }
+
public void setTimeout(String timeout)
{
_selenium.setTimeout(timeout);
@@ -517,6 +779,21 @@
_selenium.type(locator, value);
}
+ public void typeKeys(String locator, String value)
+ {
+ _selenium.typeKeys(locator, value);
+ }
+
+ public void setSpeed(String value)
+ {
+ _selenium.setSpeed(value);
+ }
+
+ public void getSpeed()
+ {
+ _selenium.getSpeed();
+ }
+
public void uncheck(String locator)
{
_selenium.uncheck(locator);
@@ -531,6 +808,52 @@
{
_selenium.waitForPageToLoad(timeout);
}
+
+ public void waitForFrameToLoad(String frameAddress, String timeout)
+ {
+ _selenium.waitForFrameToLoad(frameAddress, timeout);
+ }
+
+ public String getCookie()
+ {
+ return _selenium.getCookie();
+ }
+
+ public void createCookie(String nameValuePair, String optionsString)
+ {
+ _selenium.createCookie(nameValuePair, optionsString);
+ }
+
+ public void deleteCookie(String name, String path)
+ {
+ _selenium.deleteCookie(name, path);
+ }
+
+ public void setBrowserLogLevel(String logLevel)
+ {
+ _selenium.setBrowserLogLevel(logLevel);
+ }
+
+ public void runScript(String script)
+ {
+ _selenium.runScript(script);
+ }
+
+ public void addLocationStrategy(String strategyName, String
functionDefinition)
+ {
+ _selenium.addLocationStrategy(strategyName, functionDefinition);
+ }
+
+ public void setContext(String context)
+ {
+ _selenium.setContext(context);
+ }
+
+ public void captureScreenshot(String filename)
+ {
+ _selenium.captureScreenshot(filename);
+ }
+
/**
* Waits the default time for the page to load.