exclude unused modules

This commit is contained in:
Churikova Tetiana 2018-04-09 13:07:41 +03:00
parent 52faf5dfb8
commit 2b75cb2797
No known key found for this signature in database
GPG Key ID: 0D4EA7B33B47E6D8
10 changed files with 59 additions and 64 deletions

View File

@ -6,7 +6,6 @@ from selenium.webdriver.support import expected_conditions
class BaseElement(object):
class Locator(object):
def __init__(self, by, value):

View File

@ -15,4 +15,3 @@ class BasePageObject(object):
@property
def time_now(self):
return datetime.now().strftime('%-m%-d%-H%-M%-S')

View File

@ -9,7 +9,7 @@ class ActivityDescription(BaseText):
def __init__(self, driver, status, issue_title):
super(ActivityDescription, self).__init__(driver)
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):
@ -17,12 +17,9 @@ class ActivityPage(BasePageObject):
super(ActivityPage, self).__init__(driver)
self.driver = driver
def get_activity_page(self):
self.driver.get(test_data.config['Common']['url'] + 'app#/activity')
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()

View File

@ -1,7 +1,9 @@
import logging
from pages.base_page import BasePageObject
from pages.base_element import *
from pages.base_element import BaseText
from tests import test_data
class BountiesHeader(BaseText):
def __init__(self, driver):
@ -15,6 +17,7 @@ class TopHuntersHeader(BaseText):
super(TopHuntersHeader, self).__init__(driver)
self.locator = self.Locator.css_selector('.top-hunters-header')
class BountyTitles(BaseText):
def __init__(self, driver):
@ -28,6 +31,7 @@ class BountyItemRows(BaseText):
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):
@ -40,7 +44,7 @@ class BountyClaimsAmount(BaseText):
def __init__(self, driver, issue_title, claims_text):
super(BaseText, self).__init__(driver)
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):
@ -59,6 +63,5 @@ class BountiesPage(BasePageObject):
self.driver.get(test_data.config['Common']['url'] + 'app')
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()

View File

@ -1,5 +1,5 @@
from pages.base_page import BasePageObject
from pages.base_element import *
from pages.base_element import BaseButton
from tests import test_data

View File

@ -1,10 +1,10 @@
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 tests import test_data
class EmailEditbox(BaseEditBox):
def __init__(self, driver):
@ -107,21 +107,26 @@ class ContractBody(BaseText):
super(ContractBody, self).__init__(driver)
self.locator = self.Locator.xpath_selector("//tbody//p[contains(text(), "
"'Current balance: 0.000000 ETH')]")
class IssueId(BaseText):
def __init__(self, driver):
super(IssueId, self).__init__(driver)
self.locator = self.Locator.css_selector(".gh-header-number")
class ForkButton(BaseButton):
def __init__(self, driver):
super(ForkButton, self).__init__(driver)
self.locator = self.Locator.css_selector("[href='#fork-destination-box']")
class HeaderInForkPopup(BaseText):
def __init__(self, driver):
super(HeaderInForkPopup, self).__init__(driver)
self.locator = self.Locator.css_selector("#facebox-header")
class UserAccountInForkPopup(BaseButton):
def __init__(self, driver):
super(UserAccountInForkPopup, self).__init__(driver)
@ -133,31 +138,39 @@ class ForkedRepoText(BaseText):
super(ForkedRepoText, self).__init__(driver)
self.locator = self.Locator.css_selector(".commit-tease")
class DeleteRepo(BaseButton):
def __init__(self, driver):
super(DeleteRepo, self).__init__(driver)
self.locator = self.Locator.xpath_selector("//button[text()[contains(.,' Delete this repository')]]")
class RepoNameBoxInPopup(BaseEditBox):
def __init__(self, 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):
def __init__(self, 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):
def __init__(self, driver):
super(CompareAndPullRequest, self).__init__(driver)
self.locator = self.Locator.css_selector(".RecentBranches a")
class PrTitleEditBox(BaseEditBox):
def __init__(self, driver):
super(PrTitleEditBox, self).__init__(driver)
self.locator = self.Locator.id("pull_request_body")
class SubmitNewPrButton(BaseButton):
def __init__(self, driver):
super(SubmitNewPrButton, self).__init__(driver)
@ -208,12 +221,11 @@ class GithubPage(BasePageObject):
self.pr_body = PrTitleEditBox(self.driver)
self.submit_new_pr_button = SubmitNewPrButton(self.driver)
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):
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):
self.driver.get(test_data.config['Common']['sob_test_app'])
@ -223,7 +235,6 @@ class GithubPage(BasePageObject):
self.password_input.send_keys(password)
self.sign_in_button.click()
def install_sob_plugin(self):
initial_url = self.driver.current_url
self.get_sob_plugin_page()
@ -281,7 +292,6 @@ class GithubPage(BasePageObject):
assert upstream.exists()
repo.heads.master.checkout()
def create_pr_git(self, branch, file_to_modify='test'):
repo = git.Repo(self.local_repo_path)
logging.info(repo.git.status())
@ -298,7 +308,7 @@ class GithubPage(BasePageObject):
def open_pr_github(self, keyword_comment):
self.get_url(test_data.config['DEV']['gh_forked_repo'])
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()
def clean_repo_local_folder(self):
@ -311,5 +321,3 @@ class GithubPage(BasePageObject):
self.delete_repo.click()
self.repo_name_confirm_delete.send_keys(test_data.config['ORG']['gh_repo_name'])
self.confirm_delete.click()

View File

@ -1,6 +1,6 @@
import time
from pages.base_page import BasePageObject
from pages.base_element import *
from pages.base_element import BaseButton, BaseText, BaseEditBox
from selenium.webdriver import ActionChains
@ -74,7 +74,6 @@ class MetaMaskPlugin(BasePageObject):
self.ok_button = OkButton(self.driver)
def recover_access(self, passphrase, password, confirm_password):
self.get_url('chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/popup.html')
self.accept_button.click()
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_box_confirm.send_keys(confirm_password)
self.ok_button.click()

View File

@ -1,9 +1,9 @@
import configparser, time, datetime, os
class TestData(object):
def __init__(self):
self.test_name = None
self.config = configparser.ConfigParser()
@ -20,6 +20,4 @@ class TestData(object):
# self.issue['id'] is set in GithubPage::create_new_bounty
test_data = TestData()

View File

@ -2,18 +2,19 @@ import pytest, sys, os
from selenium import webdriver
from selenium.common.exceptions import WebDriverException
from tests.postconditions import remove_application, remove_installation
from os import environ, path
from os import environ
from tests import test_data
from pages.thirdparty.github import GithubPage
from pages.openbounty.landing import LandingPage
class BaseTestCase:
class BaseTestCase:
def print_sauce_lab_info(self, driver):
sys.stdout = sys.stderr
print("SauceOnDemandSessionID=%s job-name=%s" % (driver.session_id,
pytest.config.getoption('build')))
def get_remote_caps(self):
sauce_lab_cap = dict()
sauce_lab_cap['name'] = test_data.test_name
@ -38,9 +39,9 @@ class BaseTestCase:
cls.errors = []
cls.environment = pytest.config.getoption('env')
###################################################################################################################
################################################################################################################
######### Drivers setup
###################################################################################################################
################################################################################################################
#
# Dev Chrome options
@ -52,7 +53,8 @@ class BaseTestCase:
# Org Chrome options
#
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
@ -78,14 +80,12 @@ class BaseTestCase:
cls.driver_dev = cls.drivers[0]
cls.driver_org = cls.drivers[1]
for driver in cls.drivers:
driver.implicitly_wait(10)
###################################################################################################################
################################################################################################################
######### Actions for each driver before class
###################################################################################################################
################################################################################################################
######ORG
landing = LandingPage(cls.driver_org)
@ -119,9 +119,6 @@ class BaseTestCase:
test_data.config['ORG']['gh_repo_name'])
cls.verify_no_errors(cls)
@classmethod
def teardown_class(cls):
@ -142,6 +139,3 @@ class BaseTestCase:
except WebDriverException:
pass

View File

@ -20,4 +20,3 @@ def remove_installation(driver):
driver.find_element(By.CSS_SELECTOR, '.facebox-popup .btn-danger').click()
except NoSuchElementException:
pass