Update of /cvsroot/http-webtest/HTTP-WebTest/t
In directory usw-pr-cvs1:/tmp/cvs-serv21683/t
Modified Files:
10-click.t
Added Files:
test4.html
Log Message:
Updated test
--- NEW FILE: test4.html ---
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test File 4</title>
</head>
<body>
<form action="/show-request">
<input type="submit" name="Button">
</form>
</body>
</html>
Index: 10-click.t
===================================================================
RCS file: /cvsroot/http-webtest/HTTP-WebTest/t/10-click.t,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** 10-click.t 27 Apr 2002 21:17:20 -0000 1.5
--- 10-click.t 27 Apr 2002 22:01:47 -0000 1.6
***************
*** 16,20 ****
use vars qw($HOSTNAME $PORT $URL $TEST);
! BEGIN { plan tests => 6 }
# init tests
--- 16,20 ----
use vars qw($HOSTNAME $PORT $URL $TEST);
! BEGIN { plan tests => 7 }
# init tests
***************
*** 131,134 ****
--- 131,164 ----
}
+ # 7: submit form and pass some parameters
+ {
+ my $tests = [ { url => abs_url($URL, '/test4.html'),
+ text_require => [ '<title>Test File 4</title>' ] },
+ # click button to submit form to /test1.txt
+ { click_button => 'Button',
+ method => 'get',
+ params => [ param1 => 'value1' ],
+ text_require => [ 'Method: <GET>',
+ 'Query: <param1=value1>',
+ 'Content: <>' ],
+ },
+ { url => abs_url($URL, '/test4.html'),
+ text_require => [ '<title>Test File 4</title>' ] },
+ { click_button => 'Button',
+ method => 'post',
+ params => [ param1 => 'value1' ],
+ text_require => [ 'Method: <POST>',
+ 'Query: <>',
+ 'Content: <param1=value1>' ],
+ }
+ ];
+
+ check_webtest(webtest => $WEBTEST,
+ server_url => $URL,
+ tests => $tests,
+ opts => $OPTS,
+ check_file => 't/test.out/click_button4');
+ }
+
# try to stop server even we have been crashed
END { stop_webserver($PID) if defined $PID }
***************
*** 147,150 ****
--- 177,193 ----
} elsif($path =~ m|^/test\d+.\w+$|) {
$connect->send_file_response('t' . $path);
+ } elsif($path eq '/show-request') {
+ my $content = '';
+ $content .= 'Method: <' . $request->method . ">\n";
+ $content .= 'Query: <' . ($request->url->query || '') . ">\n";
+ $content .= 'Content: <' . $request->content . ">\n";
+
+ # create response object
+ my $response = new HTTP::Response(RC_OK);
+ $response->header(Content_Type => 'text/plain');
+ $response->content($content);
+
+ # send it to browser
+ $connect->send_response($response);
} else {
$connect->send_error(RC_NOT_FOUND);
|