added verification of user data absence in logcat

This commit is contained in:
Anton Danchenko 2017-11-09 12:58:11 +02:00
parent c9c5c57980
commit a95d118959
4 changed files with 60 additions and 22 deletions

View File

@ -18,9 +18,9 @@ class TestData(object):
self.name = None
basic_user = {'password': "qwerty",
'passphrase': "level acquire claim tide company believe duck embody consider dune century mountain",
'username': "Silky Heavenly Zethusspinipes"}
basic_user = {'password': "newuniquepassword12",
'passphrase': "tree weekend ceiling awkward universe pyramid glimpse raven pair lounge grant grief",
'username': "Splendid Useless Racerunner"}
transaction_users = {
'A_USER': {'password': "qwerty",

View File

@ -40,6 +40,7 @@ class TestAccess(SingleDeviceTestCase):
for text in new_status + ' ', new_username:
chats.find_full_text(text, 5)
@pytest.mark.recover
def test_recover_access(self):
home = HomeView(self.driver)
set_password_as_new_user(home)
@ -56,7 +57,10 @@ class TestAccess(SingleDeviceTestCase):
login.password_input.send_keys(basic_user['password'])
login.sign_in_button.click()
home.find_full_text('Chats', 60)
if basic_user['password'] in str(home.logcat):
pytest.fail('Password in logcat!!!', pytrace=False)
@pytest.mark.sign_in
@pytest.mark.parametrize("verification", ["invalid", "valid"])
def test_sign_in(self, verification):
@ -76,20 +80,30 @@ class TestAccess(SingleDeviceTestCase):
login.password_input.send_keys(verifications[verification]['input'])
login.sign_in_button.click()
home.find_full_text(verifications[verification]["outcome"], 60)
if verifications[verification]["input"] in str(home.logcat):
pytest.fail('Password in logcat!!!', pytrace=False)
@pytest.mark.parametrize("verification", ["short", "mismatch"])
@pytest.mark.password
@pytest.mark.parametrize("verification", ["logcat", "mismatch", "short"])
def test_password(self, verification):
verifications = {"short":
{"input": "qwe1",
"outcome": "Password should be not less then 6 symbols."},
"mismatch":
{"input": "mismatch1234",
"outcome": "Password confirmation doesn\'t match password."}}
verifications = {
"short": {"input": "qwe1",
"outcome": "Password should be not less then 6 symbols."},
"mismatch": {"input": "mismatch1234",
"outcome": "Password confirmation doesn\'t match password."},
"logcat": {"input": "new_unique_password",
"outcome": "Here is your signing phrase. "
"You will use it to verify your transactions. "
"Write it down and keep it safe!"}}
home = HomeView(self.driver)
home.request_password_icon.click()
home.chat_request_input.send_keys(verifications[verification]["input"])
home.confirm()
if 'short' not in verification:
home.chat_request_input.send_keys("qwerty1234")
home.chat_request_input.send_keys("new_unique_password")
home.confirm()
home.find_full_text(verifications[verification]["outcome"])
if verifications[verification]["input"] in str(home.logcat):
pytest.fail('Password in logcat!!!', pytrace=False)

View File

@ -110,6 +110,27 @@ class SaveButton(BaseButton):
"//android.widget.TextView[@text='SAVE']")
class ChatRequestInput(BaseEditBox):
def __init__(self, driver):
super(ChatRequestInput, self).__init__(driver)
self.locator = \
self.Locator.xpath_selector("//android.widget.EditText[@content-desc!='chat-message-input']")
class AppsButton(BaseButton):
def __init__(self, driver):
super(AppsButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id("Apps")
class StatusAppIcon(BaseButton):
def __init__(self, driver):
super(StatusAppIcon, self).__init__(driver)
self.locator = self.Locator.xpath_selector(
"//*[@text='Status']")
class BaseViewObject(object):
def __init__(self, driver):
self.driver = driver
@ -118,8 +139,10 @@ class BaseViewObject(object):
self.no_button = NoButton(self.driver)
self.back_button = BackButton(self.driver)
self.deny_button = DenyButton(self.driver)
self.continue_button_apk = ContinueButtonAPK(driver)
self.ok_button_apk = OkButtonAPK(driver)
self.continue_button_apk = ContinueButtonAPK(self.driver)
self.ok_button_apk = OkButtonAPK(self.driver)
self.apps_button = AppsButton(self.driver)
self.status_app_icon = StatusAppIcon(self.driver)
self.contacts_button = ContactsButton(self.driver)
self.wallet_button = WalletButton(self.driver)
@ -127,6 +150,12 @@ class BaseViewObject(object):
self.save_button = SaveButton(self.driver)
self.chat_request_input = ChatRequestInput(self.driver)
@property
def logcat(self):
return self.driver.get_log("logcat")
def confirm(self):
logging.info("Tap 'Confirm' on native keyboard")
self.driver.keyevent(66)
@ -168,6 +197,10 @@ class BaseViewObject(object):
from views.chats import ChatsViewObject
return ChatsViewObject(self.driver)
def get_login(self):
from views.login import LoginView
return LoginView(self.driver)
def get_balance(self, address):
url = 'http://ropsten.etherscan.io/api?module=account&action=balance&address=0x%s&tag=latest' % address
for i in range(5):

View File

@ -3,14 +3,6 @@ from views.base_element import *
from tests import tests_data
class ChatRequestInput(BaseEditBox):
def __init__(self, driver):
super(ChatRequestInput, self).__init__(driver)
self.locator = \
self.Locator.xpath_selector("//android.widget.EditText[@content-desc!='chat-message-input']")
class RequestPasswordIcon(BaseButton):
def __init__(self, driver):
@ -44,6 +36,5 @@ class HomeView(BaseViewObject):
i.click()
except (NoSuchElementException, TimeoutException):
pass
self.chat_request_input = ChatRequestInput(self.driver)
self.request_password_icon = RequestPasswordIcon(self.driver)
self.recover_button = RecoverButton(self.driver)