Merge branch 'master' into topic/dt_feature_search
[sgn.git] / t / legacy / integration / homepage.t
blob19d2cdb56cf3d839b7780e490b34b3f6ede54533
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
5 use List::AllUtils 'uniq';
7 use Test::More;
8 use lib 't/lib';
10 use SGN::Test::WWW::Mechanize;
11 my $mech = SGN::Test::WWW::Mechanize->new;
13 $mech->get_ok( '/' );
14 $mech->html_lint_ok;
15 $mech->dbh_leak_ok;
17 # test for any broken images or other things that have a
18 # src attr
19 { my @stuff = grep !m|^https?://|, uniq map $_->attr('src'), $mech->findnodes('//*[@src]');
20 get_ok( $mech, $_ ) for @stuff;
23 $mech->get_ok( '/' );
25 # test for any broken local links
27 my @links = grep !m"^(https?|mailto):", uniq map $_->attr('href'), $mech->findnodes('//a[@href]');
29 get_ok( $mech, $_ ) for @links;
32 done_testing;
34 sub get_ok {
35 my ( $mech, $url ) = @_;
37 local $TODO = $url =~ m!^/gbrowse/! ? 'gbrowse not installed on all development machines' : undef;
38 diag "visiting $_";
39 $mech->get_ok( $_ );
40 $mech->back;