blob: 845c3276ef2f1f945b1d2941b171a870ef36dc70 [file] [log] [blame]
Nils Diewald034ea702015-01-16 19:41:52 +00001use Mojo::Base -strict;
2use lib '../lib', 'lib';
Akron3042f242017-04-15 16:57:55 +02003use Test::More;
Nils Diewald034ea702015-01-16 19:41:52 +00004use Test::Mojo;
5
Akron3042f242017-04-15 16:57:55 +02006$ENV{MOJO_MODE} = 'test';
7
Nils Diewald2fe12e12015-03-06 16:47:06 +00008my $t = Test::Mojo->new('Kalamar');
Akron3042f242017-04-15 16:57:55 +02009
Nils Diewald034ea702015-01-16 19:41:52 +000010$t->get_ok('/')
11 ->status_is(200)
Nils Diewalda748b0e2015-05-19 22:54:06 +000012 ->text_is('title', 'KorAP - Corpus Analysis Platform')
13 ->text_like('h1 span', qr/KorAP - Corpus Analysis Platform/i)
Nils Diewald034ea702015-01-16 19:41:52 +000014 ;
15
16# Check paging
Akron3042f242017-04-15 16:57:55 +020017$t->get_ok('/?q=Baum')
18 ->text_like('h1 span', qr/KorAP: Find .Baum./i)
Nils Diewalda748b0e2015-05-19 22:54:06 +000019 # ->text_is('pre.query.serial span', 'JSON-LD Serialization for "test"')
20 ->text_like('#total-results', qr/\d+$/)
Nils Diewald034ea702015-01-16 19:41:52 +000021 ->text_is('#pagination a[rel=self] span', 1)
Akron45cd0ce2017-04-18 23:24:29 +020022 ->element_exists_not('#ql-field option[value=poliqarp][selected]')
23 ->element_exists_not('#ql-field option[value=cosmas2][selected]')
Akron3042f242017-04-15 16:57:55 +020024 ;
25
Nils Diewald034ea702015-01-16 19:41:52 +000026# Check paging
Akron45cd0ce2017-04-18 23:24:29 +020027$t->get_ok('/?q=test&p=2&ql=cosmas2')
Nils Diewalda748b0e2015-05-19 22:54:06 +000028 ->text_like('#total-results', qr/\d+$/)
Nils Diewald034ea702015-01-16 19:41:52 +000029 ->text_is('#pagination a[rel=self] span', 2)
Akron45cd0ce2017-04-18 23:24:29 +020030 ->element_exists('#ql-field option[value=cosmas2][selected]')
31 ->element_exists_not('#ql-field option[value=poliqarp][selected]')
Nils Diewald034ea702015-01-16 19:41:52 +000032;
33
Nils Diewalda748b0e2015-05-19 22:54:06 +000034done_testing;
35__END__