8 use File::Slurp qw(write_file);
11 getopts('d:h:u:p:', \%opt);
12 die usage() unless ($opt{d} and $opt{u} and $opt{p});
13 my $host = $opt{h} || 'http://localhost/freeside';
15 my $mech = WWW::Mechanize->new( autocheck => 0 );
16 $mech->get("$host/index.html");
19 credential_0 => $opt{u},
20 credential_1 => $opt{p}
26 mkdir($opt{d}) unless -d $opt{d};
29 while (my $path = shift @tests) {
30 if ($path =~ /^#(.*)/) {
31 print "$1 - skipped\n";
34 my $uri = URI->new("$host/$path");
36 my $response = $mech->get($uri);
37 print " - " . $response->code . "\n";
38 if ($response->is_success) {
40 my @dirs = $uri->path_segments;
42 foreach my $dir (@dirs) {
43 mkdir $dir unless -d $dir;
46 write_file($file, {binmode => ':utf8'}, $response->decoded_content);
51 "Usage: fetch_pages -d directory -u username -p password [ -h hostname ]\n\n";
56 fetch_pages - a testing tool for UI changes
60 fetch_pages -d before_change -u myuser -p mypass list_of_tests
61 git checkout newbranch
62 make install; apache2ctl restart
63 fetch_pages -d after_change -u myuser -p mypass list_of_tests
64 diff -ur before_change/ after_change/ |diffstat
68 -d: the directory to put the files in. Required.
70 -u: the username to use with the Freeside web interface. Required.
72 -p: the password. Required.
74 -h: the URL prefix for the Freeside server. Defaults to
75 "http://localhost/freeside".
77 The list of tests can be in a file specified after all arguments, or passed