diff options
author | Matthew Somerville <matthew@mysociety.org> | 2012-04-20 16:04:57 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2012-07-13 09:42:50 +0100 |
commit | 02d06df3644d53aaa2611882491230fc28d843bd (patch) | |
tree | b2d884368b242dae61cfcab98c3b920ab24a1011 /perllib/FixMyStreet/TestMech.pm | |
parent | bd6ecb98fd3ad6f1602b0ea5593dea0bd96f8193 (diff) |
Have a whole fake mapit (for #182) that works if MAPIT_URL is set accordingly.
Setting MAPIT_URL to .../fakemapit/ will then return one area, ID 161 and
type ZZZ, whatever co-ordinate it is given. This means the default area
type is now ZZZ, the UK specific types are moved into the UK cobrands, and
the tests updated accordingly to still function (they assume UK-ness a lot,
so probably need an ALLOWED_COBRANDS entry of "fixmystreet: 'localhost'" and
for your host's domain to show fixmystreet too).
Diffstat (limited to 'perllib/FixMyStreet/TestMech.pm')
-rw-r--r-- | perllib/FixMyStreet/TestMech.pm | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/perllib/FixMyStreet/TestMech.pm b/perllib/FixMyStreet/TestMech.pm index dc42c1aba..2a49cc2f8 100644 --- a/perllib/FixMyStreet/TestMech.pm +++ b/perllib/FixMyStreet/TestMech.pm @@ -211,26 +211,6 @@ sub get_email { return $emails[0]; } -=head2 form_errors - - my $arrayref = $mech->form_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 form_errors { - my $mech = shift; - my $result = scraper { - process 'div.form-error', 'errors[]', 'TEXT'; - process 'p.form-error', 'errors[]', 'TEXT'; - process 'p.error', 'errors[]', 'TEXT'; - } - ->scrape( $mech->response ); - return $result->{errors} || []; -} - =head2 page_errors my $arrayref = $mech->page_errors; @@ -243,8 +223,7 @@ arrayref of TEXTs. If none found return empty arrayref. sub page_errors { my $mech = shift; my $result = scraper { - process 'p.error', 'errors[]', 'TEXT'; - process 'ul.error li', 'errors[]', 'TEXT'; + process 'div.form-error, p.form-error, p.error, ul.error li', 'errors[]', 'TEXT'; } ->scrape( $mech->response ); return $result->{errors} || []; @@ -327,6 +306,7 @@ sub extract_problem_meta { my $result = scraper { process 'div#side p em', 'meta', 'TEXT'; + process '.problem-header p em', 'meta', 'TEXT'; } ->scrape( $mech->response ); @@ -348,6 +328,7 @@ sub extract_problem_title { my $result = scraper { process 'div#side h1', 'title', 'TEXT'; + process '.problem-header h1', 'title', 'TEXT'; } ->scrape( $mech->response ); @@ -388,6 +369,7 @@ sub extract_update_metas { my $result = scraper { process 'div#updates div.problem-update p em', 'meta[]', 'TEXT'; + process '.update-text .meta-2', 'meta[]', 'TEXT'; } ->scrape( $mech->response ); |