blob: 5559cc690bc068efb2d0265f3723e2b38d18080d [file] [log] [blame]
Akron4c33c622018-11-12 13:43:27 +01001use Mojo::Base -strict;
2use Test::More;
3use Test::Mojo;
4
5# Test the documentation
6my $t = Test::Mojo->new('Kalamar');
7
8$t->app->plugin('Piwik' => {
9 url => 'https://piwik.korap.ids-mannheim.de/',
10 site_id => 1,
11 embed => 1
12});
13
14# Load piwik
15$t->app->plugin('Kalamar::Plugin::Piwik');
16
17$t->get_ok('/doc/faq')
18 ->status_is(200)
19 ->text_like('section[name=piwik-opt-out] h3', qr!can I opt-out!)
20 ->element_exists('section[name=piwik-opt-out] iframe')
21 ->content_like(qr!var _paq!)
22 ->content_like(qr!window\.addEventListener\('korapRequest!)
Akronb89863a2018-11-13 16:43:59 +010023 ->content_like(qr!setDocumentTitle!)
24 ->content_like(qr!setCustomUrl!)
25 ->content_like(qr!trackPageView!)
Akron4c33c622018-11-12 13:43:27 +010026 ;
27
Akron7c758412018-11-13 14:17:00 +010028# No embedding
29$t->app->plugin('Piwik' => {
30 url => 'https://piwik.korap.ids-mannheim.de/',
31 site_id => 1,
32 embed => 0
33});
34
35$t->get_ok('/doc/faq')
36 ->status_is(200)
37 ->text_like('section[name=piwik-opt-out] h3', qr!can I opt-out!)
38 ->element_exists_not('section[name=piwik-opt-out] iframe')
39 ->content_unlike(qr!var _paq!)
40 ->content_unlike(qr!window\.addEventListener\('korapRequest!)
41 ;
42
43
Akron4c33c622018-11-12 13:43:27 +010044done_testing();