Skip Menu |

This queue is for tickets about the Test-WWW-Selenium CPAN distribution.

Report information
The Basics
Id: 25851
Status: resolved
Worked: 5 min
Priority: 0/
Queue: Test-WWW-Selenium

People
Owner: cpan [...] 5thplane.com
Requestors: tom@eborcom.com (no email address)
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.12
Fixed in: (no value)



Subject: do_command('open') fails to set _page_opened
Calling $sel->open('/') sets $self->{_page_opened} but $sel->do_command('open', '/') does not. The attached patch contains a test that demonstrates this problem and a fix that causes the test to pass. Tom
Subject: selenium_do_command.patch
diff -ruN Test-WWW-Selenium-1.12.old/lib/WWW/Selenium.pm Test-WWW-Selenium-1.12/lib/WWW/Selenium.pm --- Test-WWW-Selenium-1.12.old/lib/WWW/Selenium.pm 2007-03-14 03:23:39.000000000 +0000 +++ Test-WWW-Selenium-1.12/lib/WWW/Selenium.pm 2007-03-27 09:27:48.000000000 +0100 @@ -408,9 +408,10 @@ sub do_command { my ($self, $command, @args) = @_; + $command eq 'open' and $self->{_page_opened} = 1; + # Check that user has called open() my %valid_pre_open_commands = ( - open => 1, testComplete => 1, getNewBrowserSession => 1, ); @@ -1169,7 +1170,6 @@ sub open { my $self = shift; - $self->{_page_opened} = 1; $_[0] ||= '/'; # default to opening site root $self->do_command("open", @_); diff -ruN Test-WWW-Selenium-1.12.old/t/selenium-dwim.t Test-WWW-Selenium-1.12/t/selenium-dwim.t --- Test-WWW-Selenium-1.12.old/t/selenium-dwim.t 2007-01-19 08:35:48.000000000 +0000 +++ Test-WWW-Selenium-1.12/t/selenium-dwim.t 2007-03-27 09:10:03.000000000 +0100 @@ -1,7 +1,7 @@ #!/usr/bin/perl use strict; use warnings; -use Test::More tests => 12; +use Test::More tests => 14; use Test::Exception; use Test::Mock::LWP; @@ -47,3 +47,10 @@ $sel = undef; unlike $Mock_req->new_args->[2], qr/cmd=testComplete/, 'not auto-stop'; } + +Do_command_open: { + my $sel = t::WWW::Selenium->new; + $sel->do_command(qw(open /)); + $sel->_set_mock_response_content('http://example.com'); + lives_ok { $sel->get_location }; +}
From: LUKEC [...] cpan.org
Tom, Thanks for the test and the patch! I've applied them, and submitted the changes on the selenium-rc subversion. If you'd like the change to be pushed to cpan as 1.13 asap, I can do that, or I will wait for another change or two. So I guess this implies that you directly call do_command, instead of using open() directly. I haven't heard of anyone doing this before. Would you mind sharing your use case? Cheers, Luke On Tue Mar 27 04:36:10 2007, tom@eborcom.com wrote: Show quoted text
> Calling $sel->open('/') sets $self->{_page_opened} but > $sel->do_command('open', '/') does not. > > The attached patch contains a test that demonstrates this problem and a > fix that causes the test to pass. > > Tom
Fixed in selenium-rc svn.