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