selenium-core-runner 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +9 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +30 -0
- data/app/controllers/selenium_core_runner/suites_controller.rb +19 -0
- data/app/views/selenium_core_runner/suites/index.html.erb +177 -0
- data/app/views/selenium_core_runner/suites/show.html.erb +0 -0
- data/config/routes.rb +6 -0
- data/lib/selenium-core-runner/engine.rb +19 -0
- data/lib/selenium-core-runner.rb +3 -0
- data/public/selenium-core-runner/Blank.html +7 -0
- data/public/selenium-core-runner/InjectedRemoteRunner.html +8 -0
- data/public/selenium-core-runner/RemoteRunner.html +101 -0
- data/public/selenium-core-runner/SeleniumLog.html +109 -0
- data/public/selenium-core-runner/TestPrompt.html +145 -0
- data/public/selenium-core-runner/TestRunner-splash.html +55 -0
- data/public/selenium-core-runner/TestRunner.hta +177 -0
- data/public/selenium-core-runner/TestRunner.html +177 -0
- data/public/selenium-core-runner/icons/all.png +0 -0
- data/public/selenium-core-runner/icons/continue.png +0 -0
- data/public/selenium-core-runner/icons/continue_disabled.png +0 -0
- data/public/selenium-core-runner/icons/pause.png +0 -0
- data/public/selenium-core-runner/icons/pause_disabled.png +0 -0
- data/public/selenium-core-runner/icons/selected.png +0 -0
- data/public/selenium-core-runner/icons/step.png +0 -0
- data/public/selenium-core-runner/icons/step_disabled.png +0 -0
- data/public/selenium-core-runner/iedoc-core.xml +1789 -0
- data/public/selenium-core-runner/iedoc.xml +1830 -0
- data/public/selenium-core-runner/lib/cssQuery/cssQuery-p.js +6 -0
- data/public/selenium-core-runner/lib/cssQuery/src/cssQuery-level2.js +142 -0
- data/public/selenium-core-runner/lib/cssQuery/src/cssQuery-level3.js +150 -0
- data/public/selenium-core-runner/lib/cssQuery/src/cssQuery-standard.js +53 -0
- data/public/selenium-core-runner/lib/cssQuery/src/cssQuery.js +356 -0
- data/public/selenium-core-runner/lib/prototype.js +2006 -0
- data/public/selenium-core-runner/lib/scriptaculous/builder.js +101 -0
- data/public/selenium-core-runner/lib/scriptaculous/controls.js +815 -0
- data/public/selenium-core-runner/lib/scriptaculous/dragdrop.js +915 -0
- data/public/selenium-core-runner/lib/scriptaculous/effects.js +958 -0
- data/public/selenium-core-runner/lib/scriptaculous/scriptaculous.js +47 -0
- data/public/selenium-core-runner/lib/scriptaculous/slider.js +283 -0
- data/public/selenium-core-runner/lib/scriptaculous/unittest.js +383 -0
- data/public/selenium-core-runner/lib/snapsie.js +91 -0
- data/public/selenium-core-runner/scripts/find_matching_child.js +69 -0
- data/public/selenium-core-runner/scripts/htmlutils.js +1623 -0
- data/public/selenium-core-runner/scripts/injection.html +72 -0
- data/public/selenium-core-runner/scripts/selenium-api.js +3240 -0
- data/public/selenium-core-runner/scripts/selenium-browserbot.js +2333 -0
- data/public/selenium-core-runner/scripts/selenium-browserdetect.js +153 -0
- data/public/selenium-core-runner/scripts/selenium-commandhandlers.js +379 -0
- data/public/selenium-core-runner/scripts/selenium-executionloop.js +175 -0
- data/public/selenium-core-runner/scripts/selenium-logging.js +148 -0
- data/public/selenium-core-runner/scripts/selenium-remoterunner.js +695 -0
- data/public/selenium-core-runner/scripts/selenium-testrunner.js +1362 -0
- data/public/selenium-core-runner/scripts/selenium-version.js +5 -0
- data/public/selenium-core-runner/scripts/ui-doc.html +803 -0
- data/public/selenium-core-runner/scripts/ui-element.js +1627 -0
- data/public/selenium-core-runner/scripts/ui-map-sample.js +979 -0
- data/public/selenium-core-runner/scripts/user-extensions.js +3 -0
- data/public/selenium-core-runner/scripts/user-extensions.js.sample +75 -0
- data/public/selenium-core-runner/scripts/xmlextras.js +153 -0
- data/public/selenium-core-runner/selenium-logo.png +0 -0
- data/public/selenium-core-runner/selenium-test.css +43 -0
- data/public/selenium-core-runner/selenium.css +316 -0
- data/public/selenium-core-runner/xpath/dom.js +566 -0
- data/public/selenium-core-runner/xpath/javascript-xpath-0.1.11.js +2816 -0
- data/public/selenium-core-runner/xpath/util.js +549 -0
- data/public/selenium-core-runner/xpath/xmltoken.js +149 -0
- data/public/selenium-core-runner/xpath/xpath.js +2481 -0
- metadata +121 -0
@@ -0,0 +1,175 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright 2004 ThoughtWorks, Inc
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
16
|
+
|
17
|
+
function TestLoop(commandFactory) {
|
18
|
+
this.commandFactory = commandFactory;
|
19
|
+
}
|
20
|
+
|
21
|
+
TestLoop.prototype = {
|
22
|
+
|
23
|
+
start : function() {
|
24
|
+
selenium.reset();
|
25
|
+
LOG.debug("currentTest.start()");
|
26
|
+
this.continueTest();
|
27
|
+
},
|
28
|
+
|
29
|
+
continueTest : function() {
|
30
|
+
/**
|
31
|
+
* Select the next command and continue the test.
|
32
|
+
*/
|
33
|
+
LOG.debug("currentTest.continueTest() - acquire the next command");
|
34
|
+
if (! this.aborted) {
|
35
|
+
this.currentCommand = this.nextCommand();
|
36
|
+
}
|
37
|
+
if (! this.requiresCallBack) {
|
38
|
+
this.continueTestAtCurrentCommand();
|
39
|
+
} // otherwise, just finish and let the callback invoke continueTestAtCurrentCommand()
|
40
|
+
},
|
41
|
+
|
42
|
+
continueTestAtCurrentCommand : function() {
|
43
|
+
LOG.debug("currentTest.continueTestAtCurrentCommand()");
|
44
|
+
if (this.currentCommand) {
|
45
|
+
// TODO: rename commandStarted to commandSelected, OR roll it into nextCommand
|
46
|
+
this.commandStarted(this.currentCommand);
|
47
|
+
this._resumeAfterDelay();
|
48
|
+
} else {
|
49
|
+
this._testComplete();
|
50
|
+
}
|
51
|
+
},
|
52
|
+
|
53
|
+
_resumeAfterDelay : function() {
|
54
|
+
/**
|
55
|
+
* Pause, then execute the current command.
|
56
|
+
*/
|
57
|
+
|
58
|
+
// Get the command delay. If a pauseInterval is set, use it once
|
59
|
+
// and reset it. Otherwise, use the defined command-interval.
|
60
|
+
var delay = this.pauseInterval || this.getCommandInterval();
|
61
|
+
this.pauseInterval = undefined;
|
62
|
+
|
63
|
+
if (this.currentCommand.isBreakpoint || delay < 0) {
|
64
|
+
// Pause: enable the "next/continue" button
|
65
|
+
this.pause();
|
66
|
+
} else {
|
67
|
+
window.setTimeout(fnBind(this.resume, this), delay);
|
68
|
+
}
|
69
|
+
},
|
70
|
+
|
71
|
+
resume: function() {
|
72
|
+
/**
|
73
|
+
* Select the next command and continue the test.
|
74
|
+
*/
|
75
|
+
LOG.debug("currentTest.resume() - actually execute");
|
76
|
+
try {
|
77
|
+
selenium.browserbot.runScheduledPollers();
|
78
|
+
this._executeCurrentCommand();
|
79
|
+
this.continueTestWhenConditionIsTrue();
|
80
|
+
} catch (e) {
|
81
|
+
if (!this._handleCommandError(e)) {
|
82
|
+
this.testComplete();
|
83
|
+
} else {
|
84
|
+
this.continueTest();
|
85
|
+
}
|
86
|
+
}
|
87
|
+
},
|
88
|
+
|
89
|
+
_testComplete : function() {
|
90
|
+
selenium.ensureNoUnhandledPopups();
|
91
|
+
this.testComplete();
|
92
|
+
},
|
93
|
+
|
94
|
+
_executeCurrentCommand : function() {
|
95
|
+
/**
|
96
|
+
* Execute the current command.
|
97
|
+
*
|
98
|
+
* @return a function which will be used to determine when
|
99
|
+
* execution can continue, or null if we can continue immediately
|
100
|
+
*/
|
101
|
+
var command = this.currentCommand;
|
102
|
+
LOG.info("Executing: |" + command.command + " | " + command.target + " | " + command.value + " |");
|
103
|
+
|
104
|
+
var handler = this.commandFactory.getCommandHandler(command.command);
|
105
|
+
if (handler == null) {
|
106
|
+
throw new SeleniumError("Unknown command: '" + command.command + "'");
|
107
|
+
}
|
108
|
+
|
109
|
+
command.target = selenium.preprocessParameter(command.target);
|
110
|
+
command.value = selenium.preprocessParameter(command.value);
|
111
|
+
LOG.debug("Command found, going to execute " + command.command);
|
112
|
+
this.result = handler.execute(selenium, command);
|
113
|
+
|
114
|
+
|
115
|
+
this.waitForCondition = this.result.terminationCondition;
|
116
|
+
|
117
|
+
},
|
118
|
+
|
119
|
+
_handleCommandError : function(e) {
|
120
|
+
if (!e.isSeleniumError) {
|
121
|
+
LOG.exception(e);
|
122
|
+
var msg = "Command execution failure. Please search the forum at http://clearspace.openqa.org for error details from the log window.";
|
123
|
+
msg += " The error message is: " + extractExceptionMessage(e);
|
124
|
+
return this.commandError(msg);
|
125
|
+
} else {
|
126
|
+
LOG.error(e.message);
|
127
|
+
return this.commandError(e.message);
|
128
|
+
}
|
129
|
+
},
|
130
|
+
|
131
|
+
continueTestWhenConditionIsTrue: function () {
|
132
|
+
/**
|
133
|
+
* Busy wait for waitForCondition() to become true, and then carry
|
134
|
+
* on with test. Fail the current test if there's a timeout or an
|
135
|
+
* exception.
|
136
|
+
*/
|
137
|
+
//LOG.debug("currentTest.continueTestWhenConditionIsTrue()");
|
138
|
+
selenium.browserbot.runScheduledPollers();
|
139
|
+
try {
|
140
|
+
if (this.waitForCondition == null) {
|
141
|
+
LOG.debug("null condition; let's continueTest()");
|
142
|
+
LOG.debug("Command complete");
|
143
|
+
this.commandComplete(this.result);
|
144
|
+
this.continueTest();
|
145
|
+
} else if (this.waitForCondition()) {
|
146
|
+
LOG.debug("condition satisfied; let's continueTest()");
|
147
|
+
this.waitForCondition = null;
|
148
|
+
LOG.debug("Command complete");
|
149
|
+
this.commandComplete(this.result);
|
150
|
+
this.continueTest();
|
151
|
+
} else {
|
152
|
+
//LOG.debug("waitForCondition was false; keep waiting!");
|
153
|
+
window.setTimeout(fnBind(this.continueTestWhenConditionIsTrue, this), 10);
|
154
|
+
}
|
155
|
+
} catch (e) {
|
156
|
+
this.result = {};
|
157
|
+
this.result.failed = true;
|
158
|
+
this.result.failureMessage = extractExceptionMessage(e);
|
159
|
+
this.commandComplete(this.result);
|
160
|
+
this.continueTest();
|
161
|
+
}
|
162
|
+
},
|
163
|
+
|
164
|
+
pause : function() {},
|
165
|
+
nextCommand : function() {},
|
166
|
+
commandStarted : function() {},
|
167
|
+
commandComplete : function() {},
|
168
|
+
commandError : function() {},
|
169
|
+
testComplete : function() {},
|
170
|
+
|
171
|
+
getCommandInterval : function() {
|
172
|
+
return 0;
|
173
|
+
}
|
174
|
+
|
175
|
+
}
|
@@ -0,0 +1,148 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright 2004 ThoughtWorks, Inc
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
16
|
+
|
17
|
+
var Logger = function() {
|
18
|
+
this.logWindow = null;
|
19
|
+
}
|
20
|
+
Logger.prototype = {
|
21
|
+
|
22
|
+
logLevels: {
|
23
|
+
debug: 0,
|
24
|
+
info: 1,
|
25
|
+
warn: 2,
|
26
|
+
error: 3,
|
27
|
+
off: 999
|
28
|
+
},
|
29
|
+
|
30
|
+
pendingMessages: new Array(),
|
31
|
+
|
32
|
+
threshold: "info",
|
33
|
+
|
34
|
+
setLogLevelThreshold: function(logLevel) {
|
35
|
+
this.threshold = logLevel;
|
36
|
+
var logWindow = this.getLogWindow()
|
37
|
+
if (logWindow && logWindow.setThresholdLevel) {
|
38
|
+
logWindow.setThresholdLevel(logLevel);
|
39
|
+
}
|
40
|
+
// NOTE: log messages will be discarded until the log window is
|
41
|
+
// fully loaded.
|
42
|
+
},
|
43
|
+
|
44
|
+
getLogWindow: function() {
|
45
|
+
if (this.logWindow && this.logWindow.closed) {
|
46
|
+
this.logWindow = null;
|
47
|
+
}
|
48
|
+
return this.logWindow;
|
49
|
+
},
|
50
|
+
|
51
|
+
openLogWindow: function() {
|
52
|
+
this.logWindow = window.open(
|
53
|
+
getDocumentBase(document) + "SeleniumLog.html?startingThreshold="+this.threshold, "SeleniumLog",
|
54
|
+
"width=600,height=1000,bottom=0,right=0,status,scrollbars,resizable"
|
55
|
+
);
|
56
|
+
this.logWindow.moveTo(window.screenX + 1210, window.screenY + window.outerHeight - 1400);
|
57
|
+
if (browserVersion.appearsToBeBrokenInitialIE6) {
|
58
|
+
// I would really prefer for the message to immediately appear in the log window, the instant the user requests that the log window be
|
59
|
+
// visible. But when I initially coded it this way, thou message simply didn't appear unless I stepped through the code with a debugger.
|
60
|
+
// So obviously there is some timing issue here which I don't have the patience to figure out.
|
61
|
+
var pendingMessage = new LogMessage("warn", "You appear to be running an unpatched IE 6, which is not stable and can crash due to memory problems. We recommend you run Windows update to install a more stable version of IE.");
|
62
|
+
this.pendingMessages.push(pendingMessage);
|
63
|
+
}
|
64
|
+
return this.logWindow;
|
65
|
+
},
|
66
|
+
|
67
|
+
show: function() {
|
68
|
+
if (! this.getLogWindow()) {
|
69
|
+
this.openLogWindow();
|
70
|
+
}
|
71
|
+
setTimeout(function(){LOG.error("Log window displayed. Logging events will now be recorded to this window.");}, 500);
|
72
|
+
},
|
73
|
+
|
74
|
+
logHook: function(logLevel, message) {
|
75
|
+
},
|
76
|
+
|
77
|
+
log: function(logLevel, message) {
|
78
|
+
if (this.logLevels[logLevel] < this.logLevels[this.threshold]) {
|
79
|
+
return;
|
80
|
+
}
|
81
|
+
this.logHook(logLevel, message);
|
82
|
+
var logWindow = this.getLogWindow();
|
83
|
+
if (logWindow) {
|
84
|
+
if (logWindow.append) {
|
85
|
+
if (logWindow.disabled) {
|
86
|
+
logWindow.callBack = fnBind(this.setLogLevelThreshold, this);
|
87
|
+
logWindow.enableButtons();
|
88
|
+
}
|
89
|
+
if (this.pendingMessages.length > 0) {
|
90
|
+
logWindow.append("info("+(new Date().getTime())+"): Appending missed logging messages", "info");
|
91
|
+
while (this.pendingMessages.length > 0) {
|
92
|
+
var msg = this.pendingMessages.shift();
|
93
|
+
logWindow.append(msg.type + "("+msg.timestamp+"): " + msg.msg, msg.type);
|
94
|
+
}
|
95
|
+
logWindow.append("info("+(new Date().getTime())+"): Done appending missed logging messages", "info");
|
96
|
+
}
|
97
|
+
logWindow.append(logLevel + "("+(new Date().getTime())+"): " + message, logLevel);
|
98
|
+
}
|
99
|
+
} else {
|
100
|
+
// TODO these logging messages are never flushed, which creates
|
101
|
+
// an enormous array of strings that never stops growing.
|
102
|
+
// there should at least be a way to clear the messages!
|
103
|
+
this.pendingMessages.push(new LogMessage(logLevel, message));
|
104
|
+
}
|
105
|
+
},
|
106
|
+
|
107
|
+
close: function(message) {
|
108
|
+
if (this.logWindow != null) {
|
109
|
+
try {
|
110
|
+
this.logWindow.close();
|
111
|
+
} catch (e) {
|
112
|
+
// swallow exception
|
113
|
+
// the window is probably closed if we get an exception here
|
114
|
+
}
|
115
|
+
this.logWindow = null;
|
116
|
+
}
|
117
|
+
},
|
118
|
+
|
119
|
+
debug: function(message) {
|
120
|
+
this.log("debug", message);
|
121
|
+
},
|
122
|
+
|
123
|
+
info: function(message) {
|
124
|
+
this.log("info", message);
|
125
|
+
},
|
126
|
+
|
127
|
+
warn: function(message) {
|
128
|
+
this.log("warn", message);
|
129
|
+
},
|
130
|
+
|
131
|
+
error: function(message) {
|
132
|
+
this.log("error", message);
|
133
|
+
},
|
134
|
+
|
135
|
+
exception: function(exception) {
|
136
|
+
this.error("Unexpected Exception: " + extractExceptionMessage(exception));
|
137
|
+
this.error("Exception details: " + describe(exception, ', '));
|
138
|
+
}
|
139
|
+
|
140
|
+
};
|
141
|
+
|
142
|
+
var LOG = new Logger();
|
143
|
+
|
144
|
+
var LogMessage = function(type, msg) {
|
145
|
+
this.type = type;
|
146
|
+
this.msg = msg;
|
147
|
+
this.timestamp = (new Date().getTime());
|
148
|
+
}
|