30
29
= init_pages_for_nsp_only( $host, $agency_id, $quick_login_id );
32
my @total_pages = add_mech_objects( @mvh_pages_from_both, @pages_for_mvh,
33
@nsp_pages_from_both, @pages_for_nsp);
31
my @total_pages = add_mech_objects(
32
@mvh_pages_from_both, @pages_for_mvh,
33
@nsp_pages_from_both, @pages_for_nsp
35
36
my $NUMBER_OF_TESTS_PER_PAGE = 6;
37
my $number_of_tests = ( ( scalar @total_pages ) * $NUMBER_OF_TESTS_PER_PAGE );
39
= ( ( scalar @total_pages ) * $NUMBER_OF_TESTS_PER_PAGE );
38
40
plan tests => $number_of_tests;
40
#TestHelper::pages_get_ok( $mech, @total_pages );
41
TestHelper::pages_get_ok(@total_pages);
42
pages_links_ok(@total_pages );
43
pages_lint_ok(@total_pages );
44
pages_html_tidy_ok(@total_pages );
42
TestHelper::pages_get_ok( $mech, @total_pages );
43
pages_links_ok(@total_pages);
44
pages_lint_ok(@total_pages);
45
pages_html_tidy_ok(@total_pages);
48
49
sub init_pages_for_both {
53
54
'expected_content' => " Search for Social Services",
54
55
'tests_to_skip' => 'tidy lint link get',
55
56
'skip_reason' => 'dan 2008-02-06 testing ability to skip',
58
59
{ 'url' => "http://$host",
59
60
'expected_content' => "Search for Social Services",
60
61
'tests_to_skip' => '',
61
62
'skip_reason' => '',
64
65
{ 'url' => "http://$host/html/about.shtml",
65
66
'expected_content' => "Our Purpose",
66
67
'tests_to_skip' => '',
67
68
'skip_reason' => '',
70
71
{ 'url' => "http://$host/html/help.shtml",
71
72
'expected_content' => "Agency Account Help",
72
73
'tests_to_skip' => '',
73
74
'skip_reason' => '',
76
77
{ 'url' => "http://$host/html/register.shtml",
77
78
'expected_content' => "Why register your agency",
78
79
'tests_to_skip' => '',
79
80
'skip_reason' => '',
82
83
{ 'url' => "http://$host/reports",
83
84
'expected_content' => "PDF Reports",
84
85
'tests_to_skip' => '',
85
86
'skip_reason' => '',
88
89
{ 'url' => "http://$host/reports/",
89
90
'expected_content' => "PDF Reports",
90
91
'tests_to_skip' => '',
91
92
'skip_reason' => '',
95
96
{ 'url' => "http://$host/cgi-bin/mvhub/agency_form.pl",
96
97
'expected_content' => "Password",
97
98
'tests_to_skip' => '',
98
99
'skip_reason' => '',
101
102
{ 'url' => "http://$host/cgi-bin/mvhub/guide.pl?rm=browse_headings",
102
103
'expected_content' => "Arts/Culture/Entertainment",
103
104
'tests_to_skip' => '',
104
105
'skip_reason' => '',
107
108
{ 'url' => "http://$host/cgi-bin/mvhub/admin/admin_reports.pl",
108
109
'expected_content' => "Administrative Reports",
109
110
'tests_to_skip' => '',
110
111
'skip_reason' => '',
113
114
{ 'url' => "http://$host/cgi-bin/mvhub/admin/admin.pl",
114
115
'expected_content' => "Add a New Agency",
115
116
'tests_to_skip' => '',
116
117
'skip_reason' => '',
119
120
{ 'url' => "http://$host/cgi-bin/mvhub/logout.pl",
120
121
'expected_content' => "You have been logged out",
121
122
'tests_to_skip' => '',
122
123
'skip_reason' => '',
126
127
"http://$host/cgi-bin/mvhub/agency.pl?rm=ql&aid=00&qlid=00",
128
129
"Invalid quick log-in ID, please log in manually",
129
130
'tests_to_skip' => '',
130
131
'skip_reason' => '',
133
134
{ 'url' => "http://$host/cgi-bin/mvhub/agency.pl?rm=ql&id=00",
134
135
'expected_content' =>
135
136
"You used an old login URL that is no longer valid",
136
137
'tests_to_skip' => '',
137
138
'skip_reason' => '',
159
160
'tests_to_skip' => 'tidy lint',
161
162
'dan 2008-02-06 record uses smart quotes we dont strip ',
165
166
"http://$host/cgi-bin/mvhub/guide.pl?rm=show_agency&agency_id=101342",
166
167
'expected_content' => "(The CSL)",
167
168
'tests_to_skip' => '',
168
169
'skip_reason' => '',
172
173
"http://$host/cgi-bin/mvhub/guide.pl?rm=show_program&program_id=503916",
173
174
'expected_content' => "Community Software Lab",
174
175
'tests_to_skip' => '',
175
176
'skip_reason' => '',
178
179
{ 'url' => "http://$host/html/reports.shtml",
179
180
'expected_content' => "formatted for printing",
180
181
'tests_to_skip' => 'link',
181
182
'skip_reason' => 'dan 2008-02-06 link to pdf not implemented',
185
186
"http://$host/cgi-bin/mvhub/guide.pl?rm=show_program_results&category_id=804796",
215
216
'tests_to_skip' => 'tidy lint',
217
218
'dan 2008-02-06 record uses smart quotes we dont strip ',
221
222
"http://$host/cgi-bin/mvhub/guide.pl?rm=show_agency&agency_id=103542",
222
223
'expected_content' => "Law Center of Massachusetts",
223
224
'tests_to_skip' => '',
224
225
'skip_reason' => '',
228
229
"http://$host/cgi-bin/mvhub/guide.pl?rm=show_program&program_id=509515",
229
230
'expected_content' => "(NSCAP)",
230
231
'tests_to_skip' => '',
231
232
'skip_reason' => '',
235
236
"http://$host/cgi-bin/mvhub/guide.pl?rm=show_program_results&category_id=801584",
237
238
"programs related to: Adult Basic Education",
238
239
'tests_to_skip' => '',
239
240
'skip_reason' => '',
242
243
{ 'url' => "http://$host/$agency_id/$quick_login_id",
243
244
'expected_content' =>
244
245
"Agency Account Home Page - North Shore Community Action Programs, Inc.",
245
246
'tests_to_skip' => '',
246
247
'skip_reason' => '',
250
251
"http://$host/cgi-bin/mvhub/agency.pl?rm=ql&aid=$agency_id&qlid=$quick_login_id",
252
253
"Agency Account Home Page - North Shore Community Action Programs, Inc.",
253
254
'tests_to_skip' => '',
254
255
'skip_reason' => '',
261
#This will populate the mech field in the hashes
262
261
sub add_mech_objects {
263
my @pages=@_ or die 'add_mech_objects() missing param: @pages';
262
my @pages = @_ or die 'add_mech_objects() missing param: @pages';
265
264
foreach my $page (@pages) {
266
my $mech=Test::WWW::Mechanize->new();
267
$mech->default_header( Authorization => TestHelper::create_temp_auth() );
268
$mech->get($$page{url});
265
my $mech = Test::WWW::Mechanize->new();
266
$mech->default_header(
267
Authorization => TestHelper::create_temp_auth() );
268
$mech->get( $$page{url} );
269
$$page{mech} = $mech;
274
274
sub pages_links_ok {
275
my @pages = @_ or die 'page_links_ok() missing param: @pages';
275
my @pages = @_ or die 'page_links_ok() missing param: @pages';
278
278
foreach my $page (@pages) {
280
$mech = $$page{mech};
281
281
if ( $$page{tests_to_skip} =~ 'link' ) {
282
282
skip "$$page{url} $$page{skip_reason}", 1;
336
336
sub pages_lint_ok {
337
my @pages = @_ or die 'page_lint_ok() missing param: @pages';
337
my @pages = @_ or die 'page_lint_ok() missing param: @pages';
339
339
foreach my $page (@pages) {
341
my $mech=$$page{mech};
341
my $mech = $$page{mech};
342
342
skip $$page{skip_reason}, 1
343
343
if $$page{tests_to_skip} =~ 'lint';
344
344
$mech->html_lint_ok("Lint: ");
349
349
sub pages_html_tidy_ok {
350
my @pages = @_ or die 'pages_html_tidy_ok() missing param: @pages';
350
my @pages = @_ or die 'pages_html_tidy_ok() missing param: @pages';
352
352
foreach my $page (@pages) {
354
my $mech=$$page{mech};
354
my $mech = $$page{mech};
355
355
skip $$page{skip_reason}, 1
356
356
if $$page{tests_to_skip} =~ 'tidy';
357
357
my $short_page = shorten_pagename( $$page{url} );