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 | |
| 61 | my $app = $t->app; |
| 62 | |
| 63 | $app->plugin( |
| 64 | 'Localize' => { |
| 65 | dict => { |
| 66 | Q => { |
| 67 | newexample => { |
| 68 | poliqarp => { |
| 69 | simple => '** Beispiel' |
| 70 | } |
| 71 | } |
| 72 | } |
| 73 | } |
| 74 | } |
| 75 | ); |
| 76 | |
| 77 | # Set other example query |
| 78 | $app->config('Kalamar')->{examplecorpus} = 'newexample'; |
| 79 | |
| 80 | is($app->loc('Q_poliqarp_simple'), '** Beispiel'); |
| 81 | |
| 82 | # Check corpus examples |
| 83 | $t->get_ok('/doc/ql/poliqarp-plus') |
| 84 | ->status_is(200) |
| 85 | ->text_is('#segments pre.query.tutorial:nth-of-type(1) code', 'Beispiel') |
| 86 | ->text_is('#segments pre.query.tutorial:nth-of-type(1) span', '*'); |
Nils Diewald | a898dac | 2015-05-06 21:04:16 +0000 | [diff] [blame] | 87 | |
| 88 | done_testing(); |