rubinium 0.1.1

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.
Files changed (161) hide show
  1. data/CHANGES +7 -0
  2. data/MIT-LICENSE +21 -0
  3. data/README +137 -0
  4. data/Rakefile +139 -0
  5. data/TODO +7 -0
  6. data/doc/examples/rtc_site_live.rb +12 -0
  7. data/doc/examples/rts_main.rb +9 -0
  8. data/doc/examples/rts_shared_code.rb +25 -0
  9. data/lib/rubinium.rb +9 -0
  10. data/lib/rubinium/string.rb +3 -0
  11. data/lib/rubinium/test_base.rb +80 -0
  12. data/lib/rubinium/test_suite.rb +53 -0
  13. data/lib/rubinium/validator.rb +16 -0
  14. data/test/selenium_tests/test_click.rb +22 -0
  15. data/test/selenium_tests/test_open.rb +11 -0
  16. data/test/tc_file_creation.rb +60 -0
  17. data/test/ts_rubinium.rb +1 -0
  18. data/vendor/selenium-0.6.0/install-readme.txt +9 -0
  19. data/vendor/selenium-0.6.0/selenium/SeleneseRunner.html +253 -0
  20. data/vendor/selenium-0.6.0/selenium/SeleniumLog.html +61 -0
  21. data/vendor/selenium-0.6.0/selenium/TestRunner-splash.html +55 -0
  22. data/vendor/selenium-0.6.0/selenium/TestRunner.hta +146 -0
  23. data/vendor/selenium-0.6.0/selenium/TestRunner.html +146 -0
  24. data/vendor/selenium-0.6.0/selenium/devtests/TestClickInFrame.html +58 -0
  25. data/vendor/selenium-0.6.0/selenium/devtests/TestOpenInFrame.html +48 -0
  26. data/vendor/selenium-0.6.0/selenium/devtests/TestOpenInNewWindow.html +78 -0
  27. data/vendor/selenium-0.6.0/selenium/devtests/TestOpenMeta.html +43 -0
  28. data/vendor/selenium-0.6.0/selenium/devtests/TestSuite.html +39 -0
  29. data/vendor/selenium-0.6.0/selenium/devtests/meta/page.html +5 -0
  30. data/vendor/selenium-0.6.0/selenium/dom-images/butmin.gif +0 -0
  31. data/vendor/selenium-0.6.0/selenium/dom-images/butplus.gif +0 -0
  32. data/vendor/selenium-0.6.0/selenium/dom-styles/default.css +298 -0
  33. data/vendor/selenium-0.6.0/selenium/domviewer.html +16 -0
  34. data/vendor/selenium-0.6.0/selenium/html-xpath/carnation.jpg +0 -0
  35. data/vendor/selenium-0.6.0/selenium/html-xpath/example.html +75 -0
  36. data/vendor/selenium-0.6.0/selenium/html-xpath/html-xpath-patched.js +657 -0
  37. data/vendor/selenium-0.6.0/selenium/html-xpath/html-xpath.js +610 -0
  38. data/vendor/selenium-0.6.0/selenium/html-xpath/license.txt +504 -0
  39. data/vendor/selenium-0.6.0/selenium/html-xpath/rainbow.jpg +0 -0
  40. data/vendor/selenium-0.6.0/selenium/htmlutils.js +283 -0
  41. data/vendor/selenium-0.6.0/selenium/index.html +60 -0
  42. data/vendor/selenium-0.6.0/selenium/jsmock/mock-tests.html +205 -0
  43. data/vendor/selenium-0.6.0/selenium/jsmock/mock.js +124 -0
  44. data/vendor/selenium-0.6.0/selenium/selenium-api.js +683 -0
  45. data/vendor/selenium-0.6.0/selenium/selenium-browserbot.js +930 -0
  46. data/vendor/selenium-0.6.0/selenium/selenium-commandhandlers.js +286 -0
  47. data/vendor/selenium-0.6.0/selenium/selenium-domviewer.js +188 -0
  48. data/vendor/selenium-0.6.0/selenium/selenium-executionloop.js +250 -0
  49. data/vendor/selenium-0.6.0/selenium/selenium-fitrunner.js +597 -0
  50. data/vendor/selenium-0.6.0/selenium/selenium-logging.js +88 -0
  51. data/vendor/selenium-0.6.0/selenium/selenium-logo.png +0 -0
  52. data/vendor/selenium-0.6.0/selenium/selenium-tableparser.js +50 -0
  53. data/vendor/selenium-0.6.0/selenium/selenium.css +211 -0
  54. data/vendor/selenium-0.6.0/selenium/tests/ErrorCheckingTestSuite.html +36 -0
  55. data/vendor/selenium-0.6.0/selenium/tests/GoogleTestSearch.html +69 -0
  56. data/vendor/selenium-0.6.0/selenium/tests/GoogleTestSuite.html +32 -0
  57. data/vendor/selenium-0.6.0/selenium/tests/JsUnitSuite.html +38 -0
  58. data/vendor/selenium-0.6.0/selenium/tests/TestClick.html +128 -0
  59. data/vendor/selenium-0.6.0/selenium/tests/TestClickJavascriptHref.html +115 -0
  60. data/vendor/selenium-0.6.0/selenium/tests/TestCommandError.html +79 -0
  61. data/vendor/selenium-0.6.0/selenium/tests/TestConfirmations.html +77 -0
  62. data/vendor/selenium-0.6.0/selenium/tests/TestErrorChecking.html +71 -0
  63. data/vendor/selenium-0.6.0/selenium/tests/TestFailingAssert.html +59 -0
  64. data/vendor/selenium-0.6.0/selenium/tests/TestFailingVerifications.html +198 -0
  65. data/vendor/selenium-0.6.0/selenium/tests/TestFocusOnBlur.html +53 -0
  66. data/vendor/selenium-0.6.0/selenium/tests/TestGoBack.html +81 -0
  67. data/vendor/selenium-0.6.0/selenium/tests/TestImplicitLocators.html +81 -0
  68. data/vendor/selenium-0.6.0/selenium/tests/TestJavascriptParameters.html +91 -0
  69. data/vendor/selenium-0.6.0/selenium/tests/TestLocators.html +161 -0
  70. data/vendor/selenium-0.6.0/selenium/tests/TestModalDialog.html +58 -0
  71. data/vendor/selenium-0.6.0/selenium/tests/TestModalDialogDialog.html +48 -0
  72. data/vendor/selenium-0.6.0/selenium/tests/TestOpen.html +66 -0
  73. data/vendor/selenium-0.6.0/selenium/tests/TestPatternMatching.html +127 -0
  74. data/vendor/selenium-0.6.0/selenium/tests/TestPause.html +78 -0
  75. data/vendor/selenium-0.6.0/selenium/tests/TestPrompting.html +82 -0
  76. data/vendor/selenium-0.6.0/selenium/tests/TestProxy.html +62 -0
  77. data/vendor/selenium-0.6.0/selenium/tests/TestSelect.html +111 -0
  78. data/vendor/selenium-0.6.0/selenium/tests/TestSelectWindow.html +106 -0
  79. data/vendor/selenium-0.6.0/selenium/tests/TestStore.html +165 -0
  80. data/vendor/selenium-0.6.0/selenium/tests/TestSuite-InternetExplorer.html +79 -0
  81. data/vendor/selenium-0.6.0/selenium/tests/TestSuite-Konqueror.html +75 -0
  82. data/vendor/selenium-0.6.0/selenium/tests/TestSuite-Safari.html +75 -0
  83. data/vendor/selenium-0.6.0/selenium/tests/TestSuite.html +75 -0
  84. data/vendor/selenium-0.6.0/selenium/tests/TestType.html +79 -0
  85. data/vendor/selenium-0.6.0/selenium/tests/TestUserExtensions.html +81 -0
  86. data/vendor/selenium-0.6.0/selenium/tests/TestVerifications.html +164 -0
  87. data/vendor/selenium-0.6.0/selenium/tests/TestVerifyAlerts.html +80 -0
  88. data/vendor/selenium-0.6.0/selenium/tests/TestVerifyAlertsFailures.html +108 -0
  89. data/vendor/selenium-0.6.0/selenium/tests/TestVerifyConfirmationFailures.html +86 -0
  90. data/vendor/selenium-0.6.0/selenium/tests/TestVerifyEditable.html +70 -0
  91. data/vendor/selenium-0.6.0/selenium/tests/TestVerifyEditableFailures.html +95 -0
  92. data/vendor/selenium-0.6.0/selenium/tests/TestVisibility.html +91 -0
  93. data/vendor/selenium-0.6.0/selenium/tests/TestVisibilityFailures.html +131 -0
  94. data/vendor/selenium-0.6.0/selenium/tests/TestWait.html +112 -0
  95. data/vendor/selenium-0.6.0/selenium/tests/TestWaitFor.html +63 -0
  96. data/vendor/selenium-0.6.0/selenium/tests/TestWaitInPopupWindow.html +94 -0
  97. data/vendor/selenium-0.6.0/selenium/tests/TestXPathLocators.html +98 -0
  98. data/vendor/selenium-0.6.0/selenium/tests/browserbot/alert-handling-tests.html +79 -0
  99. data/vendor/selenium-0.6.0/selenium/tests/browserbot/assert-tests.html +113 -0
  100. data/vendor/selenium-0.6.0/selenium/tests/browserbot/browserbot-tests.html +123 -0
  101. data/vendor/selenium-0.6.0/selenium/tests/browserbot/command-factory-tests.html +290 -0
  102. data/vendor/selenium-0.6.0/selenium/tests/browserbot/command-handler-tests.html +115 -0
  103. data/vendor/selenium-0.6.0/selenium/tests/browserbot/confirm-handling-tests.html +97 -0
  104. data/vendor/selenium-0.6.0/selenium/tests/browserbot/error-checking-command-tests.html +198 -0
  105. data/vendor/selenium-0.6.0/selenium/tests/browserbot/event-bubble-tests.html +106 -0
  106. data/vendor/selenium-0.6.0/selenium/tests/browserbot/optionlocator-tests.html +180 -0
  107. data/vendor/selenium-0.6.0/selenium/tests/browserbot/pagebot-accessor-tests.html +65 -0
  108. data/vendor/selenium-0.6.0/selenium/tests/browserbot/pagebot-action-tests.html +200 -0
  109. data/vendor/selenium-0.6.0/selenium/tests/browserbot/pagebot-attribute-tests.html +98 -0
  110. data/vendor/selenium-0.6.0/selenium/tests/browserbot/pagebot-locator-tests-include.html +33 -0
  111. data/vendor/selenium-0.6.0/selenium/tests/browserbot/pagebot-locator-tests.html +258 -0
  112. data/vendor/selenium-0.6.0/selenium/tests/browserbot/pagebot-property-tests.html +49 -0
  113. data/vendor/selenium-0.6.0/selenium/tests/browserbot/pattern-matcher-tests.html +66 -0
  114. data/vendor/selenium-0.6.0/selenium/tests/browserbot/selenium-api-tests.html +412 -0
  115. data/vendor/selenium-0.6.0/selenium/tests/browserbot/selenium-parameter-tests.html +98 -0
  116. data/vendor/selenium-0.6.0/selenium/tests/browserbot/suite.html +52 -0
  117. data/vendor/selenium-0.6.0/selenium/tests/browserbot/testloop-handle-error-tests.html +74 -0
  118. data/vendor/selenium-0.6.0/selenium/tests/events/TestButtonEvents.html +72 -0
  119. data/vendor/selenium-0.6.0/selenium/tests/events/TestCheckboxEvents.html +107 -0
  120. data/vendor/selenium-0.6.0/selenium/tests/events/TestFireEvents.html +75 -0
  121. data/vendor/selenium-0.6.0/selenium/tests/events/TestLinkEvents.html +43 -0
  122. data/vendor/selenium-0.6.0/selenium/tests/events/TestRadioEvents.html +149 -0
  123. data/vendor/selenium-0.6.0/selenium/tests/events/TestSelectEvents.html +122 -0
  124. data/vendor/selenium-0.6.0/selenium/tests/events/TestTextEvents.html +87 -0
  125. data/vendor/selenium-0.6.0/selenium/tests/events/readme.txt +26 -0
  126. data/vendor/selenium-0.6.0/selenium/tests/html/banner.gif +0 -0
  127. data/vendor/selenium-0.6.0/selenium/tests/html/test_async_event.html +36 -0
  128. data/vendor/selenium-0.6.0/selenium/tests/html/test_click_javascript_page.html +34 -0
  129. data/vendor/selenium-0.6.0/selenium/tests/html/test_click_page1.html +31 -0
  130. data/vendor/selenium-0.6.0/selenium/tests/html/test_click_page2.html +30 -0
  131. data/vendor/selenium-0.6.0/selenium/tests/html/test_confirm.html +34 -0
  132. data/vendor/selenium-0.6.0/selenium/tests/html/test_dummy_page.html +26 -0
  133. data/vendor/selenium-0.6.0/selenium/tests/html/test_editable.html +36 -0
  134. data/vendor/selenium-0.6.0/selenium/tests/html/test_focus_on_blur.html +33 -0
  135. data/vendor/selenium-0.6.0/selenium/tests/html/test_form_events.html +98 -0
  136. data/vendor/selenium-0.6.0/selenium/tests/html/test_framed_page.html +7 -0
  137. data/vendor/selenium-0.6.0/selenium/tests/html/test_just_text.html +22 -0
  138. data/vendor/selenium-0.6.0/selenium/tests/html/test_locators.html +34 -0
  139. data/vendor/selenium-0.6.0/selenium/tests/html/test_modal_dialog.html +29 -0
  140. data/vendor/selenium-0.6.0/selenium/tests/html/test_modal_dialog_dialog.html +35 -0
  141. data/vendor/selenium-0.6.0/selenium/tests/html/test_open.html +23 -0
  142. data/vendor/selenium-0.6.0/selenium/tests/html/test_prompt.html +34 -0
  143. data/vendor/selenium-0.6.0/selenium/tests/html/test_reload_onchange_page.html +32 -0
  144. data/vendor/selenium-0.6.0/selenium/tests/html/test_select.html +35 -0
  145. data/vendor/selenium-0.6.0/selenium/tests/html/test_select_window.html +29 -0
  146. data/vendor/selenium-0.6.0/selenium/tests/html/test_select_window_popup.html +28 -0
  147. data/vendor/selenium-0.6.0/selenium/tests/html/test_slowloading_page.html +27 -0
  148. data/vendor/selenium-0.6.0/selenium/tests/html/test_store_value.html +23 -0
  149. data/vendor/selenium-0.6.0/selenium/tests/html/test_type_page1.html +37 -0
  150. data/vendor/selenium-0.6.0/selenium/tests/html/test_type_page2.html +61 -0
  151. data/vendor/selenium-0.6.0/selenium/tests/html/test_verifications.html +42 -0
  152. data/vendor/selenium-0.6.0/selenium/tests/html/test_verify_alert.html +46 -0
  153. data/vendor/selenium-0.6.0/selenium/tests/html/test_visibility.html +53 -0
  154. data/vendor/selenium-0.6.0/selenium/tests/readme.txt +1 -0
  155. data/vendor/selenium-0.6.0/selenium/tests/tableparser/tableparser-tests.html +122 -0
  156. data/vendor/selenium-0.6.0/selenium/tests/tinyWebServer.py +70 -0
  157. data/vendor/selenium-0.6.0/selenium/user-extensions.js.sample +62 -0
  158. data/vendor/selenium-0.6.0/selenium/version.txt +1 -0
  159. data/vendor/selenium-0.6.0/selenium/xmlextras.js +153 -0
  160. data/vendor/selenium-0.6.0/selenium/xpath.js +3910 -0
  161. metadata +216 -0
@@ -0,0 +1,33 @@
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
+ </head>
24
+
25
+ <body>
26
+ <a id="id1" href="#id1">this is the first element</a>
27
+ <a id="id2" name="name1" href="#id2">this is the second element</a>
28
+ <a id="id3" name="name1" href="#id3">this is the third element</a>
29
+ <a id="id4" name="id3" href="#id4">this is the fourth element</a>
30
+
31
+ <p id="document.links[0]" name="name1" class="pstyle">dummy element</p>
32
+ </body>
33
+ </html>
@@ -0,0 +1,258 @@
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="/html-xpath/html-xpath-patched.js"></script>
27
+
28
+ <script language="JavaScript" type="text/javascript" src="/selenium-browserbot.js"></script>
29
+ <script language="JavaScript" type="text/javascript" src="/htmlutils.js"></script>
30
+ <script language="JavaScript" type="text/javascript">
31
+
32
+ function setUp() {
33
+ // To be realistic, the elements are located in a separate IFrame.
34
+ var iframe = document.getElementById("testIframe");
35
+ var iWindow = iframe.contentWindow.window;
36
+ frameDocument = iWindow.document;
37
+
38
+ pageBot = PageBot.createForWindow(iWindow);
39
+ element1 = iWindow.document.getElementById("id1");
40
+ element2 = iWindow.document.getElementById("id2");
41
+ element3 = iWindow.document.getElementById("id3");
42
+ element4 = iWindow.document.getElementById("document.links[0]");
43
+ }
44
+
45
+ //
46
+ // Tests for "id" locator
47
+ //
48
+ function testIdLocatorReturnsNullIfElementNotPresent() {
49
+ assertNull(pageBot.findElementBy('id','noSuchElement', frameDocument));
50
+ }
51
+
52
+ function testIdLocatorReturnsElementWithMatchingId() {
53
+ assertEquals(element3, pageBot.findElementBy('id','id3', frameDocument));
54
+ }
55
+
56
+ function testIdLocatorDoesNotReturnElementWithMatchingName() {
57
+ assertNull(pageBot.findElementBy('id','name1', frameDocument));
58
+ }
59
+
60
+ //
61
+ // Tests for "name" locator
62
+ //
63
+ function testNameLocatorReturnsNullIfElementNotPresent() {
64
+ assertNull(pageBot.findElementBy('name','noSuchElement', frameDocument));
65
+ }
66
+
67
+ function testNameLocatorDoesNotReturnElementWithMatchingId() {
68
+ assertNull(pageBot.findElementBy('name','id2', frameDocument));
69
+ }
70
+
71
+ function testNameLocatorReturnsElementWithMatchingName() {
72
+ assertEquals(element2, pageBot.findElementBy('name','name1', frameDocument));
73
+ }
74
+
75
+ //
76
+ // Tests for "identifier" locator
77
+ //
78
+ function testIdentifierLocatorReturnsNullIfElementNotPresent() {
79
+ assertNull(pageBot.findElementBy('identifier','noSuchElement', frameDocument));
80
+ }
81
+
82
+ function testIdentifierLocatorReturnsHtmlElementWithMatchingId() {
83
+ assertEquals(element3, pageBot.findElementBy('identifier','id3', frameDocument));
84
+ }
85
+
86
+ function testIdentifierLocatorReturnsFirstElementWithMatchingName() {
87
+ assertEquals(element2, pageBot.findElementBy('identifier','name1', frameDocument));
88
+ }
89
+
90
+ //
91
+ // Tests for "dom" locator
92
+ //
93
+ function testLocateElementByDomTraversal() {
94
+ assertEquals(element2,
95
+ pageBot.findElementBy('dom',"document.links[1]", frameDocument));
96
+ }
97
+
98
+ function testLocateElementByDomTraversalReturnsNullForNoMatchingElement() {
99
+ }
100
+
101
+ function testLocateElementByDomTraversalFailsWithInvalidDomString() {
102
+ try {
103
+ pageBot.findElementBy('dom',"document.foo.bar", frameDocument);
104
+ fail("Should have thrown exception");
105
+ }
106
+ catch (e) {
107
+ // Expected
108
+ }
109
+ }
110
+
111
+ //
112
+ // Tests for "xpath" locator
113
+ //
114
+ function testLocateElementByXPathWithTagNameOnly() {
115
+ assertEquals(element4,
116
+ pageBot.findElementBy('xpath',"//p", frameDocument));
117
+ }
118
+
119
+ function testLocateElementByXPathWithAttributeOnly() {
120
+ assertEquals(element4,
121
+ pageBot.findElementBy('xpath',"//*[@class='pstyle']", frameDocument));
122
+ }
123
+
124
+ function testLocateElementByXPathWithTagNameAndAttribute() {
125
+ assertEquals(element4,
126
+ pageBot.findElementBy('xpath',"//p[@name='name1']", frameDocument));
127
+ }
128
+
129
+ function testLocateElementByXPathReturnsFirstMatchingElement() {
130
+ assertEquals(element2,
131
+ pageBot.findElementBy('xpath',"//*[@name='name1']", frameDocument));
132
+ }
133
+
134
+ //
135
+ // Tests for "link" locator
136
+ //
137
+ function testLocateLinkReturnsNullIfLocatorIsNotLinkLocator() {
138
+ assertNull(pageBot.findElementBy('link','//NotALinkLocator', frameDocument));
139
+ }
140
+
141
+ function testLocateLinkReturnsNullIfLinkNotPresent() {
142
+ assertNull(pageBot.findElementBy('link','No Such Link', frameDocument));
143
+ }
144
+
145
+ function testLinkElementReturnsLinkWithMatchingText() {
146
+ assertEquals(element3, pageBot.findElementBy('link','this is the third element', frameDocument));
147
+ }
148
+
149
+ function testLinkElementWithGlob() {
150
+ assertEquals(element3, pageBot.findElementBy('link','this * third element', frameDocument));
151
+ }
152
+
153
+ function testLinkElementWithRegex() {
154
+ assertEquals(element3, pageBot.findElementBy('link','regexp:this [aeiou]s the third element', frameDocument));
155
+ }
156
+
157
+ //
158
+ // Tests for PageBot.findElement()
159
+ //
160
+ function testFindElementWithNoLocatorPrefixUsesImplicitStrategy() {
161
+ var calls = new Array();
162
+ pageBot.locationStrategies['implicit'] = function(locator) { calls.push(locator); return "bar";};
163
+
164
+ var element = pageBot.findElement("foo");
165
+ assertEquals("bar", element);
166
+ assertEquals("foo", calls.join());
167
+ }
168
+
169
+ function testFindElementThrowsExceptionIfNoElementFound() {
170
+ var calls = new Array();
171
+ pageBot.locationStrategies['implicit'] = function(locator) { calls.push(locator); return null;};
172
+
173
+ var element = null;
174
+ var failureMessage = null;
175
+ try {
176
+ element = pageBot.findElement("foo");
177
+ } catch (e) {
178
+ failureMessage = e.message;
179
+ }
180
+
181
+ assertNull(element);
182
+ assertEquals("Element foo not found", failureMessage);
183
+ assertEquals("foo", calls.join());
184
+ }
185
+
186
+ function testFindElementWithLocatorPrefixUsesSpecifiedStrategy() {
187
+ var calls = new Array();
188
+ pageBot.locationStrategies["anotherlocator"] = function(locator) { calls.push(locator); return "bar";};
189
+
190
+ element = pageBot.findElement("anotherlocator=foo");
191
+ assertEquals("bar", element);
192
+ assertEquals("foo", calls.join());
193
+ }
194
+
195
+ function testFindElementWithUnknownLocatorPrefixThrowsException() {
196
+ var calls = new Array();
197
+ pageBot.locationStrategies['implicit'] = function(locator) { calls.push(locator); return "bar";};
198
+
199
+ var element = null;
200
+ var failureMessage = null;
201
+ try {
202
+ element = pageBot.findElement("bogus=foo");
203
+ } catch (e) {
204
+ failureMessage = e.message;
205
+ }
206
+
207
+ assertNull(element);
208
+ assertEquals("Unrecognised locator type: 'bogus'", failureMessage);
209
+ assertEquals("", calls.join());
210
+ }
211
+
212
+ function testFindElementReturnsElementWithMatchingIdentifier() {
213
+ assertEquals(element2, pageBot.findElement("id2"));
214
+ }
215
+
216
+ function testFindElementReturnsMatchingName() {
217
+ assertEquals(element2, pageBot.findElement("name1"));
218
+ }
219
+
220
+ function testFindElementTriesDomTraversalBeforeId() {
221
+ assertEquals(element1, pageBot.findElement("document.links[0]"));
222
+ assertEquals(element4, pageBot.findElement("id=document.links[0]"));
223
+ }
224
+
225
+ function testFindElementHandlesLinkLocators() {
226
+ assertEquals(element3, pageBot.findElement('link=this is the third element'));
227
+ }
228
+
229
+ function testUnknownElementWithoutDomTraversal() {
230
+ try {
231
+ pageBot.findElement("unknownElement");
232
+ fail("Should have failed for element not found");
233
+ }
234
+ catch (e) {
235
+ // expected
236
+ }
237
+ }
238
+
239
+ function testUnknownElementWithDomTraversal() {
240
+ try {
241
+ pageBot.findElement("document.foo");
242
+ fail("Should have failed for element not found");
243
+ }
244
+ catch (e) {
245
+ // expected
246
+ }
247
+ }
248
+
249
+ function testFindElementHandlesDomTraversal() {
250
+ assertEquals(element3, pageBot.findElement("document.links[2]"));
251
+ }
252
+ </script>
253
+ </head>
254
+
255
+ <body>
256
+ <iframe id="testIframe" src="./pagebot-locator-tests-include.html"/>
257
+ </body>
258
+ </html>
@@ -0,0 +1,49 @@
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>PageBot Property 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
+
35
+ function testTitleProperty() {
36
+ assertEquals("PageBot Property Tests", pageBot.title());
37
+ }
38
+
39
+ function testLocationProperty() {
40
+ assertEquals("/tests/browserbot/pagebot-property-tests.html", pageBot.location.pathname);
41
+ }
42
+
43
+ function testBodyText() {
44
+ assertEquals("Selenium Browserbot Tests", pageBot.bodyText());
45
+ }
46
+ </script>
47
+ </head>
48
+ <body>Selenium Browserbot Tests</body>
49
+ </html>
@@ -0,0 +1,66 @@
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>PatternMatcher 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="/htmlutils.js"></script>
28
+ <script language="JavaScript" type="text/javascript" src="/selenium-executionloop.js"></script>
29
+ <script language="JavaScript" type="text/javascript" src="/selenium-api.js"></script>
30
+ <script language="JavaScript" type="text/javascript">
31
+
32
+ function testRegexpFromGlob() {
33
+ var regexpFromGlob = PatternMatcher.regexpFromGlob;
34
+ assertEquals("^(.|[\r\n])*$", regexpFromGlob("*"));
35
+ assertEquals("^(.|[\r\n])$", regexpFromGlob("?"));
36
+ assertEquals("^a(.|[\r\n])*b$", regexpFromGlob("a*b"));
37
+ assertEquals("^\\.\\|\\^\\$\\(\\)\\[\\]\\{\\}$", regexpFromGlob(".|^$()[]{}"));
38
+ assertEquals("^(.|[\r\n])*/foo/bar(.|[\r\n])*$", regexpFromGlob("*/foo/bar*"));
39
+ }
40
+
41
+ function testCanMatchUsingGlob() {
42
+ assertTrue(new PatternMatcher("glob:a*e").matches("apple"));
43
+ assertFalse(new PatternMatcher("glob:a*z").matches("apple"));
44
+ }
45
+
46
+ function testMatchUsingGlobByDefault() {
47
+ assertTrue(new PatternMatcher("a*e").matches("apple"));
48
+ assertFalse(new PatternMatcher("a*z").matches("apple"));
49
+ }
50
+
51
+ function testCanMatchUsingRegexp() {
52
+ assertTrue(new PatternMatcher("regexp:pp").matches("apple"));
53
+ assertFalse(new PatternMatcher("regexp:^pp").matches("apple"));
54
+ assertTrue(new PatternMatcher("regexp:[a-z]$").matches("apple"));
55
+ }
56
+
57
+ function testCanDoExactMatch() {
58
+ assertTrue(new PatternMatcher("exact:abc").matches("abc"));
59
+ assertFalse(new PatternMatcher("exact:a*c").matches("abc"));
60
+ assertTrue(new PatternMatcher("exact:a*c").matches("a*c"));
61
+ }
62
+
63
+ </script>
64
+ </head>
65
+ <body>PatternMatcher Tests</body>
66
+ </html>
@@ -0,0 +1,412 @@
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>BrowserBot 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="/htmlutils.js"></script>
28
+ <script language="JavaScript" type="text/javascript" src="/selenium-executionloop.js"></script>
29
+ <script language="JavaScript" type="text/javascript" src="/selenium-api.js"></script>
30
+ <script language="JavaScript" type="text/javascript">
31
+ function setUp() {
32
+ mockPageBot = new Mock();
33
+
34
+ mockBrowserBot = new Mock();
35
+ mockBrowserBot.getCurrentPage = function() { return mockPageBot; };
36
+
37
+ selenium = new Selenium(mockBrowserBot);
38
+ assertEquals(mockPageBot, selenium.page());
39
+ }
40
+
41
+ function verifyMocks() {
42
+ mockBrowserBot.verify();
43
+ mockPageBot.verify();
44
+ }
45
+
46
+ // Tests for Element actions
47
+ function testClickElementWithoutCallback() {
48
+ mockPageBot.expects("findElement", "id").returns("elementToClick");
49
+ mockPageBot.expects("clickElement", "elementToClick");
50
+
51
+ selenium.doClick("id");
52
+ verifyMocks();
53
+ }
54
+
55
+ function testType() {
56
+ mockPageBot.expects("findElement", "id").returns("elementToType");
57
+ mockPageBot.expects("replaceText", "elementToType", "new text");
58
+
59
+ selenium.doType("id", "new text");
60
+ verifyMocks();
61
+ }
62
+
63
+ function testSelect() {
64
+ var mockOptionLocatorFactory = new Mock();
65
+ selenium.optionLocatorFactory = mockOptionLocatorFactory;
66
+ var mockSelect = new Mock();
67
+ // The doSelect() method checks the options property exists as a way
68
+ // of ensuring that the element is a Select element. Hence the following expectation.
69
+ mockSelect.expectsProperty("options").returns("some options");
70
+ mockPageBot.expects("findElement", "id").returns(mockSelect);
71
+ var mockOptionLocator = new Mock();
72
+ mockOptionLocatorFactory.expects("fromLocatorString", "Option One").returns(mockOptionLocator);
73
+ var option = new Object();
74
+ mockOptionLocator.expects("findOption", mockSelect).returns(option);
75
+ mockPageBot.expects("selectOption", mockSelect, option);
76
+
77
+ selenium.doSelect("id", "Option One");
78
+ mockOptionLocatorFactory.verify();
79
+ mockOptionLocator.verify();
80
+ mockSelect.verify();
81
+ verifyMocks();
82
+ }
83
+
84
+ // Browser actions
85
+ function testOpen() {
86
+ mockBrowserBot.expects("openLocation", "new/location");
87
+
88
+ selenium.doOpen("new/location");
89
+ verifyMocks();
90
+ }
91
+
92
+ function testSelectWindow() {
93
+ mockBrowserBot.expects("selectWindow", "windowName");
94
+
95
+ selenium.doSelectWindow("windowName");
96
+ verifyMocks();
97
+ }
98
+
99
+ // Verify functions
100
+ function testVerifyLocationSuccess() {
101
+ var mockLocation = {pathname:'http://page/path', search:'?foo=bar'};
102
+ mockPageBot.expectsProperty("location").returns(mockLocation);
103
+ selenium.assertLocation("path");
104
+ selenium.assertLocation("page/path");
105
+ selenium.assertLocation("http://page/path");
106
+ selenium.assertLocation("page/path?foo=bar");
107
+ selenium.assertLocation("http://page/path?foo=bar");
108
+ verifyMocks();
109
+ }
110
+
111
+ function testVerifyLocationFailed() {
112
+ var mockLocation = {pathname:'http://page/path', search:'?foo=bar'};
113
+ mockPageBot.expectsProperty("location").returns(mockLocation);
114
+ assertCallFails("Verify location should have failed",
115
+ function() {selenium.assertLocation("bar");});
116
+ assertCallFails("Verify location should have failed",
117
+ function() {selenium.assertLocation("http://page/");});
118
+ assertCallFails("Verify location should have failed",
119
+ function() {selenium.assertLocation("http://page/path?foo");});
120
+ verifyMocks();
121
+ }
122
+
123
+ function testGetTitleReturnsTheTitle() {
124
+ mockPageBot.expects("title").returns("foo");
125
+ assertEquals("foo", selenium.getTitle());
126
+ verifyMocks();
127
+ }
128
+
129
+ function testGetValueOfText() {
130
+ var mockTextControl = Object();
131
+ mockTextControl.type = "TEXT";
132
+ mockTextControl.value = "the value";
133
+ mockPageBot.expects("findElement", "id").returns(mockTextControl);
134
+
135
+ assertEquals("the value", selenium.getValue("id"));
136
+ verifyMocks();
137
+ }
138
+
139
+ function testGetValueOfCheckbox() {
140
+ var mockControl = Object();
141
+ mockControl.type = "CHECKBOX";
142
+ mockControl.value = "the value";
143
+ mockControl.checked = true;
144
+ mockPageBot.expects("findElement", "id").returns(mockControl);
145
+
146
+ assertEquals("on", selenium.getValue("id"));
147
+ verifyMocks();
148
+ }
149
+
150
+ function testGetText() {
151
+ var mockElement = new Object();
152
+ mockElement.textContent = " foo ";
153
+ mockPageBot.expects("findElement", "id").returns(mockElement);
154
+ assertEquals("foo", selenium.getText("id"));
155
+ verifyMocks();
156
+ }
157
+
158
+ function getMockTable() {
159
+ var mockTable = new Object();
160
+ var row1 = new Object();
161
+ row1.cells = [textCell("foo"), textCell("bar")];
162
+ var row2 = new Object();
163
+ row2.cells = [textCell("fuz"), textCell("buz")];
164
+ mockTable.rows = [row1, row2];
165
+ return mockTable;
166
+ }
167
+
168
+ function textCell(val) {
169
+ var cell = new Object();
170
+ cell.textContent = val;
171
+ return cell;
172
+ }
173
+
174
+ function testGetTableSuccess() {
175
+ mockPageBot.expects("findElement", "table").returns(getMockTable());
176
+ assertEquals("buz", selenium.getTable("table.1.1"));
177
+ verifyMocks();
178
+ }
179
+
180
+ function testGetTableInvalidLocator() {
181
+ assertCallErrors("VerifyTable should have failed for invalid locator",
182
+ function() {selenium.getTable("foo");},
183
+ "Invalid target format. Correct format is tableName.rowNum.columnNum");
184
+ verifyMocks();
185
+ }
186
+
187
+ function testGetTableNoSuchRow() {
188
+ var mockTable = getMockTable();
189
+ mockPageBot.expects("findElement", "table").returns(mockTable);
190
+ assertCallFails("VerifyTable should have failed for no such row",
191
+ function() {selenium.getTable("table.11.0", "bar");},
192
+ "Cannot access row 11 - table has 2 rows");
193
+ verifyMocks();
194
+ }
195
+
196
+ function testGetTableNoSuchColumn() {
197
+ var mockTable = getMockTable();
198
+ mockPageBot.expects("findElement", "table").returns(mockTable);
199
+ assertCallFails("VerifyTable should have failed for no such column",
200
+ function() {selenium.getTable("table.0.11", "bar");},
201
+ "Cannot access column 11 - table row has 2 columns");
202
+ verifyMocks();
203
+ }
204
+
205
+ function testVerifyTextPresentSuccess() {
206
+ mockPageBot.expects("bodyText").returns("this is some foo text");
207
+ selenium.assertTextPresent("foo");
208
+ verifyMocks();
209
+ }
210
+
211
+ function testVerifyTextPresentFailed() {
212
+ mockPageBot.expects("bodyText").returns("this is some foo text");
213
+
214
+ assertCallFails("Verify text should have failed",
215
+ function() { selenium.assertTextPresent("bar");});
216
+ verifyMocks();
217
+ }
218
+
219
+ function testVerifyElementPresentSuccess() {
220
+ mockPageBot.expects("findElement", "id").returns("foo");
221
+ selenium.assertElementPresent("id");
222
+ verifyMocks();
223
+ }
224
+
225
+ function testVerifyElementPresentFailure() {
226
+ mockPageBot.expects("findElement", "id").andThrows("foo");
227
+
228
+ assertCallFails("VerifyElementPresent should have failed",
229
+ function() {selenium.assertElementPresent("id");});
230
+ verifyMocks();
231
+ }
232
+
233
+ function testVerifyElementNotPresentSuccess() {
234
+ mockPageBot.expects("findElement", "id").andThrows("foo");
235
+ selenium.assertElementNotPresent("id");
236
+ verifyMocks();
237
+ }
238
+
239
+ function testGetAllButtonsShouldCallPageBot() {
240
+ mockPageBot.expects("getAllButtons").returns("foo");
241
+ selenium.getAllButtons();
242
+ verifyMocks();
243
+ }
244
+
245
+ function testGetAllFieldsShouldCallPageBot() {
246
+ mockPageBot.expects("getAllFields").returns("foo");
247
+ selenium.getAllFields();
248
+ verifyMocks();
249
+ }
250
+
251
+ function testGetAllLinksShouldCallPageBot() {
252
+ mockPageBot.expects("getAllLinks").returns("foo");
253
+ selenium.getAllLinks();
254
+ verifyMocks();
255
+ }
256
+
257
+ function testVerifyElementNotPresentFailure() {
258
+ mockPageBot.expects("findElement", "id").returns("foo");
259
+
260
+ assertCallFails("VerifyElementNotPresent should have failed",
261
+ function() { selenium.assertElementNotPresent("id"); });
262
+ verifyMocks();
263
+ }
264
+
265
+ function testShouldFailIfTryToGetAlertWhenThereAreNone() {
266
+ mockBrowserBot.expects("hasAlerts").returns(false);
267
+
268
+ assertCallFails("getAlert should have failed",
269
+ function() {selenium.getAlert(); },
270
+ "There were no alerts");
271
+
272
+ verifyMocks();
273
+ }
274
+
275
+ function testGetAlertReturnsNextAlert() {
276
+ mockBrowserBot.expects("hasAlerts").returns(true);
277
+ mockBrowserBot.expects("getNextAlert").returns("The real alert");
278
+
279
+ assertEquals("The real alert", selenium.getAlert());
280
+
281
+ verifyMocks();
282
+ }
283
+
284
+ function testShouldFailIfTryToVerifyConfirmationWhenThereAreNone() {
285
+ mockBrowserBot.expects("hasConfirmations").returns(false);
286
+
287
+ assertCallFails("verifyConfirmation should have failed",
288
+ function() {selenium.getConfirmation();},
289
+ "There were no confirmations");
290
+
291
+ verifyMocks();
292
+ }
293
+
294
+ function testGetConfirmationReturnsNextConfirmation() {
295
+ mockBrowserBot.expects("hasConfirmations").returns(true);
296
+ mockBrowserBot.expects("getNextConfirmation").returns("The real confirmation");
297
+
298
+ assertEquals("The real confirmation", selenium.getConfirmation());
299
+
300
+ verifyMocks();
301
+ }
302
+
303
+ function testShouldTellBroswerBotIfAskedToCancelNextConfirmation() {
304
+ mockBrowserBot.expects("cancelNextConfirmation");
305
+ selenium.doChooseCancelOnNextConfirmation();
306
+ verifyMocks();
307
+ }
308
+
309
+ function testVerifySelectedSuccess() {
310
+ var mockTextControl = Object();
311
+ mockTextControl.selectedIndex = 1;
312
+ mockTextControl.options = [{text: "option0"},{text: "option1"},{text: "option2"}];
313
+ mockPageBot.expects("findElement", "id").returns(mockTextControl);
314
+
315
+ selenium.assertSelected("id", "option1");
316
+ verifyMocks();
317
+ }
318
+
319
+ function testVerifySelectedFailed() {
320
+ var mockTextControl = Object();
321
+ mockTextControl.selectedIndex = 1;
322
+ mockTextControl.options = [{text: "option0"},{text: "option1"},{text: "option2"}];
323
+ mockPageBot.expects("findElement", "id").returns(mockTextControl);
324
+
325
+ assertCallFails("Verify selected should have failed.",
326
+ function() {selenium.assertSelected("id", "option2");});
327
+ verifyMocks();
328
+ }
329
+
330
+ function testVerifySelectOptionsSuccess() {
331
+ var mockTextControl = Object();
332
+ mockTextControl.options = [{text: "option0"},{text: "option1"},{text: "option2"}];
333
+ mockPageBot.expects("findElement", "id").returns(mockTextControl);
334
+
335
+ selenium.assertSelectOptions("id", "option0,option1,option2");
336
+ verifyMocks();
337
+ }
338
+
339
+ function testVerifySelectOptionsFailed() {
340
+ var mockTextControl = Object();
341
+ mockTextControl.options = [{text: "option0"},{text: "option1"},{text: "option2"}];
342
+ mockPageBot.expects("findElement", "id").returns(mockTextControl);
343
+
344
+ assertCallFails("Verify select options failed.",
345
+ function() { selenium.assertSelectOptions("id", "option0"); });
346
+ verifyMocks();
347
+ }
348
+
349
+ function testVerifySelectOptionsWithCommasEscaped() {
350
+ var mockTextControl = Object();
351
+ mockTextControl.options = [{text: "option,0"},{text: "option.1"}];
352
+ mockPageBot.expects("findElement", "id").returns(mockTextControl);
353
+
354
+ selenium.assertSelectOptions("id", "option\\,0,option.1");
355
+ verifyMocks();
356
+ }
357
+
358
+ function testGetAttributeWithId() {
359
+ mockPageBot.expects("findAttribute", "id@attribute").returns("foo");
360
+
361
+ assertEquals("foo", selenium.getAttribute("id@attribute"));
362
+ verifyMocks();
363
+ }
364
+
365
+
366
+ function testWaitForCreatesWaitForConditionOnTestLoop() {
367
+ var mockElement = new Object();
368
+ mockElement.value = "oldValue";
369
+ mockPageBot.expects("findElement", "id").returns(mockElement);
370
+ testLoop = new Object();
371
+
372
+ assertEquals(undefined, testLoop.waitForCondition);
373
+
374
+ selenium.doWaitForValue("id", "newValue");
375
+
376
+ assertNotEquals(undefined, testLoop.waitForCondition);
377
+ assertFalse("Wait condition should not yet be true",
378
+ testLoop.waitForCondition());
379
+ mockElement.value = "newValue";
380
+ assertTrue( "Wait condition should now be true",
381
+ testLoop.waitForCondition());
382
+ }
383
+
384
+ function assertCallFails(message, theCall, expectedFailureMessage) {
385
+ try {
386
+ theCall();
387
+ } catch (e) {
388
+ if (!e.isAssertionFailedError) {
389
+ throw e;
390
+ }
391
+ if (expectedFailureMessage) {
392
+ assertEquals(expectedFailureMessage, e.failureMessage);
393
+ }
394
+ return;
395
+ }
396
+ fail(message);
397
+ }
398
+ function assertCallErrors(message, theCall, expectedFailureMessage) {
399
+ try {
400
+ theCall();
401
+ } catch (e) {
402
+ if (expectedFailureMessage) {
403
+ assertEquals(expectedFailureMessage, e.message);
404
+ }
405
+ return;
406
+ }
407
+ fail(message);
408
+ }
409
+ </script>
410
+ </head>
411
+ <body>Selenium API Tests</body>
412
+ </html>