def test_share_from_gallery_view(self):
        # verify signed in
        assert region.exists(
            has_signed_in_rt_top_bar, default_wait_time), "Fail to sign in to cloud via UI"

        # verify test clip is in the view
        log("Verify Download.mp4 test content has been uploaded")
        assert self.RT.does_exist_in_library(download_video_item, "Download", default_wait_time), \
            "Fail to find thumbnail of test clip '" + self.test_name + "'"

        # play item
        log("Play video")
        assert_step(self.RT.play_video(download_video_item, 'Download'))

        log("Wait it to play")
        self.RT.wait_till_start_playing()

        # share it
        log("Share it from gallery view")
        assert_step(self.RT.share_media())

        # switch to another account, and check it
        op.switch_to_account2()
        assert_step(self.RT.switch_to_shared_with_me_view())

        # verify the shared item is in the view
        assert self.RT.does_exist_in_library(new_shared_media_item, "Download", default_wait_time), \
            "After sharing the test clip '" + self.test_name + "', fail to find it in 'Share with me' view"
    def setUp(self):
        try:
            TestCase_Base.setUp(self)

            log("Start to verify if RT is signed in or not")
            if self.RT.is_sign_in:
                log("RT has been signed in already, start to sign out")
                self.RT.sign_out()

            op.launch_RT_before_running_case()
            self.RT.remove_all_from_cloud_view()

            # test clip
            test_name = "Download.mp4"
            test_case_path = os.path.join(
                test_content_path, "original", test_name)
            assert os.path.isfile(test_case_path), "The media file doesn't exist in '" + test_case_path + "'"

            # upload clip to cloud
            assert helper.upload_video_via_API(
                test_case_path), "Fail to upload test clip '" + self.test_name + "' via API"
            assert_step(self.RT.switch_to_all_view())

            # share the clip to account_username2
            assert_step(self.RT.share_media_in_library_view(["Download"]))

            op.switch_to_account2()
            log("after sign in")
        except:
            TestCase_Base.tearDown(self)
            raise
    def test_share_from_library_view(self):
        # Share an album
        assert_step(self.RT.share_album(download_video_item, 'TestAlbum'))

        # Switch to another account
        op.switch_to_account2()

        # Verify the shared item is in the view
        assert_step(self.RT.switch_to_shared_with_me_view())
        assert self.RT.does_exist_in_library(shared_album_item, "TestAlbum", default_wait_time), \
            "Fail to find the shared album '" + self.test_album + "' in 'Share with me' view"
    def test_share_photo_from_library_view(self):
        # verify signed in
        assert region.exists(
            has_signed_in_rt_top_bar, default_wait_time), "Fail to sign in to cloud from UI"

        # verify test clip is in the view
        log("Verify share_photo_1.jpg has been uploaded")
        assert region.exists(
            share_photo_item1, default_wait_time), "Fail to find thumbnail of test clip 'share_photo_1.jpg' from current view"

        assert_step(self.RT.share_media_in_library_view(["share_photo_1"]))
        op.switch_to_account2()
        assert_step(self.RT.switch_to_shared_with_me_view())

        #verify the shared item is in the view
        assert region.exists(share_photo_item1, default_wait_time), "Fail to find thumbnail of shared clip 'share_photo_1.jpg' in the 'share with me' view"
    def test_share_from_library_view(self):
        # verify signed in
        assert region.exists(
            has_signed_in_rt_top_bar, default_wait_time), "Fail to sign in to cloud via UI"

        # verify test clip is in the view
        log("Verify Download.mp4 test content has been uploaded")
        assert self.RT.does_exist_in_library(download_video_item, "Download", default_wait_time), \
            "Fail to find thumbnail of test clip '" + self.test_name + "'"

        assert_step(self.RT.share_media_in_library_view(["Download"]))
        op.switch_to_account2()
        assert_step(self.RT.switch_to_shared_with_me_view())

        # verify the shared item is in the view
        assert self.RT.does_exist_in_library(new_shared_media_item, "Download", default_wait_time), \
            "After sharing the test clip '" + self.test_name + "', fail to find it in 'Share with me' view"
    def setUp(self):
        try:
            TestCase_Base.setUp(self)

            log("Start to verify if RT is signed in or not")
            if self.RT.is_sign_in:
                log("RT has been signed in already, start to sign out")
                self.RT.sign_out()

            op.launch_RT_before_running_case()
            self.RT.remove_all_from_cloud_view()
            op.create_album()
            assert_step(self.RT.share_album(test_album_item, "test"))
            op.switch_to_account2()
        except:
            TestCase_Base.tearDown(self)
            raise
    def test_share_multi_videos_and_photos(self):
        # switch to cloud view
        assert_step(self.RT.switch_to_cloud_view())

        # verify upload
        self._check_items_exists()

        # share multi video and photos
        assert_step(self.RT.share_media_in_library_view(["share_video_1", "share_video_2", "share_photo_1", "share_photo_2"]))

        # switch to another account
        op.switch_to_account2()

        # verify the shared item is in the view
        assert_step(self.RT.switch_to_shared_with_me_view())
        assert_step(self.RT.open_share_group(share_group_item))
        self._check_items_exists()
    def test_share_group(self):
        # switch to cloud view
        assert_step(self.RT.switch_to_cloud_view())

        # verify upload
        self._check_videos_exists()
        self._check_photos_exists()

        # share group
        assert_step(self.RT.share_group())

        # switch to another account
        op.switch_to_account2()

        # verify the shared item is in the view
        assert_step(self.RT.switch_to_shared_with_me_view())
        assert_step(self.RT.open_share_group(share_group_item))
        self._check_videos_exists()