[Jifty-commit] jifty branch, master, updated. 1.10518-66-gac3d217

Jifty commits jifty-commit at lists.jifty.org
Tue Feb 14 21:22:25 EST 2012


The branch, master has been updated
       via  ac3d21713bc04a6ed00131346588d9f733f9f703 (commit)
       via  05a9920415226c881c2dae10715e33c5dceee7d8 (commit)
      from  01ec81705bc063aba507eccdc5b47920ea11a288 (commit)

Summary of changes:
 lib/Jifty.pm                    |    2 +-
 lib/Jifty/Test/WWW/WebDriver.pm |   91 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 92 insertions(+), 1 deletions(-)
 create mode 100644 lib/Jifty/Test/WWW/WebDriver.pm

- Log -----------------------------------------------------------------
commit 05a9920415226c881c2dae10715e33c5dceee7d8
Author: Luke Closs <luke at 5thplane.com>
Date:   Mon Feb 13 14:30:04 2012 -0800

    Add a WebDriver layer, similar to Selenium

diff --git a/lib/Jifty.pm b/lib/Jifty.pm
index 5d3d683..67dd4c3 100644
--- a/lib/Jifty.pm
+++ b/lib/Jifty.pm
@@ -13,7 +13,7 @@ BEGIN {
     require Time::Local;
 
     # Declare early to make sure Jifty::Record::schema_version works
-    $Jifty::VERSION = '1.11107';
+    $Jifty::VERSION = '1.11108';
 }
 
 =head1 NAME
diff --git a/lib/Jifty/Test/WWW/WebDriver.pm b/lib/Jifty/Test/WWW/WebDriver.pm
new file mode 100644
index 0000000..69276df
--- /dev/null
+++ b/lib/Jifty/Test/WWW/WebDriver.pm
@@ -0,0 +1,91 @@
+package Jifty::Test::WWW::WebDriver;
+use strict;
+use warnings;
+
+use base 'Test::WebDriver';
+
+=head1 NAME
+
+Jifty::Test::WebDriver - Subclass of L<Test::WebDriver> with
+extra Jifty integration
+
+=head1 SYNOPSIS
+
+  use Jifty::Test::WWW::WebDriver;
+  my $server  = Jifty::Test->make_server;
+  my $sel = Jifty::Test::WWW::WebDriver->rc_ok( $server, lang => 'en_US.UTF-8' );
+  my $URL = $server->started_ok;
+
+  $sel->get_ok( $URL ));
+
+=head1 DESCRIPTION
+
+L<Jifty::Test::WWW::WebDriver> creates a L<Test::WebDriver> object
+associated with your jifty application to test.  In addition, it
+starts Selenium server for you, unless it finds a server already running.
+
+You can specify where to look for the Selenium server using environment
+variables: C<$TWD_HOST>, C<$TWD_PORT>, C<$TWD_BROWSER>.  See
+L<Test::WebDriver> for all the options, and see L<Selenium::Remote::Driver>
+for their meanings.
+
+You may want to set C<TEST_CLASS> to a subclass of L<Test::WebDriver> to
+refactor methods common to your application.
+
+=head2 rc_ok
+
+=cut
+
+sub rc_ok {
+    my $class = shift;
+    my $server = shift;
+    my %args = @_;
+
+    $class->_skip_rest("live test doesn't work on Win32 at the moment")
+                if $^O eq 'MSWin32';
+
+    $ENV{JIFTY_OPENID_WHITELIST_HOST} = $ENV{SELENIUM_RC_TEST_AGAINST} || 'localhost';
+
+    my ($host, $port) = $class->server_is_running;
+    unless ($host and $port) {
+        $class->_skip_rest("No selenium server was found.");
+    }
+
+    $args{browser_url} ||= 'http://'.($ENV{SELENIUM_RC_TEST_AGAINST} || $args{test_server} || 'localhost').':'.$server->port;
+
+    $args{browser_name} ||= $ENV{TWD_BROWSER};
+    $args{test_class} ||= 'Test::WebDriver';
+
+    # This module does not yet launch selenium instances in the background, as
+    # Selenium is not packaged in a way we can count on - eg: there is no
+    # Alien package yet.
+    my $sel = eval { $args{test_class}->new( %args, auto_close => 1 ) };
+    if ($@) {
+        $class->_skip_rest("Died trying to create a $args{test_class} object: $@");
+    }
+    if (!$sel) {
+        $class->_skip_rest("No selenium server was found.");
+    }
+
+    $sel->{browser_url} = $args{browser_url};
+    return $sel;
+}
+
+sub _skip_rest {
+    my $self = shift;
+    my $why  = shift;
+
+    # Schwern: i want skip_rest
+    my $Tester = Test::Builder->new;
+    $Tester->skip($why);
+
+    unless ($Tester->{No_Plan}) {
+        for my $ct ($Tester->{Curr_Test} + 1 .. $Tester->{Expected_Tests}) {
+            $Tester->skip($why); # skip rest of the test
+        }
+    }
+    $Tester->done_testing();
+    exit(0);
+}
+
+1;

commit ac3d21713bc04a6ed00131346588d9f733f9f703
Author: Luke Closs <luke at 5thplane.com>
Date:   Mon Feb 13 14:48:15 2012 -0800

    bump the version

diff --git a/lib/Jifty.pm b/lib/Jifty.pm
index 67dd4c3..e74a2cb 100644
--- a/lib/Jifty.pm
+++ b/lib/Jifty.pm
@@ -13,7 +13,7 @@ BEGIN {
     require Time::Local;
 
     # Declare early to make sure Jifty::Record::schema_version works
-    $Jifty::VERSION = '1.11108';
+    $Jifty::VERSION = '1.20213';
 }
 
 =head1 NAME

-----------------------------------------------------------------------


More information about the Jifty-commit mailing list