use lib 'lib'; BEGIN { $ENV{'DANCER_ENVIRONMENT'} = 'testing' } use Log::Log4perl qw(:easy); use VoteTracker; use Test::More; use Test::HTML::Content; use Plack::Test; use WWW::Mechanize::Chrome; $Plack::Test::Impl = "Server"; Log::Log4perl->easy_init($ERROR); my $app = VoteTracker->to_app; my $test = Plack::Test->create($app); my $port = $test->port; my $mech = WWW::Mechanize::Chrome->new( headless => 1, report_js_errors => 1, ); $mech->allow( javascript => 1 ); $mech->get("http://localhost:$port/path/to/page"); xpath_ok($mech->content, '//h1[text()="Hello"]', 'Has proper title'); done_testing;