Config support and other little improvements (#231)

* Configure work with remote config; add stepa to verify issue title;

* transfer settings to global .gitignore

* Change channel and repo path

* Delete local env by default

* change locator for BountyFooters
This commit is contained in:
Tetiana Churikova 2018-01-24 12:58:58 +02:00 committed by Anton Danchenko
parent e3fad56b74
commit 8414d19404
9 changed files with 92 additions and 12 deletions

1
.gitignore vendored
View File

@ -23,4 +23,3 @@ profiles.clj
.idea .idea
resources/contracts resources/contracts
node_modules node_modules
.DS_Store

View File

@ -10,7 +10,7 @@ For testing you will need:
* a Github account with administrative access to one or more repositories * a Github account with administrative access to one or more repositories
* for approving bounty payouts you will additionally need access to an Ethereum wallet. So far, Mist and [MetaMask](https://metamask.io/) have been used, but anything that provides the web3 javascript interface should work. * for approving bounty payouts you will additionally need access to an Ethereum wallet. So far, Mist and [MetaMask](https://metamask.io/) have been used, but anything that provides the web3 javascript interface should work.
The developers can be reached on the `#commiteth` channel in the [Status slack](http://slack.status.im/). The developers can be reached on the `#openbounty` channel in the [Status slack](http://slack.status.im/).
### Signing up ### Signing up
@ -60,6 +60,6 @@ To remove issue from the Bounties list you can close it in GitHub.
### Reporting bugs ### Reporting bugs
All bugs should be reported as issues in the [CommitETH Github repository](https://github.com/status-im/commiteth/issues). All bugs should be reported as issues in the [OpenBounty Github repository](https://github.com/status-im/open-bounty/issues).
Please first check that there is not already a duplicate issue. Issues should contain exact and minimal step-by-step instructions for reproducing the problem. Please first check that there is not already a duplicate issue. Issues should contain exact and minimal step-by-step instructions for reproducing the problem.

View File

@ -1,5 +1,6 @@
from pages.base_page import BasePageObject from pages.base_page import BasePageObject
from pages.base_element import * from pages.base_element import *
from tests import test_data
class BountiesHeader(BaseText): class BountiesHeader(BaseText):
@ -15,11 +16,38 @@ class TopHuntersHeader(BaseText):
super(TopHuntersHeader, self).__init__(driver) super(TopHuntersHeader, self).__init__(driver)
self.locator = self.Locator.css_selector('.top-hunters-header') self.locator = self.Locator.css_selector('.top-hunters-header')
class BountyTitles(BaseText):
def __init__(self, driver):
super(BountyTitles, self).__init__(driver)
self.locator = self.Locator.css_selector('.open-bounty-item-content .header')
class BountyItemRows(BaseText):
def __init__(self, driver):
super(BountyItemRows, self).__init__(driver)
self.locator = self.Locator.css_selector('.open-bounty-item-content .bounty-item-row')
class BountyFooters(BaseText):
def __init__(self, driver):
super(BountyFooters, self).__init__(driver)
self.locator = self.Locator.css_selector('.open-bounty-item-content .footer-row')
class BountiesPage(BasePageObject): class BountiesPage(BasePageObject):
def __init__(self, driver): def __init__(self, driver):
super(BountiesPage, self).__init__(driver) super(BountiesPage, self).__init__(driver)
self.driver = driver self.driver = driver
self.bounties_header = BountiesHeader(self.driver) self.bounties_header = BountiesHeader(self.driver)
self.top_hunters_header = TopHuntersHeader(self.driver) self.top_hunters_header = TopHuntersHeader(self.driver)
self.bounty_titles = BountyTitles(self.driver)
self.bounty_item_rows = BountyItemRows(self.driver)
self.bounty_footers = BountyFooters(self.driver)
def get_bounties_page(self):
self.driver.get(test_data.config['Common']['url'] + 'app')

View File

@ -1,5 +1,6 @@
from pages.base_page import BasePageObject from pages.base_page import BasePageObject
from pages.base_element import * from pages.base_element import *
from tests import test_data
class LoginButton(BaseButton): class LoginButton(BaseButton):
@ -20,4 +21,4 @@ class LandingPage(BasePageObject):
self.login_button = LoginButton(self.driver) self.login_button = LoginButton(self.driver)
def get_landing_page(self): def get_landing_page(self):
self.driver.get('https://openbounty.status.im:444/') self.driver.get(test_data.config['Common']['url'])

View File

@ -1,6 +1,7 @@
import time, pytest import time, pytest
from pages.base_element import * from pages.base_element import *
from pages.base_page import BasePageObject from pages.base_page import BasePageObject
from tests import test_data
class EmailEditbox(BaseEditBox): class EmailEditbox(BaseEditBox):
@ -156,11 +157,14 @@ class GithubPage(BasePageObject):
def create_new_bounty(self): def create_new_bounty(self):
self.get_issues_page() self.get_issues_page()
self.new_issue_button.click() self.new_issue_button.click()
self.issue_title_input.send_keys('auto_test_bounty_%s' % self.time_now) test_data.issue = dict()
test_data.issue['title'] = 'auto_test_bounty_%s' % self.time_now
self.issue_title_input.send_keys(test_data.issue['title'])
self.labels_button.click() self.labels_button.click()
self.bounty_label.click() self.bounty_label.click()
self.cross_button.click() self.cross_button.click()
self.submit_new_issue_button.click() self.submit_new_issue_button.click()
return test_data.issue['title']
def get_deployed_contract(self, wait=120): def get_deployed_contract(self, wait=120):
for i in range(wait): for i in range(wait):

View File

@ -1,8 +1,17 @@
import configparser
class TestData(object): class TestData(object):
def __init__(self): def __init__(self):
self.test_name = None self.test_name = None
self.config = configparser.ConfigParser()
# define here path to your config.ini file
#example - config_example.ini
self.config.read('config.ini')
self.base_case_issue = dict()
self.base_case_issue['title'] = 'Very first auto_test_bounty'
test_data = TestData() test_data = TestData()

View File

@ -46,16 +46,22 @@ class BaseTestCase:
def setup_method(self): def setup_method(self):
self.errors = [] self.errors = []
self.cleanup = None
if self.environment == 'local': if self.environment == 'local':
options = webdriver.ChromeOptions() options = webdriver.ChromeOptions()
options.add_argument('--start-fullscreen') options.add_argument('--start-fullscreen')
self.driver = webdriver.Chrome(options=options) options.add_extension(
path.abspath(test_data.config['Paths']['tests_absolute'] + 'resources/metamask3_12_0.crx'))
# for chromedriver 2.35
self.driver = webdriver.Chrome(chrome_options=options)
if self.environment == 'sauce': 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)
def verify_no_errors(self): def verify_no_errors(self):
if self.errors: if self.errors:
msg = '' msg = ''
@ -64,7 +70,7 @@ class BaseTestCase:
pytest.fail(msg, pytrace=False) pytest.fail(msg, pytrace=False)
def teardown_method(self): def teardown_method(self):
if self.cleanup:
remove_application(self.driver) remove_application(self.driver)
remove_installation(self.driver) remove_installation(self.driver)

View File

@ -0,0 +1,13 @@
[Common]
;app URL
url = https://openbounty.status.im:444/
[Paths]
;AbsolutePath to 'tests' folder
tests_absolute = /usr/dir/open-bounty/test/end-to-end/tests/
[ORG]
;GitHub credentials for organization
gh_login = login
gh_password = password
;MetaMask password for organization
mm_password = password

View File

@ -1,22 +1,42 @@
import pytest import pytest
from os import environ from os import environ
from pages.openbounty.landing import LandingPage from pages.openbounty.landing import LandingPage
from pages.openbounty.bounties import BountiesPage
from tests.basetestcase import BaseTestCase from tests.basetestcase import BaseTestCase
from tests import test_data
@pytest.mark.sanity @pytest.mark.sanity
class TestLogin(BaseTestCase): class TestLogin(BaseTestCase):
def test_deploy_new_contract(self): def test_deploy_new_contract(self):
self.cleanup = True
landing = LandingPage(self.driver) landing = LandingPage(self.driver)
landing.get_landing_page() landing.get_landing_page()
# Sign Up to SOB
github = landing.login_button.click() github = landing.login_button.click()
github.sign_in('anna04test', github.sign_in(test_data.config['ORG']['gh_login'],
'f@E23D3H15Rd') test_data.config['ORG']['gh_password'])
assert github.permission_type.text == 'Personal user data' assert github.permission_type.text == 'Personal user data'
bounties_page = github.authorize_sob.click() bounties_page = github.authorize_sob.click()
# SOB Plugin installation and navigate to "Open bounties"
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 5 hunters' assert bounties_page.top_hunters_header.text == 'Top 5 hunters'
# Waiting for deployed contract; test_data.issue created here
github.create_new_bounty() github.create_new_bounty()
github.get_deployed_contract() github.get_deployed_contract()
# Navigate and check top bounty in "Open bounties"
bounties_page = BountiesPage(self.driver)
bounties_page.get_bounties_page()
titles = bounties_page.bounty_titles.find_elements()
assert titles[0].text == test_data.issue['title']