Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
48 lines (36 sloc) 1.28 KB
use Modern::Perl;
use Test::More;
use Test::Mojo;
use Schema;
use Test::Database;
my $schema = Test::Database->new->create(Schema => 'test.db');
my $t = Test::Mojo->new('MojoFull');
# Photo not found
# Photoset not found
# All sets
->content_like(qr/\d+\s+photos in\s+\d+\s+albums/i);
ok my $set_id =
$t->tx->res->dom('div#photosets >')->[0]->{'id'},
'set id';
ok my $set_url =
$t->tx->res->dom('div#photosets > > a')->[0]->{'href'},
'set url';
ok my $set_title =
$t->tx->res->dom('div#photosets > > a div.title')->[0]->text,
'set title';
is length $set_id => 17;
# Show set
$t->get_ok($set_url)->status_is(200)->text_is(h1 => $set_title);
$t->get_ok("/photos/$set_id")->status_is(200)->text_is(h1 => $set_title);
$t->get_ok("/photos/$set_title")->status_is(200)->text_is(h1 => $set_title);
ok my $photo_url =
$t->tx->res->dom('div.photoset a.slide')->[0]->{'href'}, 'photo url';
like $photo_url => qr|^/photos/\d+$|;
# Photo
$t->get_ok($photo_url)->status_is(200)->text_like('h1 a.title' => qr/$set_title/);
Something went wrong with that request. Please try again.