]> iEval git - gruntmaster-page.git/blobdiff - t/mech.t
Fix problem list display during contest
[gruntmaster-page.git] / t / mech.t
index 5ea673b0fa10613e38a75b290df91d298d6b52f0..10e7248567a2328076c6ba8ad2b4ef506cdb2db4 100644 (file)
--- a/t/mech.t
+++ b/t/mech.t
@@ -2,13 +2,55 @@
 use strict;
 use warnings;
 
-use Test::More tests => 5;
+use Test::More;
 use Test::WWW::Mechanize::PSGI;
 
+use Gruntmaster::Data;
+use JSON::MaybeXS qw/decode_json/;
+use Log::Log4perl qw/:easy/;
+
+BEGIN {
+       eval {
+               dbinit 'dbi:Pg:dbname=gmtest'; 1;
+       } or plan skip_all => 'Cannot connect to test database (gmtest).'. "Error: $@";
+       plan tests => 22;
+}
+
+Log::Log4perl->easy_init($OFF);
 my $mech = Test::WWW::Mechanize::PSGI->new(app => do 'app.psgi');
+
 $mech->get_ok('/');
-$mech->title_is('Gruntmaster 6000');
+$mech->title_is('Gruntmaster 6000', 'title');
 
 $mech->get_ok('/pb/');
-$mech->title_is('Problems');
-$mech->content_contains('Spell');
+$mech->title_is('Problems', 'title');
+
+$mech->get_ok('/pb/arc');
+$mech->title_is('Problem in archive', 'title');
+
+$mech->get_ok('/ct/');
+$mech->title_is('Contests', 'title');
+
+$mech->get_ok('/ct/fc');
+$mech->title_is('Finished contest');
+
+$mech->get_ok('/log/');
+$mech->title_is('Job log', 'title');
+
+$mech->get_ok('/log/1');
+$mech->title_is('Job 1', 'title');
+
+$mech->get_ok('/us/');
+$mech->title_is('Users', 'title');
+
+$mech->get_ok('/us/MGV');
+# testdata.sql does not set name for users, therefore not checking title
+#$mech->title_is('Marius Gavrilescu', 'title');
+
+$mech->get_ok('/src/1.c');
+
+$mech->get_ok('/st/fc');
+$mech->title_is('Standings', 'title');
+
+$mech->get_ok('/ed/fc');
+$mech->title_is('Editorial of Finished contest', 'title');
This page took 0.022831 seconds and 4 git commands to generate.