Skip to content

Commit

Permalink
Remove hardcoded driver name in tests #7
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoia authored and zhidelev committed Jan 22, 2021
1 parent 00e9f17 commit 0998763
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions JDI/web/selenium/elements/composite/web_site.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ def _init(site):
WebCascadeInit().init_site_page(site)

@staticmethod
def init(site, driver_name):
WebSettings.use_driver(driver_name)
def init(site):
WebSettings.use_driver()
WebCascadeInit().init_site_page(site)
3 changes: 2 additions & 1 deletion JDI/web/selenium/settings/WebSettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ def set_driver_factory(driver_factory):
JDISettings._driver_factory = driver_factory

@staticmethod
def use_driver(driver_name, options=[], capabilities={}, executor=None):
def use_driver(options=[], capabilities={}, executor=None):
driver_name = JDISettings.get_setting_by_name('driver')
JDISettings._driver_factory = SeleniumDriverFactory()
WebSettings.set_driver_factory(JDISettings._driver_factory)
return JDISettings._driver_factory.register_driver(driver_name, options, capabilities, executor)
Expand Down
3 changes: 2 additions & 1 deletion JDI/web/selenium/settings/web_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ def set_driver_factory(driver_factory):
JDISettings._driver_factory = driver_factory

@staticmethod
def use_driver(driver_name, options=[], capabilities={}, executor=None):
def use_driver(options=[], capabilities={}, executor=None):
driver_name = JDISettings.get_setting_by_name('driver')
JDISettings._driver_factory = SeleniumDriverFactory()
WebSettings.set_driver_factory(JDISettings._driver_factory)
return JDISettings._driver_factory.register_driver(driver_name, options, capabilities, executor)
Expand Down
2 changes: 1 addition & 1 deletion Test/jdi_uitest_web_examples/test/carrer_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
class CareerTests(unittest.TestCase):
@classmethod
def setUpClass(cls):
WebSite.init(EpamSite, "chrome")
WebSite.init(EpamSite)
WebSettings.logger.info("\nRun Tests from '%s' file" % cls.__name__)

def setUp(self):
Expand Down
2 changes: 1 addition & 1 deletion Test/jdi_uitests_webtests/test/composite/page_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
class PageTests(unittest.TestCase):
def setUp(self):
WebSettings.logger.info("Run Test %s" % self.id().split(".")[-1])
WebSite.init(EpamJDISite, "chrome")
WebSite.init(EpamJDISite)
WebSettings.logger.info("Run Tests")
EpamJDISite.home_page.open()
EpamJDISite.login_page.submit(User.default())
Expand Down
4 changes: 2 additions & 2 deletions Test/jdi_uitests_webtests/test/init_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class InitTests(unittest.TestCase):

@classmethod
def setUpClass(cls):
WebSite.init(EpamJDISite, "chrome")
WebSite.init(EpamJDISite)
WebSettings.logger.info("\nRun Tests from '%s' file" % cls.__name__)
EpamJDISite.home_page.open()
EpamJDISite.login_page.submit(User.default())
Expand All @@ -31,7 +31,7 @@ class W3CInit(unittest.TestCase):

@classmethod
def setUpClass(cls):
WebSite.init(W3cSite, "chrome")
WebSite.init(W3cSite)
WebSettings.logger.info("Run Tests")
W3cSite.frame_page.open()

Expand Down

0 comments on commit 0998763

Please sign in to comment.