[prev in list] [next in list] [prev in thread] [next in thread] 

List:       selenium-commits
Subject:    [Selenium-commits] [613] trunk/code/javascript: Apply Alexander
From:       mdub () codehaus ! org
Date:       2005-08-24 12:39:36
Message-ID: 20050824123936.11907.qmail () codehaus ! org
[Download RAW message or body]

[Attachment #2 (text/html)]

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><style type="text/css"><!--
body {background:#ffffff;font-family:Verdana,Helvetica,Arial,sans-serif;}
h3 {margin:15px 0;padding:0;line-height:0;}
#msg {margin: 0 0 2em 0;}
#msg dl, #msg ul, #msg pre {padding:1em;border:1px dashed black;margin: 10px 0 30px \
0;} #msg dl {background:#ccccff;}
#msg pre {background:#ffffcc;}
#msg ul {background:#cc99ff;list-style:none;}
#msg dt {font-weight:bold;float:left;width: 6em;}
#msg dt:after { content:':';}
#patch h4 {padding: 0 \
10px;line-height:1.5em;margin:0;background:#ccffff;border-bottom:1px solid \
black;margin:0 0 10px 0;} #patch .propset h4, #patch .binary h4 {margin: 0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {background:#eeeeee;padding: 0 0 10px 0;}
#patch .propset .diff, #patch .binary .diff  {padding: 10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary \
{border:1px solid black;margin:10px 0;} #patch .add {background:#ddffdd;}
#patch .rem {background:#ffdddd;}
#patch .lines, .info {color:#888888;background:#ffffff;}
--></style>
<title>[613] trunk/code/javascript: Apply Alexander Dvoretskiy's patch implementing \
support for window.prompt().</title> </head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd>613</dd>
<dt>Author</dt> <dd>mdub</dd>
<dt>Date</dt> <dd>2005-08-24 08:39:36 -0400 (Wed, 24 Aug 2005)</dd>
</dl>

<h3>Log Message</h3>
<pre>Apply Alexander Dvoretskiy's patch implementing support for window.prompt().
Closes SEL-141.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkcodejavascriptseleniumapijs">trunk/code/javascript/selenium-api.js</a></li>
 <li><a href="#trunkcodejavascriptseleniumbrowserbotjs">trunk/code/javascript/selenium-browserbot.js</a></li>
 <li><a href="#trunkcodejavascripttestsTestSuiteInternetExplorerhtml">trunk/code/javascript/tests/TestSuite-InternetExplorer.html</a></li>
 <li><a href="#trunkcodejavascripttestsTestSuiteKonquerorhtml">trunk/code/javascript/tests/TestSuite-Konqueror.html</a></li>
 <li><a href="#trunkcodejavascripttestsTestSuiteSafarihtml">trunk/code/javascript/tests/TestSuite-Safari.html</a></li>
 <li><a href="#trunkcodejavascripttestsTestSuitehtml">trunk/code/javascript/tests/TestSuite.html</a></li>
 </ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkcodejavascripttestsTestPromptinghtml">trunk/code/javascript/tests/TestPrompting.html</a></li>
 <li><a href="#trunkcodejavascripttestshtmltest_prompthtml">trunk/code/javascript/tests/html/test_prompt.html</a></li>
 </ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkcodejavascriptseleniumapijs"></a>
<div class="modfile"><h4>Modified: trunk/code/javascript/selenium-api.js (612 => \
613)</h4> <pre class="diff">
<span class="info">--- trunk/code/javascript/selenium-api.js	2005-08-24 10:35:26 UTC \
                (rev 612)
+++ trunk/code/javascript/selenium-api.js	2005-08-24 12:39:36 UTC (rev 613)
</span><span class="lines">@@ -99,6 +99,13 @@
</span><span class="cx"> };
 
 /*
</span><span class="add">+ * Instruct Selenium what to answear on the next prompt \
dialog it encounters + */
+Selenium.prototype.doAnswerOnNextPrompt = function(answer) {
+    this.browserbot.setNextPromptResult(answer);
+};
+
+/*
</span><span class="cx">  * Simulate the browser back button
  */
 Selenium.prototype.doGoBack = function() {
</span><span class="lines">@@ -149,6 +156,20 @@
</span><span class="cx"> };
  
 /*
</span><span class="add">+ * Asserts that the supplied message was received as a \
prompt + */
+Selenium.prototype.assertPrompt = function(promptPattern) {
+    if (this.browserbot.hasPrompts()) {
+        receivedPrompt = this.browserbot.getNextPrompt();
+        if (! PatternMatcher.matches(promptPattern, receivedPrompt)) {
+            Assert.fail(&quot;The prompt message was [&quot; + receivedPrompt + \
&quot;]&quot;); +         }
+    } else {
+        Assert.fail(&quot;There were no prompts&quot;);
+    }
+};
+
+/*
</span><span class="cx">  * Verify the location of the current page.
  */
 Selenium.prototype.assertAbsoluteLocation = function(expectedLocation) {
</span></pre></div>
<a id="trunkcodejavascriptseleniumbrowserbotjs"></a>
<div class="modfile"><h4>Modified: trunk/code/javascript/selenium-browserbot.js (612 \
=> 613)</h4> <pre class="diff">
<span class="info">--- trunk/code/javascript/selenium-browserbot.js	2005-08-24 \
                10:35:26 UTC (rev 612)
+++ trunk/code/javascript/selenium-browserbot.js	2005-08-24 12:39:36 UTC (rev 613)
</span><span class="lines">@@ -50,8 +50,10 @@
</span><span class="cx">     this.modalDialogTest = null;
     this.recordedAlerts = new Array();
     this.recordedConfirmations = new Array();
</span><span class="add">+    this.recordedPrompts = new Array();
</span><span class="cx">     this.openedWindows = {};
     this.nextConfirmResult = true;
</span><span class="add">+    this.nextPromptResult = '';
</span><span class="cx">     this.newPageLoaded = false;
 
     var self = this;
</span><span class="lines">@@ -95,6 +97,10 @@
</span><span class="cx">     this.nextConfirmResult = false;
 };
 
</span><span class="add">+BrowserBot.prototype.setNextPromptResult = function(result) \
{ +    this.nextPromptResult = result;
+};
+
</span><span class="cx"> BrowserBot.prototype.hasAlerts = function() {
     return (this.recordedAlerts.length &gt; 0) ;
 };
</span><span class="lines">@@ -111,7 +117,14 @@
</span><span class="cx">     return this.recordedConfirmations.shift();
 };
 
</span><span class="add">+BrowserBot.prototype.hasPrompts = function() {
+    return (this.recordedPrompts.length &gt; 0) ;
+};
</span><span class="cx"> 
</span><span class="add">+BrowserBot.prototype.getNextPrompt = function() {
+    return this.recordedPrompts.shift();
+};
+
</span><span class="cx"> BrowserBot.prototype.getFrame = function() {
     return this.frame;
 };
</span><span class="lines">@@ -164,6 +177,14 @@
</span><span class="cx">         return result;
     };
 
</span><span class="add">+    windowToModify.prompt = function(message) {
+        browserBot.recordedPrompts.push(message);
+        var result = !browserBot.nextConfirmResult ? null : \
browserBot.nextPromptResult; +        browserBot.nextConfirmResult = true;
+        browserBot.nextPromptResult = '';
+        return result;
+    };
+
</span><span class="cx">     // Keep a reference to all popup windows by name
     // note that in IE the &quot;windowName&quot; argument must be a valid \
javascript identifier, it seems.  var originalOpen = windowToModify.open;
</span></pre></div>
<a id="trunkcodejavascripttestsTestPromptinghtml"></a>
<div class="addfile"><h4>Added: trunk/code/javascript/tests/TestPrompting.html (612 \
=> 613)</h4> <pre class="diff">
<span class="info">--- trunk/code/javascript/tests/TestPrompting.html	2005-08-24 \
                10:35:26 UTC (rev 612)
+++ trunk/code/javascript/tests/TestPrompting.html	2005-08-24 12:39:36 UTC (rev 613)
</span><span class="lines">@@ -0,0 +1,82 @@
</span><span class="add">+&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01 \
Transitional//EN&quot;&gt; +&lt;!--
+Copyright 2004 ThoughtWorks, Inc
+
+ Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+--&gt;
+&lt;html&gt;
+&lt;head&gt;
+  &lt;meta content=&quot;text/html; charset=ISO-8859-1&quot;
+ http-equiv=&quot;content-type&quot;&gt;
+  &lt;title&gt;Test Prompting Verifification&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;table cellpadding=&quot;1&quot; cellspacing=&quot;1&quot; \
border=&quot;1&quot;&gt; +  &lt;tbody&gt;
+    &lt;tr&gt;
+      &lt;td rowspan=&quot;1&quot; colspan=&quot;3&quot;&gt;Test verify \
Prompting&lt;br&gt; +      &lt;/td&gt;
+    &lt;/tr&gt;
+
+    &lt;tr&gt;
+      &lt;td&gt;open&lt;/td&gt;
+      &lt;td&gt;./tests/html/test_prompt.html&lt;/td&gt;
+      &lt;td&gt;&amp;nbsp;&lt;/td&gt;
+    &lt;/tr&gt;
+    &lt;tr&gt;
+      &lt;td&gt;answerOnNextPrompt&lt;/td&gt;
+      &lt;td&gt;no&lt;/td&gt;
+      &lt;td&gt;&lt;/td&gt;
+    &lt;/tr&gt;
+    &lt;tr&gt;
+      &lt;td&gt;click&lt;/td&gt;
+      &lt;td&gt;promptAndLeave&lt;/td&gt;
+      &lt;td&gt;&lt;/td&gt;
+    &lt;/tr&gt;
+    &lt;tr&gt;
+      &lt;td&gt;verifyPrompt&lt;/td&gt;
+      &lt;td&gt;Type 'yes' and click OK&lt;/td&gt;
+      &lt;td&gt;&lt;/td&gt;
+    &lt;/tr&gt;
+    &lt;tr&gt;
+      &lt;td&gt;verifyTitle&lt;/td&gt;
+      &lt;td&gt;Test Prompt&lt;/td&gt;
+      &lt;td&gt;&lt;/td&gt;
+    &lt;/tr&gt;
+    &lt;tr&gt;
+      &lt;td&gt;answerOnNextPrompt&lt;/td&gt;
+      &lt;td&gt;yes&lt;/td&gt;
+      &lt;td&gt;&lt;/td&gt;
+    &lt;/tr&gt;
+    &lt;tr&gt;
+      &lt;td&gt;clickAndWait&lt;/td&gt;
+      &lt;td&gt;promptAndLeave&lt;/td&gt;
+      &lt;td&gt;&lt;/td&gt;
+    &lt;/tr&gt;
+    &lt;tr&gt;
+      &lt;td&gt;verifyPrompt&lt;/td&gt;
+      &lt;td&gt;*'yes'*&lt;/td&gt;
+      &lt;td&gt;&lt;/td&gt;
+    &lt;/tr&gt;
+
+    &lt;tr&gt;
+      &lt;td&gt;verifyTitle&lt;/td&gt;
+      &lt;td&gt;Dummy Page&lt;/td&gt;
+      &lt;td&gt;&lt;/td&gt;
+    &lt;/tr&gt;
+
+
+  &lt;/tbody&gt;
+&lt;/table&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</span><span class="cx">Property changes on: \
trunk/code/javascript/tests/TestPrompting.html \
                ___________________________________________________________________
Name: svn:eol-style
   + native
</span></pre></div>
<a id="trunkcodejavascripttestsTestSuiteInternetExplorerhtml"></a>
<div class="modfile"><h4>Modified: \
trunk/code/javascript/tests/TestSuite-InternetExplorer.html (612 => 613)</h4> <pre \
class="diff"> <span class="info">--- \
trunk/code/javascript/tests/TestSuite-InternetExplorer.html	2005-08-24 10:35:26 UTC \
                (rev 612)
+++ trunk/code/javascript/tests/TestSuite-InternetExplorer.html	2005-08-24 12:39:36 \
UTC (rev 613) </span><span class="lines">@@ -57,6 +57,7 @@
</span><span class="cx">             &lt;tr&gt;&lt;td&gt;&lt;a \
href=&quot;./TestFocusOnBlur.html&quot;&gt;TestFocusOnBlur&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
                
             &lt;tr&gt;&lt;td&gt;&lt;a \
href=&quot;./TestVerifyAlerts.html&quot;&gt;TestVerifyAlerts&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
                
             &lt;tr&gt;&lt;td&gt;&lt;a \
href=&quot;./TestConfirmations.html&quot;&gt;TestVerifyConfirmations&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
 </span><span class="add">+            &lt;tr&gt;&lt;td&gt;&lt;a \
href=&quot;./TestPrompting.html&quot;&gt;TestVerifyPrompt&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
 </span><span class="cx">             &lt;tr&gt;&lt;td&gt;&lt;a \
href=&quot;./TestVisibility.html&quot;&gt;TestVisibility&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
                
             &lt;tr&gt;&lt;td&gt;&lt;a \
href=&quot;./TestVerifyEditable.html&quot;&gt;TestVerifyEditable&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
  
</span></pre></div>
<a id="trunkcodejavascripttestsTestSuiteKonquerorhtml"></a>
<div class="modfile"><h4>Modified: \
trunk/code/javascript/tests/TestSuite-Konqueror.html (612 => 613)</h4> <pre \
class="diff"> <span class="info">--- \
trunk/code/javascript/tests/TestSuite-Konqueror.html	2005-08-24 10:35:26 UTC (rev \
                612)
+++ trunk/code/javascript/tests/TestSuite-Konqueror.html	2005-08-24 12:39:36 UTC (rev \
613) </span><span class="lines">@@ -57,6 +57,7 @@
</span><span class="cx">             &lt;tr&gt;&lt;td&gt;&lt;a \
href=&quot;./TestFocusOnBlur.html&quot;&gt;TestFocusOnBlur&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
                
             &lt;tr&gt;&lt;td&gt;&lt;a \
href=&quot;./TestVerifyAlerts.html&quot;&gt;TestVerifyAlerts&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
                
             &lt;tr&gt;&lt;td&gt;&lt;a \
href=&quot;./TestConfirmations.html&quot;&gt;TestVerifyConfirmations&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
 </span><span class="add">+            &lt;tr&gt;&lt;td&gt;&lt;a \
href=&quot;./TestPrompting.html&quot;&gt;TestVerifyPrompt&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
 </span><span class="cx"> &lt;!--            &lt;tr&gt;&lt;td&gt;&lt;a \
href=&quot;./TestVisibility.html&quot;&gt;TestVisibility&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;--&gt;
                
             &lt;tr&gt;&lt;td&gt;&lt;a \
href=&quot;./TestVerifyEditable.html&quot;&gt;TestVerifyEditable&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
  
</span></pre></div>
<a id="trunkcodejavascripttestsTestSuiteSafarihtml"></a>
<div class="modfile"><h4>Modified: trunk/code/javascript/tests/TestSuite-Safari.html \
(612 => 613)</h4> <pre class="diff">
<span class="info">--- trunk/code/javascript/tests/TestSuite-Safari.html	2005-08-24 \
                10:35:26 UTC (rev 612)
+++ trunk/code/javascript/tests/TestSuite-Safari.html	2005-08-24 12:39:36 UTC (rev \
613) </span><span class="lines">@@ -57,6 +57,7 @@
</span><span class="cx">             &lt;tr&gt;&lt;td&gt;&lt;a \
href=&quot;./TestFocusOnBlur.html&quot;&gt;TestFocusOnBlur&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
                
             &lt;tr&gt;&lt;td&gt;&lt;a \
href=&quot;./TestVerifyAlerts.html&quot;&gt;TestVerifyAlerts&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
                
             &lt;tr&gt;&lt;td&gt;&lt;a \
href=&quot;./TestConfirmations.html&quot;&gt;TestVerifyConfirmations&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
 </span><span class="add">+            &lt;tr&gt;&lt;td&gt;&lt;a \
href=&quot;./TestPrompting.html&quot;&gt;TestVerifyPrompt&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
 </span><span class="cx"> &lt;!--            &lt;tr&gt;&lt;td&gt;&lt;a \
href=&quot;./TestVisibility.html&quot;&gt;TestVisibility&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;--&gt;
                
             &lt;tr&gt;&lt;td&gt;&lt;a \
href=&quot;./TestVerifyEditable.html&quot;&gt;TestVerifyEditable&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
  
</span></pre></div>
<a id="trunkcodejavascripttestsTestSuitehtml"></a>
<div class="modfile"><h4>Modified: trunk/code/javascript/tests/TestSuite.html (612 => \
613)</h4> <pre class="diff">
<span class="info">--- trunk/code/javascript/tests/TestSuite.html	2005-08-24 10:35:26 \
                UTC (rev 612)
+++ trunk/code/javascript/tests/TestSuite.html	2005-08-24 12:39:36 UTC (rev 613)
</span><span class="lines">@@ -57,6 +57,7 @@
</span><span class="cx">             &lt;tr&gt;&lt;td&gt;&lt;a \
href=&quot;./TestFocusOnBlur.html&quot;&gt;TestFocusOnBlur&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
                
             &lt;tr&gt;&lt;td&gt;&lt;a \
href=&quot;./TestVerifyAlerts.html&quot;&gt;TestVerifyAlerts&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
                
             &lt;tr&gt;&lt;td&gt;&lt;a \
href=&quot;./TestConfirmations.html&quot;&gt;TestVerifyConfirmations&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
 </span><span class="add">+            &lt;tr&gt;&lt;td&gt;&lt;a \
href=&quot;./TestPrompting.html&quot;&gt;TestVerifyPrompt&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
 </span><span class="cx">             &lt;tr&gt;&lt;td&gt;&lt;a \
href=&quot;./TestVisibility.html&quot;&gt;TestVisibility&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
                
             &lt;tr&gt;&lt;td&gt;&lt;a \
href=&quot;./TestVerifyEditable.html&quot;&gt;TestVerifyEditable&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
  
</span></pre></div>
<a id="trunkcodejavascripttestshtmltest_prompthtml"></a>
<div class="addfile"><h4>Added: trunk/code/javascript/tests/html/test_prompt.html \
(612 => 613)</h4> <pre class="diff">
<span class="info">--- trunk/code/javascript/tests/html/test_prompt.html	2005-08-24 \
                10:35:26 UTC (rev 612)
+++ trunk/code/javascript/tests/html/test_prompt.html	2005-08-24 12:39:36 UTC (rev \
613) </span><span class="lines">@@ -0,0 +1,34 @@
</span><span class="add">+&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 \
Transitional//EN&quot;&gt; +&lt;html&gt;
+&lt;head&gt;
+&lt;!--
+Copyright 2004 ThoughtWorks, Inc
+
+ Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+--&gt;
+  &lt;script type=&quot;text/javascript&quot;&gt;
+
+  function confirmLeaving() {
+    if (prompt(&quot;Type 'yes' and click OK&quot;) == 'yes') {
+        document.location = &quot;test_dummy_page.html&quot;;
+    }
+ }
+
+  &lt;/script&gt;
+  &lt;title&gt;Test Prompt&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;img style=&quot;width: 644px; height: 41px;&quot; alt=&quot;banner&quot; \
src=&quot;banner.gif&quot;&gt;&lt;br&gt; +&lt;a id=&quot;promptAndLeave&quot; \
href=&quot;javascript:confirmLeaving();&quot;&gt;click to navigate to a new \
page&lt;/a&gt; +&lt;/body&gt;
+&lt;/html&gt;
</span><span class="cx">Property changes on: \
trunk/code/javascript/tests/html/test_prompt.html \
                ___________________________________________________________________
Name: svn:eol-style
   + native
</span>
</pre>
</div>
</div>

</body>
</html>



_______________________________________________
Selenium-commits mailing list
Selenium-commits@lists.public.thoughtworks.org
http://lists.public.thoughtworks.org/mailman/listinfo/selenium-commits


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic