[Mojolicious] Re: Test buttons or links in Mojo::Test

2017-12-28 Thread yanni19990628
Thank you all!

On Tuesday, December 26, 2017 at 7:52:54 PM UTC-8, yanni1...@g.ucla.edu 
wrote:
>
> Hello all,
>
> How do I test if 
> a button (e.g. 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) 
> or a link (e.g. http://auth.syllabus.space/aboutus>">About 
> Us) 
> 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 mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


[Mojolicious] Re: Test buttons or links in Mojo::Test

2017-12-28 Thread Jan Henning Thorsen
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, yanni1...@g.ucla.edu 
wrote:
>
> Hello all,
>
> How do I test if 
> a button (e.g. 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) 
> or a link (e.g. http://auth.syllabus.space/aboutus>">About 
> Us) 
> 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 mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


[Mojolicious] Re: Test buttons or links in Mojo::Test

2017-12-27 Thread sri

>
> How do I test if 
> a button (e.g. 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) 
> or a link (e.g. http://auth.syllabus.space/aboutus>">About 
> Us) 
> 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.
>

There is no built in feature for "clicking"  on links yet. We've been 
discussing it for some time,
but not found the right way to do it yet. You have to do it manually, or 
use a 3rd party module.

--
sebastian

-- 
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 mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.