mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-26 20:08:51 +01:00
somehow these files have been marked a changed after the pull
This commit is contained in:
parent
12b2c06b71
commit
8a3ba65bb7
7 changed files with 3110 additions and 3110 deletions
138
vendor/selenium/scripts/find_matching_child.js
vendored
138
vendor/selenium/scripts/find_matching_child.js
vendored
|
|
@ -1,69 +1,69 @@
|
|||
/*
|
||||
* Copyright 2004 ThoughtWorks, Inc
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
elementFindMatchingChildren = function(element, selector) {
|
||||
var matches = [];
|
||||
|
||||
var childCount = element.childNodes.length;
|
||||
for (var i=0; i<childCount; i++) {
|
||||
var child = element.childNodes[i];
|
||||
if (selector(child)) {
|
||||
matches.push(child);
|
||||
} else {
|
||||
childMatches = elementFindMatchingChildren(child, selector);
|
||||
matches.push(childMatches);
|
||||
}
|
||||
}
|
||||
|
||||
return matches.flatten();
|
||||
}
|
||||
|
||||
ELEMENT_NODE_TYPE = 1;
|
||||
|
||||
elementFindFirstMatchingChild = function(element, selector) {
|
||||
|
||||
var childCount = element.childNodes.length;
|
||||
for (var i=0; i<childCount; i++) {
|
||||
var child = element.childNodes[i];
|
||||
if (child.nodeType == ELEMENT_NODE_TYPE) {
|
||||
if (selector(child)) {
|
||||
return child;
|
||||
}
|
||||
result = elementFindFirstMatchingChild(child, selector);
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
elementFindFirstMatchingParent = function(element, selector) {
|
||||
var current = element.parentNode;
|
||||
while (current != null) {
|
||||
if (selector(current)) {
|
||||
break;
|
||||
}
|
||||
current = current.parentNode;
|
||||
}
|
||||
return current;
|
||||
}
|
||||
|
||||
elementFindMatchingChildById = function(element, id) {
|
||||
return elementFindFirstMatchingChild(element, function(element){return element.id==id} );
|
||||
}
|
||||
|
||||
/*
|
||||
* Copyright 2004 ThoughtWorks, Inc
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
elementFindMatchingChildren = function(element, selector) {
|
||||
var matches = [];
|
||||
|
||||
var childCount = element.childNodes.length;
|
||||
for (var i=0; i<childCount; i++) {
|
||||
var child = element.childNodes[i];
|
||||
if (selector(child)) {
|
||||
matches.push(child);
|
||||
} else {
|
||||
childMatches = elementFindMatchingChildren(child, selector);
|
||||
matches.push(childMatches);
|
||||
}
|
||||
}
|
||||
|
||||
return matches.flatten();
|
||||
}
|
||||
|
||||
ELEMENT_NODE_TYPE = 1;
|
||||
|
||||
elementFindFirstMatchingChild = function(element, selector) {
|
||||
|
||||
var childCount = element.childNodes.length;
|
||||
for (var i=0; i<childCount; i++) {
|
||||
var child = element.childNodes[i];
|
||||
if (child.nodeType == ELEMENT_NODE_TYPE) {
|
||||
if (selector(child)) {
|
||||
return child;
|
||||
}
|
||||
result = elementFindFirstMatchingChild(child, selector);
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
elementFindFirstMatchingParent = function(element, selector) {
|
||||
var current = element.parentNode;
|
||||
while (current != null) {
|
||||
if (selector(current)) {
|
||||
break;
|
||||
}
|
||||
current = current.parentNode;
|
||||
}
|
||||
return current;
|
||||
}
|
||||
|
||||
elementFindMatchingChildById = function(element, id) {
|
||||
return elementFindFirstMatchingChild(element, function(element){return element.id==id} );
|
||||
}
|
||||
|
||||
|
|
|
|||
140
vendor/selenium/scripts/js2html.js
vendored
140
vendor/selenium/scripts/js2html.js
vendored
|
|
@ -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;i<parse_result.$length;i++){
|
||||
var the_start = parse_result[i].start;
|
||||
var the_end;
|
||||
if ( i == (parse_result.$length-1)) {
|
||||
the_end = parse_result.tokenizer.source.length;
|
||||
} else {
|
||||
the_end = parse_result[i+1].start;
|
||||
}
|
||||
|
||||
var script_fragment = parse_result.tokenizer.source.slice(the_start,the_end)
|
||||
|
||||
new_line = '<tr><td style="display:none;" class="js">getEval</td>' +
|
||||
'<td style="display:none;">currentTest.doNextCommand()</td>' +
|
||||
'<td style="white-space: pre;">' + script_fragment + '</td>' +
|
||||
'<td></td></tr>\n';
|
||||
new_test_source += new_line;
|
||||
//eval(script_fragment);
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
execute(parse_result,x2)
|
||||
|
||||
// Create HTML Table
|
||||
body = document.body
|
||||
body.innerHTML += "<table class='selenium' id='se-js-table'>"+
|
||||
"<tbody>" +
|
||||
"<tr><td>// " + document.title + "</td></tr>" +
|
||||
new_test_source +
|
||||
"</tbody" +
|
||||
"</table>";
|
||||
|
||||
//body.innerHTML = "<pre>" + parse_result + "</pre>"
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
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;i<parse_result.$length;i++){
|
||||
var the_start = parse_result[i].start;
|
||||
var the_end;
|
||||
if ( i == (parse_result.$length-1)) {
|
||||
the_end = parse_result.tokenizer.source.length;
|
||||
} else {
|
||||
the_end = parse_result[i+1].start;
|
||||
}
|
||||
|
||||
var script_fragment = parse_result.tokenizer.source.slice(the_start,the_end)
|
||||
|
||||
new_line = '<tr><td style="display:none;" class="js">getEval</td>' +
|
||||
'<td style="display:none;">currentTest.doNextCommand()</td>' +
|
||||
'<td style="white-space: pre;">' + script_fragment + '</td>' +
|
||||
'<td></td></tr>\n';
|
||||
new_test_source += new_line;
|
||||
//eval(script_fragment);
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
execute(parse_result,x2)
|
||||
|
||||
// Create HTML Table
|
||||
body = document.body
|
||||
body.innerHTML += "<table class='selenium' id='se-js-table'>"+
|
||||
"<tbody>" +
|
||||
"<tr><td>// " + document.title + "</td></tr>" +
|
||||
new_test_source +
|
||||
"</tbody" +
|
||||
"</table>";
|
||||
|
||||
//body.innerHTML = "<pre>" + parse_result + "</pre>"
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
126
vendor/selenium/scripts/se2html.js
vendored
126
vendor/selenium/scripts/se2html.js
vendored
|
|
@ -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. "<command> <quote> <quote> <comment>"
|
||||
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 = "<tr><td>" + (result[1] || ' ') + "</td>" +
|
||||
"<td>" + (result[2] || ' ') + "</td>" +
|
||||
"<td>" + (result[3] || ' ') + "</td>" +
|
||||
"<td>" + (result[4] || ' ') + "</td></tr>\n";
|
||||
new_test_source += new_line;
|
||||
}
|
||||
result = lines[x].match(comment_pattern);
|
||||
if (result != null) {
|
||||
new_line = '<tr><td rowspan="1" colspan="4">' +
|
||||
(result[1] || ' ') +
|
||||
'</td></tr>';
|
||||
new_test_source += new_line;
|
||||
}
|
||||
}
|
||||
|
||||
// Create HTML Table
|
||||
body = doc.body
|
||||
body.innerHTML += "<table class='selenium' id='testtable'>"+
|
||||
new_test_source +
|
||||
"</table>";
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
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. "<command> <quote> <quote> <comment>"
|
||||
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 = "<tr><td>" + (result[1] || ' ') + "</td>" +
|
||||
"<td>" + (result[2] || ' ') + "</td>" +
|
||||
"<td>" + (result[3] || ' ') + "</td>" +
|
||||
"<td>" + (result[4] || ' ') + "</td></tr>\n";
|
||||
new_test_source += new_line;
|
||||
}
|
||||
result = lines[x].match(comment_pattern);
|
||||
if (result != null) {
|
||||
new_line = '<tr><td rowspan="1" colspan="4">' +
|
||||
(result[1] || ' ') +
|
||||
'</td></tr>';
|
||||
new_test_source += new_line;
|
||||
}
|
||||
}
|
||||
|
||||
// Create HTML Table
|
||||
body = doc.body
|
||||
body.innerHTML += "<table class='selenium' id='testtable'>"+
|
||||
new_test_source +
|
||||
"</table>";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue