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 | |
| 7 | my $t = Test::Mojo->new('Kalamar'); |
| 8 | |
Akron | ccd71a4 | 2017-06-30 18:09:19 +0200 | [diff] [blame] | 9 | # Embedding |
Nils Diewald | a898dac | 2015-05-06 21:04:16 +0000 | [diff] [blame] | 10 | $t->get_ok('/doc/ql/poliqarp-plus') |
| 11 | ->status_is(200) |
| 12 | ->text_like('title', qr/poliqarp/i) |
| 13 | ->element_exists('aside.active') |
| 14 | ->element_exists('main.tutorial') |
| 15 | ->element_exists('header') |
| 16 | ->element_exists('aside nav') |
Nils Diewald | a748b0e | 2015-05-19 22:54:06 +0000 | [diff] [blame] | 17 | ->text_is('h1 span', 'KorAP: Poliqarp+') |
| 18 | ->element_exists('li.folded.active') |
| 19 | ->text_is('li.folded.active a', 'Poliqarp+'); |
Nils Diewald | a898dac | 2015-05-06 21:04:16 +0000 | [diff] [blame] | 20 | |
| 21 | $t->get_ok('/doc/ql/poliqarp-plus?embedded=true') |
| 22 | ->status_is(200) |
| 23 | ->text_like('title', qr/poliqarp/i) |
| 24 | ->element_exists('aside.active') |
| 25 | ->element_exists('main.tutorial') |
Nils Diewald | a748b0e | 2015-05-19 22:54:06 +0000 | [diff] [blame] | 26 | ->element_exists_not('header') |
| 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 | |
Akron | ccd71a4 | 2017-06-30 18:09:19 +0200 | [diff] [blame] | 30 | # Languages |
| 31 | $t->get_ok('/' => { 'Accept-Language' => 'de-DE, en-US, en' }) |
| 32 | ->status_is(200) |
| 33 | ->text_is("title", "KorAP - Korpusanalyseplattform der nächsten Generation"); |
| 34 | |
| 35 | $t->get_ok('/' => { 'Accept-Language' => 'en-US, en, de-DE' }) |
| 36 | ->status_is(200) |
| 37 | ->text_is("title", "KorAP - Corpus Analysis Platform"); |
| 38 | |
| 39 | |
| 40 | # Pages |
| 41 | $t->get_ok('/doc/ql/poliqarp-plus' => { 'Accept-Language' => 'en-US, en, de-DE' }) |
| 42 | ->status_is(200) |
| 43 | ->text_is("title", "KorAP: Poliqarp+") |
| 44 | ->text_is('main section > h3', 'Simple Segments'); |
| 45 | |
| 46 | $t->get_ok('/doc/ql/poliqarp-plus' => { 'Accept-Language' => 'de-DE, en-US, en' }) |
| 47 | ->status_is(200) |
| 48 | ->text_is("title", "KorAP: Poliqarp+") |
| 49 | ->text_is('main section > h3', 'Einfache Segmente'); |
| 50 | |
| 51 | |
| 52 | $t->get_ok('/doc/ql/annis' => { 'Accept-Language' => 'en-US, en, de-DE' }) |
| 53 | ->status_is(200) |
| 54 | ->text_is("title", "KorAP: Annis QL"); |
| 55 | |
Akron | f4a7cf4 | 2018-01-09 15:58:45 +0100 | [diff] [blame] | 56 | # Check corpus examples |
| 57 | $t->get_ok('/doc/ql/poliqarp-plus') |
| 58 | ->status_is(200) |
| 59 | ->text_is('#segments pre.query.tutorial:nth-of-type(1) code', 'Baum'); |
| 60 | |
Akron | 1bd65d9 | 2019-07-17 18:26:36 +0200 | [diff] [blame] | 61 | # Check data |
| 62 | $t->get_ok('/doc/data/annotation' => { 'Accept-Language' => 'en-US, en, de-DE' }) |
| 63 | ->status_is(200) |
| 64 | ->text_is('#tutorial-top', 'Annotations'); |
| 65 | $t->get_ok('/doc/data/annotation' => { 'Accept-Language' => 'de-DE, en-US, en' }) |
| 66 | ->status_is(200) |
| 67 | ->text_is('#tutorial-top', 'Annotationen'); |
| 68 | |
Akron | f4a7cf4 | 2018-01-09 15:58:45 +0100 | [diff] [blame] | 69 | my $app = $t->app; |
| 70 | |
| 71 | $app->plugin( |
| 72 | 'Localize' => { |
| 73 | dict => { |
| 74 | Q => { |
| 75 | newexample => { |
| 76 | poliqarp => { |
| 77 | simple => '** Beispiel' |
| 78 | } |
| 79 | } |
| 80 | } |
| 81 | } |
| 82 | } |
| 83 | ); |
| 84 | |
| 85 | # Set other example query |
| 86 | $app->config('Kalamar')->{examplecorpus} = 'newexample'; |
| 87 | |
| 88 | is($app->loc('Q_poliqarp_simple'), '** Beispiel'); |
| 89 | |
| 90 | # Check corpus examples |
| 91 | $t->get_ok('/doc/ql/poliqarp-plus') |
| 92 | ->status_is(200) |
| 93 | ->text_is('#segments pre.query.tutorial:nth-of-type(1) code', 'Beispiel') |
| 94 | ->text_is('#segments pre.query.tutorial:nth-of-type(1) span', '*'); |
Nils Diewald | a898dac | 2015-05-06 21:04:16 +0000 | [diff] [blame] | 95 | |
| 96 | done_testing(); |