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/; |
Akron | a17bc5b | 2018-10-05 13:35:01 +0200 | [diff] [blame] | 5 | use utf8; |
Nils Diewald | 5d1ffb4 | 2014-05-21 17:45:34 +0000 | [diff] [blame] | 6 | |
Nils Diewald | 2fe12e1 | 2015-03-06 16:47:06 +0000 | [diff] [blame] | 7 | my $t = Test::Mojo->new('Kalamar'); |
Akron | a0cd596 | 2015-06-29 09:38:00 +0200 | [diff] [blame] | 8 | |
| 9 | $t->app->mode('production'); |
| 10 | |
Nils Diewald | 996aa55 | 2014-12-02 03:26:44 +0000 | [diff] [blame] | 11 | $t->get_ok('/') |
| 12 | ->status_is(200) |
Nils Diewald | a748b0e | 2015-05-19 22:54:06 +0000 | [diff] [blame] | 13 | ->text_is('title', 'KorAP - Corpus Analysis Platform') |
Akron | 5e99216 | 2018-03-22 21:55:15 +0100 | [diff] [blame] | 14 | ->text_is('h1 span', 'KorAP - Corpus Analysis Platform') |
| 15 | ->element_exists('div.intro') |
| 16 | ->text_is('div.intro > p > strong', 'KorAP') |
| 17 | ; |
| 18 | |
| 19 | push @{$t->app->renderer->paths}, path(path(__FILE__)->dirname); |
| 20 | |
| 21 | $t->app->plugin(Localize => { |
| 22 | dict => { |
| 23 | Template => { |
| 24 | intro => 'custom/intro' |
| 25 | } |
| 26 | }, |
| 27 | override => 1 |
| 28 | }); |
| 29 | |
Akron | 0e1ed24 | 2018-10-11 13:22:00 +0200 | [diff] [blame] | 30 | |
Akron | 5e99216 | 2018-03-22 21:55:15 +0100 | [diff] [blame] | 31 | $t->get_ok('/') |
| 32 | ->status_is(200) |
| 33 | ->text_is('title', 'KorAP - Corpus Analysis Platform') |
| 34 | ->text_is('h1 span', 'KorAP - Corpus Analysis Platform') |
| 35 | ->element_exists('div.intro') |
Akron | a17bc5b | 2018-10-05 13:35:01 +0200 | [diff] [blame] | 36 | ->text_is('div.intro h2', 'This is a custom intro page!') |
| 37 | ->element_exists('meta[name="DC.description"][content="KorAP - Corpus Analysis Platform"]') |
| 38 | ->element_exists('meta[name="keywords"][content^="KorAP"]') |
| 39 | ->element_exists('body[itemscope][itemtype="http://schema.org/WebApplication"]') |
| 40 | ; |
Nils Diewald | 5d1ffb4 | 2014-05-21 17:45:34 +0000 | [diff] [blame] | 41 | |
Akron | a0cd596 | 2015-06-29 09:38:00 +0200 | [diff] [blame] | 42 | $t->get_ok('/huhuhuhuhu') |
| 43 | ->status_is(404) |
| 44 | ->text_is('title', 'KorAP: 404 - Page not found') |
| 45 | ->text_is('h1 span', 'KorAP: 404 - Page not found'); |
| 46 | |
Nils Diewald | 5d1ffb4 | 2014-05-21 17:45:34 +0000 | [diff] [blame] | 47 | done_testing(); |