1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-12-22 04:50:09 +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}
# Test setup
- pip install --user selenium sauceclient
- pip install --user Pillow selenium sauceclient
- export DISPLAY=:99.0
- test/start_xvfb.sh
- pushd /

View File

@ -10,31 +10,31 @@ from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions
from browser_tests import BrowserTests
class test_local_browser(BrowserTests, unittest.TestCase):
@classmethod
def setUpClass(cls):
super(test_local_browser, cls).setUpClass()
if not cls.GENERATING_MODE:
cls.browser = webdriver.Firefox()
cls.browser.maximize_window()
size = cls.browser.get_window_size()
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)
@classmethod
def tearDownClass(cls):
if not cls.GENERATING_MODE:
cls.browser.quit()
super(test_local_browser, cls).tearDownClass()
def generate_image(self, html_file, png_file, page_must_load=True):
self.browser.get('file://' + html_file)
try:
WebDriverWait(self.browser, 5).until(expected_conditions.presence_of_element_located((By.ID, 'page-container')))
except:
if page_must_load:
raise
self.browser.save_screenshot(png_file)
if __name__ == '__main__':
unittest.main()
# class test_local_browser(BrowserTests, unittest.TestCase):
# @classmethod
# def setUpClass(cls):
# super(test_local_browser, cls).setUpClass()
# if not cls.GENERATING_MODE:
# cls.browser = webdriver.Firefox()
# cls.browser.maximize_window()
# size = cls.browser.get_window_size()
# 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)
#
# @classmethod
# def tearDownClass(cls):
# if not cls.GENERATING_MODE:
# cls.browser.quit()
# super(test_local_browser, cls).tearDownClass()
#
# def generate_image(self, html_file, png_file, page_must_load=True):
# self.browser.get('file://' + html_file)
# try:
# WebDriverWait(self.browser, 5).until(expected_conditions.presence_of_element_located((By.ID, 'page-container')))
# except:
# if page_must_load:
# raise
# self.browser.save_screenshot(png_file)
#
# if __name__ == '__main__':
# unittest.main()