mirror of
https://github.com/status-im/open-bounty.git
synced 2025-01-12 18:44:38 +00:00
exclude unused modules
This commit is contained in:
parent
52faf5dfb8
commit
2b75cb2797
@ -6,7 +6,6 @@ from selenium.webdriver.support import expected_conditions
|
|||||||
|
|
||||||
|
|
||||||
class BaseElement(object):
|
class BaseElement(object):
|
||||||
|
|
||||||
class Locator(object):
|
class Locator(object):
|
||||||
|
|
||||||
def __init__(self, by, value):
|
def __init__(self, by, value):
|
||||||
|
@ -15,4 +15,3 @@ class BasePageObject(object):
|
|||||||
@property
|
@property
|
||||||
def time_now(self):
|
def time_now(self):
|
||||||
return datetime.now().strftime('%-m%-d%-H%-M%-S')
|
return datetime.now().strftime('%-m%-d%-H%-M%-S')
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ class ActivityDescription(BaseText):
|
|||||||
def __init__(self, driver, status, issue_title):
|
def __init__(self, driver, status, issue_title):
|
||||||
super(ActivityDescription, self).__init__(driver)
|
super(ActivityDescription, self).__init__(driver)
|
||||||
self.locator = self.Locator.xpath_selector(
|
self.locator = self.Locator.xpath_selector(
|
||||||
'//div[@class="description"]/div[contains(.,"' + status + '")]/a[contains(.,"' + issue_title + '")]')
|
'//div[@class="description"]/div[contains(.,"%s")]/a[contains(.,"%s")]' % (status, issue_title))
|
||||||
|
|
||||||
|
|
||||||
class ActivityPage(BasePageObject):
|
class ActivityPage(BasePageObject):
|
||||||
@ -17,12 +17,9 @@ class ActivityPage(BasePageObject):
|
|||||||
super(ActivityPage, self).__init__(driver)
|
super(ActivityPage, self).__init__(driver)
|
||||||
self.driver = driver
|
self.driver = driver
|
||||||
|
|
||||||
|
|
||||||
def get_activity_page(self):
|
def get_activity_page(self):
|
||||||
self.driver.get(test_data.config['Common']['url'] + 'app#/activity')
|
self.driver.get(test_data.config['Common']['url'] + 'app#/activity')
|
||||||
|
|
||||||
def check_activity_is_presented(self, status, issue_title):
|
def check_activity_is_presented(self, status, issue_title):
|
||||||
logging.info('Check that activity "' + status + issue_title + '" is displayed')
|
logging.info('Check that activity "%s %s" is displayed' % (status, issue_title))
|
||||||
ActivityDescription(self.driver, status, issue_title).find_element()
|
ActivityDescription(self.driver, status, issue_title).find_element()
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
|
import logging
|
||||||
from pages.base_page import BasePageObject
|
from pages.base_page import BasePageObject
|
||||||
from pages.base_element import *
|
from pages.base_element import BaseText
|
||||||
from tests import test_data
|
from tests import test_data
|
||||||
|
|
||||||
|
|
||||||
class BountiesHeader(BaseText):
|
class BountiesHeader(BaseText):
|
||||||
|
|
||||||
def __init__(self, driver):
|
def __init__(self, driver):
|
||||||
@ -15,6 +17,7 @@ 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):
|
class BountyTitles(BaseText):
|
||||||
|
|
||||||
def __init__(self, driver):
|
def __init__(self, driver):
|
||||||
@ -28,6 +31,7 @@ class BountyItemRows(BaseText):
|
|||||||
super(BountyItemRows, self).__init__(driver)
|
super(BountyItemRows, self).__init__(driver)
|
||||||
self.locator = self.Locator.css_selector('.open-bounty-item-content .bounty-item-row')
|
self.locator = self.Locator.css_selector('.open-bounty-item-content .bounty-item-row')
|
||||||
|
|
||||||
|
|
||||||
class BountyFooters(BaseText):
|
class BountyFooters(BaseText):
|
||||||
|
|
||||||
def __init__(self, driver):
|
def __init__(self, driver):
|
||||||
@ -40,7 +44,7 @@ class BountyClaimsAmount(BaseText):
|
|||||||
def __init__(self, driver, issue_title, claims_text):
|
def __init__(self, driver, issue_title, claims_text):
|
||||||
super(BaseText, self).__init__(driver)
|
super(BaseText, self).__init__(driver)
|
||||||
self.locator = self.Locator.xpath_selector(
|
self.locator = self.Locator.xpath_selector(
|
||||||
'//div[@class="header"]/a[contains(.,"' + issue_title +'")]/../../div[@class="footer-row"]/span[contains(.,"' + claims_text + '")]')
|
'//div[@class="header"]/a[contains(.,"%s")]/../../div[@class="footer-row"]/span[contains(.,"%s")]' % (issue_title, claims_text))
|
||||||
|
|
||||||
|
|
||||||
class BountiesPage(BasePageObject):
|
class BountiesPage(BasePageObject):
|
||||||
@ -59,6 +63,5 @@ class BountiesPage(BasePageObject):
|
|||||||
self.driver.get(test_data.config['Common']['url'] + 'app')
|
self.driver.get(test_data.config['Common']['url'] + 'app')
|
||||||
|
|
||||||
def check_bounty_claims_amount(self, issue_title, claims_text):
|
def check_bounty_claims_amount(self, issue_title, claims_text):
|
||||||
logging.info('Check that bounty "' + issue_title + '" has "' + claims_text + '"')
|
logging.info('Check that bounty "%s" has "%s"' % (issue_title, claims_text))
|
||||||
BountyClaimsAmount(self.driver, issue_title, claims_text).find_element()
|
BountyClaimsAmount(self.driver, issue_title, claims_text).find_element()
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
from pages.base_page import BasePageObject
|
from pages.base_page import BasePageObject
|
||||||
from pages.base_element import *
|
from pages.base_element import BaseButton
|
||||||
from tests import test_data
|
from tests import test_data
|
||||||
|
|
||||||
|
|
||||||
|
32
test/end-to-end/pages/thirdparty/github.py
vendored
32
test/end-to-end/pages/thirdparty/github.py
vendored
@ -1,10 +1,10 @@
|
|||||||
import time, pytest, git, os, shutil, logging
|
import time, pytest, git, os, shutil, logging
|
||||||
from pages.base_element import *
|
from selenium.common.exceptions import TimeoutException
|
||||||
|
from pages.base_element import BaseEditBox, BaseButton, BaseText
|
||||||
from pages.base_page import BasePageObject
|
from pages.base_page import BasePageObject
|
||||||
from tests import test_data
|
from tests import test_data
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class EmailEditbox(BaseEditBox):
|
class EmailEditbox(BaseEditBox):
|
||||||
|
|
||||||
def __init__(self, driver):
|
def __init__(self, driver):
|
||||||
@ -107,21 +107,26 @@ class ContractBody(BaseText):
|
|||||||
super(ContractBody, self).__init__(driver)
|
super(ContractBody, self).__init__(driver)
|
||||||
self.locator = self.Locator.xpath_selector("//tbody//p[contains(text(), "
|
self.locator = self.Locator.xpath_selector("//tbody//p[contains(text(), "
|
||||||
"'Current balance: 0.000000 ETH')]")
|
"'Current balance: 0.000000 ETH')]")
|
||||||
|
|
||||||
|
|
||||||
class IssueId(BaseText):
|
class IssueId(BaseText):
|
||||||
def __init__(self, driver):
|
def __init__(self, driver):
|
||||||
super(IssueId, self).__init__(driver)
|
super(IssueId, self).__init__(driver)
|
||||||
self.locator = self.Locator.css_selector(".gh-header-number")
|
self.locator = self.Locator.css_selector(".gh-header-number")
|
||||||
|
|
||||||
|
|
||||||
class ForkButton(BaseButton):
|
class ForkButton(BaseButton):
|
||||||
def __init__(self, driver):
|
def __init__(self, driver):
|
||||||
super(ForkButton, self).__init__(driver)
|
super(ForkButton, self).__init__(driver)
|
||||||
self.locator = self.Locator.css_selector("[href='#fork-destination-box']")
|
self.locator = self.Locator.css_selector("[href='#fork-destination-box']")
|
||||||
|
|
||||||
|
|
||||||
class HeaderInForkPopup(BaseText):
|
class HeaderInForkPopup(BaseText):
|
||||||
def __init__(self, driver):
|
def __init__(self, driver):
|
||||||
super(HeaderInForkPopup, self).__init__(driver)
|
super(HeaderInForkPopup, self).__init__(driver)
|
||||||
self.locator = self.Locator.css_selector("#facebox-header")
|
self.locator = self.Locator.css_selector("#facebox-header")
|
||||||
|
|
||||||
|
|
||||||
class UserAccountInForkPopup(BaseButton):
|
class UserAccountInForkPopup(BaseButton):
|
||||||
def __init__(self, driver):
|
def __init__(self, driver):
|
||||||
super(UserAccountInForkPopup, self).__init__(driver)
|
super(UserAccountInForkPopup, self).__init__(driver)
|
||||||
@ -133,31 +138,39 @@ class ForkedRepoText(BaseText):
|
|||||||
super(ForkedRepoText, self).__init__(driver)
|
super(ForkedRepoText, self).__init__(driver)
|
||||||
self.locator = self.Locator.css_selector(".commit-tease")
|
self.locator = self.Locator.css_selector(".commit-tease")
|
||||||
|
|
||||||
|
|
||||||
class DeleteRepo(BaseButton):
|
class DeleteRepo(BaseButton):
|
||||||
def __init__(self, driver):
|
def __init__(self, driver):
|
||||||
super(DeleteRepo, self).__init__(driver)
|
super(DeleteRepo, self).__init__(driver)
|
||||||
self.locator = self.Locator.xpath_selector("//button[text()[contains(.,' Delete this repository')]]")
|
self.locator = self.Locator.xpath_selector("//button[text()[contains(.,' Delete this repository')]]")
|
||||||
|
|
||||||
|
|
||||||
class RepoNameBoxInPopup(BaseEditBox):
|
class RepoNameBoxInPopup(BaseEditBox):
|
||||||
def __init__(self, driver):
|
def __init__(self, driver):
|
||||||
super(RepoNameBoxInPopup, self).__init__(driver)
|
super(RepoNameBoxInPopup, self).__init__(driver)
|
||||||
self.locator = self.Locator.css_selector("input[aria-label='Type in the name of the repository to confirm that you want to delete this repository.']")
|
self.locator = self.Locator.css_selector(
|
||||||
|
"input[aria-label='Type in the name of the repository to confirm that you want to delete this repository.']")
|
||||||
|
|
||||||
|
|
||||||
class ConfirmDeleteButton(BaseButton):
|
class ConfirmDeleteButton(BaseButton):
|
||||||
def __init__(self, driver):
|
def __init__(self, driver):
|
||||||
super(ConfirmDeleteButton, self).__init__(driver)
|
super(ConfirmDeleteButton, self).__init__(driver)
|
||||||
self.locator = self.Locator.xpath_selector("//button[text()[contains(.,'I understand the consequences, delete')]]")
|
self.locator = self.Locator.xpath_selector(
|
||||||
|
"//button[text()[contains(.,'I understand the consequences, delete')]]")
|
||||||
|
|
||||||
|
|
||||||
class CompareAndPullRequest(BaseButton):
|
class CompareAndPullRequest(BaseButton):
|
||||||
def __init__(self, driver):
|
def __init__(self, driver):
|
||||||
super(CompareAndPullRequest, self).__init__(driver)
|
super(CompareAndPullRequest, self).__init__(driver)
|
||||||
self.locator = self.Locator.css_selector(".RecentBranches a")
|
self.locator = self.Locator.css_selector(".RecentBranches a")
|
||||||
|
|
||||||
|
|
||||||
class PrTitleEditBox(BaseEditBox):
|
class PrTitleEditBox(BaseEditBox):
|
||||||
def __init__(self, driver):
|
def __init__(self, driver):
|
||||||
super(PrTitleEditBox, self).__init__(driver)
|
super(PrTitleEditBox, self).__init__(driver)
|
||||||
self.locator = self.Locator.id("pull_request_body")
|
self.locator = self.Locator.id("pull_request_body")
|
||||||
|
|
||||||
|
|
||||||
class SubmitNewPrButton(BaseButton):
|
class SubmitNewPrButton(BaseButton):
|
||||||
def __init__(self, driver):
|
def __init__(self, driver):
|
||||||
super(SubmitNewPrButton, self).__init__(driver)
|
super(SubmitNewPrButton, self).__init__(driver)
|
||||||
@ -208,12 +221,11 @@ class GithubPage(BasePageObject):
|
|||||||
self.pr_body = PrTitleEditBox(self.driver)
|
self.pr_body = PrTitleEditBox(self.driver)
|
||||||
self.submit_new_pr_button = SubmitNewPrButton(self.driver)
|
self.submit_new_pr_button = SubmitNewPrButton(self.driver)
|
||||||
|
|
||||||
|
|
||||||
def get_issues_page(self):
|
def get_issues_page(self):
|
||||||
self.driver.get(test_data.config['ORG']['gh_repo'] + 'issues')
|
self.driver.get('%sissues' % test_data.config['ORG']['gh_repo'])
|
||||||
|
|
||||||
def get_issue_page(self, issue_id):
|
def get_issue_page(self, issue_id):
|
||||||
self.driver.get(test_data.config['ORG']['gh_repo'] + 'issues/' + issue_id)
|
self.driver.get('%sissues/%s' % (test_data.config['ORG']['gh_repo'], issue_id))
|
||||||
|
|
||||||
def get_sob_plugin_page(self):
|
def get_sob_plugin_page(self):
|
||||||
self.driver.get(test_data.config['Common']['sob_test_app'])
|
self.driver.get(test_data.config['Common']['sob_test_app'])
|
||||||
@ -223,7 +235,6 @@ class GithubPage(BasePageObject):
|
|||||||
self.password_input.send_keys(password)
|
self.password_input.send_keys(password)
|
||||||
self.sign_in_button.click()
|
self.sign_in_button.click()
|
||||||
|
|
||||||
|
|
||||||
def install_sob_plugin(self):
|
def install_sob_plugin(self):
|
||||||
initial_url = self.driver.current_url
|
initial_url = self.driver.current_url
|
||||||
self.get_sob_plugin_page()
|
self.get_sob_plugin_page()
|
||||||
@ -281,7 +292,6 @@ class GithubPage(BasePageObject):
|
|||||||
assert upstream.exists()
|
assert upstream.exists()
|
||||||
repo.heads.master.checkout()
|
repo.heads.master.checkout()
|
||||||
|
|
||||||
|
|
||||||
def create_pr_git(self, branch, file_to_modify='test'):
|
def create_pr_git(self, branch, file_to_modify='test'):
|
||||||
repo = git.Repo(self.local_repo_path)
|
repo = git.Repo(self.local_repo_path)
|
||||||
logging.info(repo.git.status())
|
logging.info(repo.git.status())
|
||||||
@ -298,7 +308,7 @@ class GithubPage(BasePageObject):
|
|||||||
def open_pr_github(self, keyword_comment):
|
def open_pr_github(self, keyword_comment):
|
||||||
self.get_url(test_data.config['DEV']['gh_forked_repo'])
|
self.get_url(test_data.config['DEV']['gh_forked_repo'])
|
||||||
self.compare_and_pull_request.click()
|
self.compare_and_pull_request.click()
|
||||||
self.pr_body.send_keys(keyword_comment + ' #%s' % test_data.issue['id'])
|
self.pr_body.send_keys('%s #%s' % (keyword_comment, test_data.issue['id']))
|
||||||
self.submit_new_pr_button.click()
|
self.submit_new_pr_button.click()
|
||||||
|
|
||||||
def clean_repo_local_folder(self):
|
def clean_repo_local_folder(self):
|
||||||
@ -311,5 +321,3 @@ class GithubPage(BasePageObject):
|
|||||||
self.delete_repo.click()
|
self.delete_repo.click()
|
||||||
self.repo_name_confirm_delete.send_keys(test_data.config['ORG']['gh_repo_name'])
|
self.repo_name_confirm_delete.send_keys(test_data.config['ORG']['gh_repo_name'])
|
||||||
self.confirm_delete.click()
|
self.confirm_delete.click()
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import time
|
import time
|
||||||
from pages.base_page import BasePageObject
|
from pages.base_page import BasePageObject
|
||||||
from pages.base_element import *
|
from pages.base_element import BaseButton, BaseText, BaseEditBox
|
||||||
from selenium.webdriver import ActionChains
|
from selenium.webdriver import ActionChains
|
||||||
|
|
||||||
|
|
||||||
@ -74,7 +74,6 @@ class MetaMaskPlugin(BasePageObject):
|
|||||||
self.ok_button = OkButton(self.driver)
|
self.ok_button = OkButton(self.driver)
|
||||||
|
|
||||||
def recover_access(self, passphrase, password, confirm_password):
|
def recover_access(self, passphrase, password, confirm_password):
|
||||||
|
|
||||||
self.get_url('chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/popup.html')
|
self.get_url('chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/popup.html')
|
||||||
self.accept_button.click()
|
self.accept_button.click()
|
||||||
ActionChains(self.driver).move_to_element(self.privacy_text.find_element()).perform()
|
ActionChains(self.driver).move_to_element(self.privacy_text.find_element()).perform()
|
||||||
@ -85,4 +84,3 @@ class MetaMaskPlugin(BasePageObject):
|
|||||||
self.password_edit_box.send_keys(password)
|
self.password_edit_box.send_keys(password)
|
||||||
self.password_box_confirm.send_keys(confirm_password)
|
self.password_box_confirm.send_keys(confirm_password)
|
||||||
self.ok_button.click()
|
self.ok_button.click()
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import configparser, time, datetime, os
|
import configparser, time, datetime, os
|
||||||
|
|
||||||
|
|
||||||
class TestData(object):
|
class TestData(object):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
||||||
self.test_name = None
|
self.test_name = None
|
||||||
self.config = configparser.ConfigParser()
|
self.config = configparser.ConfigParser()
|
||||||
|
|
||||||
@ -20,6 +20,4 @@ class TestData(object):
|
|||||||
# self.issue['id'] is set in GithubPage::create_new_bounty
|
# self.issue['id'] is set in GithubPage::create_new_bounty
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
test_data = TestData()
|
test_data = TestData()
|
||||||
|
@ -2,18 +2,19 @@ import pytest, sys, os
|
|||||||
from selenium import webdriver
|
from selenium import webdriver
|
||||||
from selenium.common.exceptions import WebDriverException
|
from selenium.common.exceptions import WebDriverException
|
||||||
from tests.postconditions import remove_application, remove_installation
|
from tests.postconditions import remove_application, remove_installation
|
||||||
from os import environ, path
|
from os import environ
|
||||||
from tests import test_data
|
from tests import test_data
|
||||||
from pages.thirdparty.github import GithubPage
|
from pages.thirdparty.github import GithubPage
|
||||||
from pages.openbounty.landing import LandingPage
|
from pages.openbounty.landing import LandingPage
|
||||||
|
|
||||||
class BaseTestCase:
|
|
||||||
|
|
||||||
|
class BaseTestCase:
|
||||||
|
|
||||||
def print_sauce_lab_info(self, driver):
|
def print_sauce_lab_info(self, driver):
|
||||||
sys.stdout = sys.stderr
|
sys.stdout = sys.stderr
|
||||||
print("SauceOnDemandSessionID=%s job-name=%s" % (driver.session_id,
|
print("SauceOnDemandSessionID=%s job-name=%s" % (driver.session_id,
|
||||||
pytest.config.getoption('build')))
|
pytest.config.getoption('build')))
|
||||||
|
|
||||||
def get_remote_caps(self):
|
def get_remote_caps(self):
|
||||||
sauce_lab_cap = dict()
|
sauce_lab_cap = dict()
|
||||||
sauce_lab_cap['name'] = test_data.test_name
|
sauce_lab_cap['name'] = test_data.test_name
|
||||||
@ -38,9 +39,9 @@ class BaseTestCase:
|
|||||||
cls.errors = []
|
cls.errors = []
|
||||||
cls.environment = pytest.config.getoption('env')
|
cls.environment = pytest.config.getoption('env')
|
||||||
|
|
||||||
###################################################################################################################
|
################################################################################################################
|
||||||
######### Drivers setup
|
######### Drivers setup
|
||||||
###################################################################################################################
|
################################################################################################################
|
||||||
|
|
||||||
#
|
#
|
||||||
# Dev Chrome options
|
# Dev Chrome options
|
||||||
@ -52,7 +53,8 @@ class BaseTestCase:
|
|||||||
# Org Chrome options
|
# Org Chrome options
|
||||||
#
|
#
|
||||||
cls.capabilities_org = webdriver.ChromeOptions()
|
cls.capabilities_org = webdriver.ChromeOptions()
|
||||||
cls.capabilities_org.add_extension(os.path.join(test_data.tests_path, os.pardir, 'resources', 'metamask3_12_0.crx'))
|
cls.capabilities_org.add_extension(
|
||||||
|
os.path.join(test_data.tests_path, os.pardir, 'resources', 'metamask3_12_0.crx'))
|
||||||
|
|
||||||
#
|
#
|
||||||
# SauceLab capabilities
|
# SauceLab capabilities
|
||||||
@ -78,14 +80,12 @@ class BaseTestCase:
|
|||||||
cls.driver_dev = cls.drivers[0]
|
cls.driver_dev = cls.drivers[0]
|
||||||
cls.driver_org = cls.drivers[1]
|
cls.driver_org = cls.drivers[1]
|
||||||
|
|
||||||
|
|
||||||
for driver in cls.drivers:
|
for driver in cls.drivers:
|
||||||
driver.implicitly_wait(10)
|
driver.implicitly_wait(10)
|
||||||
|
|
||||||
|
################################################################################################################
|
||||||
###################################################################################################################
|
|
||||||
######### Actions for each driver before class
|
######### Actions for each driver before class
|
||||||
###################################################################################################################
|
################################################################################################################
|
||||||
|
|
||||||
######ORG
|
######ORG
|
||||||
landing = LandingPage(cls.driver_org)
|
landing = LandingPage(cls.driver_org)
|
||||||
@ -119,9 +119,6 @@ class BaseTestCase:
|
|||||||
test_data.config['ORG']['gh_repo_name'])
|
test_data.config['ORG']['gh_repo_name'])
|
||||||
cls.verify_no_errors(cls)
|
cls.verify_no_errors(cls)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def teardown_class(cls):
|
def teardown_class(cls):
|
||||||
|
|
||||||
@ -142,6 +139,3 @@ class BaseTestCase:
|
|||||||
|
|
||||||
except WebDriverException:
|
except WebDriverException:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,4 +20,3 @@ def remove_installation(driver):
|
|||||||
driver.find_element(By.CSS_SELECTOR, '.facebox-popup .btn-danger').click()
|
driver.find_element(By.CSS_SELECTOR, '.facebox-popup .btn-danger').click()
|
||||||
except NoSuchElementException:
|
except NoSuchElementException:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user