Add a very basic test
[plack-app-gruntmaster.git] / t / mech.t
CommitLineData
b7bd0bad
MG
1#!/usr/bin/perl -w
2use strict;
3use warnings;
4
10a4003f 5use Test::More;
b7bd0bad
MG
6use Test::WWW::Mechanize::PSGI;
7
a2431c94
MG
8use Gruntmaster::Data;
9use JSON::MaybeXS qw/decode_json/;
10use Log::Log4perl qw/:easy/;
11
10a4003f
MG
12BEGIN {
13 eval {
14 dbinit 'dbi:Pg:dbname=gmtest'; 1;
15 } or plan skip_all => 'Cannot connect to test database (gmtest).'. "Error: $@";
16 plan tests => 22;
17}
a2431c94 18
10a4003f 19Log::Log4perl->easy_init($OFF);
b7bd0bad 20my $mech = Test::WWW::Mechanize::PSGI->new(app => do 'app.psgi');
a2431c94 21
10a4003f
MG
22$mech->get_ok('/');
23$mech->title_is('Gruntmaster 6000', 'title');
a2431c94 24
10a4003f
MG
25$mech->get_ok('/pb/');
26$mech->title_is('Problems', 'title');
27
28$mech->get_ok('/pb/arc');
29$mech->title_is('Problem in archive', 'title');
30
31$mech->get_ok('/ct/');
32$mech->title_is('Contests', 'title');
33
34$mech->get_ok('/ct/fc');
35$mech->title_is('Finished contest');
36
37$mech->get_ok('/log/');
38$mech->title_is('Job log', 'title');
39
40$mech->get_ok('/log/1');
41$mech->title_is('Job 1', 'title');
42
43$mech->get_ok('/us/');
44$mech->title_is('Users', 'title');
45
46$mech->get_ok('/us/MGV');
47# testdata.sql does not set name for users, therefore not checking title
48#$mech->title_is('Marius Gavrilescu', 'title');
49
50$mech->get_ok('/src/1.c');
51
52$mech->get_ok('/st/fc');
53$mech->title_is('Standings', 'title');
a2431c94 54
10a4003f
MG
55$mech->get_ok('/ed/fc');
56$mech->title_is('Editorial of Finished contest', 'title');
This page took 0.020048 seconds and 4 git commands to generate.