blob: 3178098d0eed344c7689c3287ccb49683cb41124 [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/;
Akrona17bc5b2018-10-05 13:35:01 +02005use utf8;
Nils Diewald5d1ffb42014-05-21 17:45:34 +00006
Nils Diewald2fe12e12015-03-06 16:47:06 +00007my $t = Test::Mojo->new('Kalamar');
Akrona0cd5962015-06-29 09:38:00 +02008
9$t->app->mode('production');
10
Nils Diewald996aa552014-12-02 03:26:44 +000011$t->get_ok('/')
12 ->status_is(200)
Nils Diewalda748b0e2015-05-19 22:54:06 +000013 ->text_is('title', 'KorAP - Corpus Analysis Platform')
Akron5e992162018-03-22 21:55:15 +010014 ->text_is('h1 span', 'KorAP - Corpus Analysis Platform')
15 ->element_exists('div.intro')
16 ->text_is('div.intro > p > strong', 'KorAP')
Akron690066c2021-01-22 17:39:18 +010017 ->content_unlike(qr!onload!)
18 ->text_is('#link-guided-tour', 'guided tour')
Akron5e992162018-03-22 21:55:15 +010019 ;
20
Akron59992122019-10-29 11:28:45 +010021# Only routed when existing
22$t->get_ok('/settings')
23 ->status_is(404);
24
Akron5e992162018-03-22 21:55:15 +010025push @{$t->app->renderer->paths}, path(path(__FILE__)->dirname);
26
27$t->app->plugin(Localize => {
28 dict => {
29 Template => {
30 intro => 'custom/intro'
31 }
32 },
33 override => 1
34});
35
Akron0e1ed242018-10-11 13:22:00 +020036
Akron5e992162018-03-22 21:55:15 +010037$t->get_ok('/')
38 ->status_is(200)
39 ->text_is('title', 'KorAP - Corpus Analysis Platform')
40 ->text_is('h1 span', 'KorAP - Corpus Analysis Platform')
41 ->element_exists('div.intro')
Akrona17bc5b2018-10-05 13:35:01 +020042 ->text_is('div.intro h2', 'This is a custom intro page!')
43 ->element_exists('meta[name="DC.description"][content="KorAP - Corpus Analysis Platform"]')
44 ->element_exists('meta[name="keywords"][content^="KorAP"]')
45 ->element_exists('body[itemscope][itemtype="http://schema.org/WebApplication"]')
46 ;
Nils Diewald5d1ffb42014-05-21 17:45:34 +000047
Akrona0cd5962015-06-29 09:38:00 +020048$t->get_ok('/huhuhuhuhu')
49 ->status_is(404)
50 ->text_is('title', 'KorAP: 404 - Page not found')
51 ->text_is('h1 span', 'KorAP: 404 - Page not found');
52
Nils Diewald5d1ffb42014-05-21 17:45:34 +000053done_testing();