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 | |
Akron | e40933b | 2022-12-21 09:56:55 +0100 | [diff] [blame] | 7 | $ENV{KALAMAR_VERSION} = '0.47.999'; |
| 8 | |
Nils Diewald | 2fe12e1 | 2015-03-06 16:47:06 +0000 | [diff] [blame] | 9 | my $t = Test::Mojo->new('Kalamar'); |
Akron | a0cd596 | 2015-06-29 09:38:00 +0200 | [diff] [blame] | 10 | |
| 11 | $t->app->mode('production'); |
| 12 | |
Nils Diewald | 996aa55 | 2014-12-02 03:26:44 +0000 | [diff] [blame] | 13 | $t->get_ok('/') |
| 14 | ->status_is(200) |
Nils Diewald | a748b0e | 2015-05-19 22:54:06 +0000 | [diff] [blame] | 15 | ->text_is('title', 'KorAP - Corpus Analysis Platform') |
Akron | 5e99216 | 2018-03-22 21:55:15 +0100 | [diff] [blame] | 16 | ->text_is('h1 span', 'KorAP - Corpus Analysis Platform') |
| 17 | ->element_exists('div.intro') |
| 18 | ->text_is('div.intro > p > strong', 'KorAP') |
Akron | 690066c | 2021-01-22 17:39:18 +0100 | [diff] [blame] | 19 | ->content_unlike(qr!onload!) |
Helge | 0d3630c | 2024-10-16 17:19:40 +0200 | [diff] [blame] | 20 | ->text_is('div.intro > p > a.link-guided-tour', 'guided tour') |
Akron | c84ec1a | 2024-04-12 13:50:10 +0200 | [diff] [blame] | 21 | ->text_is('nav > div > a[href=/doc/korap/kalamar]', 'V 0.47.999') |
Akron | 397552c | 2023-09-18 12:13:33 +0200 | [diff] [blame] | 22 | ->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]') |
Akron | 5e99216 | 2018-03-22 21:55:15 +0100 | [diff] [blame] | 25 | ; |
| 26 | |
Akron | 5999212 | 2019-10-29 11:28:45 +0100 | [diff] [blame] | 27 | # Only routed when existing |
| 28 | $t->get_ok('/settings') |
| 29 | ->status_is(404); |
| 30 | |
Akron | 5e99216 | 2018-03-22 21:55:15 +0100 | [diff] [blame] | 31 | push @{$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 | |
Akron | 0e1ed24 | 2018-10-11 13:22:00 +0200 | [diff] [blame] | 42 | |
Akron | 5e99216 | 2018-03-22 21:55:15 +0100 | [diff] [blame] | 43 | $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') |
Akron | a17bc5b | 2018-10-05 13:35:01 +0200 | [diff] [blame] | 48 | ->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"]') |
Akron | 9b82901 | 2024-09-23 14:56:53 +0200 | [diff] [blame] | 52 | ->element_exists_not('#koralQuery') |
Akron | 25602e1 | 2024-11-19 13:24:00 +0100 | [diff] [blame^] | 53 | ->element_exists('aside.invisible') |
| 54 | ->element_exists('aside.off') |
Akron | 9b82901 | 2024-09-23 14:56:53 +0200 | [diff] [blame] | 55 | ; |
| 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') |
Akron | 25602e1 | 2024-11-19 13:24:00 +0100 | [diff] [blame^] | 68 | ->element_exists('aside.invisible') |
| 69 | ->element_exists('aside.off') |
Akron | a17bc5b | 2018-10-05 13:35:01 +0200 | [diff] [blame] | 70 | ; |
Nils Diewald | 5d1ffb4 | 2014-05-21 17:45:34 +0000 | [diff] [blame] | 71 | |
Akron | a0cd596 | 2015-06-29 09:38:00 +0200 | [diff] [blame] | 72 | $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 | |
Akron | b01cccc | 2024-09-30 15:32:43 +0200 | [diff] [blame] | 77 | |
| 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 Diewald | 5d1ffb4 | 2014-05-21 17:45:34 +0000 | [diff] [blame] | 86 | done_testing(); |