| 
									
										
										
										
											2015-10-10 14:09:47 +00:00
										 |  |  | ## @file This is a test script to test and to show the features of the webtester framework. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | testsuite Test WebTester Commands | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | testcase Test Certificate Load | 
					
						
							|  |  |  | # Load a SwissSign root certificate, so that it is accepted in the | 
					
						
							|  |  |  | # following tests.  Normally this is only necessary if you use | 
					
						
							|  |  |  | # self-signed certificates, that are unknown by qt. | 
					
						
							| 
									
										
										
										
											2015-10-10 15:00:06 +00:00
										 |  |  | ca-certificate ca.pem | 
					
						
							| 
									
										
										
										
											2015-10-10 14:09:47 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | testcase Test Variable Definition | 
					
						
							|  |  |  | # set a variable to a value | 
					
						
							|  |  |  | set ARG4 = Argument number 4 | 
					
						
							|  |  |  | # set a variable to the output of a system command | 
					
						
							|  |  |  | set WORKDIR | 
					
						
							|  |  |  |   execute pwd | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | testcase Test Function Call | 
					
						
							|  |  |  | # call a test function with three comma separated arguments | 
					
						
							|  |  |  | # - either with single quotes, allmust be quoted | 
					
						
							|  |  |  | call test '1', 'hello world', 'here is a comma, so it must be quoted', 'ARG4' | 
					
						
							|  |  |  | # - or with double quotes, but the two types cannot be mixed | 
					
						
							|  |  |  | call test "2", "hello world", "here's a comma, so it must be quoted", "ARG4" | 
					
						
							|  |  |  | # - or with no quotes | 
					
						
							|  |  |  | call test 3, hello world, here's no comma and no quotes, ARG4 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | testcase Test Function Definition | 
					
						
							|  |  |  | ## Just a test function | 
					
						
							|  |  |  | ## @param ARG1 an argument | 
					
						
							|  |  |  | ## @param ARG2 another argument | 
					
						
							|  |  |  | ## @param ARG3 another argument | 
					
						
							|  |  |  | ## @param ARG4 another argument | 
					
						
							|  |  |  | function test ARG1, ARG2, ARG3, ARG4 | 
					
						
							|  |  |  |   if ARG1 = 1 | 
					
						
							|  |  |  |     # this is the first function call (or at leas declared to be the first) | 
					
						
							|  |  |  |     echo This is the first call of function "test" | 
					
						
							|  |  |  |   echo called funtion test ARG1, ARG2, ARG3, ARG4 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | testcase Test Checks | 
					
						
							|  |  |  | # check comparisions of values | 
					
						
							|  |  |  | # fist set some variables to test | 
					
						
							|  |  |  | set TEXT = Hello world, this is a test. | 
					
						
							|  |  |  | set TWO = 2 | 
					
						
							|  |  |  | # then so some checks | 
					
						
							|  |  |  | check TWO = 2 | 
					
						
							|  |  |  | check 2 = TWO | 
					
						
							|  |  |  | check TWO = TWO | 
					
						
							|  |  |  | check TEXT = Hello world, this is a test. | 
					
						
							|  |  |  | check TEXT ^ hello world | 
					
						
							|  |  |  | check TEXT ~ [hH]ello.*test | 
					
						
							|  |  |  | check TEXT ~ world | 
					
						
							|  |  |  | check 1 < TWO | 
					
						
							|  |  |  | check TWO < 3 | 
					
						
							|  |  |  | check 3 > TWO | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | testcase Test Setting Clicktype | 
					
						
							|  |  |  | # there are two clicktypes: | 
					
						
							|  |  |  | #  - normal javascript this.click(); call | 
					
						
							|  |  |  | #  - Qt emulated real mouse click | 
					
						
							|  |  |  | clicktype realmouse | 
					
						
							|  |  |  | clicktype javascript | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | testcase Test Load Client Certificate | 
					
						
							|  |  |  | # define a client certificate to authenticate to a server | 
					
						
							| 
									
										
										
										
											2015-10-10 15:00:06 +00:00
										 |  |  | client-certificate client.pem client.key password | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | testcase Test For Loop | 
					
						
							|  |  |  | # test the for loop feature | 
					
						
							|  |  |  | # first run with a gven list | 
					
						
							|  |  |  | execute bash | 
					
						
							|  |  |  |   echo -n "test:" > testfile  | 
					
						
							|  |  |  | for VAR -> 1, 2, 3, 4 | 
					
						
							|  |  |  |   execute bash | 
					
						
							|  |  |  |     echo -n "-VAR;">> testfile | 
					
						
							|  |  |  | set RESULT | 
					
						
							|  |  |  |   execute bash | 
					
						
							|  |  |  |     cat testfile | 
					
						
							|  |  |  |     rm testfile | 
					
						
							|  |  |  | check RESULT = test:-1;-2;-3;-4; | 
					
						
							|  |  |  | # then run with a given global value  | 
					
						
							|  |  |  | set VAR = 5, 6, 7, 8, 9 | 
					
						
							|  |  |  | for VAR | 
					
						
							|  |  |  |   execute bash | 
					
						
							|  |  |  |     echo -n "-VAR;">> testfile | 
					
						
							|  |  |  | set RESULT | 
					
						
							|  |  |  |   execute bash | 
					
						
							|  |  |  |     cat testfile | 
					
						
							|  |  |  |     rm testfile | 
					
						
							|  |  |  | check RESULT = -5;-6;-7;-8;-9; | 
					
						
							| 
									
										
										
										
											2015-10-11 15:28:53 +00:00
										 |  |  | # multi dimensional for loops | 
					
						
							|  |  |  | # VAR colides with VARS1 and VARS2 | 
					
						
							|  |  |  | unset VAR | 
					
						
							|  |  |  | set VARS1 = 1, 2, 3, 4 | 
					
						
							|  |  |  | set VARS2 = a, b, c, d | 
					
						
							|  |  |  | set RESULT = | 
					
						
							|  |  |  | for VARS1 | 
					
						
							|  |  |  |   for VARS2 | 
					
						
							|  |  |  |     set RESULT = RESULTVARS1.VARS2; | 
					
						
							|  |  |  | check RESULT = 1.a;1.b;1.c;1.d;2.a;2.b;2.c;2.d;3.a;3.b;3.c;3.d;4.a;4.b;4.c;4.d; |