Switch to using 960.gs grids for layout.
[catagits/Gitalist.git] / t / app-mech-rootpage.t
CommitLineData
08122a3c 1#!/usr/bin/env perl
2use FindBin qw/$Bin/;
3use lib "$Bin/lib";
4use TestGitalist;
aebe9a0e 5plan '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 6
7MECH->get_ok('/');
d2510bc5 8{
9 my $nodeset = MECH->findnodes('/html/body//tr[@class="reposrow"]');
10 foreach my $row ($nodeset->get_nodelist) {
11 my $uri = $row->findnodes('.//a')->[0]->attr('href');
12 my ($repos_name) = $uri =~ m{^http://localhost/([\w\.]+)$};
13 ok $repos_name, "Repos name $repos_name";
14 like $row->findnodes('.//a')->[1]->as_text, qr/^[\w\s;'\.]+$/, 'Have description'
15 unless $repos_name eq 'nodescription';
16 like $row->findnodes('.//td[@class="time-since"')->[0]->as_text, qr/^(never|\d\s+(years|months)\s+ago)$/,
17 'Last change looks ok';
18 my ($summary, $shortlog, $log, $tree) = $row->findnodes('.//td[@class="link"]/a')->get_nodelist;
19 like $summary->as_text, qr/summary/i, 'summary text ok';
20 is $summary->attr('href'), $uri, 'summary href correct';
21 like $shortlog->as_text, qr/shortlog/i, 'shortlog text ok';
22 is $shortlog->attr('href'), "$uri/shortlog", 'shortlog href ok';
23 like $log->as_text, qr/log/, 'log text ok';
24 is $log->attr('href'), "$uri/log", 'log href ok';
25 like $tree->as_text, qr/tree/, 'tree text ok';
26 TODO: {
27 local $TODO = 'Bork';
28 is $tree->attr('href'), "$uri/tree", 'tree href ok';
29 }
30 }
31}
08122a3c 32
33done_testing;