blob: f93ea734580a1b0142220dfb9c0fb03f5e7028ce [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
Akrone40933b2022-12-21 09:56:55 +01007$ENV{KALAMAR_VERSION} = '0.47.999';
8
Nils Diewald2fe12e12015-03-06 16:47:06 +00009my $t = Test::Mojo->new('Kalamar');
Akrona0cd5962015-06-29 09:38:00 +020010
11$t->app->mode('production');
12
Nils Diewald996aa552014-12-02 03:26:44 +000013$t->get_ok('/')
14 ->status_is(200)
Nils Diewalda748b0e2015-05-19 22:54:06 +000015 ->text_is('title', 'KorAP - Corpus Analysis Platform')
Akron5e992162018-03-22 21:55:15 +010016 ->text_is('h1 span', 'KorAP - Corpus Analysis Platform')
17 ->element_exists('div.intro')
18 ->text_is('div.intro > p > strong', 'KorAP')
Akron690066c2021-01-22 17:39:18 +010019 ->content_unlike(qr!onload!)
20 ->text_is('#link-guided-tour', 'guided tour')
Akrone40933b2022-12-21 09:56:55 +010021 ->text_is('nav > a[href=/doc/korap/kalamar]', 'V 0.47.999')
Akron5e992162018-03-22 21:55:15 +010022 ;
23
Akron59992122019-10-29 11:28:45 +010024# Only routed when existing
25$t->get_ok('/settings')
26 ->status_is(404);
27
Akron5e992162018-03-22 21:55:15 +010028push @{$t->app->renderer->paths}, path(path(__FILE__)->dirname);
29
30$t->app->plugin(Localize => {
31 dict => {
32 Template => {
33 intro => 'custom/intro'
34 }
35 },
36 override => 1
37});
38
Akron0e1ed242018-10-11 13:22:00 +020039
Akron5e992162018-03-22 21:55:15 +010040$t->get_ok('/')
41 ->status_is(200)
42 ->text_is('title', 'KorAP - Corpus Analysis Platform')
43 ->text_is('h1 span', 'KorAP - Corpus Analysis Platform')
44 ->element_exists('div.intro')
Akrona17bc5b2018-10-05 13:35:01 +020045 ->text_is('div.intro h2', 'This is a custom intro page!')
46 ->element_exists('meta[name="DC.description"][content="KorAP - Corpus Analysis Platform"]')
47 ->element_exists('meta[name="keywords"][content^="KorAP"]')
48 ->element_exists('body[itemscope][itemtype="http://schema.org/WebApplication"]')
49 ;
Nils Diewald5d1ffb42014-05-21 17:45:34 +000050
Akrona0cd5962015-06-29 09:38:00 +020051$t->get_ok('/huhuhuhuhu')
52 ->status_is(404)
53 ->text_is('title', 'KorAP: 404 - Page not found')
54 ->text_is('h1 span', 'KorAP: 404 - Page not found');
55
Nils Diewald5d1ffb42014-05-21 17:45:34 +000056done_testing();