Introduced Piwik as an optional plugin
Change-Id: I57d6961ac9e922e1a661ea94a5a6c7563688ed0b
diff --git a/t/plugin/piwik.t b/t/plugin/piwik.t
new file mode 100644
index 0000000..69cd401
--- /dev/null
+++ b/t/plugin/piwik.t
@@ -0,0 +1,25 @@
+use Mojo::Base -strict;
+use Test::More;
+use Test::Mojo;
+
+# Test the documentation
+my $t = Test::Mojo->new('Kalamar');
+
+$t->app->plugin('Piwik' => {
+ url => 'https://piwik.korap.ids-mannheim.de/',
+ site_id => 1,
+ embed => 1
+});
+
+# Load piwik
+$t->app->plugin('Kalamar::Plugin::Piwik');
+
+$t->get_ok('/doc/faq')
+ ->status_is(200)
+ ->text_like('section[name=piwik-opt-out] h3', qr!can I opt-out!)
+ ->element_exists('section[name=piwik-opt-out] iframe')
+ ->content_like(qr!var _paq!)
+ ->content_like(qr!window\.addEventListener\('korapRequest!)
+ ;
+
+done_testing();