Created
December 4, 2012 14:04
-
-
Save miohtama/4204220 to your computer and use it in GitHub Desktop.
Overriding Firefox for Python / Plone Selenium tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SitsSeleniumTestCase(unittest.TestCase): | |
""" | |
Base class for Selenium based tests. | |
Use Selenium 2 API to fire up a real (Firefox) browser which bangs the crap out of your test site instance, exposed | |
to the world through HostAdjustableZServer layer. | |
""" | |
layer = SITS_FUNCTIONAL_TESTING | |
def setUp(self): | |
""" | |
Expose Selenium and helpers for sublasses. | |
""" | |
self.driver = self.layer['selenium'] | |
from selenium.webdriver.firefox.webdriver import WebDriver | |
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary | |
# Workaround for FF17 | |
if "FIREFOX_PATH" in os.environ: | |
self.driver = WebDriver(firefox_binary=FirefoxBinary(os.environ["FIREFOX_PATH"])) | |
else: | |
self.driver = WebDriver() | |
self.selenium_helper = SeleniumHelper(self, driver=self.driver) | |
self.plone_helper = PloneHelper(self) | |
self.portal = self.layer["portal"] | |
def tearDown(self): | |
self.driver.quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment