5 use SGN::Test::WWW::Mechanize skip_cgi => 1;
8 my $m = SGN::Test::WWW::Mechanize->new();
12 $m->get_ok("/cview/");
14 $m->content_contains("Interactive maps");
16 my @map_links = $m->find_all_links( url_regex => qr/map.pl/ );
18 if (@map_links < 2 ) {
19 diag("too few maps in database to test viewmaps.");
22 # try test a comparison of the first two maps.
24 my $map_name1 = $map_links[0]->text();
25 my $map_name2 = $map_links[1]->text();
27 # skip maps with non-numeric ids if local data not available
29 if ( ($map_links[0]->url =~ /map.*?id=[a-zA-Z]+/ || $map_links[1]->url =~ /map.*?id=[a-zA-z]+/) && ($m->test_level() ne 'remote') ) {
30 diag("Skipping $map_name1 / $map_name2 comparison\n");
34 my $id1 = $map_links[0]->url();
35 $id1=~s/.*map_id=(\d+).*/$1/;
36 my $id2 = $map_links[1]->url();
37 $id2=~s/.*map_id=(\d+).*/$1/g;
38 $m->get_ok("/cview/view_maps.pl?center_map_version_id=$id1&right_map_version_id=$id2");