2018-04-09 10:07:41 +00:00
|
|
|
import logging
|
2017-12-03 15:02:14 +00:00
|
|
|
from pages.base_page import BasePageObject
|
2018-04-09 10:07:41 +00:00
|
|
|
from pages.base_element import BaseText
|
2018-01-24 10:58:58 +00:00
|
|
|
from tests import test_data
|
2017-12-03 15:02:14 +00:00
|
|
|
|
2018-04-09 10:07:41 +00:00
|
|
|
|
2017-12-03 15:02:14 +00:00
|
|
|
class BountiesHeader(BaseText):
|
|
|
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(BountiesHeader, self).__init__(driver)
|
|
|
|
self.locator = self.Locator.css_selector('.open-bounties-header')
|
|
|
|
|
|
|
|
|
|
|
|
class TopHuntersHeader(BaseText):
|
|
|
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(TopHuntersHeader, self).__init__(driver)
|
|
|
|
self.locator = self.Locator.css_selector('.top-hunters-header')
|
|
|
|
|
2018-04-09 10:07:41 +00:00
|
|
|
|
2018-01-24 10:58:58 +00:00
|
|
|
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')
|
|
|
|
|
2018-04-09 10:07:41 +00:00
|
|
|
|
2018-01-24 10:58:58 +00:00
|
|
|
class BountyFooters(BaseText):
|
|
|
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(BountyFooters, self).__init__(driver)
|
|
|
|
self.locator = self.Locator.css_selector('.open-bounty-item-content .footer-row')
|
|
|
|
|
2017-12-03 15:02:14 +00:00
|
|
|
|
2018-04-06 11:58:07 +00:00
|
|
|
class BountyClaimsAmount(BaseText):
|
|
|
|
|
|
|
|
def __init__(self, driver, issue_title, claims_text):
|
|
|
|
super(BaseText, self).__init__(driver)
|
|
|
|
self.locator = self.Locator.xpath_selector(
|
2018-04-25 09:18:02 +00:00
|
|
|
'//div[@class="header"]/a[contains(.,"%s")]/../../*/span[contains(.,"%s")]' % (issue_title, claims_text))
|
|
|
|
|
2018-04-06 11:58:07 +00:00
|
|
|
|
|
|
|
|
2017-12-03 15:02:14 +00:00
|
|
|
class BountiesPage(BasePageObject):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(BountiesPage, self).__init__(driver)
|
2018-01-24 10:58:58 +00:00
|
|
|
|
2017-12-03 15:02:14 +00:00
|
|
|
self.driver = driver
|
|
|
|
|
|
|
|
self.bounties_header = BountiesHeader(self.driver)
|
|
|
|
self.top_hunters_header = TopHuntersHeader(self.driver)
|
2018-01-24 10:58:58 +00:00
|
|
|
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')
|
|
|
|
|
2018-04-06 11:58:07 +00:00
|
|
|
def check_bounty_claims_amount(self, issue_title, claims_text):
|
2018-04-09 10:07:41 +00:00
|
|
|
logging.info('Check that bounty "%s" has "%s"' % (issue_title, claims_text))
|
2018-04-06 11:58:07 +00:00
|
|
|
BountyClaimsAmount(self.driver, issue_title, claims_text).find_element()
|