Explorar o código

Initial work on running selenium tests.

JC Brand %!s(int64=8) %!d(string=hai) anos
pai
achega
4a2cbd4085
Modificáronse 4 ficheiros con 86 adicións e 13 borrados
  1. 15 10
      .gitignore
  2. 20 3
      buildout.cfg
  3. 12 0
      setup.py
  4. 39 0
      tests.py

+ 15 - 10
.gitignore

@@ -1,32 +1,37 @@
-*~
-.sw?
-*.mo
 *.kpf
-.*.sw?
+*.mo
+*.pyc
+*~
 .*.cfg
-.hg/
+.*.sw?
 .bzr/
-.svn/
+.hg/
+.idea
 .project
 .pydevproject
-.idea
 .su?
+.su?
+.svn/
+.sw?
 builds/*
 
 analytics.js
 inverse-analytics.js
 
 # python/buildout
-eggs
+*.egg-info
+*.pyc
 .Python
 build
+converse.js.egg-info/
+eggs
+parts
 parts
-*.pyc
-*.egg-info
 
 dev-jc.html
 inverse-dev.html
 inverse-dev-jc.html
+
 converse-logs/*.html
 
 # Ruby/Sass/Bundler

+ 20 - 3
buildout.cfg

@@ -1,7 +1,11 @@
 [buildout]
 parts =
     sphinx
+    test
+eggs =
+    selenium
 
+develop = .
 versions = versions
 
 [sphinx]
@@ -10,13 +14,26 @@ eggs =
     Sphinx
     sphinx-bootstrap-theme
 
+[test]
+recipe = zc.recipe.testrunner
+eggs =
+    ipdb    
+    selenium
+    converse.js
+defaults = [
+    '-v',
+    '--auto-color',
+    '--auto-progress',
+    '--shuffle']
+
 [versions]
+selenium = 3.4.3
 docutils = 0.13.1
 Jinja2 = 2.9.5
 MarkupSafe = 0.23
 Pygments = 2.2.0
 six = 1.10.0
-setuptools = 28.6.1
+setuptools = 36.0.1
 Sphinx = 1.5.2
-z3c.recipe.egg = 2.0.3
-zc.buildout = 2.5.3
+zc.recipe.egg = 2.0.3
+zc.buildout = 2.9.3

+ 12 - 0
setup.py

@@ -0,0 +1,12 @@
+
+from setuptools import setup
+
+setup(
+    name="converse.js",
+    version="3.0.2",
+    description="XMPP chat client that runs in a web-browser",
+    author="JC Brand",
+    author_email="jc@opkode.com",
+    url="https://conversejs.org",
+    packages=[]
+)

+ 39 - 0
tests.py

@@ -0,0 +1,39 @@
+import os
+import unittest
+import threading
+import SimpleHTTPServer
+import SocketServer
+
+from selenium import webdriver
+
+DOMAIN = '127.0.0.1'
+PORT = 8088
+
+class TestServer(SocketServer.TCPServer):
+    allow_reuse_address = True
+
+
+class SeleniumTests(unittest.TestCase):
+
+    def setUp(self):
+        os.chdir('../../')
+	Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
+	httpd = TestServer(("", PORT), Handler)
+        httpd_thread = threading.Thread(target=httpd.serve_forever)
+        httpd_thread.setDaemon(True)
+        httpd_thread.start()
+	print "serving at port", PORT
+        self.driver = webdriver.Chrome()
+
+    def test_load_inverse(self):
+        self.driver.get("http://{}:{}/inverse-dev.html".format(DOMAIN, PORT))
+        assert("inVerse" in self.driver.title)
+        
+    def tearDown(self):
+        self.driver.quit()
+        
+
+if __name__ == "__main__":
+    unittest.main()
+
+