From 903ae8a581fac1e6917fc3e31d2ad8fb91df80c3 Mon Sep 17 00:00:00 2001 From: ctrlaltca <> Date: Thu, 12 Jul 2012 11:21:01 +0000 Subject: standardize the use of unix eol; use svn properties to enforce native eol --- tests/test_tools/selenium/core/scripts/js2html.js | 140 +++++++++++----------- tests/test_tools/selenium/core/scripts/se2html.js | 126 +++++++++---------- 2 files changed, 133 insertions(+), 133 deletions(-) (limited to 'tests/test_tools/selenium/core/scripts') diff --git a/tests/test_tools/selenium/core/scripts/js2html.js b/tests/test_tools/selenium/core/scripts/js2html.js index a384dce3..407709df 100644 --- a/tests/test_tools/selenium/core/scripts/js2html.js +++ b/tests/test_tools/selenium/core/scripts/js2html.js @@ -1,70 +1,70 @@ -/* - -This is an experiment in using the Narcissus JavaScript engine -to allow Selenium scripts to be written in plain JavaScript. - -The 'jsparse' function will compile each high level block into a Selenium table script. - - -TODO: -1) Test! (More browsers, more sample scripts) -2) Stepping and walking lower levels of the parse tree -3) Calling Selenium commands directly from JavaScript -4) Do we want comments to appear in the TestRunner? -5) Fix context so variables don't have to be global - For now, variables defined with "var" won't be found - if used later on in a script. -6) Fix formatting -*/ - - -function jsparse() { - var script = document.getElementById('sejs') - var fname = 'javascript script'; - parse_result = parse(script.text, fname, 0); - - var x2 = new ExecutionContext(GLOBAL_CODE); - ExecutionContext.current = x2; - - - var new_test_source = ''; - var new_line = ''; - - for (i=0;icurrentTest.doNextCommand()' + - '' + script_fragment + '' + - '\n'; - new_test_source += new_line; - //eval(script_fragment); - - - }; - - - - execute(parse_result,x2) - - // Create HTML Table - body = document.body - body.innerHTML += ""+ - "" + - "" + - new_test_source + - ""; - - //body.innerHTML = "
" + parse_result + "
" -} - - +/* + +This is an experiment in using the Narcissus JavaScript engine +to allow Selenium scripts to be written in plain JavaScript. + +The 'jsparse' function will compile each high level block into a Selenium table script. + + +TODO: +1) Test! (More browsers, more sample scripts) +2) Stepping and walking lower levels of the parse tree +3) Calling Selenium commands directly from JavaScript +4) Do we want comments to appear in the TestRunner? +5) Fix context so variables don't have to be global + For now, variables defined with "var" won't be found + if used later on in a script. +6) Fix formatting +*/ + + +function jsparse() { + var script = document.getElementById('sejs') + var fname = 'javascript script'; + parse_result = parse(script.text, fname, 0); + + var x2 = new ExecutionContext(GLOBAL_CODE); + ExecutionContext.current = x2; + + + var new_test_source = ''; + var new_line = ''; + + for (i=0;icurrentTest.doNextCommand()' + + '' + + '\n'; + new_test_source += new_line; + //eval(script_fragment); + + + }; + + + + execute(parse_result,x2) + + // Create HTML Table + body = document.body + body.innerHTML += "
// " + document.title + "
' + script_fragment + '
"+ + "" + + "" + + new_test_source + + ""; + + //body.innerHTML = "
" + parse_result + "
" +} + + diff --git a/tests/test_tools/selenium/core/scripts/se2html.js b/tests/test_tools/selenium/core/scripts/se2html.js index 67054a49..4894d4b1 100644 --- a/tests/test_tools/selenium/core/scripts/se2html.js +++ b/tests/test_tools/selenium/core/scripts/se2html.js @@ -1,63 +1,63 @@ -/* - -This is an experiment in creating a "selenese" parser that drastically -cuts down on the line noise associated with writing tests in HTML. - -The 'parse' function will accept the follow sample commands. - -test-cases: - //comment - command "param" - command "param" // comment - command "param" "param2" - command "param" "param2" // this is a comment - -TODO: -1) Deal with multiline parameters -2) Escape quotes properly -3) Determine whether this should/will become the "preferred" syntax - for delivered Selenium self-test scripts -*/ - - -function separse(doc) { - // Get object - script = doc.getElementById('testcase') - // Split into lines - lines = script.text.split('\n'); - - - var command_pattern = / *(\w+) *"([^"]*)" *(?:"([^"]*)"){0,1}(?: *(\/\/ *.+))*/i; - var comment_pattern = /^ *(\/\/ *.+)/ - - // Regex each line into selenium command and convert into table row. - // eg. " " - var new_test_source = ''; - var new_line = ''; - for (var x=0; x < lines.length; x++) { - result = lines[x].match(command_pattern); - if (result != null) { - new_line = "" + - "" + - "" + - "\n"; - new_test_source += new_line; - } - result = lines[x].match(comment_pattern); - if (result != null) { - new_line = ''; - new_test_source += new_line; - } - } - - // Create HTML Table - body = doc.body - body.innerHTML += "
// " + document.title + "
" + (result[1] || ' ') + "" + (result[2] || ' ') + "" + (result[3] || ' ') + "" + (result[4] || ' ') + "
' + - (result[1] || ' ') + - '
"+ - new_test_source + - "
"; - -} - - +/* + +This is an experiment in creating a "selenese" parser that drastically +cuts down on the line noise associated with writing tests in HTML. + +The 'parse' function will accept the follow sample commands. + +test-cases: + //comment + command "param" + command "param" // comment + command "param" "param2" + command "param" "param2" // this is a comment + +TODO: +1) Deal with multiline parameters +2) Escape quotes properly +3) Determine whether this should/will become the "preferred" syntax + for delivered Selenium self-test scripts +*/ + + +function separse(doc) { + // Get object + script = doc.getElementById('testcase') + // Split into lines + lines = script.text.split('\n'); + + + var command_pattern = / *(\w+) *"([^"]*)" *(?:"([^"]*)"){0,1}(?: *(\/\/ *.+))*/i; + var comment_pattern = /^ *(\/\/ *.+)/ + + // Regex each line into selenium command and convert into table row. + // eg. " " + var new_test_source = ''; + var new_line = ''; + for (var x=0; x < lines.length; x++) { + result = lines[x].match(command_pattern); + if (result != null) { + new_line = "" + (result[1] || ' ') + "" + + "" + (result[2] || ' ') + "" + + "" + (result[3] || ' ') + "" + + "" + (result[4] || ' ') + "\n"; + new_test_source += new_line; + } + result = lines[x].match(comment_pattern); + if (result != null) { + new_line = '' + + (result[1] || ' ') + + ''; + new_test_source += new_line; + } + } + + // Create HTML Table + body = doc.body + body.innerHTML += ""+ + new_test_source + + "
"; + +} + + -- cgit v1.2.3