1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-12-22 13:00:08 +00:00

Turn on tests since pdf2htmlEX build is now working. local_browser tests have to be disabled until geckobrowser can be reliably installed on Travis

This commit is contained in:
Jonathan Goldfarb 2018-10-10 21:05:03 -04:00
parent af074465f3
commit 316f5a221d
2 changed files with 29 additions and 29 deletions

View File

@ -110,7 +110,7 @@ before_install:
- cd ${TRAVIS_BUILD_DIR} - cd ${TRAVIS_BUILD_DIR}
# Test setup # Test setup
- pip install --user selenium sauceclient - pip install --user Pillow selenium sauceclient
- export DISPLAY=:99.0 - export DISPLAY=:99.0
- test/start_xvfb.sh - test/start_xvfb.sh
- pushd / - pushd /

View File

@ -10,31 +10,31 @@ from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions from selenium.webdriver.support import expected_conditions
from browser_tests import BrowserTests from browser_tests import BrowserTests
class test_local_browser(BrowserTests, unittest.TestCase): # class test_local_browser(BrowserTests, unittest.TestCase):
@classmethod # @classmethod
def setUpClass(cls): # def setUpClass(cls):
super(test_local_browser, cls).setUpClass() # super(test_local_browser, cls).setUpClass()
if not cls.GENERATING_MODE: # if not cls.GENERATING_MODE:
cls.browser = webdriver.Firefox() # cls.browser = webdriver.Firefox()
cls.browser.maximize_window() # cls.browser.maximize_window()
size = cls.browser.get_window_size() # size = cls.browser.get_window_size()
assert ((size['width'] >= cls.BROWSER_WIDTH) and (size['height'] >= cls.BROWSER_HEIGHT)), 'Screen is not large enough' # assert ((size['width'] >= cls.BROWSER_WIDTH) and (size['height'] >= cls.BROWSER_HEIGHT)), 'Screen is not large enough'
cls.browser.set_window_size(cls.BROWSER_WIDTH, cls.BROWSER_HEIGHT) # cls.browser.set_window_size(cls.BROWSER_WIDTH, cls.BROWSER_HEIGHT)
#
@classmethod # @classmethod
def tearDownClass(cls): # def tearDownClass(cls):
if not cls.GENERATING_MODE: # if not cls.GENERATING_MODE:
cls.browser.quit() # cls.browser.quit()
super(test_local_browser, cls).tearDownClass() # super(test_local_browser, cls).tearDownClass()
#
def generate_image(self, html_file, png_file, page_must_load=True): # def generate_image(self, html_file, png_file, page_must_load=True):
self.browser.get('file://' + html_file) # self.browser.get('file://' + html_file)
try: # try:
WebDriverWait(self.browser, 5).until(expected_conditions.presence_of_element_located((By.ID, 'page-container'))) # WebDriverWait(self.browser, 5).until(expected_conditions.presence_of_element_located((By.ID, 'page-container')))
except: # except:
if page_must_load: # if page_must_load:
raise # raise
self.browser.save_screenshot(png_file) # self.browser.save_screenshot(png_file)
#
if __name__ == '__main__': # if __name__ == '__main__':
unittest.main() # unittest.main()