blob: 0bbc09e0a0307909bd3941c6d6182c352b07b818 [file] [log] [blame]
Nils Diewald5d1ffb42014-05-21 17:45:34 +00001use Mojo::Base -strict;
Nils Diewald5d1ffb42014-05-21 17:45:34 +00002use Test::More;
3use Test::Mojo;
Akron5e992162018-03-22 21:55:15 +01004use Mojo::File qw/path/;
Nils Diewald5d1ffb42014-05-21 17:45:34 +00005
Nils Diewald2fe12e12015-03-06 16:47:06 +00006my $t = Test::Mojo->new('Kalamar');
Akrona0cd5962015-06-29 09:38:00 +02007
8$t->app->mode('production');
9
Nils Diewald996aa552014-12-02 03:26:44 +000010$t->get_ok('/')
11 ->status_is(200)
Nils Diewalda748b0e2015-05-19 22:54:06 +000012 ->text_is('title', 'KorAP - Corpus Analysis Platform')
Akron5e992162018-03-22 21:55:15 +010013 ->text_is('h1 span', 'KorAP - Corpus Analysis Platform')
14 ->element_exists('div.intro')
15 ->text_is('div.intro > p > strong', 'KorAP')
16 ;
17
18push @{$t->app->renderer->paths}, path(path(__FILE__)->dirname);
19
20$t->app->plugin(Localize => {
21 dict => {
22 Template => {
23 intro => 'custom/intro'
24 }
25 },
26 override => 1
27});
28
29$t->get_ok('/')
30 ->status_is(200)
31 ->text_is('title', 'KorAP - Corpus Analysis Platform')
32 ->text_is('h1 span', 'KorAP - Corpus Analysis Platform')
33 ->element_exists('div.intro')
34 ->text_is('div.intro h2', 'This is a custom intro page!');
Nils Diewald5d1ffb42014-05-21 17:45:34 +000035
Akrona0cd5962015-06-29 09:38:00 +020036$t->get_ok('/huhuhuhuhu')
37 ->status_is(404)
38 ->text_is('title', 'KorAP: 404 - Page not found')
39 ->text_is('h1 span', 'KorAP: 404 - Page not found');
40
Nils Diewald5d1ffb42014-05-21 17:45:34 +000041done_testing();