[Jifty-commit] r4688 - in jifty/trunk/t/TestApp-JiftyJS: lib/TestApp/JiftyJS t

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Fri Dec 14 04:02:57 EST 2007


Author: gugod
Date: Fri Dec 14 04:02:57 2007
New Revision: 4688

Added:
   jifty/trunk/t/TestApp-JiftyJS/t/3-continuation.t
Modified:
   jifty/trunk/t/TestApp-JiftyJS/lib/TestApp/JiftyJS/Action/AddTwoNumbers.pm
   jifty/trunk/t/TestApp-JiftyJS/lib/TestApp/JiftyJS/View.pm

Log:
Finish two sets of selenium tests for testing continuation.

The goal is to see if form_return actually returned to where it
begins.  The entry point can be either '/c/page1', or
'/c/page_another_one'.


Modified: jifty/trunk/t/TestApp-JiftyJS/lib/TestApp/JiftyJS/Action/AddTwoNumbers.pm
==============================================================================
--- jifty/trunk/t/TestApp-JiftyJS/lib/TestApp/JiftyJS/Action/AddTwoNumbers.pm	(original)
+++ jifty/trunk/t/TestApp-JiftyJS/lib/TestApp/JiftyJS/Action/AddTwoNumbers.pm	Fri Dec 14 04:02:57 2007
@@ -12,8 +12,8 @@
 
 use Jifty::Param::Schema;
 use Jifty::Action schema {
-    param first_number  => type is 'integer', render as 'Text';
-    param second_number => type is 'integer', render as 'Text';
+    param first_number  => type is 'text';
+    param second_number => type is 'text';
 };
 
 =head2 take_action

Modified: jifty/trunk/t/TestApp-JiftyJS/lib/TestApp/JiftyJS/View.pm
==============================================================================
--- jifty/trunk/t/TestApp-JiftyJS/lib/TestApp/JiftyJS/View.pm	(original)
+++ jifty/trunk/t/TestApp-JiftyJS/lib/TestApp/JiftyJS/View.pm	Fri Dec 14 04:02:57 2007
@@ -91,7 +91,7 @@
 template '/c/page2' => page {
     form {
         label { "Second Number" };
-        outs_raw('<input type="text" name="number" />');
+        outs_raw('<input type="text" class="text" name="number" />');
         form_return( label => "Pick", as_button => 1);
     }
 };

Added: jifty/trunk/t/TestApp-JiftyJS/t/3-continuation.t
==============================================================================
--- (empty file)
+++ jifty/trunk/t/TestApp-JiftyJS/t/3-continuation.t	Fri Dec 14 04:02:57 2007
@@ -0,0 +1,72 @@
+# This test is for testing Jifty.update() javascript function.
+
+use strict;
+use warnings;
+use lib 't/lib';
+use Jifty::SubTest;
+use Jifty::Test tests => 24;
+use Jifty::Test::WWW::Selenium;
+use utf8;
+
+my $server = Jifty::Test->make_server;
+my $sel    = Jifty::Test::WWW::Selenium->rc_ok($server);
+my $URL    = $server->started_ok;
+
+{
+    # /c/page1 -> /c/page2 -> /c/page1
+
+
+    $sel->open_ok("/c/page1");
+    $sel->wait_for_text_present_ok('first_number');
+
+    my $field = '//input[contains(@class, "text")]';
+    my $button = '//input[@type="submit"]';
+
+    $sel->wait_for_element_present_ok($field);
+    $sel->click_ok($field);
+    $sel->type_ok($field, "100");
+
+    $sel->do_command_ok("clickAndWait", $button);
+
+    my $loc = $sel->get_location;
+    like $loc, qr{/c/page2}, "URL looks like /c/page2";;
+
+    $sel->click_ok($field);
+    $sel->type_ok($field, "50");
+    $sel->do_command_ok("clickAndWait", $button);
+
+    $loc = $sel->get_location;
+    like $loc, qr{/c/page1}, "URL looks like /c/page1";
+
+}
+
+
+{
+    # /c/page_another_one -> /c/page2 -> /c/page_another_one
+
+    $sel->open_ok("/c/page_another_one");
+    $sel->wait_for_text_present_ok('first_number');
+
+    my $field = '//input[contains(@class, "text")]';
+    my $button = '//input[@type="submit"]';
+
+    $sel->wait_for_element_present_ok($field);
+    $sel->click_ok($field);
+    $sel->type_ok($field, "100");
+
+    $sel->do_command_ok("clickAndWait", $button);
+
+    my $loc = $sel->get_location;
+    like $loc, qr{/c/page2}, "URL looks like /c/page2";
+
+    $sel->click_ok($field);
+    $sel->type_ok($field, "50");
+    $sel->do_command_ok("clickAndWait", $button);
+
+    $loc = $sel->get_location;
+    like $loc, qr{/c/page_another_one}, "URL looks like /c/page_another_one";
+}
+
+
+
+$sel->stop;


More information about the Jifty-commit mailing list