Updated test for signing a transaction in a DApp and removed test fro signing a transaction later

Signed-off-by: yevh-berdnyk <ie.berdnyk@gmail.com>
This commit is contained in:
yevh-berdnyk 2018-05-14 17:56:21 +03:00
parent 35f7527a1e
commit 9a94779238
No known key found for this signature in database
GPG Key ID: E9B425FDFC4DEA9C
5 changed files with 38 additions and 112 deletions

View File

@ -1,4 +1,3 @@
import time
from tests.base_test_case import SingleDeviceTestCase, MultipleDeviceTestCase
from tests import transaction_users, api_requests, get_current_time, transaction_users_wallet, marks
from selenium.common.exceptions import TimeoutException
@ -82,64 +81,27 @@ class TestTransaction(SingleDeviceTestCase):
sender = transaction_users['B_USER']
sign_in_view = SignInView(self.driver)
sign_in_view.recover_access(sender['passphrase'], sender['password'])
home_view = sign_in_view.get_home_view()
address = transaction_users['B_USER']['address']
initial_balance = api_requests.get_balance(address)
profile_view = sign_in_view.profile_button.click()
profile_view.advanced_button.click()
profile_view.debug_mode_toggle.click()
home_view = profile_view.home_button.click()
start_new_chat_view = home_view.plus_button.click()
start_new_chat_view.open_d_app_button.click()
auction_house = start_new_chat_view.auction_house_button.click()
start_new_chat_view.simple_dapp_button.scroll_to_element()
simple_dapp = start_new_chat_view.simple_dapp_button.click()
start_new_chat_view.open_button.click()
auction_house.wait_for_d_aap_to_load()
auction_house.toggle_navigation_button.click()
auction_house.new_auction_button.click()
auction_house.name_to_reserve_input.click()
auction_name = time.strftime('%Y-%m-%d-%H-%M')
auction_house.send_as_keyevent(auction_name)
auction_house.register_name_button.click()
simple_dapp.wait_for_d_aap_to_load()
simple_dapp.assets_button.click()
simple_dapp.request_stt_button.click()
send_transaction_view = home_view.get_send_transaction_view()
send_transaction_view.sign_transaction(sender['password'])
auction_house.find_full_text('You are the proud owner of the name: ' + auction_name, 120)
api_requests.verify_balance_is_updated(initial_balance, address)
@marks.pr
@marks.testrail_case_id(3405)
def test_send_eth_from_wallet_sign_later(self):
sender = transaction_users_wallet['B_USER']
recipient = transaction_users_wallet['A_USER']
sign_in_view = SignInView(self.driver)
sign_in_view.recover_access(sender['passphrase'], sender['password'])
home_view = sign_in_view.get_home_view()
initial_balance_recipient = api_requests.get_balance(recipient['address'])
home_view.add_contact(recipient['public_key'])
home_view.get_back_to_home_view()
wallet_view = home_view.wallet_button.click()
send_transaction = wallet_view.send_button.click()
send_transaction.amount_edit_box.click()
amount = send_transaction.get_unique_amount()
send_transaction.amount_edit_box.set_value(amount)
send_transaction.confirm()
send_transaction.chose_recipient_button.click()
send_transaction.enter_recipient_address_button.click()
send_transaction.enter_recipient_address_input.set_value(recipient['address'])
send_transaction.done_button.click_until_presence_of_element(send_transaction.sign_later_button)
send_transaction.sign_later_button.click()
send_transaction.yes_button.click()
send_transaction.ok_button.click()
transactions_view = wallet_view.transactions_button.click()
transactions_view.unsigned_tab.click()
transactions_view.sign_button.click()
send_transaction.sign_transaction_button.click()
send_transaction.enter_password_input.send_keys(sender['password'])
send_transaction.sign_transaction_button.click()
send_transaction.got_it_button.click()
api_requests.verify_balance_is_updated(initial_balance_recipient, recipient['address'])
transactions_view.history_tab.click()
transactions_view.transactions_table.find_transaction(amount=amount)
@marks.pr
@marks.testrail_case_id(3406)
def test_send_stt_from_wallet_via_enter_recipient_address(self):
@ -301,4 +263,3 @@ class TestTransactions(MultipleDeviceTestCase):
request_button = device_2_chat.element_by_text_part('Requesting %s ETH' % amount, 'button')
device_2_chat.send_eth_to_request(request_button, sender['password'])
api_requests.verify_balance_is_updated(initial_balance_recipient, recipient['address'])

View File

@ -2,16 +2,15 @@ from views.base_element import BaseButton, BaseEditBox
from views.base_view import BaseView
class AuctionHouseButton(BaseButton):
class SimpleDAppButton(BaseButton):
def __init__(self, driver):
super(AuctionHouseButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector(
"(//android.widget.TextView[@text='Auction House'])[1]")
super(SimpleDAppButton, self).__init__(driver)
self.locator = self.Locator.text_selector('Simple Dapp')
def navigate(self):
from views.web_views.auction_house import AuctionHouseWebView
return AuctionHouseWebView(self.driver)
from views.web_views.simple_dapp import SimpleDAppWebView
return SimpleDAppWebView(self.driver)
class PlusButton(BaseButton):
@ -44,4 +43,4 @@ class ContactsView(BaseView):
self.public_key_edit_box = PublicKeyEditBox(self.driver)
self.confirm_public_key_button = ConfirmPublicKeyButton(self.driver)
self.auction_house_button = AuctionHouseButton(self.driver)
self.simple_dapp_button = SimpleDAppButton(self.driver)

View File

@ -14,12 +14,6 @@ class SignTransactionButton(BaseButton):
self.locator = self.Locator.accessibility_id('sign-transaction-button')
class SignLaterButton(BaseButton):
def __init__(self, driver):
super(SignLaterButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id('sign-later-button')
class AmountEditBox(BaseEditBox, BaseButton):
def __init__(self, driver):
@ -104,7 +98,6 @@ class SendTransactionView(BaseView):
self.amount_edit_box = AmountEditBox(self.driver)
self.sign_transaction_button = SignTransactionButton(self.driver)
self.sign_later_button = SignLaterButton(self.driver)
self.confirm_button = ConfirmButton(self.driver)
self.password_input = PasswordInput(self.driver)
self.enter_password_input = EnterPasswordInput(self.driver)

View File

@ -1,50 +0,0 @@
from views.web_views.base_web_view import *
class ToggleNavigationButton(BaseButton):
def __init__(self, driver):
super(ToggleNavigationButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector("//*[@text='Toggle navigation ']")
class NewAuctionButton(BaseButton):
def __init__(self, driver):
super(ToggleNavigationButton.NewAuctionButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector("//*[@text='New Auction']")
class ReserveAssetName(BaseElement):
class NameToReserveInput(BaseEditBox, BaseButton):
def __init__(self, driver):
super(ReserveAssetName.NameToReserveInput, self).__init__(driver)
self.locator = self.Locator.xpath_selector(
'(//*[@text="Name To Reserve:"])[2]')
class RegisterNameButton(BaseButton):
def __init__(self, driver):
super(ReserveAssetName.RegisterNameButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector('//*[@text="Register Name"]')
class AssetContract(BaseElement):
def __init__(self, driver):
super(AssetContract, self).__init__(driver)
self.locator = self.Locator.xpath_selector('//*[@text="Asset contract"]')
class AuctionHouseWebView(BaseWebView):
def __init__(self, driver):
super(AuctionHouseWebView, self).__init__(driver)
self.driver = driver
self.toggle_navigation_button = ToggleNavigationButton(self.driver)
self.new_auction_button = ToggleNavigationButton.NewAuctionButton(self.driver)
self.name_to_reserve_input = ReserveAssetName.NameToReserveInput(self.driver)
self.register_name_button = ReserveAssetName.RegisterNameButton(self.driver)
self.asset_contract = AssetContract(self.driver)

View File

@ -0,0 +1,23 @@
from views.web_views.base_web_view import BaseWebView, BaseButton
class AssetsButton(BaseButton):
def __init__(self, driver):
super(AssetsButton, self).__init__(driver)
self.locator = self.Locator.text_selector('Assets')
class RequestSTTButton(BaseButton):
def __init__(self, driver):
super(AssetsButton.RequestSTTButton, self).__init__(driver)
self.locator = self.Locator.text_selector('Request STT')
class SimpleDAppWebView(BaseWebView):
def __init__(self, driver):
super(SimpleDAppWebView, self).__init__(driver)
self.driver = driver
self.assets_button = AssetsButton(self.driver)
self.request_stt_button = AssetsButton.RequestSTTButton(self.driver)