functional test added: user can remove profile picture

Signed-off-by: Oleksii Lymarenko <alexey.lymarenko@gmail.com>
This commit is contained in:
Oleksii Lymarenko 2018-10-24 11:50:58 +03:00
parent edaf70ca5d
commit aa18cdc20e
No known key found for this signature in database
GPG Key ID: 2007E841ECE4A02C
2 changed files with 33 additions and 1 deletions

View File

@ -24,6 +24,22 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
if not profile_view.profile_picture.is_element_image_equals_template(): if not profile_view.profile_picture.is_element_image_equals_template():
pytest.fail('Profile picture was not updated') pytest.fail('Profile picture was not updated')
@marks.testrail_id(5454)
@marks.critical
def test_user_can_remove_profile_picture(self):
signin_view = SignInView(self.driver)
home_view = signin_view.create_user()
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():
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():
self.driver.fail('Profile picture was not deleted')
@marks.testrail_id(5323) @marks.testrail_id(5323)
@marks.critical @marks.critical
def test_share_contact_code_and_wallet_address(self): def test_share_contact_code_and_wallet_address(self):

View File

@ -394,6 +394,12 @@ class AboutButton(BaseButton):
return self.navigate() return self.navigate()
class RemovePictureButton(BaseButton):
def __init__(self, driver):
super().__init__(driver)
self.locator = self.Locator.text_selector('Remove current photo')
class ProfileView(BaseView): class ProfileView(BaseView):
def __init__(self, driver): def __init__(self, driver):
@ -427,6 +433,7 @@ class ProfileView(BaseView):
self.edit_button = EditButton(self.driver) self.edit_button = EditButton(self.driver)
self.profile_picture = ProfilePictureElement(self.driver) self.profile_picture = ProfilePictureElement(self.driver)
self.edit_picture_button = EditPictureButton(self.driver) self.edit_picture_button = EditPictureButton(self.driver)
self.remove_picture_button = RemovePictureButton(self.driver)
self.confirm_edit_button = ConfirmEditButton(self.driver) self.confirm_edit_button = ConfirmEditButton(self.driver)
self.cross_icon = CrossIcon(self.driver) self.cross_icon = CrossIcon(self.driver)
self.share_button = ShareButton(self.driver) self.share_button = ShareButton(self.driver)
@ -505,10 +512,10 @@ class ProfileView(BaseView):
def edit_profile_picture(self, file_name: str): def edit_profile_picture(self, file_name: str):
if not AbstractTestCase().environment == 'sauce': if not AbstractTestCase().environment == 'sauce':
raise NotImplementedError('Test case is implemented to run on SauceLabs only') raise NotImplementedError('Test case is implemented to run on SauceLabs only')
self.profile_picture.template = file_name
self.edit_button.click() self.edit_button.click()
self.swipe_down() self.swipe_down()
self.edit_picture_button.click() self.edit_picture_button.click()
self.profile_picture.template = file_name
self.select_from_gallery_button.click() self.select_from_gallery_button.click()
if self.allow_button.is_element_displayed(sec=10): if self.allow_button.is_element_displayed(sec=10):
self.allow_button.click() self.allow_button.click()
@ -519,6 +526,15 @@ class ProfileView(BaseView):
picture.click() picture.click()
self.confirm_edit_button.click() 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.remove_picture_button.click()
self.confirm_edit_button.click()
def logout(self): def logout(self):
self.logout_button.click() self.logout_button.click()
return self.logout_dialog.logout_button.click() return self.logout_dialog.logout_button.click()