# Copyright (c) 2005 bivio Software, Inc. All rights reserved. # # Visit http://www.bivio.biz for more info. # # This library is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation; either version 2.1 of the # License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; If not, you may get a copy from: # http://www.opensource.org/licenses/lgpl-license.html # # $Id: HTMLParser.bunit,v 1.14 2010/05/19 21:02:42 dobbs Exp $ my($_TMP); config({ 'Bivio::Test::HTMLParser::Forms' => { error_color => '#990000', }, }); options({ create_object => sub { my($case, $params) = @_; my($o) = Bivio::Test::HTMLParser->new( Bivio::IO::File->read("HTMLParser/$params->[0].html")); return $params->[1] ? $o->get($params->[1]) : $o; }, }); [ map({ $_->[0] => [ get_nested => $_->[1], ]; } [ 'all-users' => [ ['Forms', 'Any Privilege', 'visible', '_anon', 'name',] => 'b_filter', ], ],[ 'chooser-label' => [ ['Forms', 'Refresh', 'visible', '_anon', 'type'] => 'select', ], ],[ 'first-option-label' => [ ['Forms', 'Refresh', 'visible', '_anon', 'options', 'A1', 'value'] => 'a1', ], ], [ 'referenceusa' => [ ['Forms', 'YOUR NAME:', 'visible', 'YOUR NAME:', 'type'] => 'text', ], ], [ 'unlabeled-field' => [ ['Forms', 's', 'visible', 's', 'type'] => 'text', ], ],[ 'text-before-error' => [ ['Forms', 'I have fullfilled all of the Classroom Mini-Grant Requirements as enumerated above.', 'visible', 'I have fullfilled all of the Classroom Mini-Grant Requirements as enumerated above.', 'error'] => 'We are not accepting final submission of any applications at this time. You will be notified by email when you will be allowed to complete this application.', ], ],[ 'assign-reviewer' => [ ['Forms', 'Email Address:', 'visible', 'Email Address:', 'type'] => 'text', ], ], [ 'workshop-payment' => [ ['Forms', 'Credit Card Number*:', 'visible', 'Credit Card Number*:', 'type'] => 'text', ['Forms', 'Credit Card Number*:', 'visible', 'Card Expiration Date:', 'type'] => 'select', ['Forms', 'Credit Card Number*:', 'visible', '_anon', 'type'] => 'select', ['Forms', 'Credit Card Number*:', 'visible', 'Full Name on Card*:', 'type'] => 'text', ['Forms', 'Credit Card Number*:', 'visible', "Card Owner's Zip Code*:", 'type'] => 'text', ['Images', 'dot', 'label'] => 'dot', ['Images', 'dot', 'src'] => '/i/dot.gif', ['Images', 'dot', 'alt'] => [undef], ['Images', 'logo', 'label'] => 'logo', ['Images', 'logo', 'src'] => '/i/logo.gif', ['Images', 'logo', 'alt'] => [undef], ], ],[ 'applicants' => [ ['Forms', ' 'textarea', ], ],[ 'div-err' => [ ['Forms', 'Email Address:', 'visible', 'Email Address:', 'error'] => ['You must supply a value for Email Address.'], ], ], [ 'already-registered' => [ ['Forms', 'Your Full Name:', 'visible', 'Your Full Name:', 'error'] => 'You are already registered.Please click here if you would like to recover your password.', ], ], [ 'missing-href' => [ ['Links', 'missing'] => Bivio::DieCode->DIE, ], ], [ duplicate => [ ['Forms', 'OK#0'] => undef, ['Forms', 'OK#1'] => undef, ], ], [ 'service-price' => [ ['Forms', 'Recalculate Price'] => undef, ['Forms', 'Recalculate Price', 'submit', 'Recalculate Price'] => undef, ], ], [ 'ballot-pool-membership' => [ ['Forms', 'Enrolled_0', 'visible', 'Enrolled_0', 'checked' ] => [ 1 ], ['Forms', 'Enrolled_0', 'visible', 'Enrolled_1', 'checked' ] => Bivio::DieCode::DIE, ], ], [ 'ieeesa-ballot-invitation-request-step-2' => [ ['Forms', 'AES/GA', 'visible', 'AES/GA', 'type'] => [ 'checkbox' ], ], ], [ 'ioe-overview' => [ ['Forms', ' ['checkbox'], ['Forms', ' ['1'], ['Forms', ' ['1'], ['Forms', ' ['1'], ['Forms', ' Bivio::DieCode::DIE, ], ], [ 'ieeesa-open-ballot-invitations' => [ ['Forms', 'Join Ballot Group_0', 'visible', 'Classification_0', 'options', '', 'value'] => [ '1' ], ], ], [ login => [ ['Links', 'Please Register.', 'href'] => ['/pub/register'], ['Links', 'help_off', 'href'] => ['/hp/index.html'], ['Forms', 'User ID or Email:', 'visible', 'User ID or Email:', 'type'] => ['text'], ['Forms', 'User ID or Email:', 'visible', 'Password:', 'type'] => ['password'], ['Forms', 'User ID or Email:', 'visible', 'Save Password', 'type'] => ['checkbox'], ], ], [ 'petshop-account-created' => [ ['Links', 'MyAccount', 'href'] => ['/test_http_28027/account'], ], ], [ petshop => [ ['Forms', 'search', 'submit', 'search', 'type'] => ['submit'], ['Forms', 'search', 'visible', '_anon', 'type'] => ['text'], ], ], [ 'petshop-login' => [ ['Forms', 'search', 'submit', 'search', 'type'] => ['submit'], ['Forms', 'search', 'visible', '_anon', 'type'] => ['text'], ['Links', 'Cart', 'href'] => ['/my/cart'], ['Links', 'bivio_power', 'href'] => ['http://www.bivio.biz'], ['Forms', 'User ID:', 'visible', 'User ID:', 'type'] => ['text'], ['Forms', 'User ID:', 'visible', 'Password:', 'type'] => ['password'], ], ], [ 'petshop-login-error' => [ ['Forms', 'User ID:', 'visible', 'User ID:', 'error'] => ['not found'], ['Forms', 'User ID:', 'visible', 'Password:', 'type'] => ['password'], ], ], [ 'petshop-corgi' => [ ['Forms', 'add_to_cart_0', 'submit', 'add_to_cart_0', 'name'] => ['f2_0'], ], ], [ 'petshop-cart' => [ ['Forms', 'remove_0', 'visible', 'Quantity_0', 'value'] => ['1'], ['Tables', 'Remove', 'headings', 0, 'text'] => ['Remove'], ['Tables', 'Remove', 'rows', 0, 1, 'text'] => ['EST-6'], ['Tables', 'Remove', 'rows', 0, 2, 'text'] => ['Male Adult Corgi'], ['Tables', 'Remove', 'rows', 0, 5, 'text'] => ['1'], ['Tables', 'Remove', 'rows', 1, 1, 'text'] => ['Total:'], ['Tables', 'Remove', 'rows', 1, 6, 'text'] => ['18.50'], ], ], [ 'petshop-checkout' => [ ['Tables', 'Item ID', 'headings', 2, 'text'] => ['In Stock'], ['Tables', 'Item ID', 'rows', 0, 2, 'text'] => ['yes'], ], ], [ 'petshop-cart-error' => [ ['Forms', 'remove_0', 'visible', 'Quantity_0', 'error'] => ['expecting a number without a decimal point'], ], ], [ 'petshop-register' => [ ['Forms', 'User ID:', 'visible', 'Country:', 'name'] => ['f10'], ['Forms', 'User ID:', 'visible', '_anon', 'name'] => ['f6'], ['Forms', 'User ID:', 'visible', 'Postal Code:', 'name'] => ['f9'], ['Forms', 'User ID:', 'visible', 'State/Province:', 'name'] => ['f8'], ], ], [ 'petshop-item-detail' => [ ['Tables', 'item', 'headings'] => [[]], ['Tables', 'item', 'rows', 0, 1, 'text'] => ['18.50'], ], ], [ 'as-blacklist-summary' => [ ['Tables', 'IP Address', 'rows', 0, 2, 'text'] => ['0'], ['Tables', 'IP Address', 'rows', 1, 2, 'text'] => ['2'], ['Links', '06/11/2003 GMT', 'href'] => ['/demo/blacklists/detail?p=10400025'], ['Links', '06/11/2003 GMT_1', 'href'] => ['/demo/blacklists/detail?p=10300025'], ], ], [ 'as-blacklist-detail' => [ ['Tables', 'Server', 'rows', 2, 2, 'text'] => ['request removal, website'], ], ], [ 'as-mail-campaign-list' => [ ['Tables', 'First Seen', 'rows', 0, 1, 'text'] => 'REMINDER: Boulder Software Club - First Annual Business Builders Series', ['Tables', 'First Seen', 'rows', 1, 1, 'text'] => 'campaign.btest at 06/16/2003 17:21:39', ], ], [ 'societas-valuation' => [ ['Tables', 'Shares Held', 'rows', 2, 1, 'text'] => ['(600.0000)'], ], ], [ 'button-error' => [ ['Forms', 'Copyright Release_1', 'submit', 'Copyright Release_1', 'error'] => ['To join the ballot, you must sign the Copyright Release'], ], ]), ['login', 'Forms'] => [ get_by_field_names => [ ['User ID or Email:', 'Password:', 'Save Password'] => undef, ['Not found'] => Bivio::DieCode->DIE, ], get_by_field_names => [ [qr/User ID/] => undef, [qr/User ID/ . ''] => undef, [qr/Not fo/] => Bivio::DieCode->DIE, ], ], ['societas-valuation', 'Tables'] => [ find_row => [ ['Shares Held', '', 'Hartford Financial Services Group Inc (HIG)'] => qr{\(1,368\.00\)}s, ], do_rows => [ ['Shares Held', sub { my($row, $index) = @_; $_TMP = 0; return 1 unless exists($row->{'Price per Share'}); return 1 unless $row->{'Price per Share'}->get('text') eq '72.2800'; $_TMP = $index; return 0; }] => sub { return $_TMP == 2 ? 1 : 0; }, ], ], ['already-registered', 'Forms'] => [ get_ok_button => [ [qr{email}i] => 'Register', ], ], ['petshop-cart', 'Tables'] => [ get_by_headings => [ ['Remove'] => undef, ['Not found'] => Bivio::DieCode->DIE, ], do_rows => [ ['Remove', sub { my($row, $index) = @_; unless ($_TMP) { die('index not 0 first time') unless $index eq 0; } die('In Stock is not yes') unless $row->{'In Stock'}->get('text') eq 'yes'; die($index, ': row index mismatch: ', $row) unless $row->{_row_index} eq $index; $_TMP = $index; return 0; }] => sub { return $_TMP == 0 ? 1 : 0; }, ], ], ['as-mail-campaign-list', 'Tables'] => [ do_rows => [ ['First Seen', sub { my($row, $index) = @_; if ($index == 1 && $row->{Subject}->get('text') eq 'campaign.btest at 06/16/2003 17:21:39') { $_TMP = $row->{ID}->get('text'); Bivio::Die->die( $row->{Subject}->get('Links')->get_shallow_copy, ': bad href' ) unless $row->{Subject}->get_nested('Links', 'campaign.btest at 06/16/2003 17:21:39', 'href', ) eq '/dev/campaign-domains?p=33600023'; } return 1; }] => sub { shift->actual_return([$_TMP]); return [1055805699]; }, ], find_row => [ [qr{subj}i, 'campaign.btest at 06/16/2003 17:21:39'] => qr{href.*/dev/campaign-domains\?p=33600023}s, ['First Seen', 'Subject', 'campaign.btest at 06/16/2003 17:21:39'] => qr{href.*/dev/campaign-domains\?p=33600023}s, ['Subject', 'campaign.btest at 06/16/2003 17:21:39'] => qr{href.*/dev/campaign-domains\?p=33600023}s, ], ], ['isto-new-blog', 'Forms'] => [ get_by_field_names => [ [qr{:}, qr{anon}i] => undef, ], ], ];