X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=t%2Fmech.t;h=10e7248567a2328076c6ba8ad2b4ef506cdb2db4;hb=06652b6de8dfe1dfdc25729a22330ff6cca489df;hp=5ea673b0fa10613e38a75b290df91d298d6b52f0;hpb=b7bd0bad53df03baf5dc302ade58bea4f73d0880;p=gruntmaster-page.git diff --git a/t/mech.t b/t/mech.t index 5ea673b..10e7248 100644 --- 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');