Nils Diewald | a898dac | 2015-05-06 21:04:16 +0000 | [diff] [blame] | 1 | use Mojo::Base -strict; |
Nils Diewald | a898dac | 2015-05-06 21:04:16 +0000 | [diff] [blame] | 2 | use Test::More; |
| 3 | use Test::Mojo; |
| 4 | |
| 5 | # Test the documentation |
| 6 | |
Akron | 07d8de6 | 2020-02-04 17:45:40 +0100 | [diff] [blame] | 7 | my $t = Test::Mojo->new('Kalamar' => { |
| 8 | Kalamar => { |
Akron | 07d8de6 | 2020-02-04 17:45:40 +0100 | [diff] [blame] | 9 | proxy_prefix => '/test' |
| 10 | } |
| 11 | }); |
Nils Diewald | a898dac | 2015-05-06 21:04:16 +0000 | [diff] [blame] | 12 | |
Akron | aa5cf80 | 2021-06-11 11:31:00 +0200 | [diff] [blame^] | 13 | # Bug 2021-06-11 |
| 14 | $t->get_ok('/doc/ql/wildcards?cat=1') |
| 15 | ->status_is(404) |
| 16 | ; |
| 17 | |
Akron | ccd71a4 | 2017-06-30 18:09:19 +0200 | [diff] [blame] | 18 | # Embedding |
Nils Diewald | a898dac | 2015-05-06 21:04:16 +0000 | [diff] [blame] | 19 | $t->get_ok('/doc/ql/poliqarp-plus') |
| 20 | ->status_is(200) |
| 21 | ->text_like('title', qr/poliqarp/i) |
| 22 | ->element_exists('aside.active') |
| 23 | ->element_exists('main.tutorial') |
| 24 | ->element_exists('header') |
| 25 | ->element_exists('aside nav') |
Nils Diewald | a748b0e | 2015-05-19 22:54:06 +0000 | [diff] [blame] | 26 | ->text_is('h1 span', 'KorAP: Poliqarp+') |
| 27 | ->element_exists('li.folded.active') |
| 28 | ->text_is('li.folded.active a', 'Poliqarp+'); |
Nils Diewald | a898dac | 2015-05-06 21:04:16 +0000 | [diff] [blame] | 29 | |
| 30 | $t->get_ok('/doc/ql/poliqarp-plus?embedded=true') |
| 31 | ->status_is(200) |
| 32 | ->text_like('title', qr/poliqarp/i) |
| 33 | ->element_exists('aside.active') |
| 34 | ->element_exists('main.tutorial') |
Nils Diewald | a748b0e | 2015-05-19 22:54:06 +0000 | [diff] [blame] | 35 | ->element_exists_not('header') |
| 36 | ->element_exists('li.folded.active') |
| 37 | ->text_is('li.folded.active a', 'Poliqarp+'); |
Nils Diewald | a898dac | 2015-05-06 21:04:16 +0000 | [diff] [blame] | 38 | |
Akron | ccd71a4 | 2017-06-30 18:09:19 +0200 | [diff] [blame] | 39 | # Languages |
| 40 | $t->get_ok('/' => { 'Accept-Language' => 'de-DE, en-US, en' }) |
| 41 | ->status_is(200) |
| 42 | ->text_is("title", "KorAP - Korpusanalyseplattform der nächsten Generation"); |
| 43 | |
| 44 | $t->get_ok('/' => { 'Accept-Language' => 'en-US, en, de-DE' }) |
| 45 | ->status_is(200) |
| 46 | ->text_is("title", "KorAP - Corpus Analysis Platform"); |
| 47 | |
| 48 | |
| 49 | # Pages |
| 50 | $t->get_ok('/doc/ql/poliqarp-plus' => { 'Accept-Language' => 'en-US, en, de-DE' }) |
| 51 | ->status_is(200) |
| 52 | ->text_is("title", "KorAP: Poliqarp+") |
| 53 | ->text_is('main section > h3', 'Simple Segments'); |
| 54 | |
| 55 | $t->get_ok('/doc/ql/poliqarp-plus' => { 'Accept-Language' => 'de-DE, en-US, en' }) |
| 56 | ->status_is(200) |
| 57 | ->text_is("title", "KorAP: Poliqarp+") |
| 58 | ->text_is('main section > h3', 'Einfache Segmente'); |
| 59 | |
Akron | ccd71a4 | 2017-06-30 18:09:19 +0200 | [diff] [blame] | 60 | $t->get_ok('/doc/ql/annis' => { 'Accept-Language' => 'en-US, en, de-DE' }) |
| 61 | ->status_is(200) |
| 62 | ->text_is("title", "KorAP: Annis QL"); |
| 63 | |
Akron | f4a7cf4 | 2018-01-09 15:58:45 +0100 | [diff] [blame] | 64 | # Check corpus examples |
| 65 | $t->get_ok('/doc/ql/poliqarp-plus') |
| 66 | ->status_is(200) |
| 67 | ->text_is('#segments pre.query.tutorial:nth-of-type(1) code', 'Baum'); |
| 68 | |
Akron | 1bd65d9 | 2019-07-17 18:26:36 +0200 | [diff] [blame] | 69 | # Check data |
| 70 | $t->get_ok('/doc/data/annotation' => { 'Accept-Language' => 'en-US, en, de-DE' }) |
| 71 | ->status_is(200) |
Akron | 9490e3b | 2019-10-17 12:26:29 +0200 | [diff] [blame] | 72 | ->text_is('#page-top', 'KorAP: Annotations'); |
Akron | 1bd65d9 | 2019-07-17 18:26:36 +0200 | [diff] [blame] | 73 | $t->get_ok('/doc/data/annotation' => { 'Accept-Language' => 'de-DE, en-US, en' }) |
| 74 | ->status_is(200) |
Akron | 9490e3b | 2019-10-17 12:26:29 +0200 | [diff] [blame] | 75 | ->text_is('#page-top', 'KorAP: Annotationen'); |
Akron | 1bd65d9 | 2019-07-17 18:26:36 +0200 | [diff] [blame] | 76 | |
Akron | f4a7cf4 | 2018-01-09 15:58:45 +0100 | [diff] [blame] | 77 | my $app = $t->app; |
| 78 | |
| 79 | $app->plugin( |
| 80 | 'Localize' => { |
| 81 | dict => { |
| 82 | Q => { |
| 83 | newexample => { |
| 84 | poliqarp => { |
| 85 | simple => '** Beispiel' |
| 86 | } |
| 87 | } |
| 88 | } |
| 89 | } |
| 90 | } |
| 91 | ); |
| 92 | |
| 93 | # Set other example query |
| 94 | $app->config('Kalamar')->{examplecorpus} = 'newexample'; |
| 95 | |
| 96 | is($app->loc('Q_poliqarp_simple'), '** Beispiel'); |
| 97 | |
| 98 | # Check corpus examples |
| 99 | $t->get_ok('/doc/ql/poliqarp-plus') |
| 100 | ->status_is(200) |
| 101 | ->text_is('#segments pre.query.tutorial:nth-of-type(1) code', 'Beispiel') |
| 102 | ->text_is('#segments pre.query.tutorial:nth-of-type(1) span', '*'); |
Nils Diewald | a898dac | 2015-05-06 21:04:16 +0000 | [diff] [blame] | 103 | |
Akron | 07d8de6 | 2020-02-04 17:45:40 +0100 | [diff] [blame] | 104 | # Check API endpoint |
| 105 | $t->get_ok('/doc/api' => { 'X-Forwarded-Host' => 'korap.ids-mannheim.de' }) |
| 106 | ->status_is(200) |
| 107 | ->text_is('#api-service-uri', 'https://korap.ids-mannheim.de/test/api/v1.0/'); |
| 108 | |
| 109 | |
Akron | 1011daf | 2021-03-01 12:34:58 +0100 | [diff] [blame] | 110 | # Check mail_to_chiffre |
| 111 | like($t->app->mail_to_chiffre('korap@korap.example'),qr!rel="nofollow"!); |
| 112 | like($t->app->mail_to_chiffre('korap@korap.example'),qr!class="PArok"!); |
| 113 | |
Nils Diewald | a898dac | 2015-05-06 21:04:16 +0000 | [diff] [blame] | 114 | done_testing(); |