Skip to content

Instantly share code, notes, and snippets.

@nutzhub
Created August 28, 2014 05:19
Show Gist options
  • Save nutzhub/97cb36822f97fccfadd7 to your computer and use it in GitHub Desktop.
Save nutzhub/97cb36822f97fccfadd7 to your computer and use it in GitHub Desktop.
use strict;
use warnings;
use Test::More;
use Test::WWW::Mechanize::Catalyst;
use FindBin;
use Mojo::DOM;
use lib "$FindBin::Bin/lib";
use TestSetup;
our $db;
BEGIN {
$db = TestSetup->new();
use_ok("Test::WWW::Mechanize::Catalyst" => "MeeTV::CSS");
}
warn "Using " . $db->db_filename . " as db file.\n";
warn "Using " . $db->dsn() . " as dsn.\n";
my $ua1 = Test::WWW::Mechanize::Catalyst->new({
catlyst_app => "MeeTV::CSS"
});
subtest 'Test entering in root url' => sub {
$ua1->get_ok('/', 'Be able to access root page');
};
subtest 'Test Critical message pin' => sub {
my $cc_count = $db->schema->resultset('CriticalMessage')->count;
print STDERR "This is a message, lol\n"; #show in the console.
print "critical $cc_count records"; # doesn't appear in console.
$ua1->get_ok('/?platform=ios', 'Be able to access index page');
my $dom = Mojo::DOM->new($ua1->content);
is($dom->find('.container')->size, 1);
is($dom->find('.alert')->size, 1);
};
done_testing();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment