fixed tests and updated readme
This commit is contained in:
parent
8b9465c805
commit
6ad3ede106
28
README.rst
28
README.rst
|
@ -23,7 +23,7 @@ Install xvfbwrapper from PyPI
|
|||
***********************
|
||||
|
||||
* Xvfb (`sudo apt-get install xvfb`, or similar)
|
||||
* Python 2
|
||||
* Python 2.7 or 3.2+ (tested on py27, py32, py33, pypy)
|
||||
|
||||
**************************************
|
||||
About Xvfb (X Virtual Framebuffer)
|
||||
|
@ -53,34 +53,30 @@ In the X Window System, Xvfb or X virtual framebuffer is an X11 server that perf
|
|||
|
||||
::
|
||||
|
||||
#!/usr/bin/env python
|
||||
|
||||
from selenium import webdriver
|
||||
from xvfbwrapper import Xvfb
|
||||
|
||||
|
||||
import unittest
|
||||
|
||||
|
||||
class TestHomepages(unittest.TestCase):
|
||||
|
||||
class TestPages(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.vdisplay = Xvfb(width=1280, height=720)
|
||||
self.vdisplay.start()
|
||||
self.xvfb = Xvfb(width=1280, height=720)
|
||||
self.addCleanup(self.xvfb.stop)
|
||||
self.xvfb.start()
|
||||
self.browser = webdriver.Firefox()
|
||||
|
||||
self.addCleanup(self.browser.quit)
|
||||
|
||||
def testUbuntuHomepage(self):
|
||||
self.browser.get('http://www.ubuntu.com')
|
||||
self.assertIn('Ubuntu', self.browser.title)
|
||||
|
||||
|
||||
def testGoogleHomepage(self):
|
||||
self.browser.get('http://www.google.com')
|
||||
self.assertIn('Google', self.browser.title)
|
||||
|
||||
def tearDown(self):
|
||||
self.browser.quit()
|
||||
self.vdisplay.stop()
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main(verbosity=2)
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ class TestXvfb(unittest.TestCase):
|
|||
h = 600
|
||||
depth = 16
|
||||
xvfb = Xvfb(width=w, height=h, colordepth=depth)
|
||||
self.addCleanup(xvfb.stop)
|
||||
xvfb.start()
|
||||
self.assertEqual(w, xvfb.width)
|
||||
self.assertEqual(h, xvfb.height)
|
||||
|
|
Loading…
Reference in New Issue