Skip to content

Commit b04b5b4

Browse files
Konstantinaccfreskoulix
authored andcommitted
Added py.test command line option to enable plugin in Firefox.
The option can be used in order to open Firefox without plugin installed, to test related views and actions.
1 parent 93ecff0 commit b04b5b4

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

bin/seleniumbender

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,21 +54,21 @@ email_date=$(date +"%Y-%m-%d %H:%M:%S")
5454

5555
if [ "${common}" -eq 1 ]; then
5656
IDENTIFIER="common"
57-
tox tests/common -- --url=${URL} --source=${SOURCE}
57+
tox tests/common -- --url=${URL} --source=${SOURCE} --plugin
5858
RETVAL=$?
5959
if [ "${RETVAL}" -eq 1 ]; then
6060
mail -s "Selenium Tests: ${IDENTIFIER} Failed To Run" [email protected] <<< 'Something went wrong with common tests. Please check the logs.'
6161
exit ${RETVAL}
6262
fi
6363
elif [ "${examples}" -eq 1 ]; then
6464
IDENTIFIER="libraries_test"
65-
tox tests/libraries -- --url=${URL} --source=${SOURCE} -F
65+
tox tests/libraries -- --url=${URL} --source=${SOURCE} -F --plugin
6666
elif [ "${libraries}" -eq 1 ]; then
6767
IDENTIFIER="libraries_fetch"
68-
tox tests/libraries_fetch -- --url=${URL} --source=${SOURCE} -F
68+
tox tests/libraries_fetch -- --url=${URL} --source=${SOURCE} -F --plugin
6969
elif [ "${sketches}" -eq 1 ]; then
7070
IDENTIFIER="cb_compile_tester"
71-
tox tests/compile_tester -- --url=${URL} --source=${SOURCE} -F
71+
tox tests/compile_tester -- --url=${URL} --source=${SOURCE} -F --plugin
7272
fi
7373

7474
DATE=$(date +"%Y-%m-%d") # Get the current date

codebender_testing/config.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
66
import yaml
77
import simplejson
8+
import pytest
89

910

1011
def _rel_path(*args):
@@ -90,9 +91,10 @@ def _get_firefox_profile():
9091
extension.
9192
"""
9293
firefox_profile = webdriver.FirefoxProfile()
93-
firefox_profile.add_extension(
94-
extension=os.path.join(_EXTENSIONS_DIR, _FIREFOX_EXTENSION_FNAME)
95-
)
94+
if pytest.config.getoption("--plugin"):
95+
firefox_profile.add_extension(
96+
extension=os.path.join(_EXTENSIONS_DIR, _FIREFOX_EXTENSION_FNAME)
97+
)
9698
return firefox_profile
9799

98100
def get_browsers(capabilities_file_path=None):

tests/conftest.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ def pytest_addoption(parser):
3434
default=config.DEFAULT_CAPABILITIES_FILE_PATH,
3535
help="Custom path to a YAML file containing a capability list.")
3636

37+
parser.addoption("-P", "--plugin", action="store_true",
38+
default=False,
39+
help="Install plugin in Firefox profile")
40+
3741

3842
def pytest_generate_tests(metafunc):
3943
"""Special function used by pytest to configure test generation."""

0 commit comments

Comments
 (0)