Skip to content

Commit 541b9df

Browse files
committed
Added options to Firefox driver like Chrome
1 parent ef1e63e commit 541b9df

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

.devcontainer/devcontainer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
"Rofrano",
1313
"sqlalchemy",
1414
"psycopg",
15+
"wsgi",
16+
"dotenv",
1517
"pytest",
1618
"tekton",
1719
"creds",
@@ -64,7 +66,6 @@
6466
"njpwerner.autodocstring",
6567
"wholroyd.jinja",
6668
"redhat.vscode-yaml",
67-
"redhat.fabric8-analytics",
6869
"ms-azuretools.vscode-docker",
6970
"ms-kubernetes-tools.vscode-kubernetes-tools",
7071
"inercia.vscode-k3d",

features/environment.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
"""
22
Environment for Behave Testing
33
"""
4+
45
from os import getenv
56
from selenium import webdriver
67

7-
WAIT_SECONDS = int(getenv('WAIT_SECONDS', '30'))
8-
BASE_URL = getenv('BASE_URL', 'http://localhost:8080')
9-
DRIVER = getenv('DRIVER', 'firefox').lower()
8+
WAIT_SECONDS = int(getenv("WAIT_SECONDS", "30"))
9+
BASE_URL = getenv("BASE_URL", "http://localhost:8080")
10+
DRIVER = getenv("DRIVER", "firefox").lower()
1011

1112

1213
def before_all(context):
13-
""" Executed once before all tests """
14+
"""Executed once before all tests"""
1415
context.base_url = BASE_URL
1516
context.wait_seconds = WAIT_SECONDS
1617
# Select either Chrome or Firefox
17-
if 'firefox' in DRIVER:
18+
if "firefox" in DRIVER:
1819
context.driver = get_firefox()
1920
else:
2021
context.driver = get_chrome()
@@ -24,15 +25,18 @@ def before_all(context):
2425

2526

2627
def after_all(context):
27-
""" Executed after all tests """
28+
"""Executed after all tests"""
2829
context.driver.quit()
2930

31+
3032
######################################################################
3133
# Utility functions to create web drivers
3234
######################################################################
3335

36+
3437
def get_chrome():
3538
"""Creates a headless Chrome driver"""
39+
print("Running Behave using the Chrome driver...\n")
3640
options = webdriver.ChromeOptions()
3741
options.add_argument("--no-sandbox")
3842
options.add_argument("--disable-dev-shm-usage")
@@ -42,7 +46,9 @@ def get_chrome():
4246

4347
def get_firefox():
4448
"""Creates a headless Firefox driver"""
49+
print("Running Behave using the Firefox driver...\n")
4550
options = webdriver.FirefoxOptions()
51+
options.add_argument("--no-sandbox")
52+
options.add_argument("--disable-dev-shm-usage")
4653
options.add_argument("--headless")
47-
return webdriver.Firefox(options=options)
48-
54+
return webdriver.Firefox(options=options)

0 commit comments

Comments
 (0)