added local env

This commit is contained in:
Anton Danchenko 2018-01-22 18:19:05 +02:00
parent d073102d1a
commit 0db8136730
4 changed files with 17 additions and 8 deletions

View File

@ -84,7 +84,7 @@ class LabelsButton(BaseButton):
class BountyLabel(BaseButton): class BountyLabel(BaseButton):
def __init__(self, driver): def __init__(self, driver):
super(LabelsButton.BountyLabel, self).__init__(driver) super(LabelsButton.BountyLabel, self).__init__(driver)
self.locator = self.Locator.css_selector("[data-name='bounty']") self.locator = self.Locator.css_selector("[data-name='748942015']")
class CrossButton(BaseButton): class CrossButton(BaseButton):
def __init__(self, driver): def __init__(self, driver):

View File

@ -39,14 +39,19 @@ class BaseTestCase:
desired_caps['captureHtml'] = False desired_caps['captureHtml'] = False
return desired_caps return desired_caps
@property
def environment(self):
return pytest.config.getoption('env')
def setup_method(self): def setup_method(self):
self.errors = [] self.errors = []
# options = webdriver.ChromeOptions() if self.environment == 'local':
# options.add_argument('--start-fullscreen') options = webdriver.ChromeOptions()
# options.add_extension(path.abspath('/resources/metamask3_12_0.crx')) options.add_argument('--start-fullscreen')
self.driver = webdriver.Chrome(options=options)
if self.environment == 'sauce':
self.driver = webdriver.Remote(self.executor_sauce_lab, self.driver = webdriver.Remote(self.executor_sauce_lab,
desired_capabilities=self.capabilities_sauce_lab) desired_capabilities=self.capabilities_sauce_lab)
self.driver.implicitly_wait(5) self.driver.implicitly_wait(5)

View File

@ -11,6 +11,10 @@ def pytest_addoption(parser):
action='store', action='store',
default=True, default=True,
help='Display each test step in terminal as plain text: True/False') help='Display each test step in terminal as plain text: True/False')
parser.addoption('--env',
action='store',
default='sauce',
help='Specify environment, sauce or local')
def pytest_configure(config): def pytest_configure(config):

View File

@ -17,6 +17,6 @@ class TestLogin(BaseTestCase):
bounties_page = github.authorize_sob.click() bounties_page = github.authorize_sob.click()
github.install_sob_plugin() github.install_sob_plugin()
assert bounties_page.bounties_header.text == 'Bounties' assert bounties_page.bounties_header.text == 'Bounties'
assert bounties_page.top_hunters_header.text == 'Top hunters' assert bounties_page.top_hunters_header.text == 'Top 5 hunters'
github.create_new_bounty() github.create_new_bounty()
github.get_deployed_contract() github.get_deployed_contract()