def switch_to_shared_by_me_view(self): helper.assert_step(self.switch_to_share_view()) if self.region.exists(share_everyone_item): self.region.click(share_everyone_item) self.region.click(share_by_me_dropdown_list_item) return True return False, "The 'Share By Me' button is not clicked"
def upload_story(self): helper.assert_step(self.play_video(suggested_story_icon)) helper.assert_step(self.wait_till_start_playing(2 * 60)) self.make_overlay_display() self.region.click(story_save_button) time.sleep(1) type('up') time.sleep(1) type(Key.ENTER)
def unlike_album(self, album_item): """To unlike the specified album in the sharing folder""" helper.assert_step(self.switch_to_shared_with_me_view()) if not self.open_album(album_item): return False, "Open album failed" if not self.region.exists(unlike_button): return False, "There is no unlike button or it is already unliked" self.region.click(unlike_button) time.sleep(2) if not self.region.exists(like_button): return False, "Unlike operation is failed" return True
def unlike_media(self, media_item, name=''): """To like the specified media in the sharing folder""" helper.assert_step(self.switch_to_shared_with_me_view()) self.play_video(media_item, name) time.sleep(5) if not self.region.exists(unlike_button): return False, "There is no unlike button or it is already unliked" self.region.click(unlike_button) time.sleep(2) if not self.region.exists(like_button): return False, "You can't unlike the media, unlike operation is failed" if self.region.exists(one_like_message): return False, "The like number is not correct" return True
def share_album(self, album_item, album_name='', share_to_account=account_username2): """ Share an album to another account, currently we use default account_username to share """ helper.log("Switch to album") helper.retry(self.switch_to_albums_view) # Select an album to share helper.log("The created album will be shared") if self.region.exists(album_item, default_wait_long_time): self.region.click(album_item) elif helper.check_exist_by_cliclick(album_name): helper.click_item_by_cliclick(album_name) else: return False, "The album item doesn't exist" helper.assert_step(self.share_via_bottom_bar()) time.sleep(20) return self.share_dialog(share_to_account)
def set_to_init_env(self): # need to sign in first if not self.is_sign_in: return False, "RealTimes is not in signed in status!!" # maximize RT self.maximize() # check if current is in gallery view self.make_overlay_display() if self.is_in_gallery_view(): self.exit_gallery_view() # check if 'Photos&Videos' is selected if self.region.exists(photos_and_videos_button_selected, default_wait_time): self.region.click(photos_and_videos_button_selected) else: return False, "Fail to find 'Photos & Videos' button" helper.assert_step(self.switch_to_all_view()) return True
def add_item_to_album(self, screenshot, name, item_in_album_view=test_album_item, album_name="new"): if self.region.exists(screenshot, default_wait_time): self.region.click(screenshot) else: helper.click_item_by_cliclick(name) helper.assert_step(self.add_to_album_via_bottom_bar()) if album_name == 'new': self.region.wait(new_album_dialog_button) self.region.click(new_album_dialog_button) time.sleep(1) type("test") time.sleep(1) type(Key.ENTER) if not region.exists(album_item_dialog_icon, default_wait_time): type(Key.ESC) return False, "Failed to create new album" helper.log("Click album icon in dialog") self.region.click(album_item_dialog_icon) helper.log("Click 'Enter' to add item to album") time.sleep(1) type(Key.ENTER) helper.assert_step(self.switch_to_albums_view()) if not self.does_exist_in_library(item_in_album_view, "test", default_wait_time): return False, "Failed to add item to the new created album" else: type(album_name) time.sleep(1) type(Key.ENTER) helper.assert_step(self.switch_to_albums_view()) return True
def share_media(self, share_account=account_username2): helper.assert_step(self.share_via_bottom_bar()) return self.share_dialog(share_account)
def share_story(self, story_icon, share_account=account_username2, wait_time=default_wait_long_time): self.region.click(story_icon) helper.assert_step(self.share_via_bottom_bar()) return self.share_dialog(share_account, wait_time)