3 * - Run button/index.html -> buttonMarkup/index.html automatically in one browser
4 * - Summarize result of each test suite
5 * - pass current summary data by GET variables
6 * - Get current summary data by parsing URL to get those GET variables
9 * - Some testcases may change URL during test
10 * It is a not complete versionc. Optimization, refactoring is needed
14 function setCookie( cookieName, cookieValue, expireDate) {
15 var today = new Date();
16 today.setDate( today.getDate() + parseInt( expireDate ) );
17 document.cookie = cookieName + "=" + escape( cookieValue ) + "; path=/; expires=" + today.toGMTString() + ";";
19 function getCookie(name) {
20 var cname = name + "=";
21 var dc = document.cookie;
23 begin = dc.indexOf(cname);
25 begin += cname.length;
26 end = dc.indexOf(";", begin);
30 return unescape(dc.substring(begin, end));
38 var QueryString = function () {
39 var query_string = {},
43 query = window.location.search.substring(1);
45 vars = query.split("&");
47 for (var i = 0 ; i < vars.length ; i++) {
48 pair = vars[i].split("=");
49 if (typeof query_string[pair[0]] === "undefined") {
50 query_string[pair[0]] = pair[1];
51 } else if (typeof query_string[pair[0]] === "string") {
52 arr = [ query_string[pair[0]], pair[1] ];
53 query_string[pair[0]] = arr;
55 query_string[pair[0]].push(pair[1]);
61 except : listview, event
92 passCount, failCount, totalCount, runtime,
96 function getCurrentURL ( ) {
97 return window.location.href;
99 function getURLParameter(name) {
101 (RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1]
104 url = getCurrentURL( );
106 ( function parseURL ( url ) {
110 passCount = ( getCookie( "TizenP") === "undefined" ) ? 0 : parseInt( getCookie( "TizenP") );
111 failCount = ( getCookie( "TizenF") === "undefined" ) ? 0 : parseInt( getCookie( "TizenF") );
112 totalCount = ( getCookie( "TizenT") === "undefined" ) ? 0 : parseInt( getCookie( "TizenT") );
113 runTime = ( getCookie( "TizenR") === "undefined" ) ? 0 : parseInt( getCookie( "TizenR") );
115 loc = window.location.pathname;
116 dirs = loc.substring(0, loc.lastIndexOf('/')).split('/');
117 currentTest = dirs[dirs.length-1];
120 QUnit.done = function ( details ) {
123 function getNextTestURL( currentTest, passCount, failCount, totalCount , runTime ) {
127 for( i = 0 ; i < tests.length ; i++ )
129 if( tests[i] == currentTest ) {
134 if( tests.length -1 == i )
137 nextUrl ="../../../../../../tests/jqm-tchelper/result.php";
139 if( currentTest === "navigation" ) {
141 } else if ( currentTest === "listview" ) {
144 setCookie( "TizenP", passCount );
145 setCookie( "TizenF", failCount );
146 setCookie( "TizenR", runTime );
147 setCookie( "TizenT", totalCount );
148 nextUrl = updir + tests[i + 1];
153 function gotoURL( url ) {
154 window.location.href = url;
158 passCount += details.passed;
159 failCount += details.failed;
160 totalCount += details.total;
161 runTime += details.runtime;
163 nextTestURL = getNextTestURL( currentTest, passCount, failCount, totalCount ,runTime );
164 gotoURL( nextTestURL );