++ed by:
KES

1 PAUSE user
1 non-PAUSE user.

Zoffix Znet
and 1 contributors

NAME

Test::Mojo::Role::Debug - Test::Mojo role to make debugging test failures easier

SYNOPSIS

    use Test::More;
    use Test::Mojo::WithRoles 'Debug';
    my $t = Test::Mojo::WithRoles->new('MyApp');

    $t->get_ok('/')->status_is(200)
        ->element_exists('existant')
        ->d         # Does nothing, since test succeeded
        ->element_exists('non_existant')
        ->d         # Dump entire DOM on fail
        ->d('#foo') # Dump a specific element on fail
        ->da        # Always dump
    ;

    done_testing;

DESCRIPTION

When you chain up a bunch of tests and they fail, you really want an easy way to dump up your markup at a specific point in that chain and see what's what. This module comes to the rescue.

METHODS

You have all the methods provided by Test::Mojo, plus these:

d

    $t->d;         # print entire DOM on failure
    $t->d('#foo'); # print a specific element on failure

Returns its invocant. On failure of previous tests (see "success" in Mojo::DOM), dumps the DOM of the current page to the screen. Takes an optional selector to be passed to "at" in Mojo::DOM, in which case, only the markup of that element will be dumped.

da

    $t->da;
    $t->da('#foo');

Same as "d", except it always dumps, regardless of whether the previous test failed or not.

SEE ALSO

Test::Mojo ("or" in Test::Mojo in particular), Mojo::DOM

REPOSITORY

BUGS

To report bugs or request features, please use https://github.com/zoffixznet/Test-Mojo-Role-Debug/issues

If you can't access GitHub, you can email your request to bug-test-mojo-role-debug at rt.cpan.org

AUTHOR

CONTRIBUTORS

LICENSE

You can use and distribute this module under the same terms as Perl itself. See the LICENSE file included in this distribution for complete details.