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:32 UTC

svn commit: r890912 - in /tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core: AjaxTests.java BeanEditorTests.java CoreBehaviorsTests.java FormTests.java GridTests.java ZoneTests.java

Author: hlship
Date: Tue Dec 15 17:47:31 2009
New Revision: 890912

URL: http://svn.apache.org/viewvc?rev=890912&view=rev
Log:
Categorize yet more tests

Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/AjaxTests.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/CoreBehaviorsTests.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
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/ZoneTests.java

Modified: 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=890912&r1=890911&r2=890912&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/AjaxTests.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/AjaxTests.java Tue Dec 15 17:47:31 2009
@@ -102,4 +102,84 @@
         assertText("sum", "0.0");
     }
 
+    /**
+     * TAP5-240
+     */
+    @Test
+    public void ajax_server_side_exception()
+    {
+        clickThru("Zone Demo");
+
+        click("link=Failure on the server side");
+
+        // Wait for the console to appear
+
+        waitForCSSSelectedElementToAppear("#t-console li");
+
+        assertTextPresent("Communication with the server failed: Server-side exception.");
+    }
+
+    /**
+     * TAP5-544
+     */
+    @Test
+    public void slow_ajax_load_warning()
+    {
+        clickThru("Slow Ajax Demo");
+
+        // ActionLink
+
+        click("link=action");
+
+        waitForElementToAppear("slow");
+
+        click("link=action");
+
+        waitForElementToAppear("zoneOutput");
+
+        assertText("zoneOutput", "Updated via an ActionLink");
+
+        // LinkSubmit
+
+        clickAndWait("link=refresh");
+
+        click("link=link submit");
+
+        waitForElementToAppear("slow");
+
+        click("link=link submit");
+
+        waitForElementToAppear("zoneOutput");
+
+        assertText("zoneOutput", "Updated via form submission.");
+
+        // Normal submit
+
+        clickAndWait("link=refresh");
+
+        click(SUBMIT);
+
+        waitForElementToAppear("slow");
+
+        click(SUBMIT);
+
+        waitForElementToAppear("zoneOutput");
+
+        assertText("zoneOutput", "Updated via form submission.");
+    }
+
+    /**
+     * TAP5-236
+     */
+    @Test
+    public void progressive_display()
+    {
+        clickThru("ProgressiveDisplay Demo");
+
+        waitForElementToAppear("content1");
+        assertText("content1", "Progressive Display content #1.");
+
+        waitForElementToAppear("content2");
+        assertText("content2", "Music Library");
+    }
 }

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=890912&r1=890911&r2=890912&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:31 2009
@@ -17,6 +17,7 @@
 import org.apache.tapestry5.corelib.components.BeanEditForm;
 import org.apache.tapestry5.corelib.components.BeanEditor;
 import org.apache.tapestry5.integration.TapestryCoreTestCase;
+import org.apache.tapestry5.integration.app1.data.RegistrationData;
 import org.testng.annotations.Test;
 
 /**
@@ -164,4 +165,37 @@
 
         assertText("//dd[@class='value']", "237");
     }
+
+    // TAPESTRY-2460
+
+    @Test
+    public void nested_bean_editor_and_bean_display()
+    {
+        clickThru("Nested BeanEditor");
+
+        type("name", "Parent");
+        type("age", "60");
+
+        type("name_0", "Child");
+        type("age_0", "40");
+
+        clickAndWait(SUBMIT);
+
+        assertText("//div[@id='content']//h1", "Nested BeanDisplay");
+
+        // As usual, Selenium is fighting me in terms of extracting data, so the
+        // above check just ensures
+        // we made it past the form submit without error.
+    }
+
+    /**
+     * TAPESTRY-2592
+     */
+    @Test
+    public void bean_editor_pushes_bean_edit_context()
+    {
+        clickThru("BeanEditor BeanEditContext");
+
+        assertTextPresent("Bean class from context is: " + RegistrationData.class.getName());
+    }
 }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/CoreBehaviorsTests.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/CoreBehaviorsTests.java?rev=890912&r1=890911&r2=890912&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/CoreBehaviorsTests.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/CoreBehaviorsTests.java Tue Dec 15 17:47:31 2009
@@ -1266,4 +1266,72 @@
 
         assertText("message", "from getActionURL()");
     }
+
+    /**
+     * TAPESTRY-2244
+     */
+    @Test
+    public void cached()
+    {
+        clickThru("Cached Annotation");
+
+        assertText("value", "000");
+        assertText("value2size", "111");
+
+        assertText("//span[@class='watch'][1]", "0");
+        assertText("//span[@class='watch'][2]", "0");
+        assertText("//span[@class='watch'][3]", "1");
+
+        clickAndWait("link=Back to index");
+
+        // TAPESTRY-2338: Make sure the data is cleared.
+
+        clickAndWait("link=Cached Annotation");
+
+        assertText("value", "000");
+        assertText("value2size", "111");
+
+        assertText("//span[@class='watch'][1]", "0");
+        assertText("//span[@class='watch'][2]", "0");
+        assertText("//span[@class='watch'][3]", "1");
+    }
+
+    /**
+     * TAPESTRY-2244
+     */
+    @Test
+    public void override_method_with_cached()
+    {
+        clickThru("Cached Annotation2");
+
+        assertText("value", "111");
+
+        clickAndWait("link=Back to index");
+
+        // TAPESTRY-2338: Make sure the data is cleared.
+
+        clickAndWait("link=Cached Annotation2");
+
+        assertText("value", "111");
+    }
+
+    /**
+     * TAPESTRY-2542
+     */
+    @Test
+    public void has_body()
+    {
+        clickThru("Has Body Demo");
+
+        assertText("nobody", "false");
+        assertText("somebody", "true");
+    }
+
+    @Test
+    public void renderclientid_mixin()
+    {
+        clickThru("RenderClientId Mixin");
+
+        assertText("divwithid", "Div Content");
+    }
 }

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=890912&r1=890911&r2=890912&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:31 2009
@@ -419,4 +419,285 @@
 
         assertTextPresent("Result: 10.14159");
     }
+
+    /**
+     * TAPESTRY-2563
+     */
+    @Test
+    public void form_action_via_get()
+    {
+        open(getBaseURL() + "validform.form");
+
+        assertTextPresent("Forms require that the request method be POST and that the t:formdata query parameter have values.");
+    }
+
+    /**
+     * TAPESTRY-2352
+     */
+    @Test
+    public void client_field_format_validation()
+    {
+        clickThru("Client Format Validation");
+
+        type("amount", "abc");
+        type("quantity", "abc");
+
+        click(SUBMIT);
+
+        waitForElementToAppear("amount:errorpopup");
+        waitForElementToAppear("quantity:errorpopup");
+
+        assertText("//div[@id='amount:errorpopup']/span",
+                "You must provide a numeric value for Amount.");
+        assertText("//div[@id='quantity:errorpopup']/span", "Provide quantity as a number.");
+    }
+
+    /**
+     * TAPESTRY-2438
+     */
+    @Test
+    public void validation_exception_thrown_from_validate_form_event_handler()
+    {
+        clickThru("ValidationForm ValidationException Demo");
+
+        clickAndWait(SUBMIT);
+
+        assertTextPresent("From event handler method.");
+
+        assertText("event", "failure");
+    }
+
+    @Test
+    public void form_field_outside_form()
+    {
+        clickThru("Form Field Outside Form");
+
+        assertTextPresent(
+                "org.apache.tapestry5.internal.services.RenderQueueException",
+                "Render queue error in SetupRender[FormFieldOutsideForm:textfield]: The Textfield component must be enclosed by a Form component.",
+                "context:FormFieldOutsideForm.tml, line 5");
+    }
+
+    /**
+     * TAP5-281
+     */
+    @Test
+    public void nested_form_check()
+    {
+        clickThru("Nested Form Demo");
+
+        assertTextPresent("Form components may not be placed inside other Form components.");
+    }
+
+    /**
+     * TAP5-87
+     */
+    @Test
+    public void blank_password_does_not_update()
+    {
+        clickThru("Blank Password Demo");
+
+        type("password", "secret");
+
+        clickAndWait(SUBMIT);
+
+        assertFieldValue("password", "");
+
+        assertText("visiblepassword", "secret");
+
+        clickAndWait(SUBMIT);
+
+        assertFieldValue("password", "");
+
+        assertText("visiblepassword", "secret");
+    }
+
+    /**
+     * TAP5-228: And to think I almost blew off the integration tests!
+     */
+    @Test
+    public void per_form_validation_messages_and_constraints()
+    {
+        clickThru("Per-Form Validation Messages");
+
+        clickAndWait("//input[@type='submit' and @value='Login']");
+
+        assertTextPresent("Enter the unique user id you provided when you registerred.");
+
+        type("userId", "aaa");
+
+        clickAndWait("//input[@type='submit' and @value='Login']");
+
+        assertTextPresent("You must provide at least 10 characters for User Id.");
+
+        clickAndWait("//input[@type='submit' and @value='Register']");
+
+        assertTextPresent("Enter a unique user id, such as your initials.");
+
+        type("userId_0", "aaa");
+
+        clickAndWait("//input[@type='submit' and @value='Register']");
+
+        assertTextPresent("You must provide at least 20 characters for User Id.");
+    }
+
+    /**
+     * TAP5-719
+     */
+    @Test
+    public void link_submit_without_validator()
+    {
+        clickThru("LinkSubmit Without Validator Demo");
+
+        type("searchField", "Anders Haraldsson");
+
+        clickAndWait("link=Search");
+
+        assertTextPresent("Result: Anders Haraldsson not found!");
+    }
+
+    /**
+     * TAP5-211
+     */
+    @Test
+    public void client_side_numeric_validation()
+    {
+        clickThru("Client-Side Numeric Validation", "reset");
+
+        assertText("outputLongValue", "1000");
+        assertText("outputDoubleValue", "1234.67");
+
+        assertFieldValue("longValue", "1000");
+        assertFieldValue("doubleValue", "1,234.67");
+
+        type("longValue", "2,000 ");
+        type("doubleValue", " -456,789.12");
+
+        clickAndWait(SUBMIT);
+
+        assertText("outputLongValue", "2000");
+        assertText("outputDoubleValue", "-456789.12");
+
+        assertFieldValue("longValue", "2000");
+        assertFieldValue("doubleValue", "-456,789.12");
+
+        clickAndWait("link=switch to German");
+
+        assertText("outputLongValue", "2000");
+        assertText("outputDoubleValue", "-456789.12");
+
+        assertFieldValue("longValue", "2000");
+        assertFieldValue("doubleValue", "-456.789,12");
+
+        type("longValue", "3.000");
+        type("doubleValue", "5.444.333,22");
+
+        clickAndWait(SUBMIT);
+
+        assertFieldValue("longValue", "3000");
+        assertFieldValue("doubleValue", "5.444.333,22");
+
+        assertText("outputLongValue", "3000");
+        assertText("outputDoubleValue", "5444333.22");
+
+        clickAndWait("link=reset");
+
+        type("longValue", "4000.");
+        click(SUBMIT);
+
+        assertBubbleMessage("longValue", "You must provide an integer value for Long Value.");
+
+        type("doubleValue", "abc");
+
+        click(SUBMIT);
+
+        assertBubbleMessage("doubleValue", "You must provide a numeric value for Double Value.");
+    }
+
+    @Test
+    public void client_validation_for_numeric_fields_that_are_not_required()
+    {
+        clickThru("Form Zone Demo");
+
+        type("longValue", "alpha");
+
+        click(SUBMIT);
+
+        waitForElementToAppear("longValue:errorpopup");
+
+        assertText("//div[@id='longValue:errorpopup']/span",
+                "You must provide an integer value for Long Value.");
+
+        type("longValue", "37");
+
+        click(SUBMIT);
+
+        waitForElementToAppear("outputvalue");
+
+        assertText("outputvalue", "37");
+    }
+
+    @Test
+    public void hidden_field()
+    {
+        clickThru("Hidden Demo", "setup");
+
+        clickAndWait(SUBMIT);
+
+        assertText("stored", "12345");
+    }
+
+    @Test
+    public void validation_constraints_from_messages()
+    {
+        clickThru("Validation Constraints From Messages");
+
+        click(SUBMIT);
+
+        assertBubbleMessage("name", "You must provide a value for Name.");
+        assertBubbleMessage("age", "You must provide a value for Age.");
+
+        type("name", "behemoth");
+        type("age", "0");
+        select("type", "label=Snake");
+
+        click(SUBMIT);
+        assertBubbleMessage("age", "Age requires a value of at least 1.");
+
+        type("age", "121");
+        click(SUBMIT);
+        assertBubbleMessage("age", "Age requires a value no larger than 120.");
+
+        type("age", "5");
+        clickAndWait(SUBMIT);
+    }
+
+    /**
+     * TAP5-157
+     */
+    @Test
+    public void link_submit_component()
+    {
+        clickThru("LinkSubmit Demo");
+
+        click("link=Fred");
+
+        waitForCondition("selenium.browserbot.getCurrentWindow().$('name:errorpopup')",
+                PAGE_LOAD_TIMEOUT);
+
+        assertTextPresent("You must provide a value for Name.");
+
+        type("name", "Wilma");
+
+        clickAndWait("link=Fred");
+
+        assertText("name-value", "Wilma");
+        assertText("last-clicked", "Fred");
+
+        type("name", "Betty");
+        clickAndWait("link=Barney");
+
+        assertText("name-value", "Betty");
+        assertText("last-clicked", "Barney");
+    }
 }

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=890912&r1=890911&r2=890912&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:31 2009
@@ -252,4 +252,42 @@
         // The rendered   becomes just a blank string.
         assertTextSeries("//tr[1]/td[%d]", 1, "7", "view", "1", "");
     }
+
+    @Test
+    public void inplace_grid()
+    {
+        clickThru("In-Place Grid Demo");
+
+        String timestamp = getText("lastupdate");
+
+        click("link=2");
+        sleep(100);
+        click("link=Album");
+        sleep(100);
+
+        assertEquals(getText("lastupdate"), timestamp,
+                "Timestamp should not have changed because updates are in-place.");
+    }
+
+    /**
+     * TAPESTRY-2502
+     */
+    @Test
+    public void short_grid()
+    {
+        clickThru("Short Grid");
+
+        for (int i = 0; i < 6; i++)
+        {
+            String locator = String.format("grid.%d.0", i + 1);
+            String expected = String.format("Index #%d", i);
+
+            assertEquals(getTable(locator), expected);
+        }
+
+        String count = getEval("window.document.getElementById('grid').rows.length");
+
+        assertEquals(count, "7", "Expected seven rows: the header and six data rows.");
+    }
+
 }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/ZoneTests.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/ZoneTests.java?rev=890912&r1=890911&r2=890912&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/ZoneTests.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/ZoneTests.java Tue Dec 15 17:47:31 2009
@@ -86,4 +86,113 @@
 
         click("link=Direct JSON response");
     }
+
+    /**
+     * TAP5-187
+     */
+    @Test
+    public void zone_redirect_by_class()
+    {
+        clickThru("Zone Demo");
+
+        clickAndWait("link=Perform a redirect to another page");
+
+        assertText("activePageName", "nested/AssetDemo");
+    }
+
+    /**
+     * TAP5-108
+     */
+    @Test
+    public void update_multiple_zones_at_once()
+    {
+        clickThru("Multiple Zone Update Demo");
+
+        String now = getText("now");
+
+        click("update");
+
+        waitForElementToAppear("fredName");
+
+        assertText("fredName", "Fred Flintstone");
+        assertText("dino", "His dog, Dino.");
+
+        // Ideally, we'd add checks that the JavaScript for the Palette in the
+        // Barney Zone was
+        // updated.
+
+        // Make sure it was a partial update
+        assertText("now", now);
+    }
+
+    /**
+     * TAP5-573
+     */
+    @Test
+    public void zone_namespace_interaction_fixed()
+    {
+        clickThru("Zone/Namespace Interaction");
+
+        String outerNow = getText("outernow");
+        String innerNow = getText("innernow");
+
+        // If we're too fast that innernow doesn't change because its all within
+        // a single second.
+
+        sleep(1050);
+
+        click(SUBMIT);
+
+        waitForElementToAppear("message");
+
+        // Make sure it was just an Ajax update.
+        assertEquals(getText("outernow"), outerNow);
+
+        assertFalse(getText("innernow").equals(innerNow));
+    }
+
+    @Test
+    public void zone_updated_event_triggered_on_client()
+    {
+        clickThru("Zone Demo");
+
+        assertText("zone-update-message", "");
+
+        click("link=Direct JSON response");
+
+        // Give it some time to process.
+
+        sleep(100);
+
+        assertText("zone-update-message", "Zone updated.");
+    }
+
+    /**
+     * TAP5-389
+     */
+    @Test
+    public void link_submit_inside_form_that_updates_a_zone()
+    {
+        clickThru("LinkSubmit inside Zone");
+
+        String now = getText("now");
+
+        click("link=submit");
+
+        waitForElementToAppear("value:errorpopup");
+
+        type("value", "robot chicken");
+
+        click("link=submit");
+
+        waitForElementToAppear("outputvalue");
+
+        assertText("outputvalue", "robot chicken");
+
+        assertText("eventfired", "true");
+
+        // Make sure it was a partial update
+        assertText("now", now);
+    }
+
 }