Skip to content

Commit

Permalink
Merge branch 'master' into refactor-conftest-to-reduce-duplicate-code
Browse files Browse the repository at this point in the history
  • Loading branch information
rohandudam committed Oct 16, 2024
2 parents 545a826 + 5c25662 commit 48b95ca
Show file tree
Hide file tree
Showing 18 changed files with 366 additions and 467 deletions.
4 changes: 0 additions & 4 deletions conf/opera_browser_conf.py

This file was deleted.

13 changes: 5 additions & 8 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
from conf import browser_os_name_conf # pylint: disable=import-error wrong-import-position
from conf import base_url_conf # pylint: disable=import-error wrong-import-position
from endpoints.API_Player import API_Player # pylint: disable=import-error wrong-import-position
from endpoints.api_player import APIPlayer # pylint: disable=import-error wrong-import-position
from page_objects.PageFactory import PageFactory # pylint: disable=import-error wrong-import-position
from utils import interactive_mode # pylint: disable=import-error wrong-import-position
from core_helpers.custom_pytest_plugins import CustomTerminalReporter # pylint: disable=import-error wrong-import-position
Expand Down Expand Up @@ -227,19 +227,16 @@ def test_mobile_obj(mobile_os_name, mobile_os_version, device_name, app_package,
{"status":"failed", "reason": "Exception occured"}}""")

@pytest.fixture
def test_api_obj(request, interactivemode_flag, api_url=base_url_conf.api_base_url): # pylint: disable=redefined-outer-name
def test_api_obj(interactivemode_flag, testname, api_url=base_url_conf.api_base_url): # pylint: disable=redefined-outer-name
"Return an instance of Base Page that knows about the third party integrations"
# request.module._name__ is tests.<module_name> strip and get the module name
log_file = request.module.__name__.split('.')[-1] + '.log'
log_file = testname + '.log'
try:
if interactivemode_flag.lower()=='y':
api_url,session_flag = interactive_mode.ask_questions_api(api_url)
test_api_obj = API_Player(api_url, # pylint: disable=redefined-outer-name
session_flag,
test_api_obj = APIPlayer(api_url, # pylint: disable=redefined-outer-name
log_file_path=log_file)
else:
test_api_obj = API_Player(url=api_url,
session_flag=True,
test_api_obj = APIPlayer(url=api_url,
log_file_path=log_file)
yield test_api_obj

Expand Down
4 changes: 2 additions & 2 deletions core_helpers/drivers/driverfactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ def get_local_driver(self, browser):
local_driver = self.explorer_local()
elif browser.lower() == "chrome":
local_driver = self.chrome_local()
elif browser.lower() == "opera":
local_driver = self.opera_local()
elif browser.lower() == "safari":
local_driver = self.safari_local()
elif browser.lower() == "headless-chrome":
local_driver = self.headless_chrome()
else:
raise AttributeError(f"Unsupported Browser - {browser!r}")

return local_driver

Expand Down
18 changes: 0 additions & 18 deletions core_helpers/drivers/local_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,6 @@ def chrome_local():

return local_driver

@staticmethod
def opera_local():
"""Get webdriver for opera."""
from conf import opera_browser_conf
try:
opera_browser_location = opera_browser_conf.location
options = webdriver.ChromeOptions()
options.binary_location = opera_browser_location # path to opera executable
local_driver = webdriver.Opera(options=options)

except Exception as exception:
print("\nException when trying to get remote webdriver:%s"%sys.modules[__name__])
print("Python says:%s"%str(exception))
if 'no Opera binary' in str(exception):
print("SOLUTION: It looks like you are trying to use Opera Browser. Please update Opera Browser location under conf/opera_browser_conf.\n")

return local_driver

@staticmethod
def safari_local():
"""Get webdriver for safari."""
Expand Down
44 changes: 0 additions & 44 deletions endpoints/API_Interface.py

This file was deleted.

166 changes: 0 additions & 166 deletions endpoints/Base_API.py

This file was deleted.

81 changes: 0 additions & 81 deletions endpoints/Cars_API_Endpoints.py

This file was deleted.

Loading

0 comments on commit 48b95ca

Please sign in to comment.