X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=t%2Fmech.t;h=10e7248567a2328076c6ba8ad2b4ef506cdb2db4;hb=10a4003fe323fbd7116c99202254dea5d69cdc71;hp=6a30b18dccb8ae799ceafe42035f79040bb2b1df;hpb=f06598163e56880bfe2004262adf59f7474c687e;p=plack-app-gruntmaster.git diff --git a/t/mech.t b/t/mech.t index 6a30b18..10e7248 100644 --- a/t/mech.t +++ b/t/mech.t @@ -3,16 +3,54 @@ use strict; use warnings; use Test::More; +use Test::WWW::Mechanize::PSGI; + +use Gruntmaster::Data; +use JSON::MaybeXS qw/decode_json/; +use Log::Log4perl qw/:easy/; + BEGIN { - plan skip_all => '$ENV{AUTHOR_TESTING} is false, skipping tests' unless $ENV{AUTHOR_TESTING}; - plan tests => 5; + eval { + dbinit 'dbi:Pg:dbname=gmtest'; 1; + } or plan skip_all => 'Cannot connect to test database (gmtest).'. "Error: $@"; + plan tests => 22; } -use Test::WWW::Mechanize::PSGI; +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');