[Zope3-checkins] SVN: Zope3/branches/benji-testbrowser-with-real-browsers-take-3/src/zope/testbrowser/real/ checkpoint work-in-progress

Benji York benji at zope.com
Sun Aug 20 16:03:52 EDT 2006


Log message for revision 69706:
  checkpoint work-in-progress
  

Changed:
  U   Zope3/branches/benji-testbrowser-with-real-browsers-take-3/src/zope/testbrowser/real/__resources__/commands.js
  U   Zope3/branches/benji-testbrowser-with-real-browsers-take-3/src/zope/testbrowser/real/__resources__/start.html
  U   Zope3/branches/benji-testbrowser-with-real-browsers-take-3/src/zope/testbrowser/real/proxy.py

-=-
Modified: Zope3/branches/benji-testbrowser-with-real-browsers-take-3/src/zope/testbrowser/real/__resources__/commands.js
===================================================================
--- Zope3/branches/benji-testbrowser-with-real-browsers-take-3/src/zope/testbrowser/real/__resources__/commands.js	2006-08-20 19:00:39 UTC (rev 69705)
+++ Zope3/branches/benji-testbrowser-with-real-browsers-take-3/src/zope/testbrowser/real/__resources__/commands.js	2006-08-20 20:03:52 UTC (rev 69706)
@@ -1,17 +1,16 @@
+_tb_remembered_links = [];
+
 function log(msg) {
-    top.frames['log_frame'].document.write(msg + '<br />');
+//    top.frames['log_frame'].document.write(msg + '<br />');
 }
 
 function _tb_open(info) {
-    log('open '+info[0]);
-    _tb_remembered_links = [];
-    top.frames[0].location = info[0];
-    return '_tb_WAIT_FOR_PAGE_LOAD';
+    selenium.doOpen(info[0]);
+    selenium.doWaitForPageToLoad(10000);
 }
 
 function _tb_stop(info) {
     should_stop = true;
-    top.frames['log_frame'].document.close();
 }
 
 function _tb_getContents(info) {
@@ -24,7 +23,7 @@
 }
 
 function _tb_getUrl(info) {
-    return top.frames[0].location.href;
+    return selenium.getLocation().href;
 }
 
 function _tb_reload(info) {
@@ -82,13 +81,13 @@
     element.value = value; // XXX need to handle different ways of setting value
 }
 
+function locateElementByRememberdLink(locator, doc) {
+    var n = Number(locator);
+    return _tb_remembered_links[n];
+}
+
 function _tb_clickRememberedLink(info) {
-    log(info);
-    var n = info[0];
-    var element = _tb_remembered_links[n];
-    log(element);
-    _tb_click(element);
-    return '_tb_WAIT_FOR_PAGE_LOAD';
+    selenium.doClick('rememberedlink=' + info[0]);
 }
 
 //function _tb_doEvent(element, type) {

Modified: Zope3/branches/benji-testbrowser-with-real-browsers-take-3/src/zope/testbrowser/real/__resources__/start.html
===================================================================
--- Zope3/branches/benji-testbrowser-with-real-browsers-take-3/src/zope/testbrowser/real/__resources__/start.html	2006-08-20 19:00:39 UTC (rev 69705)
+++ Zope3/branches/benji-testbrowser-with-real-browsers-take-3/src/zope/testbrowser/real/__resources__/start.html	2006-08-20 20:03:52 UTC (rev 69706)
@@ -1,14 +1,55 @@
-<!doctype html public "-//w3c//dtd html 4.01 fRAMESET//en"
-   "HTTP://WWW.W3.ORG/tr/HTML4/FRAMESET.DTD">
 <html>
 <head>
   <title>zope.testbrowser Start Page</title>
+  <script type="text/javascript" src="/__resources__/commands.js"></script>
+<!--How many of these do I really need?-->
+  <script type="text/javascript" src="/selenium/scripts/narcissus-defs.js"></script>
+  <script type="text/javascript" src="/selenium/scripts/narcissus-parse.js"></script>
+  <script type="text/javascript" src="/selenium/scripts/narcissus-exec.js"></script>
+  <script language="JavaScript" type="text/javascript" src="/selenium/scripts/prototype-1.4.0.js"></script>
+  <script language="JavaScript" type="text/javascript" src="/selenium/lib/cssQuery.js"></script>
+  <script language="JavaScript" type="text/javascript" src="/selenium/lib/cssQuery-standard.js"></script>
+  <script language="JavaScript" type="text/javascript" src="/selenium/lib/cssQuery-level2.js"></script>
+  <script language="JavaScript" type="text/javascript" src="/selenium/lib/cssQuery-level3.js"></script>
+  <script language="JavaScript" type="text/javascript" src="/selenium/scripts/selenium-browserdetect.js"></script>
+  <script language="JavaScript" type="text/javascript" src="/selenium/scripts/selenium-browserbot.js"></script>
+  <script language="JavaScript" type="text/javascript" src="/selenium/scripts/find_matching_child.js"></script>
+  <script language="JavaScript" type="text/javascript" src="/selenium/scripts/selenium-api.js"></script>
+  <script language="JavaScript" type="text/javascript" src="/selenium/scripts/selenium-commandhandlers.js"></script>
+  <script language="JavaScript" type="text/javascript" src="/selenium/scripts/selenium-executionloop.js"></script>
+  <script language="JavaScript" type="text/javascript" src="/selenium/scripts/selenium-testrunner.js"></script>
+  <script language="JavaScript" type="text/javascript" src="/selenium/scripts/selenium-logging.js"></script>
+  <script language="JavaScript" type="text/javascript" src="/selenium/scripts/selenium-version.js"></script>
+  <script language="JavaScript" type="text/javascript" src="/selenium/scripts/htmlutils.js"></script>
+  <script language="JavaScript" type="text/javascript" src="/selenium/xpath/misc.js"></script>
+  <script language="JavaScript" type="text/javascript" src="/selenium/xpath/dom.js"></script>
+  <script language="JavaScript" type="text/javascript" src="/selenium/xpath/xpath.js"></script>
+<!--  <script language="JavaScript" type="text/javascript" src="/selenium/scripts/user-extensions.js"></script>-->
+
+<!--Here are the testbrowser files.-->
   <script type="text/javascript" src="/__resources__/MochiKit/MochiKit.js"></script>
   <script type="text/javascript" src="/__resources__/shim.js"></script>
-  <script type="text/javascript" src="/__resources__/commands.js"></script>
+
+  <script language="JavaScript" type="text/javascript">
+function init() {
+  var _tb_app_frame = document.getElementById('aut_frame');
+  selenium = Selenium.createForFrame(_tb_app_frame);
+  selenium.page().locationStrategies['rememberedlink'] = locateElementByRememberdLink;
+}
+  </script>
 </head>
-<frameset rows="80%, 20%" border="1">
-    <frame src="about:blank" onload="_tb_onloadFunc();" />
-    <frame src="about:blank" name="log_frame" />
-</frameset>
+<body onload="init()">
+  <table border="0" style="width: 100%; height: 100%;">
+    <tr>
+      <td>
+        <h1>zope.testbrowser</h1>
+      </td>
+    </tr>
+    <tr>
+      <td height="90%">
+        <iframe name="aut_frame" id="aut_frame" src="" height="100%" width="100%"></iframe>
+      </td>
+    </tr>
+  </table>
+</body>
 </html>

Modified: Zope3/branches/benji-testbrowser-with-real-browsers-take-3/src/zope/testbrowser/real/proxy.py
===================================================================
--- Zope3/branches/benji-testbrowser-with-real-browsers-take-3/src/zope/testbrowser/real/proxy.py	2006-08-20 19:00:39 UTC (rev 69705)
+++ Zope3/branches/benji-testbrowser-with-real-browsers-take-3/src/zope/testbrowser/real/proxy.py	2006-08-20 20:03:52 UTC (rev 69706)
@@ -57,23 +57,25 @@
         return True
 
     def sendFile(self, path):
-        assert path.startswith('/')
+        # XXX need to make sure this is secure
         path = path[1:]
-        assert path.split('/')[1] in allowed_resources
         # XXX might use too much memory
         self.wfile.write(open(os.path.join(base_dir, path)).read())
 
     def handleRequest(self):
+#        print self.path
         (scheme, netloc, path, params, query, fragment) = urlparse.urlparse(
             self.path, 'http')
         assert netloc == ''
-#        print self.path
         if scheme != 'http':
             self.send_error(400, "unknown scheme %r" % scheme)
             return
         self.log_request()
 
         if self.command in ('GET', 'POST'):
+            if path.startswith('/selenium/'):
+                self.sendFile(path)
+                return
             if path.startswith('/__resources__/'):
                 self.sendFile(path)
                 return



More information about the Zope3-Checkins mailing list