Nils Diewald | 5d1ffb4 | 2014-05-21 17:45:34 +0000 | [diff] [blame] | 1 | use Mojo::Base -strict; |
Nils Diewald | 5d1ffb4 | 2014-05-21 17:45:34 +0000 | [diff] [blame] | 2 | use Test::More; |
| 3 | use Test::Mojo; |
Akron | 5e99216 | 2018-03-22 21:55:15 +0100 | [diff] [blame] | 4 | use Mojo::File qw/path/; |
Nils Diewald | 5d1ffb4 | 2014-05-21 17:45:34 +0000 | [diff] [blame] | 5 | |
Nils Diewald | 2fe12e1 | 2015-03-06 16:47:06 +0000 | [diff] [blame] | 6 | my $t = Test::Mojo->new('Kalamar'); |
Akron | a0cd596 | 2015-06-29 09:38:00 +0200 | [diff] [blame] | 7 | |
| 8 | $t->app->mode('production'); |
| 9 | |
Nils Diewald | 996aa55 | 2014-12-02 03:26:44 +0000 | [diff] [blame] | 10 | $t->get_ok('/') |
| 11 | ->status_is(200) |
Nils Diewald | a748b0e | 2015-05-19 22:54:06 +0000 | [diff] [blame] | 12 | ->text_is('title', 'KorAP - Corpus Analysis Platform') |
Akron | 5e99216 | 2018-03-22 21:55:15 +0100 | [diff] [blame] | 13 | ->text_is('h1 span', 'KorAP - Corpus Analysis Platform') |
| 14 | ->element_exists('div.intro') |
| 15 | ->text_is('div.intro > p > strong', 'KorAP') |
| 16 | ; |
| 17 | |
| 18 | push @{$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 Diewald | 5d1ffb4 | 2014-05-21 17:45:34 +0000 | [diff] [blame] | 35 | |
Akron | a0cd596 | 2015-06-29 09:38:00 +0200 | [diff] [blame] | 36 | $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 Diewald | 5d1ffb4 | 2014-05-21 17:45:34 +0000 | [diff] [blame] | 41 | done_testing(); |