2014-11-16 14:57:38 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
2014-11-19 18:27:08 +00:00
|
|
|
# Run browsers tests with a local Firefox
|
|
|
|
|
2014-11-16 14:57:38 +00:00
|
|
|
import unittest
|
|
|
|
|
|
|
|
from selenium import webdriver
|
2015-03-17 11:07:05 +00:00
|
|
|
from selenium.webdriver.common.by import By
|
|
|
|
from selenium.webdriver.support.ui import WebDriverWait
|
|
|
|
from selenium.webdriver.support import expected_conditions
|
2014-11-16 14:57:38 +00:00
|
|
|
from browser_tests import BrowserTests
|
|
|
|
|
2018-10-11 01:05:03 +00:00
|
|
|
# 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()
|