I've always done this manually. Something like this:
$t->get_ok('/')->status_is(200)->element_exists('a[href*="msgid"]');
$t->get_ok($t->tx->res->dom->at('a[href*="msgid"]')->{href})->status_is(302)->header_like(Location
=> qr{something});
$t->get_ok($t->tx->res->headers->location)->status_is(200)->element_exists_not('a[href*="msgid="]');
I like how it's dynamic, but at the same time very explicit.
On Wednesday, December 27, 2017 at 4:52:54 AM UTC+1, [email protected]
wrote:
>
> Hello all,
>
> How do I test if
> a button (e.g. <a href="?msgid=0
> <http://auth.syllabus.space/auth/authenticator?msgid=0>" class="btn
> btn-default btn-xs" style="font-size:x-small;color:black" > do not show
> again</a>)
> or a link (e.g. <a href="/aboutus <http://auth.syllabus.space/aboutus>">About
> Us</a>)
> works, using Mojo::Test? I want to make sure that when the user clicks on
> them they can be redirected to the right page, and I want my test object to
> follow those links and test the content of the new page.
>
> Thanks!
>
> Ni
>
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.