Check that all UI pages load without PHP warnings or deprecation messages

This commit is contained in:
Andrew Ruthven 2024-02-25 12:23:09 +13:00
parent a102105f27
commit 974d7d3924
6 changed files with 150 additions and 0 deletions

View File

@ -24,6 +24,7 @@ my $suite;
my $case;
my $helpmeplease = 0;
my $testmode = 'DAVICAL';
my $save_location = "/var/log/davical";
# Hash for eval'd Perl code to store long lived variables in
my %evaled;
@ -67,6 +68,16 @@ if ( !defined($testdef) ) {
die "You need to run this from the testing directory!\n"
unless -d "tests";
# Heuristics to work out if we should make $save_location elsewhere. We want
# /var/log/davical for the CI rig, but within the test directories for localo
# runs. Do we?
if ($ENV{USER} ne 'testrunner') {
$save_location = "tests/$suite/results/";
} elsif (! -w $save_location) {
warn "$save_location isn't writable, using local location";
$save_location = "tests/$suite/results/";
}
my $datafile = $testdef;
$datafile =~ s{\.test$}{};
push @arguments, "--header", 'X-DAViCal-Testcase: '.$datafile;

View File

@ -158,6 +158,11 @@ cp $davical_repo_path/testing/*.php /usr/share/davical/testing/
mkdir -p /var/log/davical
chown www-data /var/log/davical
# Allow the testrunner user to write and read /var/log/davical .
# - Write for saving the output of some tests if they fail
chgrp adm /var/log/davical
chmod 775 /var/log/davical
###
### Setup DAViCal config files
###

View File

@ -0,0 +1,81 @@
1..80
ok 1 - Fetch first page
ok 2 - Not logged in
ok 3 - Login to site
ok 4 - Logged in
ok 5 - Fetch page - http://mycaldav/admin.php?action=browse&t=external
ok 6 - Page has HTTP status 200 - http://mycaldav/admin.php?action=browse&t=external
ok 7 - Page free of Dreprecated warnings - http://mycaldav/admin.php?action=browse&t=external
ok 8 - Page free of Warning warnings - http://mycaldav/admin.php?action=browse&t=external
ok 9 - Fetch page - http://mycaldav/admin.php?action=browse&t=principal&active=f
ok 10 - Page has HTTP status 200 - http://mycaldav/admin.php?action=browse&t=principal&active=f
ok 11 - Page free of Dreprecated warnings - http://mycaldav/admin.php?action=browse&t=principal&active=f
ok 12 - Page free of Warning warnings - http://mycaldav/admin.php?action=browse&t=principal&active=f
ok 13 - Fetch page - http://mycaldav/admin.php?action=browse&t=principal&type=1
ok 14 - Page has HTTP status 200 - http://mycaldav/admin.php?action=browse&t=principal&type=1
ok 15 - Page free of Dreprecated warnings - http://mycaldav/admin.php?action=browse&t=principal&type=1
ok 16 - Page free of Warning warnings - http://mycaldav/admin.php?action=browse&t=principal&type=1
ok 17 - Fetch page - http://mycaldav/admin.php?action=browse&t=principal&type=1
ok 18 - Page has HTTP status 200 - http://mycaldav/admin.php?action=browse&t=principal&type=1
ok 19 - Page free of Dreprecated warnings - http://mycaldav/admin.php?action=browse&t=principal&type=1
ok 20 - Page free of Warning warnings - http://mycaldav/admin.php?action=browse&t=principal&type=1
ok 21 - Fetch page - http://mycaldav/admin.php?action=browse&t=principal&type=1
ok 22 - Page has HTTP status 200 - http://mycaldav/admin.php?action=browse&t=principal&type=1
ok 23 - Page free of Dreprecated warnings - http://mycaldav/admin.php?action=browse&t=principal&type=1
ok 24 - Page free of Warning warnings - http://mycaldav/admin.php?action=browse&t=principal&type=1
ok 25 - Fetch page - http://mycaldav/admin.php?action=browse&t=principal&type=2
ok 26 - Page has HTTP status 200 - http://mycaldav/admin.php?action=browse&t=principal&type=2
ok 27 - Page free of Dreprecated warnings - http://mycaldav/admin.php?action=browse&t=principal&type=2
ok 28 - Page free of Warning warnings - http://mycaldav/admin.php?action=browse&t=principal&type=2
ok 29 - Fetch page - http://mycaldav/admin.php?action=browse&t=principal&type=3
ok 30 - Page has HTTP status 200 - http://mycaldav/admin.php?action=browse&t=principal&type=3
ok 31 - Page free of Dreprecated warnings - http://mycaldav/admin.php?action=browse&t=principal&type=3
ok 32 - Page free of Warning warnings - http://mycaldav/admin.php?action=browse&t=principal&type=3
ok 33 - Fetch page - http://mycaldav/admin.php?action=browse&t=principal&type=4
ok 34 - Page has HTTP status 200 - http://mycaldav/admin.php?action=browse&t=principal&type=4
ok 35 - Page free of Dreprecated warnings - http://mycaldav/admin.php?action=browse&t=principal&type=4
ok 36 - Page free of Warning warnings - http://mycaldav/admin.php?action=browse&t=principal&type=4
ok 37 - Fetch page - http://mycaldav/admin.php?action=edit&t=principal
ok 38 - Page has HTTP status 200 - http://mycaldav/admin.php?action=edit&t=principal
ok 39 - Page free of Dreprecated warnings - http://mycaldav/admin.php?action=edit&t=principal
ok 40 - Page free of Warning warnings - http://mycaldav/admin.php?action=edit&t=principal
ok 41 - Fetch page - http://mycaldav/admin.php?action=edit&t=principal&id=1
ok 42 - Page has HTTP status 200 - http://mycaldav/admin.php?action=edit&t=principal&id=1
ok 43 - Page free of Dreprecated warnings - http://mycaldav/admin.php?action=edit&t=principal&id=1
ok 44 - Page free of Warning warnings - http://mycaldav/admin.php?action=edit&t=principal&id=1
ok 45 - Fetch page - http://mycaldav/davical.css
ok 46 - Page has HTTP status 200 - http://mycaldav/davical.css
ok 47 - Page free of Dreprecated warnings - http://mycaldav/davical.css
ok 48 - Page free of Warning warnings - http://mycaldav/davical.css
ok 49 - Fetch page - http://mycaldav/help.php
ok 50 - Page has HTTP status 200 - http://mycaldav/help.php
ok 51 - Page free of Dreprecated warnings - http://mycaldav/help.php
ok 52 - Page free of Warning warnings - http://mycaldav/help.php
ok 53 - Fetch page - http://mycaldav/iSchedule.php
ok 54 - Page has HTTP status 200 - http://mycaldav/iSchedule.php
ok 55 - Page free of Dreprecated warnings - http://mycaldav/iSchedule.php
ok 56 - Page free of Warning warnings - http://mycaldav/iSchedule.php
ok 57 - Fetch page - http://mycaldav/index.php
ok 58 - Page has HTTP status 200 - http://mycaldav/index.php
ok 59 - Page free of Dreprecated warnings - http://mycaldav/index.php
ok 60 - Page free of Warning warnings - http://mycaldav/index.php
ok 61 - Fetch page - http://mycaldav/index.php
ok 62 - Page has HTTP status 200 - http://mycaldav/index.php
ok 63 - Page free of Dreprecated warnings - http://mycaldav/index.php
ok 64 - Page free of Warning warnings - http://mycaldav/index.php
ok 65 - Fetch page - http://mycaldav/setup.php
ok 66 - Page has HTTP status 200 - http://mycaldav/setup.php
ok 67 - Page free of Dreprecated warnings - http://mycaldav/setup.php
ok 68 - Page free of Warning warnings - http://mycaldav/setup.php
ok 69 - Fetch page - http://mycaldav/tools.php
ok 70 - Page has HTTP status 200 - http://mycaldav/tools.php
ok 71 - Page free of Dreprecated warnings - http://mycaldav/tools.php
ok 72 - Page free of Warning warnings - http://mycaldav/tools.php
ok 73 - Fetch page - http://mycaldav/upgrade.php
ok 74 - Page has HTTP status 200 - http://mycaldav/upgrade.php
ok 75 - Page free of Dreprecated warnings - http://mycaldav/upgrade.php
ok 76 - Page free of Warning warnings - http://mycaldav/upgrade.php
ok 77 - Fetch page - http://mycaldav/index.php?logout
ok 78 - Page has HTTP status 200 - http://mycaldav/index.php?logout
ok 79 - Page free of Dreprecated warnings - http://mycaldav/index.php?logout
ok 80 - Page free of Warning warnings - http://mycaldav/index.php?logout

View File

@ -0,0 +1,53 @@
MODE=TAP,80
BEGINPERL
my $mech = webui_login(
username => 'admin',
password => 'nimda',
url => "http://$webhost",
);
for my $link (sort { $a->url cmp $b->url } $mech->links()) {
my $url = $link->url();
# Only consider local pages.
next unless $url =~ m,^/,;
# Don't logout...
next if $url =~ m,logout$,;
check_url($url);
}
# Finally check logout...
check_url("/index.php?logout");
sub check_url {
my $url = shift;
my $failed = 0;
$url = "http://$webhost$url";
$mech->get_ok($url, "Fetch page - $url")
|| do { $failed = 1 };
ok($mech->response->code == 200, "Page has HTTP status 200 - $url")
|| do {
diag("HTTP Status: " . $mech->status());
$failed = 1;
};
$mech->content_lacks('<b>Deprecated</b>:',
"Page free of Dreprecated warnings - $url")
|| do { $failed = 1 };
$mech->content_lacks('<b>Warning</b>:',
"Page free of Warning warnings - $url")
|| do { $failed = 1 };
if ($failed) {
$url =~ s,[/:],_,g;
diag("Saved content of $url to $save_location/$case-$url");
$mech->save_content("$save_location/$case-$url", binmode => ':utf8');
}
}
ENDPERL