Author: reebalazs
Date: Fri Dec 7 19:10:53 2007
New Revision: 49530
Added:
kukit/kss.demo/branch/kss-zope-transition/kss/demo/browser/kss_demo_suite.pt
- copied unchanged from r49525,
kukit/kss.demo/trunk/kss/demo/browser/kss_demo_suite.pt
kukit/kss.demo/branch/kss-zope-transition/kss/demo/browser/setDevMode.html
- copied unchanged from r49525,
kukit/kss.demo/trunk/kss/demo/browser/setDevMode.html
kukit/kss.demo/branch/kss-zope-transition/kss/demo/browser/setProdMode.html
- copied unchanged from r49525,
kukit/kss.demo/trunk/kss/demo/browser/setProdMode.html
Modified:
kukit/kss.demo/branch/kss-zope-transition/kss/demo/browser/body_macros.pt
kukit/kss.demo/branch/kss-zope-transition/kss/demo/browser/configure-z3.zcml
kukit/kss.demo/branch/kss-zope-transition/kss/demo/browser/configure.zcml
kukit/kss.demo/branch/kss-zope-transition/kss/demo/browser/demo.css
kukit/kss.demo/branch/kss-zope-transition/kss/demo/browser/kss_demo_index.pt
kukit/kss.demo/branch/kss-zope-transition/kss/demo/browser/registry.py
kukit/kss.demo/branch/kss-zope-transition/kss/demo/interfaces.py
Log:
Merge up -r48516:48557 from trunk of kss.demo.
Modified:
kukit/kss.demo/branch/kss-zope-transition/kss/demo/browser/body_macros.pt
==============================================================================
--- kukit/kss.demo/branch/kss-zope-transition/kss/demo/browser/body_macros.pt
(original)
+++ kukit/kss.demo/branch/kss-zope-transition/kss/demo/browser/body_macros.pt
Fri Dec 7 19:10:53 2007
@@ -19,12 +19,12 @@
<p class="kssMode"
tal:define="kss_devel_mode nocall:context/@@kss_devel_mode |
nothing;
devel_mode python: kss_devel_mode and
kss_devel_mode.ison()">
- Kss is in <b>
- <span class="green" tal:condition="devel_mode">development</span>
- <span class="red" tal:condition="not: devel_mode">production</span>
+ KSS is in <b>
+ <span class="development"
tal:condition="devel_mode">development</span>
+ <span class="production" tal:condition="not:
devel_mode">production</span>
</b>
mode.
- <a href="" tal:attributes="href
string:${context/@@absolute_url}/@@kss_devel_mode/ui">Setup</a>
+ <a class="button" href="" tal:attributes="href
string:${context/@@absolute_url}/@@kss_devel_mode/ui">Setup</a>
</p>
</metal:kss_mode>
Modified:
kukit/kss.demo/branch/kss-zope-transition/kss/demo/browser/configure-z3.zcml
==============================================================================
---
kukit/kss.demo/branch/kss-zope-transition/kss/demo/browser/configure-z3.zcml
(original)
+++
kukit/kss.demo/branch/kss-zope-transition/kss/demo/browser/configure-z3.zcml
Fri Dec 7 19:10:53 2007
@@ -8,31 +8,16 @@
Define resources for the demo central
-->
- <!-- Things to do only on Zope2 -->
- <zope:configure zcml:condition="have compat_five">
-
- <page
- for="kss.demo.interfaces.ISimpleContent"
- template="kss_demo_index.pt"
- name="index.html"
- permission="zope.View"
- />
-
- </zope:configure>
-
- <!-- Things to do only on Zope3 -->
- <zope:configure zcml:condition="have compat_not_five">
<page
- for="kss.demo.interfaces.ISimpleContent"
- template="kss_demo_index.pt"
- name="index.html"
- permission="zope.View"
- menu="zmi_views"
- title="View demos"
- />
+ for="kss.demo.interfaces.ISimpleContent"
+ template="kss_demo_index.pt"
+ name="index.html"
+ permission="zope.View"
+ menu="zmi_views"
+ title="View demos"
+ />
- </zope:configure>
<defaultView
for="kss.demo.interfaces.ISimpleContent"
@@ -60,10 +45,24 @@
<!-- View for accessing the utility -->
<page
- for="*"
+ for="kss.demo.interfaces.ISimpleContent"
name="kss_demo_registry"
class=".registry.KSSDemoRegistryView"
- allowed_attributes="getSortedDemos getDemoGroups"
+ allowed_attributes="getSortedDemos getDemoGroups getSeleniumTests"
+ permission="zope.View"
+ />
+ <page
+ for="kss.demo.interfaces.ISimpleContent"
+ name="resource"
+ class=".registry.KSSDemoRegistryView"
+ attribute="getSeleniumTestResource"
+ permission="zope.View"
+ />
+ <page
+ for="kss.demo.interfaces.ISimpleContent"
+ name="zuite.html"
+ class=".registry.KSSDemoRegistryView"
+ attribute="getZuiteHomePage"
permission="zope.View"
/>
@@ -81,5 +80,29 @@
permission="demo.Manager"
/>
+ <!-- Resources for automated selenium tests -->
+
+ <page
+ for="kss.demo.interfaces.ISimpleContent"
+ template="kss_demo_suite.pt"
+ name="suite.html"
+ permission="zope.View"
+ />
+
+ <page
+ for="kss.demo.interfaces.ISimpleContent"
+ template="setDevMode.html"
+ name="setDevMode.html"
+ permission="zope.View"
+ />
+
+ <page
+ for="kss.demo.interfaces.ISimpleContent"
+ template="setProdMode.html"
+ name="setProdMode.html"
+ permission="zope.View"
+ />
+
+
</configure>
Modified:
kukit/kss.demo/branch/kss-zope-transition/kss/demo/browser/configure.zcml
==============================================================================
--- kukit/kss.demo/branch/kss-zope-transition/kss/demo/browser/configure.zcml
(original)
+++ kukit/kss.demo/branch/kss-zope-transition/kss/demo/browser/configure.zcml
Fri Dec 7 19:10:53 2007
@@ -42,10 +42,24 @@
<!-- View for accessing the utility -->
<page
- for="*"
+ for="kss.demo.interfaces.ISimpleContent"
name="kss_demo_registry"
class=".registry.KSSDemoRegistryView"
- allowed_attributes="getSortedDemos getDemoGroups"
+ allowed_attributes="getSortedDemos getDemoGroups getSeleniumTests"
+ permission="zope.View"
+ />
+ <page
+ for="kss.demo.interfaces.ISimpleContent"
+ name="resource"
+ class=".registry.KSSDemoRegistryView"
+ attribute="getSeleniumTestResource"
+ permission="zope.View"
+ />
+ <page
+ for="kss.demo.interfaces.ISimpleContent"
+ name="zuite.html"
+ class=".registry.KSSDemoRegistryView"
+ attribute="getZuiteHomePage"
permission="zope.View"
/>
@@ -63,5 +77,29 @@
permission="demo.Manager"
/>
+ <!-- Resources for automated selenium tests -->
+
+ <page
+ for="kss.demo.interfaces.ISimpleContent"
+ template="kss_demo_suite.pt"
+ name="suite.html"
+ permission="zope.View"
+ />
+
+ <page
+ for="kss.demo.interfaces.ISimpleContent"
+ template="setDevMode.html"
+ name="setDevMode.html"
+ permission="zope.View"
+ />
+
+ <page
+ for="kss.demo.interfaces.ISimpleContent"
+ template="setProdMode.html"
+ name="setProdMode.html"
+ permission="zope.View"
+ />
+
+
</configure>
Modified: kukit/kss.demo/branch/kss-zope-transition/kss/demo/browser/demo.css
==============================================================================
--- kukit/kss.demo/branch/kss-zope-transition/kss/demo/browser/demo.css
(original)
+++ kukit/kss.demo/branch/kss-zope-transition/kss/demo/browser/demo.css Fri Dec
7 19:10:53 2007
@@ -14,7 +14,7 @@
font-size: 80%;
}
-#global-links ul {
+#global-links ul, #log-reset {
display: table-row;
}
@@ -22,7 +22,7 @@
display: table-cell;
}
-#global-links a {
+#global-links a, #log-reset a {
display: block;
padding: 0.25em;
margin: 0.25em;
@@ -88,3 +88,13 @@
.container {
padding : 1em;
}
+
+.log {
+ margin: 0;
+ padding: 0.4em;
+ background: #CCC;
+ color: gray;
+ font-style: italic;
+}
+
+
Modified:
kukit/kss.demo/branch/kss-zope-transition/kss/demo/browser/kss_demo_index.pt
==============================================================================
---
kukit/kss.demo/branch/kss-zope-transition/kss/demo/browser/kss_demo_index.pt
(original)
+++
kukit/kss.demo/branch/kss-zope-transition/kss/demo/browser/kss_demo_index.pt
Fri Dec 7 19:10:53 2007
@@ -8,10 +8,20 @@
<body>
<h1>KSS demos</h1>
<p metal:use-macro="context/@@body_macros/kss_mode">Kss mode</p>
- <h2>Unit tests</h2>
+ <h2>Tests</h2>
<ul style="background-color:#E0E0C0;">
- <li><a href="@@kukittestsuite">Run all tests</a></li>
+ <li><a href="@@kukittestsuite">Run all ECMA unittests</a></li>
+ <li>Link to Zelenium object:
+ <form tal:attributes="action string:${context/absolute_url}/zuite.html">
+ <input type="text" name="path" value="zuite" />
+ <input type="submit" name="submit" value="Run all Selenium tests" />
+ </form>
+ </li>
</ul>
+ <p class="help">
+ Zelenium object link must be an absolute path from the domain root,
+ or a relative path from the demo SimpleContent's parent.
+ </p>
<tal:groups repeat="demo_group
context/@@kss_demo_registry/getDemoGroups">
<tal:plugin condition="python:demo_group['is_first_plugin_namespace']
and demo_group['plugin_namespace']==''">
<h2>Core plugin</h2>
Modified: kukit/kss.demo/branch/kss-zope-transition/kss/demo/browser/registry.py
==============================================================================
--- kukit/kss.demo/branch/kss-zope-transition/kss/demo/browser/registry.py
(original)
+++ kukit/kss.demo/branch/kss-zope-transition/kss/demo/browser/registry.py
Fri Dec 7 19:10:53 2007
@@ -5,6 +5,7 @@
from zope.component import getUtility
from zope.interface import implements
from kss.demo.selenium_utils.builder import getSeleniumTestsFromSuite,
cookSeleniumTests
+import os.path
try:
from Products.Five import BrowserView
BrowserView # make pyflakes happy
@@ -55,6 +56,60 @@
group.append(demo)
return demo_groups
+ @staticmethod
+ def _filename_to_title(filename):
+ """Automatic conversion of filename to readable title"""
+ if filename.lower().endswith('.html'):
+ filename = filename[:-5]
+ elif filename.lower().endswith('.htm'):
+ filename = filename[:-4]
+ words = os.path.basename(filename).split('_')
+ result = ' '.join([word.capitalize() for word in words])
+ return result
+
+ @staticmethod
+ def _filename_to_href(filename):
+ """Automatic conversion of filename to publication href"""
+ return "@@resource?filename=%s" % (filename, )
+
+ def getSeleniumTests(self):
+ """Get selenium tests annotated with title and href."""
+ return [dict(
+ href = self._filename_to_href(filename),
+ title=self._filename_to_title(filename),
+ )
+ for filename in self.selenium_test_filenames]
+
+ @property
+ def selenium_test_filenames(self):
+ """A cached representation of all filenames."""
+ try:
+ return self._cooked_selenium_test_filenames
+ except AttributeError:
+ registry = getUtility(IKSSPluginRegistry)
+ suites = registry.zope_selenium_testsuites()
+ # Extract filenames from all suites
+ filenames = []
+ for owner_instance, suite in suites:
+ filenames.extend(getSeleniumTestsFromSuite(owner_instance,
suite))
+ return filenames
+
+ def getSeleniumTestResource(self, filename):
+ """Return the html resource, whose absolute filename is given,"""
+ # First of all, let's check if this is one of our file.
+ # (Refuse otherwise - we don't want access to all files on the server.)
+ if filename not in self.selenium_test_filenames:
+ raise Exception, "Nonexistent resource"
+ # Return the file's content.
+ self.request.response.setHeader('Content-type',
'text/html;charset=utf-8')
+ return file(filename).read()
+
+ def getZuiteHomePage(self, path):
+ """Redirects to the Zuite home page, Zuite object is found from
path."""
+ zuite = self.context.aq_inner.aq_parent.restrictedTraverse(path)
+ html = "%s/core/TestRunner.html?test=%s/suite.html" %
(zuite.absolute_url(), self.context.absolute_url())
+ return self.request.response.redirect(html)
+
class KSSDemoRegistryAdminView(BrowserView):
"""Things that only admin should do"""
implements(IBrowserPublisher)
@@ -87,7 +142,7 @@
"""Cook selenium tests
The *.html tests from each plugin are produced
- into the file seltest_all.pty in the directory
+ into the file seltest_all.py in the directory
of kss.demo.selenium_utils .
"""
registry = getUtility(IKSSPluginRegistry)
Modified: kukit/kss.demo/branch/kss-zope-transition/kss/demo/interfaces.py
==============================================================================
--- kukit/kss.demo/branch/kss-zope-transition/kss/demo/interfaces.py
(original)
+++ kukit/kss.demo/branch/kss-zope-transition/kss/demo/interfaces.py Fri Dec
7 19:10:53 2007
@@ -1,7 +1,6 @@
from zope.interface import Interface
from zope.schema import (
TextLine,
- List,
)
class ISimpleContent(Interface):
_______________________________________________
Kukit-checkins mailing list
[email protected]
http://codespeak.net/mailman/listinfo/kukit-checkins