fixed actions for profile

Signed-off-by: Churikova Tetiana <churikova.tm@gmail.com>
This commit is contained in:
Churikova Tetiana 2019-08-14 18:05:04 +02:00
parent 39e095e1ed
commit ebefb0c9e3
No known key found for this signature in database
GPG Key ID: 0D4EA7B33B47E6D8
6 changed files with 16 additions and 33 deletions

View File

@ -34,12 +34,11 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
profile_view = home_view.profile_button.click()
profile_view.edit_profile_picture('sauce_logo.png')
profile_view.swipe_down()
if not profile_view.profile_picture.is_element_image_equals_template():
if not profile_view.profile_picture.is_element_image_equals_template('sauce_logo_profile.png'):
self.driver.fail('Profile picture was not updated')
profile_view.remove_profile_picture()
profile_view.swipe_down()
if profile_view.profile_picture.is_element_image_equals_template():
if profile_view.profile_picture.is_element_image_equals_template('default_icon_profile.png'):
self.driver.fail('Profile picture was not deleted')
@marks.testrail_id(5323)
@ -56,7 +55,7 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
self.errors.append("Can't share public key")
for _ in range(2):
profile_view.click_system_back_button()
profile_view.cross_icon.click()
profile_view.close_share_chat_key_popup()
wallet = profile_view.wallet_button.click()
wallet.set_up_wallet()
wallet.accounts_status_account.click()

View File

@ -149,8 +149,8 @@ class ProfileButton(TabButton):
return ProfileView(self.driver)
def click(self):
from views.profile_view import ShareMyProfileButton
self.click_until_presence_of_element(ShareMyProfileButton(self.driver))
from views.profile_view import DefaultUserNameText
self.click_until_presence_of_element(DefaultUserNameText(self.driver))
return self.navigate()
@ -555,12 +555,15 @@ class BaseView(object):
sign_in_view = self.get_sign_in_view()
sign_in_view.sign_in(password)
def close_share_chat_key_popup(self):
TouchAction(self.driver).tap(None, 255, 104, 1).perform()
def get_public_key(self):
profile_view = self.profile_button.click()
profile_view.share_my_profile_button.click()
profile_view.public_key_text.wait_for_visibility_of_element()
public_key = profile_view.public_key_text.text
profile_view.cross_icon.click()
self.close_share_chat_key_popup()
return public_key
def share_via_messenger(self):

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -8,7 +8,7 @@ class PublicKeyText(BaseText):
def __init__(self, driver):
super(PublicKeyText, self).__init__(driver)
self.locator = self.Locator.accessibility_id('address-text')
self.locator = self.Locator.accessibility_id('chat-key')
class ProfileAddressText(BaseText):
@ -112,22 +112,16 @@ class DefaultUserNameText(BaseText):
def __init__(self, driver):
super(DefaultUserNameText, self).__init__(driver)
self.locator = self.Locator.xpath_selector(
'//android.widget.ImageView[@content-desc="chat-icon"]/../android.widget.TextView[2]')
'//android.view.ViewGroup[@content-desc="edit-profile-photo-button"]/../android.widget.TextView')
class ShareMyProfileButton(BaseButton):
def __init__(self, driver):
super(ShareMyProfileButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id('share-my-profile-button')
self.locator = self.Locator.xpath_selector('(//android.view.ViewGroup[@content-desc="icon"])[1]')
class EditButton(BaseButton):
def __init__(self, driver):
super(EditButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id('edit-button')
class ProfilePictureElement(BaseElement):
def __init__(self, driver):
@ -139,7 +133,7 @@ class EditPictureButton(BaseButton):
def __init__(self, driver):
super(EditPictureButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id('edit-profile-photo-button')
self.locator = self.Locator.xpath_selector('//android.view.ViewGroup[@content-desc="edit-profile-photo-button"]')
class ConfirmEditButton(BaseButton):
@ -519,7 +513,6 @@ class ProfileView(BaseView):
self.username_set_by_user_text = UserNameSetByUserText(self.driver)
self.default_username_text = DefaultUserNameText(self.driver)
self.share_my_profile_button = ShareMyProfileButton(self.driver)
self.edit_button = EditButton(self.driver)
self.profile_picture = ProfilePictureElement(self.driver)
self.edit_picture_button = EditPictureButton(self.driver)
self.remove_picture_button = RemovePictureButton(self.driver)
@ -622,9 +615,7 @@ class ProfileView(BaseView):
def edit_profile_picture(self, file_name: str):
if not AbstractTestCase().environment == 'sauce':
raise NotImplementedError('Test case is implemented to run on SauceLabs only')
self.edit_button.click()
self.swipe_down()
self.edit_picture_button.click()
self.profile_picture.click()
self.profile_picture.template = file_name
self.select_from_gallery_button.click()
if self.allow_button.is_element_displayed(sec=5):
@ -635,23 +626,14 @@ class ProfileView(BaseView):
for element_text in 'Images', 'DCIM':
self.element_by_text(element_text).click()
picture.click()
self.confirm_edit_button.click()
def edit_profile_username(self, user_name: str):
self.edit_button.click()
self.swipe_down()
self.username_input.clear()
self.username_input.set_value(user_name)
self.confirm_edit_button.click()
def remove_profile_picture(self):
if not AbstractTestCase().environment == 'sauce':
raise NotImplementedError('Test case is implemented to run on SauceLabs only')
self.edit_button.click()
self.swipe_down()
self.edit_picture_button.click()
self.profile_picture.click()
self.remove_picture_button.click()
self.confirm_edit_button.click()
def logout(self):
self.logout_button.click()
@ -665,7 +647,6 @@ class ProfileView(BaseView):
def discover_and_advertise_device(self, device_name):
self.profile_button.click()
# device_2_profile = device_2_home.get_profile_view()
self.devices_button.scroll_to_element()
self.devices_button.click()
self.device_name_input.set_value(device_name)