rubinium 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +7 -0
- data/MIT-LICENSE +21 -0
- data/README +137 -0
- data/Rakefile +139 -0
- data/TODO +7 -0
- data/doc/examples/rtc_site_live.rb +12 -0
- data/doc/examples/rts_main.rb +9 -0
- data/doc/examples/rts_shared_code.rb +25 -0
- data/lib/rubinium.rb +9 -0
- data/lib/rubinium/string.rb +3 -0
- data/lib/rubinium/test_base.rb +80 -0
- data/lib/rubinium/test_suite.rb +53 -0
- data/lib/rubinium/validator.rb +16 -0
- data/test/selenium_tests/test_click.rb +22 -0
- data/test/selenium_tests/test_open.rb +11 -0
- data/test/tc_file_creation.rb +60 -0
- data/test/ts_rubinium.rb +1 -0
- data/vendor/selenium-0.6.0/install-readme.txt +9 -0
- data/vendor/selenium-0.6.0/selenium/SeleneseRunner.html +253 -0
- data/vendor/selenium-0.6.0/selenium/SeleniumLog.html +61 -0
- data/vendor/selenium-0.6.0/selenium/TestRunner-splash.html +55 -0
- data/vendor/selenium-0.6.0/selenium/TestRunner.hta +146 -0
- data/vendor/selenium-0.6.0/selenium/TestRunner.html +146 -0
- data/vendor/selenium-0.6.0/selenium/devtests/TestClickInFrame.html +58 -0
- data/vendor/selenium-0.6.0/selenium/devtests/TestOpenInFrame.html +48 -0
- data/vendor/selenium-0.6.0/selenium/devtests/TestOpenInNewWindow.html +78 -0
- data/vendor/selenium-0.6.0/selenium/devtests/TestOpenMeta.html +43 -0
- data/vendor/selenium-0.6.0/selenium/devtests/TestSuite.html +39 -0
- data/vendor/selenium-0.6.0/selenium/devtests/meta/page.html +5 -0
- data/vendor/selenium-0.6.0/selenium/dom-images/butmin.gif +0 -0
- data/vendor/selenium-0.6.0/selenium/dom-images/butplus.gif +0 -0
- data/vendor/selenium-0.6.0/selenium/dom-styles/default.css +298 -0
- data/vendor/selenium-0.6.0/selenium/domviewer.html +16 -0
- data/vendor/selenium-0.6.0/selenium/html-xpath/carnation.jpg +0 -0
- data/vendor/selenium-0.6.0/selenium/html-xpath/example.html +75 -0
- data/vendor/selenium-0.6.0/selenium/html-xpath/html-xpath-patched.js +657 -0
- data/vendor/selenium-0.6.0/selenium/html-xpath/html-xpath.js +610 -0
- data/vendor/selenium-0.6.0/selenium/html-xpath/license.txt +504 -0
- data/vendor/selenium-0.6.0/selenium/html-xpath/rainbow.jpg +0 -0
- data/vendor/selenium-0.6.0/selenium/htmlutils.js +283 -0
- data/vendor/selenium-0.6.0/selenium/index.html +60 -0
- data/vendor/selenium-0.6.0/selenium/jsmock/mock-tests.html +205 -0
- data/vendor/selenium-0.6.0/selenium/jsmock/mock.js +124 -0
- data/vendor/selenium-0.6.0/selenium/selenium-api.js +683 -0
- data/vendor/selenium-0.6.0/selenium/selenium-browserbot.js +930 -0
- data/vendor/selenium-0.6.0/selenium/selenium-commandhandlers.js +286 -0
- data/vendor/selenium-0.6.0/selenium/selenium-domviewer.js +188 -0
- data/vendor/selenium-0.6.0/selenium/selenium-executionloop.js +250 -0
- data/vendor/selenium-0.6.0/selenium/selenium-fitrunner.js +597 -0
- data/vendor/selenium-0.6.0/selenium/selenium-logging.js +88 -0
- data/vendor/selenium-0.6.0/selenium/selenium-logo.png +0 -0
- data/vendor/selenium-0.6.0/selenium/selenium-tableparser.js +50 -0
- data/vendor/selenium-0.6.0/selenium/selenium.css +211 -0
- data/vendor/selenium-0.6.0/selenium/tests/ErrorCheckingTestSuite.html +36 -0
- data/vendor/selenium-0.6.0/selenium/tests/GoogleTestSearch.html +69 -0
- data/vendor/selenium-0.6.0/selenium/tests/GoogleTestSuite.html +32 -0
- data/vendor/selenium-0.6.0/selenium/tests/JsUnitSuite.html +38 -0
- data/vendor/selenium-0.6.0/selenium/tests/TestClick.html +128 -0
- data/vendor/selenium-0.6.0/selenium/tests/TestClickJavascriptHref.html +115 -0
- data/vendor/selenium-0.6.0/selenium/tests/TestCommandError.html +79 -0
- data/vendor/selenium-0.6.0/selenium/tests/TestConfirmations.html +77 -0
- data/vendor/selenium-0.6.0/selenium/tests/TestErrorChecking.html +71 -0
- data/vendor/selenium-0.6.0/selenium/tests/TestFailingAssert.html +59 -0
- data/vendor/selenium-0.6.0/selenium/tests/TestFailingVerifications.html +198 -0
- data/vendor/selenium-0.6.0/selenium/tests/TestFocusOnBlur.html +53 -0
- data/vendor/selenium-0.6.0/selenium/tests/TestGoBack.html +81 -0
- data/vendor/selenium-0.6.0/selenium/tests/TestImplicitLocators.html +81 -0
- data/vendor/selenium-0.6.0/selenium/tests/TestJavascriptParameters.html +91 -0
- data/vendor/selenium-0.6.0/selenium/tests/TestLocators.html +161 -0
- data/vendor/selenium-0.6.0/selenium/tests/TestModalDialog.html +58 -0
- data/vendor/selenium-0.6.0/selenium/tests/TestModalDialogDialog.html +48 -0
- data/vendor/selenium-0.6.0/selenium/tests/TestOpen.html +66 -0
- data/vendor/selenium-0.6.0/selenium/tests/TestPatternMatching.html +127 -0
- data/vendor/selenium-0.6.0/selenium/tests/TestPause.html +78 -0
- data/vendor/selenium-0.6.0/selenium/tests/TestPrompting.html +82 -0
- data/vendor/selenium-0.6.0/selenium/tests/TestProxy.html +62 -0
- data/vendor/selenium-0.6.0/selenium/tests/TestSelect.html +111 -0
- data/vendor/selenium-0.6.0/selenium/tests/TestSelectWindow.html +106 -0
- data/vendor/selenium-0.6.0/selenium/tests/TestStore.html +165 -0
- data/vendor/selenium-0.6.0/selenium/tests/TestSuite-InternetExplorer.html +79 -0
- data/vendor/selenium-0.6.0/selenium/tests/TestSuite-Konqueror.html +75 -0
- data/vendor/selenium-0.6.0/selenium/tests/TestSuite-Safari.html +75 -0
- data/vendor/selenium-0.6.0/selenium/tests/TestSuite.html +75 -0
- data/vendor/selenium-0.6.0/selenium/tests/TestType.html +79 -0
- data/vendor/selenium-0.6.0/selenium/tests/TestUserExtensions.html +81 -0
- data/vendor/selenium-0.6.0/selenium/tests/TestVerifications.html +164 -0
- data/vendor/selenium-0.6.0/selenium/tests/TestVerifyAlerts.html +80 -0
- data/vendor/selenium-0.6.0/selenium/tests/TestVerifyAlertsFailures.html +108 -0
- data/vendor/selenium-0.6.0/selenium/tests/TestVerifyConfirmationFailures.html +86 -0
- data/vendor/selenium-0.6.0/selenium/tests/TestVerifyEditable.html +70 -0
- data/vendor/selenium-0.6.0/selenium/tests/TestVerifyEditableFailures.html +95 -0
- data/vendor/selenium-0.6.0/selenium/tests/TestVisibility.html +91 -0
- data/vendor/selenium-0.6.0/selenium/tests/TestVisibilityFailures.html +131 -0
- data/vendor/selenium-0.6.0/selenium/tests/TestWait.html +112 -0
- data/vendor/selenium-0.6.0/selenium/tests/TestWaitFor.html +63 -0
- data/vendor/selenium-0.6.0/selenium/tests/TestWaitInPopupWindow.html +94 -0
- data/vendor/selenium-0.6.0/selenium/tests/TestXPathLocators.html +98 -0
- data/vendor/selenium-0.6.0/selenium/tests/browserbot/alert-handling-tests.html +79 -0
- data/vendor/selenium-0.6.0/selenium/tests/browserbot/assert-tests.html +113 -0
- data/vendor/selenium-0.6.0/selenium/tests/browserbot/browserbot-tests.html +123 -0
- data/vendor/selenium-0.6.0/selenium/tests/browserbot/command-factory-tests.html +290 -0
- data/vendor/selenium-0.6.0/selenium/tests/browserbot/command-handler-tests.html +115 -0
- data/vendor/selenium-0.6.0/selenium/tests/browserbot/confirm-handling-tests.html +97 -0
- data/vendor/selenium-0.6.0/selenium/tests/browserbot/error-checking-command-tests.html +198 -0
- data/vendor/selenium-0.6.0/selenium/tests/browserbot/event-bubble-tests.html +106 -0
- data/vendor/selenium-0.6.0/selenium/tests/browserbot/optionlocator-tests.html +180 -0
- data/vendor/selenium-0.6.0/selenium/tests/browserbot/pagebot-accessor-tests.html +65 -0
- data/vendor/selenium-0.6.0/selenium/tests/browserbot/pagebot-action-tests.html +200 -0
- data/vendor/selenium-0.6.0/selenium/tests/browserbot/pagebot-attribute-tests.html +98 -0
- data/vendor/selenium-0.6.0/selenium/tests/browserbot/pagebot-locator-tests-include.html +33 -0
- data/vendor/selenium-0.6.0/selenium/tests/browserbot/pagebot-locator-tests.html +258 -0
- data/vendor/selenium-0.6.0/selenium/tests/browserbot/pagebot-property-tests.html +49 -0
- data/vendor/selenium-0.6.0/selenium/tests/browserbot/pattern-matcher-tests.html +66 -0
- data/vendor/selenium-0.6.0/selenium/tests/browserbot/selenium-api-tests.html +412 -0
- data/vendor/selenium-0.6.0/selenium/tests/browserbot/selenium-parameter-tests.html +98 -0
- data/vendor/selenium-0.6.0/selenium/tests/browserbot/suite.html +52 -0
- data/vendor/selenium-0.6.0/selenium/tests/browserbot/testloop-handle-error-tests.html +74 -0
- data/vendor/selenium-0.6.0/selenium/tests/events/TestButtonEvents.html +72 -0
- data/vendor/selenium-0.6.0/selenium/tests/events/TestCheckboxEvents.html +107 -0
- data/vendor/selenium-0.6.0/selenium/tests/events/TestFireEvents.html +75 -0
- data/vendor/selenium-0.6.0/selenium/tests/events/TestLinkEvents.html +43 -0
- data/vendor/selenium-0.6.0/selenium/tests/events/TestRadioEvents.html +149 -0
- data/vendor/selenium-0.6.0/selenium/tests/events/TestSelectEvents.html +122 -0
- data/vendor/selenium-0.6.0/selenium/tests/events/TestTextEvents.html +87 -0
- data/vendor/selenium-0.6.0/selenium/tests/events/readme.txt +26 -0
- data/vendor/selenium-0.6.0/selenium/tests/html/banner.gif +0 -0
- data/vendor/selenium-0.6.0/selenium/tests/html/test_async_event.html +36 -0
- data/vendor/selenium-0.6.0/selenium/tests/html/test_click_javascript_page.html +34 -0
- data/vendor/selenium-0.6.0/selenium/tests/html/test_click_page1.html +31 -0
- data/vendor/selenium-0.6.0/selenium/tests/html/test_click_page2.html +30 -0
- data/vendor/selenium-0.6.0/selenium/tests/html/test_confirm.html +34 -0
- data/vendor/selenium-0.6.0/selenium/tests/html/test_dummy_page.html +26 -0
- data/vendor/selenium-0.6.0/selenium/tests/html/test_editable.html +36 -0
- data/vendor/selenium-0.6.0/selenium/tests/html/test_focus_on_blur.html +33 -0
- data/vendor/selenium-0.6.0/selenium/tests/html/test_form_events.html +98 -0
- data/vendor/selenium-0.6.0/selenium/tests/html/test_framed_page.html +7 -0
- data/vendor/selenium-0.6.0/selenium/tests/html/test_just_text.html +22 -0
- data/vendor/selenium-0.6.0/selenium/tests/html/test_locators.html +34 -0
- data/vendor/selenium-0.6.0/selenium/tests/html/test_modal_dialog.html +29 -0
- data/vendor/selenium-0.6.0/selenium/tests/html/test_modal_dialog_dialog.html +35 -0
- data/vendor/selenium-0.6.0/selenium/tests/html/test_open.html +23 -0
- data/vendor/selenium-0.6.0/selenium/tests/html/test_prompt.html +34 -0
- data/vendor/selenium-0.6.0/selenium/tests/html/test_reload_onchange_page.html +32 -0
- data/vendor/selenium-0.6.0/selenium/tests/html/test_select.html +35 -0
- data/vendor/selenium-0.6.0/selenium/tests/html/test_select_window.html +29 -0
- data/vendor/selenium-0.6.0/selenium/tests/html/test_select_window_popup.html +28 -0
- data/vendor/selenium-0.6.0/selenium/tests/html/test_slowloading_page.html +27 -0
- data/vendor/selenium-0.6.0/selenium/tests/html/test_store_value.html +23 -0
- data/vendor/selenium-0.6.0/selenium/tests/html/test_type_page1.html +37 -0
- data/vendor/selenium-0.6.0/selenium/tests/html/test_type_page2.html +61 -0
- data/vendor/selenium-0.6.0/selenium/tests/html/test_verifications.html +42 -0
- data/vendor/selenium-0.6.0/selenium/tests/html/test_verify_alert.html +46 -0
- data/vendor/selenium-0.6.0/selenium/tests/html/test_visibility.html +53 -0
- data/vendor/selenium-0.6.0/selenium/tests/readme.txt +1 -0
- data/vendor/selenium-0.6.0/selenium/tests/tableparser/tableparser-tests.html +122 -0
- data/vendor/selenium-0.6.0/selenium/tests/tinyWebServer.py +70 -0
- data/vendor/selenium-0.6.0/selenium/user-extensions.js.sample +62 -0
- data/vendor/selenium-0.6.0/selenium/version.txt +1 -0
- data/vendor/selenium-0.6.0/selenium/xmlextras.js +153 -0
- data/vendor/selenium-0.6.0/selenium/xpath.js +3910 -0
- metadata +216 -0
@@ -0,0 +1,115 @@
|
|
1
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/html4/loose.dtd">
|
3
|
+
|
4
|
+
<!--
|
5
|
+
Copyright 2004 ThoughtWorks, Inc
|
6
|
+
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
you may not use this file except in compliance with the License.
|
9
|
+
You may obtain a copy of the License at
|
10
|
+
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
See the License for the specific language governing permissions and
|
17
|
+
limitations under the License.
|
18
|
+
-->
|
19
|
+
<html>
|
20
|
+
<head>
|
21
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
22
|
+
<title>Test for the CommandHandler</title>
|
23
|
+
<link rel="stylesheet" type="text/css" href="jsunit/css/jsUnitStyle.css">
|
24
|
+
<script language="JavaScript" type="text/javascript" src="/jsunit/app/jsUnitCore.js"></script>
|
25
|
+
<script language="JavaScript" type="text/javascript" src="/jsmock/mock.js"></script>
|
26
|
+
<script language="JavaScript" type="text/javascript" src="/selenium-commandhandlers.js"></script>
|
27
|
+
<script language="JavaScript" type="text/javascript" src="/htmlutils.js"></script>
|
28
|
+
<script language="JavaScript" type="text/javascript">
|
29
|
+
|
30
|
+
function testCommandHandlerExecuteCallsTheExecutorFunction() {
|
31
|
+
var called = false;
|
32
|
+
var executor = function() { called = true;};
|
33
|
+
var handler = new CommandHandler("name", false, executor);
|
34
|
+
handler.execute("selenium", "command");
|
35
|
+
|
36
|
+
assertTrue(called);
|
37
|
+
}
|
38
|
+
|
39
|
+
|
40
|
+
function testShouldFailActionCommandsIfAlertPresent() {
|
41
|
+
|
42
|
+
mockBrowserBot = new Mock();
|
43
|
+
|
44
|
+
function MockSelenium() {
|
45
|
+
this.browserbot = mockBrowserBot;
|
46
|
+
}
|
47
|
+
|
48
|
+
mockBrowserBot.expects("hasAlerts").returns(true);
|
49
|
+
mockBrowserBot.expects("getNextAlert").returns("The Alert");
|
50
|
+
|
51
|
+
var executorCalled = false;
|
52
|
+
var executor = function() { executorCalled = true;};
|
53
|
+
var handler = new ActionHandler(executor, false);
|
54
|
+
try {
|
55
|
+
handler.execute(new MockSelenium(), "command");
|
56
|
+
fail("Command Should have failed");
|
57
|
+
} catch ( e ) {
|
58
|
+
assertTrue(e.isSeleniumError);
|
59
|
+
assertEquals("There was an unexpected Alert! [The Alert]", e.message);
|
60
|
+
}
|
61
|
+
|
62
|
+
assertFalse(executorCalled);
|
63
|
+
mockBrowserBot.verify();
|
64
|
+
}
|
65
|
+
|
66
|
+
function testShouldFailActionCommandsIfConfirmPresent() {
|
67
|
+
|
68
|
+
mockBrowserBot = new Mock();
|
69
|
+
|
70
|
+
function MockSelenium() {
|
71
|
+
this.browserbot = mockBrowserBot;
|
72
|
+
}
|
73
|
+
|
74
|
+
mockBrowserBot.expects("hasAlerts").returns(false);
|
75
|
+
mockBrowserBot.expects("hasConfirmations").returns(true);
|
76
|
+
mockBrowserBot.expects("getNextConfirmation").returns("The Confirmation");
|
77
|
+
|
78
|
+
var executorCalled = false;
|
79
|
+
var executor = function() { executorCalled = true;};
|
80
|
+
var handler = new ActionHandler(executor, false);
|
81
|
+
try {
|
82
|
+
handler.execute(new MockSelenium(), "command");
|
83
|
+
fail("Command Should have failed");
|
84
|
+
} catch ( e ) {
|
85
|
+
assertTrue(e.isSeleniumError);
|
86
|
+
assertEquals("There was an unexpected Confirmation! [The Confirmation]", e.message);
|
87
|
+
}
|
88
|
+
|
89
|
+
assertFalse(executorCalled);
|
90
|
+
mockBrowserBot.verify();
|
91
|
+
}
|
92
|
+
|
93
|
+
function testAccessorHandlerShouldReturnResultInCommandResult() {
|
94
|
+
function MockSelenium() {
|
95
|
+
}
|
96
|
+
|
97
|
+
var executorCalled = false;
|
98
|
+
var executor = function() { executorCalled = true; return "foo"; };
|
99
|
+
var handler = new AccessorHandler(executor, false);
|
100
|
+
|
101
|
+
result = handler.execute(new MockSelenium(), "command");
|
102
|
+
|
103
|
+
assertTrue(executorCalled);
|
104
|
+
assertEquals("foo", result.result);
|
105
|
+
}
|
106
|
+
|
107
|
+
</script>
|
108
|
+
</head>
|
109
|
+
|
110
|
+
<body>
|
111
|
+
<h1>CommandHandler component tests</h1>
|
112
|
+
|
113
|
+
<p>This page contains tests for different components in the CommandHandler. To see them, take a look at the source. To run them, load this file via JsUnit's testRunner.html</p>
|
114
|
+
</body>
|
115
|
+
</html>
|
@@ -0,0 +1,97 @@
|
|
1
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/html4/loose.dtd">
|
3
|
+
<!--
|
4
|
+
Copyright 2004 ThoughtWorks, Inc
|
5
|
+
|
6
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
you may not use this file except in compliance with the License.
|
8
|
+
You may obtain a copy of the License at
|
9
|
+
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
|
12
|
+
Unless required by applicable law or agreed to in writing, software
|
13
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
See the License for the specific language governing permissions and
|
16
|
+
limitations under the License.
|
17
|
+
-->
|
18
|
+
<html>
|
19
|
+
<head>
|
20
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
21
|
+
<title>JsUnit Utility Tests</title>
|
22
|
+
<link rel="stylesheet" type="text/css" href="/jsunit/css/jsUnitStyle.css">
|
23
|
+
<script language="JavaScript" type="text/javascript" src="/jsunit/app/jsUnitCore.js"></script>
|
24
|
+
<script language="JavaScript" type="text/javascript" src="/jsmock/mock.js"></script>
|
25
|
+
<script language="JavaScript" type="text/javascript" src="/selenium-logging.js"></script>
|
26
|
+
|
27
|
+
<script language="JavaScript" type="text/javascript" src="/selenium-browserbot.js"></script>
|
28
|
+
<script language="JavaScript" type="text/javascript" src="/htmlutils.js"></script>
|
29
|
+
<script language="JavaScript" type="text/javascript">
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
function setUp() {
|
34
|
+
LOG = new DummyLogger();
|
35
|
+
testFrame = document.getElementById("frame");
|
36
|
+
testWindow = testFrame.contentWindow;
|
37
|
+
browserBot = BrowserBot.createForFrame(testFrame);
|
38
|
+
browserBot.getCurrentPage();
|
39
|
+
}
|
40
|
+
|
41
|
+
function testShouldConfirmConfirmationsByDefault() {
|
42
|
+
assertTrue( testWindow.confirm("Continue?"));
|
43
|
+
}
|
44
|
+
|
45
|
+
function testShouldCancelConfirmationIfPreviouslyInstructedTo() {
|
46
|
+
browserBot.cancelNextConfirmation();
|
47
|
+
assertFalse( testWindow.confirm("Continue?"));
|
48
|
+
}
|
49
|
+
|
50
|
+
function testShouldRevertToDefaultBehaviourAfterCancellingConfirmation() {
|
51
|
+
browserBot.cancelNextConfirmation();
|
52
|
+
testWindow.confirm("Continue?");
|
53
|
+
testShouldConfirmConfirmationsByDefault();
|
54
|
+
}
|
55
|
+
|
56
|
+
function testShouldNotReportAnyConfirmationsIfNoneHaveBeenGenerated() {
|
57
|
+
assertFalse(browserBot.hasConfirmations());
|
58
|
+
assertUndefined(browserBot.getNextConfirmation());
|
59
|
+
}
|
60
|
+
|
61
|
+
function testShouldReportSingleConfirmationIfGenerated() {
|
62
|
+
testWindow.confirm("Continue?");
|
63
|
+
|
64
|
+
assertTrue(browserBot.hasConfirmations());
|
65
|
+
assertEquals("Continue?", browserBot.getNextConfirmation());
|
66
|
+
}
|
67
|
+
|
68
|
+
function testShouldReportMultipleConfirmationsInOrderIfGenerated() {
|
69
|
+
testWindow.confirm("Continue?");
|
70
|
+
testWindow.confirm("Really Continue?");
|
71
|
+
|
72
|
+
assertTrue(browserBot.hasConfirmations());
|
73
|
+
assertEquals("Continue?", browserBot.getNextConfirmation());
|
74
|
+
assertTrue(browserBot.hasConfirmations());
|
75
|
+
assertEquals("Really Continue?", browserBot.getNextConfirmation());
|
76
|
+
assertFalse(browserBot.hasConfirmations());
|
77
|
+
}
|
78
|
+
|
79
|
+
function testShouldRemoveConfirmationWhenItIsRetreived() {
|
80
|
+
testWindow.confirm("Continue?");
|
81
|
+
|
82
|
+
assertTrue(browserBot.hasConfirmations());
|
83
|
+
assertNotUndefined(browserBot.getNextConfirmation());
|
84
|
+
assertFalse(browserBot.hasConfirmations());
|
85
|
+
assertUndefined(browserBot.getNextConfirmation());
|
86
|
+
}
|
87
|
+
|
88
|
+
|
89
|
+
</script>
|
90
|
+
</head>
|
91
|
+
|
92
|
+
<body>
|
93
|
+
<h1>Selenium PageBot Confirm Handling Tests</h1>
|
94
|
+
<iframe NAME="frame" ID="frame" SRC=""></iframe>
|
95
|
+
|
96
|
+
</body>
|
97
|
+
</html>
|
@@ -0,0 +1,198 @@
|
|
1
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/html4/loose.dtd">
|
3
|
+
|
4
|
+
<!--
|
5
|
+
Copyright 2004 ThoughtWorks, Inc
|
6
|
+
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
you may not use this file except in compliance with the License.
|
9
|
+
You may obtain a copy of the License at
|
10
|
+
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
See the License for the specific language governing permissions and
|
17
|
+
limitations under the License.
|
18
|
+
-->
|
19
|
+
<html>
|
20
|
+
<head>
|
21
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
22
|
+
<title>JsUnit Utility Tests</title>
|
23
|
+
<link rel="stylesheet" type="text/css" href="jsunit/css/jsUnitStyle.css">
|
24
|
+
<script language="JavaScript" type="text/javascript" src="/jsunit/app/jsUnitCore.js"></script>
|
25
|
+
<script language="JavaScript" type="text/javascript" src="/jsmock/mock.js"></script>
|
26
|
+
<script language="JavaScript" type="text/javascript" src="/htmlutils.js"></script>
|
27
|
+
<script language="JavaScript" type="text/javascript" src="/selenium-api.js"></script>
|
28
|
+
<script language="JavaScript" type="text/javascript" src="/selenium-executionloop.js"></script>
|
29
|
+
<script language="JavaScript" type="text/javascript" src="/selenium-commandhandlers.js"></script>
|
30
|
+
<script language="JavaScript" type="text/javascript">
|
31
|
+
function setUp() {
|
32
|
+
commandFactory = new Mock();
|
33
|
+
testLoop = new TestLoop(commandFactory);
|
34
|
+
|
35
|
+
selenium = new Selenium();
|
36
|
+
};
|
37
|
+
|
38
|
+
function verifyMocks() {
|
39
|
+
commandFactory.verify();
|
40
|
+
}
|
41
|
+
|
42
|
+
function testMustProvideMessageToExpectFailure() {
|
43
|
+
try {
|
44
|
+
selenium.assertFailureOnNext();
|
45
|
+
}
|
46
|
+
catch (expected) {
|
47
|
+
return;
|
48
|
+
}
|
49
|
+
fail("Message is a required parameter");
|
50
|
+
};
|
51
|
+
|
52
|
+
function testCommandFactoryIsTemporarilyReplacedByExpectFailureOnNext() {
|
53
|
+
var failingCommand = new Mock();
|
54
|
+
failingCommand.expects("execute").returns({failed:true, failureMessage: "Expected failure message"});
|
55
|
+
commandFactory.expects("getCommandHandler", "cmd").returns(failingCommand);
|
56
|
+
|
57
|
+
selenium.assertFailureOnNext("Expected failure message");
|
58
|
+
|
59
|
+
assertTrue(commandFactory != testLoop.commandFactory);
|
60
|
+
|
61
|
+
testLoop.commandFactory.getCommandHandler("cmd").execute();
|
62
|
+
|
63
|
+
assertTrue(commandFactory === testLoop.commandFactory);
|
64
|
+
|
65
|
+
verifyMocks();
|
66
|
+
};
|
67
|
+
|
68
|
+
function testExpectFailureSucceedsWhenSubsequentCommandFails() {
|
69
|
+
var failingCommand = new Mock();
|
70
|
+
failingCommand.expects("execute").returns({failed:true, failureMessage: "Expected failure message"});
|
71
|
+
commandFactory.expects("getCommandHandler", "cmd").returns(failingCommand);
|
72
|
+
|
73
|
+
selenium.assertFailureOnNext("Expected failure message");
|
74
|
+
var result = testLoop.commandFactory.getCommandHandler("cmd").execute();
|
75
|
+
assertTrue(result.passed);
|
76
|
+
verifyMocks();
|
77
|
+
};
|
78
|
+
|
79
|
+
function testExpectFailureFailsWhenSubsequentCommandFailsWithTheWrongMessage() {
|
80
|
+
var failingCommand = new Mock();
|
81
|
+
failingCommand.expects("execute").returns({failed:true, failureMessage: "foo"});
|
82
|
+
var originalCommandFactory = testLoop.commandFactory;
|
83
|
+
originalCommandFactory.expects("getCommandHandler", "cmd").returns(failingCommand);
|
84
|
+
|
85
|
+
selenium.assertFailureOnNext("bar");
|
86
|
+
var result = testLoop.commandFactory.getCommandHandler("cmd").execute();
|
87
|
+
assertTrue(result.failed);
|
88
|
+
assertEquals("Expected failure message 'bar' but was 'foo'", result.failureMessage);
|
89
|
+
verifyMocks();
|
90
|
+
};
|
91
|
+
|
92
|
+
function testExpectFailureFailsWhenSubsequentCommandPasses() {
|
93
|
+
var successCommand = new Mock();
|
94
|
+
successCommand.expects("execute").returns({passed:true});
|
95
|
+
var originalCommandFactory = testLoop.commandFactory;
|
96
|
+
originalCommandFactory.expects("getCommandHandler", "foo").returns(successCommand);
|
97
|
+
|
98
|
+
selenium.assertFailureOnNext("Expected failure message");
|
99
|
+
var result = testLoop.commandFactory.getCommandHandler("foo").execute();
|
100
|
+
assertTrue(result.failed);
|
101
|
+
assertEquals("Command should have failed.", result.failureMessage);
|
102
|
+
verifyMocks();
|
103
|
+
};
|
104
|
+
|
105
|
+
function testExpectFailurePropogatesCommandErrors() {
|
106
|
+
var errorCommand = new Mock();
|
107
|
+
errorCommand.expects("execute").andThrows("error message");
|
108
|
+
commandFactory.expects("getCommandHandler", "foo").returns(errorCommand);
|
109
|
+
|
110
|
+
selenium.assertFailureOnNext("Expected failure message");
|
111
|
+
try {
|
112
|
+
testLoop.commandFactory.getCommandHandler("foo").execute();
|
113
|
+
}
|
114
|
+
catch (expected) {
|
115
|
+
verifyMocks();
|
116
|
+
return;
|
117
|
+
}
|
118
|
+
fail("Command error should not be caught by expect failure.");
|
119
|
+
};
|
120
|
+
|
121
|
+
function testMustProvideMessageToExpectError() {
|
122
|
+
try {
|
123
|
+
selenium.assertErrorOnNext();
|
124
|
+
}
|
125
|
+
catch (expected) {
|
126
|
+
return;
|
127
|
+
}
|
128
|
+
fail("Message is a required parameter");
|
129
|
+
};
|
130
|
+
|
131
|
+
function testCommandFactoryIsTemporarilyReplacedByExpectErrorOnNext() {
|
132
|
+
var errorCommand = new Mock();
|
133
|
+
errorCommand.expects("execute").andThrows("error message");
|
134
|
+
commandFactory.expects("getCommandHandler", "cmd").returns(errorCommand);
|
135
|
+
|
136
|
+
selenium.assertErrorOnNext("Error: error message");
|
137
|
+
|
138
|
+
assertTrue(commandFactory != testLoop.commandFactory);
|
139
|
+
|
140
|
+
testLoop.commandFactory.getCommandHandler("cmd").execute();
|
141
|
+
|
142
|
+
assertTrue(commandFactory === testLoop.commandFactory);
|
143
|
+
verifyMocks();
|
144
|
+
};
|
145
|
+
|
146
|
+
function testExpectErrorSucceedsWhenSubsequentCommandErrors() {
|
147
|
+
var errorCommand = new Mock();
|
148
|
+
errorCommand.expects("execute").andThrows("error message");
|
149
|
+
commandFactory.expects("getCommandHandler", "cmd").returns(errorCommand);
|
150
|
+
|
151
|
+
selenium.assertErrorOnNext("error message");
|
152
|
+
var result = testLoop.commandFactory.getCommandHandler("cmd").execute();
|
153
|
+
assertTrue(result.passed);
|
154
|
+
verifyMocks();
|
155
|
+
};
|
156
|
+
|
157
|
+
function testExpectErrorFailsWhenSubsequentCommandErrorsWithTheWrongMessage() {
|
158
|
+
var errorCommand = new Mock();
|
159
|
+
errorCommand.expects("execute").andThrows("Error: foo");
|
160
|
+
commandFactory.expects("getCommandHandler", "cmd").returns(errorCommand);
|
161
|
+
|
162
|
+
selenium.assertErrorOnNext("Error: bar");
|
163
|
+
var result = testLoop.commandFactory.getCommandHandler("cmd").execute();
|
164
|
+
assertTrue(result.failed);
|
165
|
+
assertEquals("Expected failure message 'Error: bar' but was 'Error: foo'", result.failureMessage);
|
166
|
+
verifyMocks();
|
167
|
+
};
|
168
|
+
|
169
|
+
function testExpectErrorFailsWhenSubsequentCommandPasses() {
|
170
|
+
var successCommand = new Mock();
|
171
|
+
successCommand.expects("execute").returns({passed:true});
|
172
|
+
commandFactory.expects("getCommandHandler", "foo").returns(successCommand);
|
173
|
+
|
174
|
+
selenium.assertErrorOnNext("Expected failure message");
|
175
|
+
var result = testLoop.commandFactory.getCommandHandler("foo").execute();
|
176
|
+
assertTrue(result.failed);
|
177
|
+
assertEquals("Command should have failed.", result.failureMessage);
|
178
|
+
verifyMocks();
|
179
|
+
};
|
180
|
+
|
181
|
+
function testExpectErrorFailsWhenSubsequentCommandFails() {
|
182
|
+
var failingCommand = new Mock();
|
183
|
+
failingCommand.expects("execute").returns({failed:true, failureMessage: "Expected failure message"});
|
184
|
+
commandFactory.expects("getCommandHandler", "cmd").returns(failingCommand);
|
185
|
+
|
186
|
+
selenium.assertErrorOnNext("Expected failure message");
|
187
|
+
var result = testLoop.commandFactory.getCommandHandler("cmd").execute();
|
188
|
+
assertTrue(result.failed);
|
189
|
+
assertEquals("Command should have failed.", result.failureMessage);
|
190
|
+
verifyMocks();
|
191
|
+
};
|
192
|
+
</script>
|
193
|
+
</head>
|
194
|
+
|
195
|
+
<body>
|
196
|
+
<p>This page contains tests for the ExpectFailureCommandFactory object. To see them, take a look at the source. To run them, load this file via JsUnit's testRunner.html</p>
|
197
|
+
</body>
|
198
|
+
</html>
|
@@ -0,0 +1,106 @@
|
|
1
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/html4/loose.dtd">
|
3
|
+
|
4
|
+
<!--
|
5
|
+
Copyright 2004 ThoughtWorks, Inc
|
6
|
+
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
you may not use this file except in compliance with the License.
|
9
|
+
You may obtain a copy of the License at
|
10
|
+
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
See the License for the specific language governing permissions and
|
17
|
+
limitations under the License.
|
18
|
+
-->
|
19
|
+
<html>
|
20
|
+
<head>
|
21
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
22
|
+
<title>JsUnit Utility Tests</title>
|
23
|
+
<link rel="stylesheet" type="text/css" href="/jsunit/css/jsUnitStyle.css">
|
24
|
+
<script language="JavaScript" type="text/javascript" src="/jsunit/app/jsUnitCore.js"></script>
|
25
|
+
<script language="JavaScript" type="text/javascript" src="/jsmock/mock.js"></script>
|
26
|
+
|
27
|
+
<script language="JavaScript" type="text/javascript" src="/selenium-browserbot.js"></script>
|
28
|
+
<script language="JavaScript" type="text/javascript" src="/htmlutils.js"></script>
|
29
|
+
<script language="JavaScript" type="text/javascript">
|
30
|
+
|
31
|
+
function setUp() {
|
32
|
+
pageBot = PageBot.createForWindow(window);
|
33
|
+
|
34
|
+
theForm = document.getElementById("theFormElement");
|
35
|
+
theTextbox = document.getElementById("theTextboxElement");
|
36
|
+
}
|
37
|
+
|
38
|
+
function testFocusEventNeverBubbles() {
|
39
|
+
var textboxFocus = false;
|
40
|
+
var formFocus = false;
|
41
|
+
theTextbox.onfocus = function() {textboxFocus = true};
|
42
|
+
theForm.onfocus = function() {formFocus = true};
|
43
|
+
|
44
|
+
pageBot.replaceText(theTextbox, 'foo1');
|
45
|
+
|
46
|
+
assertTrue(textboxFocus);
|
47
|
+
assertFalse(formFocus);
|
48
|
+
}
|
49
|
+
|
50
|
+
function testSelectEventCanBubbleInFirefoxButNotInIE() {
|
51
|
+
assertTrue(true);
|
52
|
+
var textboxSelect = false;
|
53
|
+
var formSelect = false;
|
54
|
+
theTextbox.onselect = function() {textboxSelect = true};
|
55
|
+
theForm.onselect = function() {formSelect = true};
|
56
|
+
|
57
|
+
pageBot.replaceText(theTextbox, 'foo1');
|
58
|
+
|
59
|
+
assertTrue(textboxSelect);
|
60
|
+
if (isIE) {
|
61
|
+
assertFalse(formSelect);
|
62
|
+
} else {
|
63
|
+
assertTrue(formSelect);
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
function testChangeEventCanBubbleInFirefoxButNotInIE() {
|
68
|
+
var textboxChange = false;
|
69
|
+
var formChange = false;
|
70
|
+
theTextbox.onchange = function() {textboxChange = true};
|
71
|
+
theForm.onchange = function() {formChange = true};
|
72
|
+
|
73
|
+
pageBot.replaceText(theTextbox, 'foo2');
|
74
|
+
|
75
|
+
assertTrue(textboxChange);
|
76
|
+
if (isIE) {
|
77
|
+
assertFalse(formChange);
|
78
|
+
} else {
|
79
|
+
assertTrue(formChange);
|
80
|
+
}
|
81
|
+
}
|
82
|
+
|
83
|
+
function testClickEventAlwaysBubbles() {
|
84
|
+
var buttonClick = false;
|
85
|
+
var formClick = false;
|
86
|
+
var theButton = document.getElementById("theButtonElement")
|
87
|
+
theButton.onclick = function() {buttonClick = true};
|
88
|
+
theForm.onclick = function() {formClick = true};
|
89
|
+
|
90
|
+
pageBot.clickElement(theButton);
|
91
|
+
|
92
|
+
assertTrue(buttonClick);
|
93
|
+
assertTrue(formClick);
|
94
|
+
}
|
95
|
+
</script>
|
96
|
+
</head>
|
97
|
+
|
98
|
+
<body>
|
99
|
+
<h1>Selenium Browserbot Tests</h1>
|
100
|
+
|
101
|
+
<form id="theFormElement" name="theFormElement">
|
102
|
+
<input name="theTextboxElement" id="theTextboxElement" type="text" value="theTextbox"/>
|
103
|
+
<input name="theButtonElement" id="theButtonElement" type="button" value="theButton"/>
|
104
|
+
</form>
|
105
|
+
</body>
|
106
|
+
</html>
|