Beispiel #1
0
def pytest_funcarg__eukalypse(request):
    import os
    eukalypse = Eukalypse()
    eukalypse.resolution = (1280, 768)
    eukalypse.browser = 'chrome'
    eukalypse.output = TMP_DIR

    #monkeypatch the Eukalypse object tp NOT use selenium but our own mock class
    funcType = type(Eukalypse.connect)
    eukalypse.connect = funcType(connect, eukalypse, Eukalypse)

    eukalypse.connect()

    def eukalypse_teardown():
        eukalypse.disconnect()

    request.addfinalizer(eukalypse_teardown)
    return eukalypse
import os
import inspect
sys.path.append(os.path.join(os.path.dirname(inspect.getfile(inspect.currentframe())), '../eukalypse'))
from eukalypse import Eukalypse
from PIL import Image
from PIL import ImageDraw
import logging as logger
logger.basicConfig(level=logger.INFO)


tmp_folder = 'tests/assets'
e = Eukalypse()
e.resolution = (1280, 768)
e.browser = 'phantomjsbin'
e.output = tmp_folder
e.connect()
logger.info("getting first screenshot")
screenshot = e.screenshot('reference_test_screenshot', 'http://localhost:8400/index.html')
logger.info("writing reference_test_screenshot.png")
logger.info("getting second screenshot")
screenshot = e.screenshot('reference_test_screenshot_index2', 'http://localhost:8400/index2.html')
logger.info("writing reference_test_screenshot_index2.png")

statement = """
driver = self.driver
driver.get("http://localhost:8400/index.html")
driver.set_window_size(1280, 768)
driver.find_element_by_css_selector('input[type="text"]').clear()
driver.find_element_by_css_selector('input[type="text"]').send_keys("asd")
"""
e.execute(statement)
import inspect
sys.path.append(
    os.path.join(os.path.dirname(inspect.getfile(inspect.currentframe())),
                 '../eukalypse'))
from eukalypse import Eukalypse
from PIL import Image
from PIL import ImageDraw
import logging as logger
logger.basicConfig(level=logger.INFO)

tmp_folder = 'tests/assets'
e = Eukalypse()
e.resolution = (1280, 768)
e.browser = 'phantomjsbin'
e.output = tmp_folder
e.connect()
logger.info("getting first screenshot")
screenshot = e.screenshot('reference_test_screenshot',
                          'http://localhost:8400/index.html')
logger.info("writing reference_test_screenshot.png")
logger.info("getting second screenshot")
screenshot = e.screenshot('reference_test_screenshot_index2',
                          'http://localhost:8400/index2.html')
logger.info("writing reference_test_screenshot_index2.png")

statement = """
driver = self.driver
driver.get("http://localhost:8400/index.html")
driver.set_window_size(1280, 768)
driver.find_element_by_css_selector('input[type="text"]').clear()
driver.find_element_by_css_selector('input[type="text"]').send_keys("asd")