#!/usr/bin/perl

use Test::WWW::Mechanize::CGIApp;
 use Test::Builder::Tester;

use strict;
use warnings;

# use Test::More tests => 13;
use Test::More 'no_plan';

require 't/test-lib.pl';

my $mech = get_mech();

# login/logout tests handled by test-lib.pl

do_login();   # print $fh $mech->content; # exit;
################################################

################################################

#$mech->get_ok("/config/general-practitioners/search?name=bla"); print_and_exit();

#=begin
foreach my $mode( qw/error info warning/ ) {
    $mech->get_ok("/test/test_flash/$mode");   # print_content();

    $mech->content_contains(
        uc $mode,
        "flash mode attribute '$mode' passed and detected correctly",
    );
}

# $mech->get_ok("/test/test_urls?foo=bar"); # print_and_exit();

# forbidden page:
$mech->get_ok('/test/forbidden_page'); # print_and_exit();
$mech->content_contains(
    'Permission Denied',
    'OK: forbidden action',
);                                       # print_and_exit();    

#=cut

=begin
$mech->get_ok('/config/specimens');  # print_and_exit();

# invoke regenerate function:
# $mech->submit;                              # print_and_exit();

$mech->follow_link_ok(
    # {n => 8}, "Logout $_ via eighth link on page",
    { url_regex => qr/edit/i, },
    'OK: select "edit" link',
);                                           # print_and_exit();

$mech->content_contains(
    '&raquo; Edit Specimen',
    'OK: edit page loaded',
);

$mech->submit_form(
    fields => {
        sample_code => 'BMAT',
    }
);                                             # print_and_exit();

=cut

do_logout();

