Use chromedriver instead of phantomjs for testing
This commit is contained in:
parent
06fa669f8c
commit
68c7f502b4
1 changed files with 14 additions and 8 deletions
|
@ -17,9 +17,9 @@ def pytest_addoption(parser):
|
||||||
|
|
||||||
# Config
|
# Config
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
PHANTOMJS_PATH = "tools/phantomjs/bin/phantomjs.exe"
|
CHROMEDRIVER_PATH = "tools/chrome/chromedriver.exe"
|
||||||
else:
|
else:
|
||||||
PHANTOMJS_PATH = "phantomjs"
|
CHROMEDRIVER_PATH = "chromedriver"
|
||||||
SITE_URL = "http://127.0.0.1:43110"
|
SITE_URL = "http://127.0.0.1:43110"
|
||||||
|
|
||||||
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__) + "/../lib")) # External modules directory
|
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__) + "/../lib")) # External modules directory
|
||||||
|
@ -194,15 +194,21 @@ def user():
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="session")
|
@pytest.fixture(scope="session")
|
||||||
def browser():
|
def browser(request):
|
||||||
try:
|
try:
|
||||||
from selenium import webdriver
|
from selenium import webdriver
|
||||||
print "Starting phantomjs..."
|
print "Starting chromedriver..."
|
||||||
browser = webdriver.PhantomJS(executable_path=PHANTOMJS_PATH, service_log_path=os.path.devnull)
|
options = webdriver.chrome.options.Options()
|
||||||
print "Set window size..."
|
options.add_argument("--headless")
|
||||||
browser.set_window_size(1400, 1000)
|
options.add_argument("--window-size=1920x1080")
|
||||||
|
options.add_argument("--log-level=1")
|
||||||
|
browser = webdriver.Chrome(executable_path=CHROMEDRIVER_PATH, service_log_path=os.path.devnull, chrome_options=options)
|
||||||
|
|
||||||
|
def quit():
|
||||||
|
browser.quit()
|
||||||
|
request.addfinalizer(quit)
|
||||||
except Exception, err:
|
except Exception, err:
|
||||||
raise pytest.skip("Test requires selenium + phantomjs: %s" % err)
|
raise pytest.skip("Test requires selenium + chromedriver: %s" % err)
|
||||||
return browser
|
return browser
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue