blob: 52e2f1a67f6445eab3f6fc74fd211d53a454e059 [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
61my $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
80is($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 Diewalda898dac2015-05-06 21:04:16 +000087
88done_testing();