5 use LWP::Protocol::PSGI;
6 use Test::WWW::Mechanize;
13 use lib ("$FindBin::Bin/lib");
15 use stemmaweb::Test::DB;
17 stemmaweb::Test::DB->new_db;
19 LWP::Protocol::PSGI->register(stemmaweb->psgi_app);
21 my $ua = Test::WWW::Mechanize->new;
23 $ua->get_ok('http://localhost/login');
24 my $response = $ua->submit_form(
26 username => 'user@example.org',
27 password => 'UserPass'
30 $ua->content_contains('Stemmaweb - Logged in', 'Log in successful.');
32 my $content = $ua->get('/');
33 $ua->content_contains('Hello! user@example.org', 'We are logged in.');
40 $ua->content_contains('Your username is required.', 'Username is required to log in');
41 $ua->content_contains('Your password is required.', 'Password is required to log in.');
45 username => 'nonexistant',
46 password => 'nonexistant',
49 $ua->content_contains('Bad username or password.', 'Error is shown on incorrect details.');