Skip to content

Commit 6c84d01

Browse files
author
Bruno Oliveira
committed
Use Firefox as webdriver for tests
1 parent f20a6f2 commit 6c84d01

File tree

2 files changed

+7
-34
lines changed

2 files changed

+7
-34
lines changed

environment.devenv.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ includes:
99
environment:
1010
# Tip: Use `--driver <driver_name>` to change driver for a single run
1111
{% if TEST_QMXGRAPH %}
12-
PYTEST_ADDOPTS: --driver PhantomJS
12+
PYTEST_ADDOPTS: --driver Firefox
1313
{% endif %}
1414

1515
dependencies:
@@ -18,11 +18,12 @@ dependencies:
1818
{% if TEST_QMXGRAPH %}
1919
- cherrypy
2020
- hypothesis =3.11
21-
- phantomjs
21+
- firefox
22+
- geckodriver
2223
- pytest-mock
2324
- pytest-qt
2425
- pytest-rerunfailures
25-
- pytest-selenium >=1,<2
26+
- pytest-selenium
2627
- pytest-timeout
2728
- typing-extensions <4.2.0 # [PYTHON_VERSION=="3.6"]
2829
# Pin importlib_resources due to #151.

tests/conftest.py

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import os
2-
import shutil
32

43
import pytest
54

@@ -10,43 +9,16 @@ def pytest_configure(config):
109
# of pytest so they can't reliably be removed by a fixture.
1110
config.cache.set('qmxgraph/ports', [])
1211

13-
# Ensure phantomjs is available.
14-
phantomjs = shutil.which("phantomjs")
15-
assert phantomjs is not None
16-
1712
lock_file = _get_port_lock_filename(config.rootdir)
1813
if os.path.isfile(lock_file):
1914
os.remove(lock_file)
2015

2116

2217
# Fixtures --------------------------------------------------------------------
23-
24-
25-
@pytest.fixture
26-
def phantomjs_driver(capabilities, driver_path, port):
27-
"""
28-
Overrides default `phantomjs_driver` driver from pytest-selenium.
29-
30-
Default implementation uses ephemeral ports just as our tests but
31-
it doesn't provide any way to configure them, for this reason we basically
32-
recreate the driver fixture using port fixture.
33-
"""
34-
kwargs = {}
35-
if capabilities:
36-
kwargs['desired_capabilities'] = capabilities
37-
if driver_path is not None:
38-
kwargs['executable_path'] = driver_path
39-
40-
kwargs['port'] = port.get()
41-
42-
from selenium.webdriver import PhantomJS
43-
44-
return PhantomJS(**kwargs)
45-
46-
4718
@pytest.fixture
48-
def driver_args():
49-
return ['--debug=true']
19+
def firefox_options(firefox_options):
20+
firefox_options.headless = True
21+
return firefox_options
5022

5123

5224
@pytest.fixture(autouse=True)

0 commit comments

Comments
 (0)