e2e: updated method for a profile picture changing
This commit is contained in:
parent
7db35a3cc8
commit
05a810b051
|
@ -59,6 +59,7 @@ class TestActivityCenterContactRequestMultipleDevicePR(MultipleSharedDeviceTestC
|
||||||
self.errors.append("Push notification with text was received for new message in activity centre")
|
self.errors.append("Push notification with text was received for new message in activity centre")
|
||||||
self.device_1.click_system_back_button()
|
self.device_1.click_system_back_button()
|
||||||
self.device_1.driver.activate_app(app_package)
|
self.device_1.driver.activate_app(app_package)
|
||||||
|
self.device_1.wait_for_application_to_be_running(app_package)
|
||||||
|
|
||||||
self.device_1.just_fyi('Device1 verifies pending contact request')
|
self.device_1.just_fyi('Device1 verifies pending contact request')
|
||||||
self.home_1.contacts_tab.click()
|
self.home_1.contacts_tab.click()
|
||||||
|
|
|
@ -271,8 +271,6 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
|
||||||
self.home_1.jump_to_messages_home()
|
self.home_1.jump_to_messages_home()
|
||||||
self.home_1.profile_button.click()
|
self.home_1.profile_button.click()
|
||||||
self.profile_1.edit_profile_picture(image_index=2)
|
self.profile_1.edit_profile_picture(image_index=2)
|
||||||
self.profile_1.navigate_back_to_home_view()
|
|
||||||
self.profile_1.chats_tab.click()
|
|
||||||
|
|
||||||
self.chat_2.just_fyi("Send messages with non-latin symbols")
|
self.chat_2.just_fyi("Send messages with non-latin symbols")
|
||||||
self.home_1.jump_to_card_by_text(self.username_2)
|
self.home_1.jump_to_card_by_text(self.username_2)
|
||||||
|
|
|
@ -6,6 +6,7 @@ import time
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from appium.webdriver import WebElement
|
from appium.webdriver import WebElement
|
||||||
|
from appium.webdriver.applicationstate import ApplicationState
|
||||||
from appium.webdriver.common.touch_action import TouchAction
|
from appium.webdriver.common.touch_action import TouchAction
|
||||||
from selenium.common.exceptions import NoSuchElementException, TimeoutException
|
from selenium.common.exceptions import NoSuchElementException, TimeoutException
|
||||||
from selenium.webdriver.support import expected_conditions
|
from selenium.webdriver.support import expected_conditions
|
||||||
|
@ -658,13 +659,24 @@ class BaseView(object):
|
||||||
self.click_on_floating_jump_to()
|
self.click_on_floating_jump_to()
|
||||||
self.element_by_text(text).click()
|
self.element_by_text(text).click()
|
||||||
|
|
||||||
|
def wait_for_application_to_be_running(self, app_package: str, wait_time: int = 3):
|
||||||
|
for _ in range(wait_time):
|
||||||
|
if self.driver.query_app_state(app_package) == ApplicationState.RUNNING_IN_FOREGROUND:
|
||||||
|
return
|
||||||
|
time.sleep(1)
|
||||||
|
raise TimeoutException(msg="Status app is not running in foreground after %s sec" % wait_time)
|
||||||
|
|
||||||
|
def wait_for_application_to_not_run(self, app_package: str, wait_time: int = 3):
|
||||||
|
for _ in range(wait_time):
|
||||||
|
if self.driver.query_app_state(app_package) == ApplicationState.NOT_RUNNING:
|
||||||
|
return
|
||||||
|
time.sleep(1)
|
||||||
|
raise TimeoutException(msg="Status app is not terminated after %s sec" % wait_time)
|
||||||
|
|
||||||
def reopen_app(self, password=common_password, sign_in=True):
|
def reopen_app(self, password=common_password, sign_in=True):
|
||||||
app_package = self.driver.current_package
|
app_package = self.driver.current_package
|
||||||
self.driver.terminate_app(app_package)
|
self.driver.terminate_app(app_package)
|
||||||
for _ in range(3):
|
self.wait_for_application_to_not_run(app_package=app_package)
|
||||||
if self.driver.query_app_state(app_package) == 1:
|
|
||||||
break
|
|
||||||
time.sleep(1)
|
|
||||||
self.driver.activate_app(app_package)
|
self.driver.activate_app(app_package)
|
||||||
if sign_in:
|
if sign_in:
|
||||||
sign_in_view = self.get_sign_in_view()
|
sign_in_view = self.get_sign_in_view()
|
||||||
|
|
|
@ -199,9 +199,9 @@ class ProfileView(BaseView):
|
||||||
self.online_indicator = Button(self.driver, accessibility_id="online-profile-photo-dot")
|
self.online_indicator = Button(self.driver, accessibility_id="online-profile-photo-dot")
|
||||||
self.edit_picture_button = Button(self.driver, accessibility_id="edit-profile-photo-button")
|
self.edit_picture_button = Button(self.driver, accessibility_id="edit-profile-photo-button")
|
||||||
self.confirm_edit_button = Button(self.driver, accessibility_id="done-button")
|
self.confirm_edit_button = Button(self.driver, accessibility_id="done-button")
|
||||||
self.select_from_gallery_button = Button(self.driver, translation_id="profile-pic-pick")
|
self.select_from_gallery_button_old = Button(self.driver, translation_id="profile-pic-pick")
|
||||||
self.capture_button = Button(self.driver, translation_id="image-source-make-photo")
|
self.capture_button = Button(self.driver, translation_id="image-source-make-photo")
|
||||||
self.take_photo_button = Button(self.driver, accessibility_id="take-photo")
|
self.take_photo_button_old = Button(self.driver, accessibility_id="take-photo")
|
||||||
self.crop_photo_button = Button(self.driver, accessibility_id="Crop")
|
self.crop_photo_button = Button(self.driver, accessibility_id="Crop")
|
||||||
self.decline_photo_crop = Button(self.driver, accessibility_id="Navigate up")
|
self.decline_photo_crop = Button(self.driver, accessibility_id="Navigate up")
|
||||||
self.shutter_button = Button(self.driver, accessibility_id="Shutter")
|
self.shutter_button = Button(self.driver, accessibility_id="Shutter")
|
||||||
|
@ -354,6 +354,12 @@ class ProfileView(BaseView):
|
||||||
self.confirm_logout_button = Button(self.driver, translation_id="logout", uppercase=True)
|
self.confirm_logout_button = Button(self.driver, translation_id="logout", uppercase=True)
|
||||||
|
|
||||||
# New profile
|
# New profile
|
||||||
|
self.edit_profile_button = Button(self.driver, accessibility_id="icon, Edit Profile, label-component, icon")
|
||||||
|
self.change_profile_photo_button = Button(
|
||||||
|
self.driver,
|
||||||
|
xpath="//*[@content-desc='user-avatar']/following-sibling::android.view.ViewGroup[@content-desc='icon']")
|
||||||
|
self.take_photo_button = Button(self.driver, accessibility_id="take-photo-button")
|
||||||
|
self.select_from_gallery_button = Button(self.driver, accessibility_id="select-from-gallery-button")
|
||||||
self.profile_password_button = Button(self.driver, accessibility_id="icon, Password, label-component, icon")
|
self.profile_password_button = Button(self.driver, accessibility_id="icon, Password, label-component, icon")
|
||||||
self.profile_legacy_button = Button(self.driver,
|
self.profile_legacy_button = Button(self.driver,
|
||||||
accessibility_id="icon, Legacy settings, label-component, icon")
|
accessibility_id="icon, Legacy settings, label-component, icon")
|
||||||
|
@ -438,10 +444,8 @@ class ProfileView(BaseView):
|
||||||
self.driver.info("## Setting custom profile image", device=False)
|
self.driver.info("## Setting custom profile image", device=False)
|
||||||
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')
|
||||||
## pointing to legacy profile until new feature is implemented
|
self.edit_profile_button.click()
|
||||||
self.logout_button.scroll_to_element()
|
self.change_profile_photo_button.click()
|
||||||
self.profile_legacy_button.click()
|
|
||||||
self.profile_picture.click()
|
|
||||||
if update_by == "Gallery":
|
if update_by == "Gallery":
|
||||||
self.select_from_gallery_button.click()
|
self.select_from_gallery_button.click()
|
||||||
self.select_photo_from_gallery_by_index(image_index)
|
self.select_photo_from_gallery_by_index(image_index)
|
||||||
|
@ -454,6 +458,7 @@ class ProfileView(BaseView):
|
||||||
self.accept_photo_button.click()
|
self.accept_photo_button.click()
|
||||||
self.crop_photo_button.click()
|
self.crop_photo_button.click()
|
||||||
self.driver.info("## Custom profile image has been set", device=False)
|
self.driver.info("## Custom profile image has been set", device=False)
|
||||||
|
self.click_system_back_button()
|
||||||
|
|
||||||
def take_photo(self):
|
def take_photo(self):
|
||||||
self.take_photo_button.click()
|
self.take_photo_button.click()
|
||||||
|
|
Loading…
Reference in New Issue