aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/TestMech.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/TestMech.pm')
-rw-r--r--perllib/FixMyStreet/TestMech.pm18
1 files changed, 18 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/TestMech.pm b/perllib/FixMyStreet/TestMech.pm
index 26738556d..6a4382c3d 100644
--- a/perllib/FixMyStreet/TestMech.pm
+++ b/perllib/FixMyStreet/TestMech.pm
@@ -204,6 +204,24 @@ sub form_errors {
return $result->{errors} || [];
}
+=head2 page_errors
+
+ my $arrayref = $mech->page_errors;
+
+Find all the form errors on the current page and return them in page order as an
+arrayref of TEXTs. If none found return empty arrayref.
+
+=cut
+
+sub page_errors {
+ my $mech = shift;
+ my $result = scraper {
+ process 'p.error', 'errors[]', 'TEXT';
+ }
+ ->scrape( $mech->response );
+ return $result->{errors} || [];
+}
+
=head2 import_errors
my $arrayref = $mech->import_errors;