3 # Copyright (c) 2006 Jonathan Rockway <jrockway@cpan.org>
5 use Test::More tests => 80;
7 use lib "$FindBin::Bin/lib";
9 use IPC::Cmd qw/can_run/;
13 ( can_run('firefox') || can_run('firefox-bin') );
17 # Missing Java or firefox, just do a use_ok test
18 use_ok('Test::WWW::Selenium::Catalyst', 'TestApp',
19 -no_selenium_server => 1);
20 skip "java and firefox requires for further testing", 79;
22 diag("You need to have firefox(-bin) in your path for this to work!");
24 my $port = int(20000+rand()*20000);
25 # Try to cope with case when selenium is already running or something is on port 4444
28 use_ok('Test::WWW::Selenium::Catalyst', 'TestApp',
29 -selenium_args => "-singleWindow -port $port");
31 Test::WWW::Selenium::Catalyst->start( {
32 browser => '*firefox',
33 selenium_port => $port
40 $sel->text_is("link=Click here", "Click here");
41 $sel->click_ok("link=Click here");
42 $sel->wait_for_page_to_load_ok("30000", 'wait');
44 $sel->open_ok("/words/$i");
45 $sel->is_text_present_ok(
46 qq{Here you'll find all things "words" printed $i time(s)!});
49 $sel->is_text_present_ok("$j: foo bar baz bat qux quux");