You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2009/12/15 18:47:26 UTC
svn commit: r890911 - in
/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration:
./ core/
Author: hlship
Date: Tue Dec 15 17:47:26 2009
New Revision: 890911
URL: http://svn.apache.org/viewvc?rev=890911&view=rev
Log:
Test reoganization continues
Added:
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/AjaxTests.java (with props)
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/CoreBehaviorsTests.java (contents, props changed)
- copied, changed from r890910, tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/CoreBehaviorsTest.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/GeneralComponentTests.java (with props)
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/ZoneTests.java (contents, props changed)
- copied, changed from r890910, tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/ZoneTest.java
Removed:
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/CoreBehaviorsTest.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/ZoneTest.java
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/BeanEditorTests.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/FormTests.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/GridTests.java
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java?rev=890911&r1=890910&r2=890911&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java Tue Dec 15 17:47:26 2009
@@ -162,4 +162,14 @@
assertText(String.format("//div[@id='%s']/span", popupId), expected);
}
+
+ protected final void assertFieldValueSeries(String idFormat, int startIndex, String... values)
+ {
+ for (int i = 0; i < values.length; i++)
+ {
+ String id = String.format(idFormat, startIndex + i);
+
+ assertFieldValue(id, values[i]);
+ }
+ }
}
Added: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/AjaxTests.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/AjaxTests.java?rev=890911&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/AjaxTests.java (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/AjaxTests.java Tue Dec 15 17:47:26 2009
@@ -0,0 +1,105 @@
+// Copyright 2009 The Apache Software Foundation
+//
+// Licensed 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.tapestry5.integration.core;
+
+import org.apache.tapestry5.integration.TapestryCoreTestCase;
+import org.testng.annotations.Test;
+
+/**
+ * Tests for various Ajax related components, mixins and behaviors.
+ */
+public class AjaxTests extends TapestryCoreTestCase
+{
+ @Test
+ public void autocomplete_mixin()
+ {
+ clickThru("Autocomplete Mixin Demo");
+
+ // And that's as far as we can go currently, because
+ // of limitations in Selenium 0.8.3 and bugs in Selenium 0.9.2.
+ }
+
+ @Test
+ public void form_fragment()
+ {
+ clickThru("Form Fragment Demo", "Clear");
+
+ type("name", "Fred");
+
+ // Really, you can't type in the field because it is not visible, but
+ // this checks that invisible fields are not processed.
+ type("email", "this field is ignored");
+
+ clickAndWait(SUBMIT);
+
+ assertText("name", "Fred");
+ assertText("email", "");
+
+ clickAndWait("link=Back");
+ clickAndWait("link=Clear");
+
+ click("subscribeToEmail");
+ click("on");
+
+ waitForCondition(
+ "selenium.browserbot.getCurrentWindow().$('code').isDeepVisible() == true",
+ PAGE_LOAD_TIMEOUT);
+
+ type("name", "Barney");
+ type("email", "rubble@bedrock.gov");
+ type("code", "ABC123");
+
+ click("off");
+
+ waitForCondition(
+ "selenium.browserbot.getCurrentWindow().$('code').isDeepVisible() == false",
+ PAGE_LOAD_TIMEOUT);
+
+ clickAndWait(SUBMIT);
+
+ assertText("name", "Barney");
+ assertText("email", "rubble@bedrock.gov");
+ assertText("code", "");
+ }
+
+ @Test
+ public void form_injector()
+ {
+ clickThru("FormInjector Demo");
+
+ assertText("sum", "0.0");
+
+ click("link=Add a row");
+
+ sleep(1000);
+
+ type("//input[@type='text'][1]", "5.1");
+
+ // I wanted to add two rows, but Selenium didn't want to play.
+
+ clickAndWait(SUBMIT);
+
+ assertText("sum", "5.1");
+
+ click("link=remove");
+
+ sleep(2000);
+
+ clickAndWait(SUBMIT);
+
+ assertText("sum", "0.0");
+ }
+
+}
Propchange: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/AjaxTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/BeanEditorTests.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/BeanEditorTests.java?rev=890911&r1=890910&r2=890911&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/BeanEditorTests.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/BeanEditorTests.java Tue Dec 15 17:47:26 2009
@@ -97,4 +97,71 @@
assertTextPresent("Howard", "Lewis Ship", "0", "100% He-Man", "U.S. Citizen");
}
+
+ @Test
+ public void multiple_beaneditor_components()
+ {
+ clickThru("MultiBeanEdit Demo", "Clear Data");
+
+ type("firstName", "Howard");
+ type("lastName", "Lewis Ship");
+ type("path", "/var/www");
+ clickAndWait("//input[@value='Set Access']");
+
+ assertTextSeries("//li[%d]", 1, "First Name: [Howard]", "Last Name: [Lewis Ship]",
+ "Path: [/var/www]", "Role: [GRANT]");
+ }
+
+ /**
+ * This also checks that the date type is displayed correctly by BeanDisplay
+ * and Grid.
+ */
+ @Test
+ public void date_field_inside_bean_editor()
+ {
+ clickThru("BeanEditor / Date Demo", "clear");
+
+ type("name", "Howard Lewis Ship");
+ type("date", "12/24/1966");
+
+ clickAndWait(SUBMIT);
+
+ // Notice the date output format; that is controlled by the date Block
+ // on the
+ // PropertyDisplayBlocks page.
+
+ assertTextPresent("Howard Lewis Ship", "Dec 24, 1966");
+ }
+
+ /**
+ * TAPESTRY-2013
+ */
+ @Test
+ public void bean_editor_overrides()
+ {
+ clickThru("BeanEditor Override", "Clear Data");
+
+ assertTextPresent("[FirstName Property Editor Override]");
+ }
+
+ /**
+ * TAPESTRY-1869
+ */
+ @Test
+ public void null_fields_and_bean_editor()
+ {
+ clickThru("Number BeanEditor Demo");
+
+ clickAndWait(SUBMIT);
+
+ // Hard to check for anything here.
+
+ clickAndWait("link=Back to form");
+
+ type("value", "237");
+
+ clickAndWait(SUBMIT);
+
+ assertText("//dd[@class='value']", "237");
+ }
}
Copied: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/CoreBehaviorsTests.java (from r890910, tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/CoreBehaviorsTest.java)
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/CoreBehaviorsTests.java?p2=tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/CoreBehaviorsTests.java&p1=tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/CoreBehaviorsTest.java&r1=890910&r2=890911&rev=890911&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/CoreBehaviorsTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/CoreBehaviorsTests.java Tue Dec 15 17:47:26 2009
@@ -19,7 +19,7 @@
import org.apache.tapestry5.integration.app1.pages.RenderErrorDemo;
import org.testng.annotations.Test;
-public class CoreBehaviorsTest extends TapestryCoreTestCase
+public class CoreBehaviorsTests extends TapestryCoreTestCase
{
@Test
@@ -1233,4 +1233,37 @@
assertTextPresent("This file should be available to clients.");
}
+
+ /**
+ * TAPESTRY-1598
+ */
+ @Test
+ public void value_encoder_via_type_coercer()
+ {
+ clickThru("Magic ValueEncoder Demo");
+
+ select("number", "25");
+
+ clickAndWait(SUBMIT);
+
+ String locator = "//span[@id='selectednumber']";
+
+ assertText(locator, "25");
+
+ select("number", "100");
+ clickAndWait(SUBMIT);
+
+ assertText(locator, "100");
+ }
+
+ /**
+ * TAPESTRY-2184
+ */
+ @Test
+ public void create_action_link_while_not_rendering()
+ {
+ clickThru("Action via Link Demo", "via explicit Link creation");
+
+ assertText("message", "from getActionURL()");
+ }
}
Propchange: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/CoreBehaviorsTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/FormTests.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/FormTests.java?rev=890911&r1=890910&r2=890911&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/FormTests.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/FormTests.java Tue Dec 15 17:47:26 2009
@@ -49,4 +49,374 @@
assertFieldValue("t:ac",
"betty/wilma/context$0020with$0020spaces/context$002fwith$002fslashes");
}
+
+ @Test
+ public void password_field()
+ {
+ clickThru("PasswordFieldDemo");
+
+ type("userName", "howard");
+ type("password", "wrong-password");
+
+ clickAndWait(SUBMIT);
+
+ assertFieldValue("userName", "howard");
+ // Verify that password fields do not render a non-blank password, even
+ // when it is known.
+ assertFieldValue("password", "");
+
+ assertTextPresent("[howard]");
+ assertTextPresent("[wrong-password]");
+
+ type("password", "tapestry");
+
+ clickAndWait(SUBMIT);
+
+ assertTextPresent("You have provided the correct user name and password.");
+ }
+
+ @Test
+ public void server_side_validation_for_textfield_and_textarea() throws Exception
+ {
+ clickThru("ValidForm");
+
+ clickAndWait(SUBMIT);
+ assertTextPresent("You must provide a value for Email.");
+ // is an overridden validation error message:
+ assertTextPresent("Please provide a detailed description of the incident.");
+
+ // Check on decorations via the default validation decorator:
+
+ assertAttribute("//label[1]/@class", "t-error");
+ assertAttribute("//label[2]/@class", "t-error");
+ assertAttribute("//input[@id='email']/@class", "t-error");
+ assertAttribute("//textarea[@id='message']/@class", "t-error");
+
+ type("email", "foo@bar.baz");
+ type("message", "Show me the money!");
+ type("hours", "foo");
+
+ clickAndWait(SUBMIT);
+
+ assertTextPresent("[false]");
+ assertTextPresent("You must provide an integer value for Hours.");
+
+ assertAttribute("//input[@id='hours']/@value", "foo");
+
+ type("hours", " 19 ");
+ click("//input[@id='urgent']");
+ clickAndWait(SUBMIT);
+
+ // Make sure the decoration went away.
+
+ // Sorry, not sure how to do that, since the attributes don't exist, we
+ // get xpath errors.
+
+ // assertText("//label[1]/@class", "");
+ // assertText("//label[2]/@class", "");
+ // assertText("//input[@id='email']/@class", "");
+ // assertText("//textarea[@id='message']/@class", "");
+
+ assertTextPresent("[foo@bar.baz]");
+ assertTextPresent("[Show me the money!]");
+ assertTextPresent("[true]");
+ assertTextPresent("[19]");
+ }
+
+ @Test
+ public void client_side_validation()
+ {
+ clickThru("Client Validation Demo");
+
+ // Used to ensure that the <script> tag was present, but that's hard to
+ // do with script combining enabled.
+
+ clickAndWait("link=Clear Data");
+
+ // Notice: click, not click and wait.
+
+ click(SUBMIT);
+
+ // Looks like more weaknesses in Selenium, can only manage the first
+ // match not the others.
+ assertTextSeries("//div[@class='t-error-popup'][%d]/span", 1,
+ "You must provide a value for First Name."
+ // , "Everyone has to have a last name!",
+ // "Year of Birth requires a value of at least 1900."
+ );
+
+ type("firstName", "Howard");
+ type("lastName", "Lewis Ship");
+ type("birthYear", "1000");
+ type("password", "supersecret");
+
+ click(SUBMIT);
+
+ type("birthYear", "1966");
+ click("citizen");
+
+ clickAndWait(SUBMIT);
+
+ assertTextPresent("Howard", "Lewis Ship", "1966", "U.S. Citizen");
+ }
+
+ @Test
+ public void radio_group_validator()
+ {
+ clickThru("RadioDemo");
+
+ // Verify that the "required" validator works.
+ clickAndWait(SUBMIT);
+ assertTextPresent("You must provide a value for Department.");
+ }
+
+ @Test
+ public void regexp_validator()
+ {
+ clickThru("Regexp Demo");
+
+ String update = SUBMIT;
+
+ type("zipCode", "abc");
+
+ click(update); // but don't wait
+
+ assertTextPresent("A zip code consists of five or nine digits, eg: 02134 or 90125-4472.");
+
+ type("zipCode", "12345");
+
+ clickAndWait(update);
+
+ assertTextPresent("Zip code: [12345]");
+
+ type("zipCode", "12345-9876");
+
+ clickAndWait(update);
+
+ assertTextPresent("Zip code: [12345-9876]");
+ }
+
+ @Test
+ public void basic_datefield()
+ {
+ clickThru("DateField Demo", "clear", "english");
+
+ type("birthday", "24 dec 1966");
+ type("asteroidImpact", "05/28/2046");
+
+ clickAndWait(SUBMIT);
+
+ assertTextPresent("Birthday: [12/24/1966]");
+ assertTextPresent("Impact: [05/28/2046]");
+
+ assertFieldValue("birthday", "24 Dec 1966");
+ assertFieldValue("asteroidImpact", "5/28/2046");
+
+ clickAndWait("link=french");
+
+ click("birthday-trigger");
+
+ waitForCondition(
+ "selenium.browserbot.getCurrentWindow().$$('DIV.datePicker').first().isDeepVisible() == true",
+ PAGE_LOAD_TIMEOUT);
+
+ assertText("//A[@class='topLabel']", "1966 d\u00e9cembre");
+
+ clickAndWait("link=english");
+ }
+
+ @Test
+ public void event_based_translate() throws Exception
+ {
+ clickThru("EventMethod Translator");
+
+ type("count", "123");
+ clickAndWait(SUBMIT);
+
+ assertTextPresent("Count: [123]");
+
+ type("count", "0");
+ clickAndWait(SUBMIT);
+
+ assertTextPresent("Count: [0]");
+
+ assertFieldValue("count", "zero");
+
+ type("count", "456");
+ clickAndWait(SUBMIT);
+
+ assertTextPresent("Count: [456]");
+
+ assertFieldValue("count", "456");
+
+ type("count", "ZERO");
+ clickAndWait(SUBMIT);
+
+ assertTextPresent("Count: [0]");
+
+ assertFieldValue("count", "zero");
+
+ // Try the server-side custom exception reporting.
+
+ type("count", "13");
+ clickAndWait(SUBMIT);
+
+ assertTextPresent("Event Handler Method Translate", "Thirteen is an unlucky number.");
+
+ type("count", "i");
+ clickAndWait(SUBMIT);
+
+ assertTextPresent("Event Handler Method Translate", "Rational numbers only, please.");
+ }
+
+ @Test
+ public void radio_button_and_group()
+ {
+ clickThru("RadioDemo");
+
+ String update = SUBMIT;
+
+ // in a loop ...
+ click("//label[.='Accounting']");
+ clickAndWait(update);
+ assertTextPresent("Selected department: ACCOUNTING");
+
+ click("//label[.='Sales And Marketing']");
+ clickAndWait(update);
+ assertTextPresent("Selected department: SALES_AND_MARKETING");
+
+ // not in a loop ...
+ click("//label[.='Temp']");
+ clickAndWait(update);
+ assertTextPresent("Selected position: TEMP");
+
+ click("//label[.='Lifer']");
+ clickAndWait(update);
+ assertTextPresent("Selected position: LIFER");
+ }
+
+ @Test
+ public void disabled_fields() throws Exception
+ {
+ clickThru("Disabled Fields");
+
+ String[] paths = new String[]
+ { "//input[@id='textfield']",
+
+ "//input[@id='passwordfield']",
+
+ "//textarea[@id='textarea']",
+
+ "//input[@id='checkbox']",
+
+ "//select[@id='select']",
+
+ "//input[@id='radio1']",
+
+ "//input[@id='radio2']",
+
+ "//input[@id='datefield']",
+
+ "//select[@id='palette-avail']",
+
+ "//button[@id='palette-select']",
+
+ "//button[@id='palette-deselect']",
+
+ "//select[@id='palette']",
+
+ "//input[@id='submit']" };
+
+ for (String path : paths)
+ {
+ String locator = String.format("%s/@disabled", path);
+
+ assertAttribute(locator, "disabled");
+ }
+ }
+
+ /**
+ * TAPESTRY-2056
+ */
+ @Test
+ public void null_field_strategy()
+ {
+ clickThru("Null Field Strategy Demo");
+
+ String locator = "//span[@id='value']";
+
+ assertText(locator, "");
+
+ assertAttribute("//input[@id='number']/@value", "0");
+
+ type("number", "");
+
+ clickAndWait(SUBMIT);
+
+ assertText(locator, "0");
+ }
+
+ /**
+ * TAPESTRY-1647
+ */
+ @Test
+ public void label_invokes_validation_decorator_at_correct_time()
+ {
+ clickThru("Override Validation Decorator");
+
+ // This is sub-optimal, as it doesn't esnure that the before/after field
+ // values really do wrap around
+ // the field (they do, but that's hard to prove!).
+
+ // Along the way we are also testing:
+ // - primitive types are automatically required
+ // - AbstractTextField.isRequired() and the logic inside
+ // ComponentFieldValidator.isRequired()
+
+ assertSourcePresent(
+ "[Before label for Value]<label id=\"value-label\" for=\"value\">Value</label>[After label for Value]",
+ "[Before field Value]",
+ "[After field Value (optional)]",
+ "[Before label for Required Value]<label id=\"requiredValue-label\" for=\"requiredValue\">Required Value</label>[After label for Required Value]",
+ "[Before field Required Value]", "[After field Required Value (required)]");
+ }
+
+ /**
+ * TAPESTRY-2085
+ */
+ @Test
+ public void wrapper_types_with_text_field()
+ {
+ clickThru("TextField Wrapper Types", "clear");
+
+ assertFieldValue("count", "");
+ assertText("value", "null");
+
+ type("count", "0");
+ clickAndWait(SUBMIT);
+
+ assertFieldValue("count", "0");
+ assertText("value", "0");
+
+ type("count", "1");
+ clickAndWait(SUBMIT);
+
+ assertFieldValue("count", "1");
+ assertText("value", "1");
+
+ clickAndWait("link=clear");
+
+ assertFieldValue("count", "");
+ assertText("value", "null");
+ }
+
+ @Test
+ public void submit_with_context()
+ {
+ clickThru("Submit With Context");
+
+ clickAndWait(SUBMIT);
+
+ assertTextPresent("Result: 10.14159");
+ }
}
Added: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/GeneralComponentTests.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/GeneralComponentTests.java?rev=890911&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/GeneralComponentTests.java (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/GeneralComponentTests.java Tue Dec 15 17:47:26 2009
@@ -0,0 +1,60 @@
+// Copyright 2009 The Apache Software Foundation
+//
+// Licensed 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.tapestry5.integration.core;
+
+import org.apache.tapestry5.integration.TapestryCoreTestCase;
+import org.testng.annotations.Test;
+
+public class GeneralComponentTests extends TapestryCoreTestCase
+{
+ @Test
+ public void unless_component()
+ {
+ clickThru("Unless Demo");
+
+ assertText("//p[@id='false']", "false is rendered");
+
+ assertText("//p[@id='true']", "");
+ }
+
+ /**
+ * TAPESTRY-2044
+ */
+ @Test
+ public void action_links_on_non_active_page()
+ {
+ clickThru("Action Links off of Active Page");
+
+ String contextSpan = "//span[@id='context']";
+
+ assertText(contextSpan, "0");
+
+ clickAndWait("link=3");
+
+ assertText(contextSpan, "3");
+
+ clickAndWait("link=refresh");
+
+ assertText(contextSpan, "3");
+
+ clickAndWait("link=1");
+
+ assertText(contextSpan, "1");
+
+ clickAndWait("link=refresh");
+
+ assertText(contextSpan, "1");
+ }
+}
Propchange: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/GeneralComponentTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/GridTests.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/GridTests.java?rev=890911&r1=890910&r2=890911&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/GridTests.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/GridTests.java Tue Dec 15 17:47:26 2009
@@ -152,4 +152,104 @@
assertTextPresent("There is no data to display.");
}
+
+ @Test
+ public void grid_inside_form()
+ {
+ clickThru("Grid Form Demo", "reset", "2");
+
+ // The first input field is the form's hidden field.
+
+ assertFieldValue("title", "ToDo # 6");
+ assertFieldValueSeries("title_%d", 0, "ToDo # 7", "ToDo # 8", "ToDo # 9", "ToDo # 10");
+
+ type("title_0", "Cure Cancer");
+ select("urgency_0", "Top Priority");
+
+ type("title_1", "Pay Phone Bill");
+ select("urgency_1", "Low");
+
+ clickAndWait(SUBMIT);
+
+ assertFieldValueSeries("title_%d", 0, "Cure Cancer", "Pay Phone Bill");
+ assertFieldValueSeries("urgency_%d", 0, "HIGH", "LOW");
+ }
+
+ @Test
+ public void grid_inside_form_with_encoder()
+ {
+ clickThru("Grid Form Encoder Demo", "reset", "2");
+
+ // The first input field is the form's hidden field.
+
+ // Note the difference: same data sorted differently (there's a default
+ // sort).
+
+ assertFieldValue("title", "ToDo # 14");
+ assertFieldValueSeries("title_%d", 0, "ToDo # 15", "ToDo # 16", "ToDo # 17", "ToDo # 18");
+
+ type("title_0", "Cure Cancer");
+ select("urgency_0", "Top Priority");
+
+ type("title_1", "Pay Phone Bill");
+ select("urgency_1", "Low");
+
+ clickAndWait(SUBMIT);
+
+ // Because of the sort, the updated items shift to page #1
+
+ clickAndWait("link=1");
+
+ assertFieldValue("title", "Cure Cancer");
+ assertFieldValue("title_0", "Pay Phone Bill");
+
+ assertFieldValue("urgency", "HIGH");
+ assertFieldValue("urgency_0", "LOW");
+ }
+
+ /**
+ * TAPESTRY-2021
+ */
+ @Test
+ public void lean_grid()
+ {
+ clickThru("Lean Grid Demo");
+
+ assertTextSeries("//th[%d]", 1, "Title", "Album", "Artist", "Genre", "Play Count", "Rating");
+
+ // Selenium makes it pretty hard to check for a missing class.
+
+ // assertText("//th[1]/@class", "");
+ }
+
+ /**
+ * TAPESTRY-1310
+ */
+ @Test
+ public void grid_row_and_column_indexes()
+ {
+ clickThru("Lean Grid Demo", "2");
+
+ // Use page 2 to ensure that the row index is the row in the Grid, not
+ // the row index of the data
+
+ assertText("//th[7]", "Indexes (6)");
+ assertText("//tr[1]/td[7]", "0,6");
+ assertText("//tr[2]/td[7]", "1,6");
+ }
+
+ /**
+ * TAPESTRY-1416
+ */
+
+ @Test
+ public void adding_new_columns_to_grid_programattically()
+ {
+ clickThru("Added Grid Columns Demo", "Title Length");
+
+ assertTextSeries("//th[%d]", 1, "Title", "View", "Title Length", "Dummy");
+
+ // The rendered becomes just a blank string.
+ assertTextSeries("//tr[1]/td[%d]", 1, "7", "view", "1", "");
+ }
}
Copied: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/ZoneTests.java (from r890910, tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/ZoneTest.java)
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/ZoneTests.java?p2=tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/ZoneTests.java&p1=tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/ZoneTest.java&r1=890910&r2=890911&rev=890911&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/ZoneTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/ZoneTests.java Tue Dec 15 17:47:26 2009
@@ -21,7 +21,7 @@
/**
* Tests related to the {@link Zone} component.
*/
-public class ZoneTest extends TapestryCoreTestCase
+public class ZoneTests extends TapestryCoreTestCase
{
/**
* TAP5-138
@@ -67,4 +67,23 @@
assertTextPresent("Car Model: E-Class");
}
+ @Test
+ public void zone_updates()
+ {
+ clickThru("Zone Demo");
+
+ assertTextPresent("No name has been selected.");
+
+ // Hate doing this, but selecting by the text isn't working, perhaps
+ // because of the
+ // HTML entities.
+ click("select_0");
+
+ // And that's as far as we can go currently, because
+ // of limitations in Selenium 0.8.3 and bugs in Selenium 0.9.2.
+
+ // assertTextPresent("Selected: Mr. <Roboto>");
+
+ click("link=Direct JSON response");
+ }
}
Propchange: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/ZoneTests.java
------------------------------------------------------------------------------
svn:eol-style = native