FAQ
I'm testing a Cat app using T::W::M::Catalyst, and am struggling to
understand why one test is failing. It's only the test that's failing;
the action is OK.

I have a simple add-user form that has several checkboxes for different
roles the user can have. I first tick the checkbox corresponding to the
role I want, and then use submit_form_ok with the rest of the info. (If
I can tick the box using submit_form_ok I'm happy to do so, but I can't
figure out how.)

---

ok( $mech_admin->tick('roles','2'), "ticked the newwords_admin checkbox" );

$mech_admin->submit_form_ok( { fields => {
login => 'new_user',
password => 'new_user',
name => 'New Regular User',
email => 'FOO-new@bar.com'
}, }, "Submitted add-user form");

---

The only thing failing here is the _test_ in the first line of this. The
form is submitted correctly, and when I test the "view" page for this
newly-created user, it has the correct role.

Similarly, for my "edit" test, I untick this role, tick a different
role, and the results are correct. But both "ok" tests for the unticking
and ticking, fail.

What's wrong with my test here?

Thanks.

Jesse Sheidlower

Search Discussions

  • Ronald J Kimball at Jun 10, 2011 at 3:19 pm

    On Fri, Jun 10, 2011 at 11:10 AM, Jesse Sheidlower wrote:
    ok( $mech_admin->tick('roles','2'), "ticked the newwords_admin checkbox" );
    The only thing failing here is the _test_ in the first line of this. The
    form is submitted correctly, and when I test the "view" page for this
    newly-created user, it has the correct role.

    Similarly, for my "edit" test, I untick this role, tick a different
    role, and the results are correct. But both "ok" tests for the unticking
    and ticking, fail.

    What's wrong with my test here?
    WWW::Mechanize->tick() and WWW::Mechanize->untick() don't return anything on
    success. They call WWW::Mechanize->warn() if the referenced checkbox does
    not exist.

    Ronald
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20110610/d34047b3/attachment.htm
  • Jesse Sheidlower at Jun 10, 2011 at 3:38 pm

    On Fri, Jun 10, 2011 at 11:19:14AM -0400, Ronald J Kimball wrote:
    On Fri, Jun 10, 2011 at 11:10 AM, Jesse Sheidlower wrote:


    ok( $mech_admin->tick('roles','2'), "ticked the newwords_admin checkbox" );
    The only thing failing here is the _test_ in the first line of this. The
    form is submitted correctly, and when I test the "view" page for this
    newly-created user, it has the correct role.

    Similarly, for my "edit" test, I untick this role, tick a different
    role, and the results are correct. But both "ok" tests for the unticking
    and ticking, fail.

    What's wrong with my test here?
    WWW::Mechanize->tick() and WWW::Mechanize->untick() don't return anything on
    success. They call WWW::Mechanize->warn() if the referenced checkbox does
    not exist.
    Ah. That would indeed explain it then. Thanks!

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedJun 10, '11 at 3:10p
activeJun 10, '11 at 3:38p
posts3
users2
websitecatalystframework.org
irc#catalyst

People

Translate

site design / logo © 2021 Grokbase