From 65fa9e57412f8fcd5e17957a88c5b204b11141f6 Mon Sep 17 00:00:00 2001 From: yevh-berdnyk Date: Fri, 1 Jun 2018 18:37:44 +0200 Subject: [PATCH] Fixed login in e2e tests Signed-off-by: yevh-berdnyk --- test/appium/tests/__init__.py | 4 +++- test/appium/tests/test_chat_management.py | 2 +- test/appium/tests/test_messaging.py | 2 +- test/appium/tests/test_profile.py | 3 +-- test/appium/tests/test_transaction.py | 4 ++-- test/appium/views/base_view.py | 4 ++-- test/appium/views/chat_view.py | 12 ++++++++---- test/appium/views/sign_in_view.py | 6 +++--- 8 files changed, 21 insertions(+), 16 deletions(-) diff --git a/test/appium/tests/__init__.py b/test/appium/tests/__init__.py index da5312a52a..900dfeffc6 100644 --- a/test/appium/tests/__init__.py +++ b/test/appium/tests/__init__.py @@ -158,4 +158,6 @@ group_chat_users['C_USER']['password'] = "qwerty" group_chat_users['C_USER']['passphrase'] = "you salmon ticket antique spray panther flee neck scale mad trial exile" group_chat_users['C_USER']['username'] = "Optimistic Gigantic Bagworm" group_chat_users['C_USER']['public_key'] = "0x04dcdb5cac266328c41bdb0e33a266544a4ac1f2655a68170e5fe4452baff1a413a1d40" \ - "3dba7e295445505ee55ea03ee99cb7d26bee05e6b486a9bdaaf6be73a0b" \ No newline at end of file + "3dba7e295445505ee55ea03ee99cb7d26bee05e6b486a9bdaaf6be73a0b" + +common_password = 'qwerty' diff --git a/test/appium/tests/test_chat_management.py b/test/appium/tests/test_chat_management.py index e8e7191ff0..357a605e79 100644 --- a/test/appium/tests/test_chat_management.py +++ b/test/appium/tests/test_chat_management.py @@ -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') diff --git a/test/appium/tests/test_messaging.py b/test/appium/tests/test_messaging.py index ee895af3de..c85121127e 100644 --- a/test/appium/tests/test_messaging.py +++ b/test/appium/tests/test_messaging.py @@ -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') diff --git a/test/appium/tests/test_profile.py b/test/appium/tests/test_profile.py index 3bec9695a0..23c6cda178 100644 --- a/test/appium/tests/test_profile.py +++ b/test/appium/tests/test_profile.py @@ -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') diff --git a/test/appium/tests/test_transaction.py b/test/appium/tests/test_transaction.py index 2a094a11a2..469e9c076d 100644 --- a/test/appium/tests/test_transaction.py +++ b/test/appium/tests/test_transaction.py @@ -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) diff --git a/test/appium/views/base_view.py b/test/appium/views/base_view.py index b88aa4dd46..7d988fb4dd 100644 --- a/test/appium/views/base_view.py +++ b/test/appium/views/base_view.py @@ -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() diff --git a/test/appium/views/chat_view.py b/test/appium/views/chat_view.py index 5a81d2886c..caf0f3acf0 100644 --- a/test/appium/views/chat_view.py +++ b/test/appium/views/chat_view.py @@ -281,14 +281,18 @@ 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() - self.send_message_button.click_until_presence_of_element(send_transaction_view.sign_transaction_button) + 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) try: diff --git a/test/appium/views/sign_in_view.py b/test/appium/views/sign_in_view.py index 2deb40128e..29609a9c9d 100644 --- a/test/appium/views/sign_in_view.py +++ b/test/appium/views/sign_in_view.py @@ -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()