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