Commit | Line | Data |
08122a3c |
1 | #!/usr/bin/env perl |
2 | use FindBin qw/$Bin/; |
5ed74c87 |
3 | BEGIN { do "$FindBin::Bin/../script/env" or die $@ } |
08122a3c |
4 | use lib "$Bin/lib"; |
5 | use TestGitalist; |
aebe9a0e |
6 | plan 'skip_all' => "One or more of the following modules aren't present: Test::WWW::Mechanize::Catalyst WWW::Mechanize::TreeBuilder HTML::TreeBuilder::XPath" unless MECH(); |
08122a3c |
7 | |
8 | MECH->get_ok('/'); |
d2510bc5 |
9 | { |
10 | my $nodeset = MECH->findnodes('/html/body//tr[@class="reposrow"]'); |
11 | foreach my $row ($nodeset->get_nodelist) { |
12 | my $uri = $row->findnodes('.//a')->[0]->attr('href'); |
13 | my ($repos_name) = $uri =~ m{^http://localhost/([\w\.]+)$}; |
14 | ok $repos_name, "Repos name $repos_name"; |
2d376b54 |
15 | like $row->findnodes('.//a')->[1]->as_text, qr{^[\w\s/;',\.]+$}, 'Have description' |
d2510bc5 |
16 | unless $repos_name eq 'nodescription'; |
17 | like $row->findnodes('.//td[@class="time-since"')->[0]->as_text, qr/^(never|\d\s+(years|months)\s+ago)$/, |
18 | 'Last change looks ok'; |
19 | my ($summary, $shortlog, $log, $tree) = $row->findnodes('.//td[@class="link"]/a')->get_nodelist; |
20 | like $summary->as_text, qr/summary/i, 'summary text ok'; |
21 | is $summary->attr('href'), $uri, 'summary href correct'; |
22 | like $shortlog->as_text, qr/shortlog/i, 'shortlog text ok'; |
23 | is $shortlog->attr('href'), "$uri/shortlog", 'shortlog href ok'; |
24 | like $log->as_text, qr/log/, 'log text ok'; |
25 | is $log->attr('href'), "$uri/log", 'log href ok'; |
26 | like $tree->as_text, qr/tree/, 'tree text ok'; |
27 | TODO: { |
28 | local $TODO = 'Bork'; |
29 | is $tree->attr('href'), "$uri/tree", 'tree href ok'; |
30 | } |
31 | } |
32 | } |
08122a3c |
33 | |
34 | done_testing; |