Fixed login in e2e tests

Signed-off-by: yevh-berdnyk <ie.berdnyk@gmail.com>
This commit is contained in:
yevh-berdnyk 2018-06-01 18:37:44 +02:00
parent 49592f3a50
commit 65fa9e5741
No known key found for this signature in database
GPG Key ID: E9B425FDFC4DEA9C
8 changed files with 21 additions and 16 deletions

View File

@ -159,3 +159,5 @@ group_chat_users['C_USER']['passphrase'] = "you salmon ticket antique spray pant
group_chat_users['C_USER']['username'] = "Optimistic Gigantic Bagworm"
group_chat_users['C_USER']['public_key'] = "0x04dcdb5cac266328c41bdb0e33a266544a4ac1f2655a68170e5fe4452baff1a413a1d40" \
"3dba7e295445505ee55ea03ee99cb7d26bee05e6b486a9bdaaf6be73a0b"
common_password = 'qwerty'

View File

@ -164,7 +164,7 @@ class TestChatManagement(SingleDeviceTestCase):
chat_view.send_message_button.click()
transaction_amount = '0.00001'
chat_view.request_transaction_in_1_1_chat(transaction_amount)
chat_view.send_transaction_in_1_1_chat(transaction_amount, sender['password'])
chat_view.send_transaction_in_1_1_chat(transaction_amount, sender['password'], wallet_set_up=True)
chat_view.delete_chat(recipient['username'], self.errors)
if home_view.get_chat_with_user(recipient['username']).is_element_present(5):
pytest.fail('Deleted chat is shown on Home screen')

View File

@ -288,7 +288,7 @@ class TestOfflineMessages(MultipleDeviceTestCase):
chat_1.chat_message_input.send_keys(message_text)
chat_1.send_message_button.click()
sign_in_2.click_account_by_position(0)
sign_in_2.sign_in('qwerty1234')
sign_in_2.sign_in()
sign_in_2.home_button.wait_for_visibility_of_element()
if not home_2.offline_label.is_element_displayed():
self.errors.append('Offline label is not shown on Home view while being offline')

View File

@ -60,8 +60,7 @@ class TestProfileView(SingleDeviceTestCase):
profile_view = sign_in_view.profile_button.click()
sign_in_view = profile_view.switch_network('Rinkeby with upstream RPC')
sign_in_view.click_account_by_position(0)
sign_in_view.password_input.set_value('qwerty1234')
sign_in_view.sign_in_button.click()
sign_in_view.sign_in()
sign_in_view.profile_button.click_until_presence_of_element(profile_view.advanced_button)
profile_view.advanced_button.click()
desired_network = profile_view.element_by_text('RINKEBY WITH UPSTREAM RPC', 'text')

View File

@ -1,6 +1,6 @@
import pytest
from selenium.common.exceptions import TimeoutException
from tests import transaction_users, get_current_time, transaction_users_wallet, marks
from tests import transaction_users, get_current_time, transaction_users_wallet, marks, common_password
from tests.base_test_case import SingleDeviceTestCase, MultipleDeviceTestCase
from views.sign_in_view import SignInView
from views.web_views.base_web_view import BaseWebView
@ -28,7 +28,7 @@ class TestTransaction(SingleDeviceTestCase):
wallet_view.home_button.click()
home_view.add_contact(recipient['public_key'])
chat_view = home_view.get_chat_with_user(recipient['username']).click()
chat_view.send_transaction_in_1_1_chat(transaction_amount, 'qwerty1234')
chat_view.send_transaction_in_1_1_chat(transaction_amount, common_password)
send_transaction_view = chat_view.get_send_transaction_view()
send_transaction_view.back_button.click()
self.network_api.find_transaction_by_unique_amount(recipient['address'], transaction_amount)

View File

@ -1,7 +1,7 @@
import time
import base64
import zbarlight
from tests import info
from tests import info, common_password
from eth_keys import datatypes
from selenium.common.exceptions import NoSuchElementException, TimeoutException
from PIL import Image
@ -307,7 +307,7 @@ class BaseView(object):
except (NoSuchElementException, TimeoutException):
counter += 1
def relogin(self, password='qwerty1234'):
def relogin(self, password=common_password):
self.get_back_to_home_view()
profile_view = self.profile_button.click()
profile_view.logout_button.click()

View File

@ -281,13 +281,17 @@ class ChatView(BaseView):
self.element_by_text(chat_name).is_element_present():
errors.append('Chat was not deleted')
def send_transaction_in_1_1_chat(self, amount, password):
def send_transaction_in_1_1_chat(self, amount, password, wallet_set_up=False):
self.commands_button.click()
self.send_command.click()
self.send_as_keyevent(amount)
self.send_message_button.click()
send_transaction_view = self.get_send_transaction_view()
if wallet_set_up:
wallet_view = self.get_wallet_view()
self.send_message_button.click_until_presence_of_element(wallet_view.sign_in_phrase)
wallet_view.done_button.click()
wallet_view.yes_button.click()
else:
self.send_message_button.click_until_presence_of_element(send_transaction_view.sign_transaction_button)
send_transaction_view.sign_transaction(password)
send_transaction_view.find_full_text(amount)

View File

@ -1,4 +1,4 @@
from tests import get_current_time
from tests import get_current_time, common_password
from views.base_element import BaseButton, BaseEditBox
from views.base_view import BaseView
@ -98,7 +98,7 @@ class SignInView(BaseView):
self.name_input = NameInput(self.driver)
self.do_not_share = DonNotShare(self.driver)
def create_user(self, username: str = '', password='qwerty'):
def create_user(self, username: str = '', password=common_password):
self.create_account_button.click()
self.password_input.set_value(password)
self.next_button.click()
@ -124,7 +124,7 @@ class SignInView(BaseView):
self.do_not_share.wait_for_element(10)
self.do_not_share.click_until_presence_of_element(self.home_button)
def sign_in(self, password):
def sign_in(self, password=common_password):
self.password_input.set_value(password)
self.sign_in_button.click()