You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2012/12/03 19:29:26 UTC

[1/6] git commit: Fix broken tests

Updated Branches:
  refs/heads/5.4-js-rewrite aa4ccaad9 -> c43855074


Fix broken tests


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/c4385507
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/c4385507
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/c4385507

Branch: refs/heads/5.4-js-rewrite
Commit: c438550745e4b88a4f13eb0cadc26864501efe88
Parents: 872df61
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Mon Dec 3 10:29:15 2012 -0800
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Mon Dec 3 10:29:15 2012 -0800

----------------------------------------------------------------------
 tapestry-core/src/test/app1/PaletteDemo.tml        |    3 -
 .../integration/TapestryCoreTestCase.java          |    1 +
 .../tapestry5/integration/app1/PaletteTests.java   |   81 +++++++++-----
 .../integration/app1/pages/PaletteDemo.java        |    6 -
 4 files changed, 53 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/c4385507/tapestry-core/src/test/app1/PaletteDemo.tml
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/app1/PaletteDemo.tml b/tapestry-core/src/test/app1/PaletteDemo.tml
index 3a59f34..3023c3a 100644
--- a/tapestry-core/src/test/app1/PaletteDemo.tml
+++ b/tapestry-core/src/test/app1/PaletteDemo.tml
@@ -41,7 +41,4 @@
 
 <p>Selected Languages: ${languages}</p>
 
-<p>
-    <t:actionlink t:id="reset" class="btn btn-warning">reset</t:actionlink>
-</p>
 </html>

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/c4385507/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java
index a8f85b9..1a57e37 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java
@@ -33,6 +33,7 @@ public abstract class TapestryCoreTestCase extends SeleniumTestCase
         }
     }
 
+    /** @deprecated Deprecated in 5.4, should not be used, as it expects 5.3 style error popups. */
     protected final void assertBubbleMessage(String fieldId, String expected)
     {
         String popupId = fieldId + "_errorpopup";

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/c4385507/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/PaletteTests.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/PaletteTests.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/PaletteTests.java
index 05afe0a..9d3c642 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/PaletteTests.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/PaletteTests.java
@@ -23,56 +23,77 @@ import org.testng.annotations.Test;
  */
 public class PaletteTests extends TapestryCoreTestCase
 {
+
+    public static final String AVAILABLE_OPTIONS = "css=.t-palette-available select";
+
+    public static final String SELECTED_OPTIONS = "css=.t-palette-selected select";
+
+    public static final String SELECT_BUTTON = "css=.t-palette [data-action=select]";
+
+    public static final String DESELECT_BUTTON = "css=.t-palette [data-action=deselect]";
+
+    public static final String MOVE_UP_BUTTON = "css=.t-palette [data-action=move-up]";
+
+    public static final String MOVE_DOWN_BUTTON = "css=.t-palette [data-action=move-down]";
+
     @Test
     public void palette_component()
     {
-        openLinks("Palette Demo", "reset");
+        openLinks("Palette Demo", "Reset Page State");
 
-        assertText("//div[@class='t-palette-available']/div[@class='t-palette-title']",
+        waitForPageLoaded();
+
+        assertText("css=.t-palette-available .t-palette-title",
                 "Languages Offered");
-        assertText("//div[@class='t-palette-selected']/div[@class='t-palette-title']",
+        assertText("css=.t-palette-selected .t-palette-title",
                 "Selected Languages");
 
-        addSelection("languages-avail", "label=Haskell");
-        addSelection("languages-avail", "label=Javascript");
-        click("languages-select");
+        addSelection(AVAILABLE_OPTIONS, "label=Haskell");
+        addSelection(AVAILABLE_OPTIONS, "label=Javascript");
+        click(SELECT_BUTTON);
 
         clickAndWait(SUBMIT);
+
         assertTextPresent("Selected Languages: [HASKELL, JAVASCRIPT]");
 
-        addSelection("languages", "label=Javascript");
-        click("languages-deselect");
+        waitForPageLoaded();
+
+        addSelection(SELECTED_OPTIONS, "label=Javascript");
 
-        addSelection("languages-avail", "label=Perl");
-        removeSelection("languages-avail", "label=Javascript");
-        addSelection("languages-avail", "label=Erlang");
-        addSelection("languages-avail", "label=Java");
-        addSelection("languages-avail", "label=Lisp");
-        addSelection("languages-avail", "label=Ml");
-        addSelection("languages-avail", "label=Python");
-        addSelection("languages-avail", "label=Ruby");
+        click(DESELECT_BUTTON);
 
-        click("languages-select");
+        addSelection(AVAILABLE_OPTIONS, "label=Perl");
+        removeSelection(AVAILABLE_OPTIONS, "label=Javascript");
+        addSelection(AVAILABLE_OPTIONS, "label=Erlang");
+        addSelection(AVAILABLE_OPTIONS, "label=Java");
+        addSelection(AVAILABLE_OPTIONS, "label=Lisp");
+        addSelection(AVAILABLE_OPTIONS, "label=Ml");
+        addSelection(AVAILABLE_OPTIONS, "label=Python");
+        addSelection(AVAILABLE_OPTIONS, "label=Ruby");
+
+        click(SELECT_BUTTON);
 
         clickAndWait(SUBMIT);
 
         assertTextPresent("[ERLANG, HASKELL, JAVA, LISP, ML, PERL, PYTHON, RUBY]");
 
         check("reorder");
+
         clickAndWait(SUBMIT);
 
-        assertText("//div[@class='t-palette-selected']/div[@class='t-palette-title']",
-                "Selected / Ranked Languages");
+        waitForPageLoaded();
 
-        addSelection("languages", "label=Ruby");
+        addSelection(SELECTED_OPTIONS, "label=Ruby");
 
         for (int i = 0; i < 6; i++)
-            click("languages-up");
+        {
+            click(MOVE_UP_BUTTON);
+        }
 
-        removeSelection("languages", "label=Ruby");
-        addSelection("languages", "label=Perl");
+        removeSelection(SELECTED_OPTIONS, "label=Ruby");
+        addSelection(SELECTED_OPTIONS, "label=Perl");
 
-        click("languages-down");
+        click(MOVE_DOWN_BUTTON);
 
         clickAndWait(SUBMIT);
 
@@ -85,7 +106,7 @@ public class PaletteTests extends TapestryCoreTestCase
     @Test
     public void palette_component_disabled_options()
     {
-        openLinks("Palette Demo", "reset");
+        openLinks("Palette Demo", "Reset Page State");
 
         /*
          * force of the options to be disabled rather than creating the model
@@ -93,20 +114,22 @@ public class PaletteTests extends TapestryCoreTestCase
          * it is possible to get into this state by creating a model with
          * disabled options.
          */
-        getEval("this.browserbot.findElement('//select[@id=\"languages-avail\"]/option[1]').disabled = 'disabled';");
+        getEval("this.browserbot.findElement('" + AVAILABLE_OPTIONS + " option').disabled = 'disabled';");
 
         // causes an error in the js console but does not throw an exception
         // here. optimally, this would make the test case fail.
-        doubleClick("//select[@id=\"languages-avail\"]/option[1]");
+        doubleClick(AVAILABLE_OPTIONS + " option");
     }
 
     @Test
     public void palette_component_client_validation()
     {
-        openLinks("Palette Demo", "reset");
+        openLinks("Palette Demo", "Reset Page State");
+
+        waitForPageLoaded();
 
         click(SUBMIT);
 
-        assertBubbleMessage("languages", "You must provide a value for Languages.");
+        assertTextPresent("You must provide a value for Languages.");
     }
 }

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/c4385507/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/PaletteDemo.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/PaletteDemo.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/PaletteDemo.java
index 7cf5dba..8ed2e3f 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/PaletteDemo.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/PaletteDemo.java
@@ -63,10 +63,4 @@ public class PaletteDemo
     {
         return new EnumValueEncoder(typeCoercer, ProgrammingLanguage.class);
     }
-
-    void onActionFromReset()
-    {
-        reorder = false;
-        languages = null;
-    }
 }