blob: 3f4d0c14aab094da28e821fa6745e1609fb51691 [file] [log] [blame]
Nils Diewalda898dac2015-05-06 21:04:16 +00001use Mojo::Base -strict;
Nils Diewalda898dac2015-05-06 21:04:16 +00002use Test::More;
3use Test::Mojo;
4
5# Test the documentation
6
7my $t = Test::Mojo->new('Kalamar');
8
Akronccd71a42017-06-30 18:09:19 +02009# Embedding
Nils Diewalda898dac2015-05-06 21:04:16 +000010$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 Diewalda748b0e2015-05-19 22:54:06 +000017 ->text_is('h1 span', 'KorAP: Poliqarp+')
18 ->element_exists('li.folded.active')
19 ->text_is('li.folded.active a', 'Poliqarp+');
Nils Diewalda898dac2015-05-06 21:04:16 +000020
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 Diewalda748b0e2015-05-19 22:54:06 +000026 ->element_exists_not('header')
27 ->element_exists('li.folded.active')
28 ->text_is('li.folded.active a', 'Poliqarp+');
Nils Diewalda898dac2015-05-06 21:04:16 +000029
Akronccd71a42017-06-30 18:09:19 +020030# 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
Akronf4a7cf42018-01-09 15:58:45 +010056# 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
Akron1bd65d92019-07-17 18:26:36 +020061# 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
Akronf4a7cf42018-01-09 15:58:45 +010069my $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
88is($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 Diewalda898dac2015-05-06 21:04:16 +000095
96done_testing();