wst has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
Looks like I need more help with this one. I am novice to Test::WWW::Mechanize::Catalyst.
I have a simple search application. First page(and url), asks for one input mgid. If mgid is correct, it will display new page (same url) if mgid is not of correct length/format, an error message is displayed on same page (uses c->flash->{message} format to display error message). if mgid is not found, another chance for checking with shid is given (same url /page but with words SHID : rather than MGID in first instance).
Can a test be done, to check following:
1.check if form HTTP status code is 200 (using submit_form_ok for that),
2. if 1 is ok, then check the page for words /not correct/.
3. if 2 is not ok then check the page for words /SHID:/
4. if 3 is not ok, then check page for words /Found/.
Could such a test be done? Purpose of doing such a test to make sure the flow works for all possible combination. Any suggestion/help would be appreciated.
Thanks for the quick response, time and help in advance!
How about reading the documentation of Test::WWW::Mechanize, of which Test::WWW::Mechanize::Catalyst is a subclass? Especially, look at the ->content_* methods, like ->content_contains() for 2,3 and 4. You will have to write some code after that.