Commits

Francesco Banconi committed a0f4771

Integration tests: possibility to restore the browser visibility.

Comments (0)

Files changed (2)

 	@echo -e '\nWhen testing the application, define the env var'
 	@echo 'SKIP_SELENIUM to exclude integration tests, e.g.:'
 	@echo '  - make check SKIP_SELENIUM=1'
+	@echo -e '\nWhen running integration tests, by default all graphical'
+	@echo 'operations are performed in memory where possible. However,'
+	@echo 'defining the env var SHOW_BROWSER, it is possible run tests'
+	@echo 'using a visible browser instance, e.g.:'
+	@echo '  - make check SHOW_BROWSER=1'
 
 install:
 	python setup.py install

endless_pagination/tests/integration/__init__.py

 from django.test import LiveServerTestCase
 from django.utils import unittest
 from selenium.common import exceptions
-from selenium.webdriver.firefox.webdriver import WebDriver
+from selenium.webdriver import Firefox
 from selenium.webdriver.support import ui
 from xvfbwrapper.xvfbwrapper import Xvfb
 
 from endless_pagination.utils import PYTHON3
 
 
+SHOW_BROWSER = os.getenv('SHOW_BROWSER', False)
 SKIP_SELENIUM = os.getenv('SKIP_SELENIUM', False)
 # FIXME: do not exclude integration tests on Python3 once Selenium is updated
 # (bug #17).
     # Just skipping *setup_package* and *teardown_package* generates an
     # uncaught exception under Python 2.6.
     if tests_are_run:
-        # Perform all graphical operations in memory.
-        vdisplay = SeleniumTestCase.vdisplay = Xvfb(width=1280, height=720)
-        vdisplay.start()
+        if not SHOW_BROWSER:
+            # Perform all graphical operations in memory.
+            vdisplay = SeleniumTestCase.vdisplay = Xvfb(width=1280, height=720)
+            vdisplay.start()
         # Create a Selenium browser instance.
-        selenium = SeleniumTestCase.selenium = WebDriver()
+        selenium = SeleniumTestCase.selenium = Firefox()
         SeleniumTestCase.wait = ui.WebDriverWait(selenium, 10)
 
 
 def teardown_package():
     """Quit the Selenium driver."""
     if tests_are_run:
-        SeleniumTestCase.vdisplay.stop()
+        if not SHOW_BROWSER:
+            SeleniumTestCase.vdisplay.stop()
         SeleniumTestCase.selenium.quit()