37
38
my $mech = $test->mech();
38
40
$mech->get_ok('http://localhost/svnweb/repos/browse/');
39
$mech->title_is('browse: /repos (Rev: HEAD, via SVN::Web)',
40
"'browse' has correct title") or diag $mech->content();
42
'browse: /repos (Rev: HEAD, via SVN::Web)',
43
"'browse' has correct title")
44
or diag $mech->content();
42
46
$mech->get('http://localhost/svnweb/repos/browse/?rev=1');
44
48
'browse: /repos (Rev: 1, via SVN::Web)',
45
"'browse' with rev has correct title"
49
"'browse' with rev has correct title")
50
or diag $mech->content();
48
52
$mech->get('http://localhost/svnweb/repos/revision/?rev=2');
49
53
$mech->title_is('revision: /repos (Rev: 2, via SVN::Web)',
50
"'revision' has correct title");
54
"'revision' has correct title")
55
or diag $mech->content();
52
57
$mech->get('http://localhost/svnweb/');
53
$mech->title_is('Repository List (via SVN::Web)', "'list' has correct title");
58
$mech->title_is('Repository List (via SVN::Web)', "'list' has correct title")
59
or diag $mech->content();
55
diag "Recursively checking all links";
61
note "Recursively checking all links";
57
63
my $test_sub = sub {
58
is($mech->status, 200, 'Fetched ' . $mech->uri());
64
note('skip static files checks in local tests: '.$mech->uri), return
65
if $mech->uri->path eq '/' or $mech->uri->path =~ m{/css/};
67
is($mech->status, 200, 'Fetched ' . $mech->uri())
68
or diag $mech->status;
60
70
# Make sure that there are no '//' in the URI, unless preceeded by
61
71
# a ':'. This catches template bugs with too many slashes.
62
unlike($mech->uri(), qr{(?<!:)//}, 'URI does not contain "//"');
64
$mech->content_unlike(qr'An error occured', ' and content was correct');
72
unlike($mech->uri(), qr{(?<!:)//}, 'URI does not contain "//"')
75
$mech->content_unlike(qr'An error occured', ' and content was correct')
76
or diag $mech->content;
66
79
and ($mech->uri() !~ m{ (?:
67
80
/ (?: rss | checkout )
70
83
Test::HTML::Tidy::html_tidy_ok($tidy, $mech->content(),
84
' and is valid HTML ('.$mech->uri.')')
72
85
or diag($mech->content());
88
# Make sure that all local links (like <a href="#anchor"...) has
89
# appropriate anchors in code
90
my @local_links = $mech->find_all_links(tag=>'a',url_regex=>qr/^\#/);
91
foreach (@local_links) {
94
$mech->content_like(qr/(?:id|name)=['"]$name(?:['"])/, " and has element with name='$name' (".$mech->uri.")");
75
97
if($can_parse_rss and ($mech->uri() =~ m{/rss/})) {
76
my $feed = $rss->parse_string($mech->content());
77
ok(defined $feed, 'RSS parsed successfully')
78
or diag $rss->errstr(), diag $mech->content();
98
my $feed = $rss->parse_string($mech->content());
99
ok(defined $feed, 'RSS parsed successfully')
100
or diag $rss->errstr(), diag $mech->content();
80
# Make sure that each item's <link> element is a full URL
81
foreach my $item ($feed->query('//item')) {
82
my $node = $item->query('link');
83
like($node->text_content(), qr/^http/, 'RSS link is fully qualified')
84
or diag $node->text_content();
103
local $TODO = "I'am unsure about this test, in some environments full URL can't be"
104
." obtained, so may be we can introduce canonical_uri in config?"
105
." Anyway mark as todo for now";
106
# Make sure that each item's <link> element is a full URL
107
for my $item ($feed->query('//item')) {
108
my $node = $item->query('link');
109
like($node->text_content(), qr/^http/, 'RSS link is fully qualified')
110
or diag $node->text_content();
89
116
$test->walk_site($test_sub);