blob: bb1a48881c4baf45cc1783814447449a21d2e772 [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!)
Helge0d3630c2024-10-16 17:19:40 +020020 ->text_is('div.intro > p > a.link-guided-tour', 'guided tour')
Akronc84ec1a2024-04-12 13:50:10 +020021 ->text_is('nav > div > a[href=/doc/korap/kalamar]', 'V 0.47.999')
Akron397552c2023-09-18 12:13:33 +020022 ->element_exists('select#ql-field option[value=poliqarp]')
23 ->element_exists('select#ql-field option[value=cqp]')
24 ->element_exists_not('select#ql-field option[value=noliqart]')
Akron5e992162018-03-22 21:55:15 +010025 ;
26
Akron59992122019-10-29 11:28:45 +010027# Only routed when existing
28$t->get_ok('/settings')
29 ->status_is(404);
30
Akron5e992162018-03-22 21:55:15 +010031push @{$t->app->renderer->paths}, path(path(__FILE__)->dirname);
32
33$t->app->plugin(Localize => {
34 dict => {
35 Template => {
36 intro => 'custom/intro'
37 }
38 },
39 override => 1
40});
41
Akron0e1ed242018-10-11 13:22:00 +020042
Akron5e992162018-03-22 21:55:15 +010043$t->get_ok('/')
44 ->status_is(200)
45 ->text_is('title', 'KorAP - Corpus Analysis Platform')
46 ->text_is('h1 span', 'KorAP - Corpus Analysis Platform')
47 ->element_exists('div.intro')
Akrona17bc5b2018-10-05 13:35:01 +020048 ->text_is('div.intro h2', 'This is a custom intro page!')
49 ->element_exists('meta[name="DC.description"][content="KorAP - Corpus Analysis Platform"]')
50 ->element_exists('meta[name="keywords"][content^="KorAP"]')
51 ->element_exists('body[itemscope][itemtype="http://schema.org/WebApplication"]')
Akron9b829012024-09-23 14:56:53 +020052 ->element_exists_not('#koralQuery')
Akron25602e12024-11-19 13:24:00 +010053 ->element_exists('aside.invisible')
54 ->element_exists('aside.off')
Akron9b829012024-09-23 14:56:53 +020055 ;
56
57$t->get_ok('/?cq=corpusSigle%3DGOE')
58 ->status_is(200)
59 ->text_is('title', 'KorAP - Corpus Analysis Platform')
60 ->text_is('h1 span', 'KorAP - Corpus Analysis Platform')
61 ->element_exists_not('#notifications div.notify')
62 ->element_exists('div.intro')
63 ->text_is('div.intro h2', 'This is a custom intro page!')
64 ->element_exists('meta[name="DC.description"][content="KorAP - Corpus Analysis Platform"]')
65 ->element_exists('meta[name="keywords"][content^="KorAP"]')
66 ->element_exists('body[itemscope][itemtype="http://schema.org/WebApplication"]')
67 ->element_exists('#koralQuery')
Akron25602e12024-11-19 13:24:00 +010068 ->element_exists('aside.invisible')
69 ->element_exists('aside.off')
Akrona17bc5b2018-10-05 13:35:01 +020070 ;
Nils Diewald5d1ffb42014-05-21 17:45:34 +000071
Akrona0cd5962015-06-29 09:38:00 +020072$t->get_ok('/huhuhuhuhu')
73 ->status_is(404)
74 ->text_is('title', 'KorAP: 404 - Page not found')
75 ->text_is('h1 span', 'KorAP: 404 - Page not found');
76
Akronb01cccc2024-09-30 15:32:43 +020077
78$t->get_ok('/doc/off')
79 ->status_is(200)
80 ->text_is('title', 'KorAP - Corpus Analysis Platform')
81 ->text_is('h1 span', 'KorAP - Corpus Analysis Platform')
82 ->attr_is('aside', 'class',' off')
83 ;
84
85
Nils Diewald5d1ffb42014-05-21 17:45:34 +000086done_testing();