public void ShareLibraryAndRemoveUserFromTeamTest()
        {
            Permission permission = new Permission(false, true, true, true);

            ConsoleMessage.StartTest("Share library with team and remove user from team", "ShareLibrary");
            //Login as Library owner and share a library with a Team
            Appium.Instance.Driver.LaunchApp();
            LoginActivity.LoginStep(_user1, _timeout);
            TabMenu.Library.Tap();
            LibraryActivity.LibraryList.FindAndTap(_baseLibrary);
            LibraryActivity.SelectAndShareLibrary(_baseLibrary, _shareName);
            LibraryShareDialog.ShareWithTeamStep(_team, permission);
            CommonOperation.Delay(_shareDelay);
            TabMenu.Logout.Tap();

            //Login as a Team member and verify user received the shared library
            LoginActivity.LoginStep(_user2, _timeout);
            CommonOperation.Delay(_loginDelay);
            TabMenu.Library.Tap();
            LibraryActivity.LibraryList.FindAndTap(_shareName);
            LibraryActivity.ElementList.VerifyElementCountById(1, "library_document_icon");
            TabMenu.Logout.Tap();

            //Login as Owner and add a new user to the team
            LoginActivity.LoginStep(_user1, _timeout);
            TabMenu.Teams.Tap();
            CommonOperation.Delay(2);
            TeamActivity.TeamList.FindAndTap(_team);
            TeamActivity.AddUserToTeam(_user3.Name);
            TeamActivity.TeamMemberList.VerifyElementCountById(3, "user_picture");
            CommonOperation.Delay(_shareDelay);
            TabMenu.Logout.Tap();

            //Login as new user and verify user received shared library
            LoginActivity.LoginStep(_user3, _timeout);
            CommonOperation.Delay(_loginDelay);
            TabMenu.Library.Tap();
            LibraryActivity.LibraryList.FindAndTap(_shareName);
            LibraryActivity.ElementList.VerifyElementCountById(1, "library_document_icon");
            TabMenu.Logout.Tap();

            //Login as Owner and remove the new user from the team
            LoginActivity.LoginStep(_user1, _timeout);
            TabMenu.Teams.Tap();
            CommonOperation.Delay(2);
            TeamActivity.TeamList.FindAndTap(_team);
            TeamActivity.RemoveUserFromTeam(_user3.Name);
            TeamActivity.TeamMemberList.VerifyElementCountById(2, "user_picture");
            CommonOperation.Delay(_shareDelay);
            TabMenu.Logout.Tap();

            //Login as new user and verify user does not have the shared library
            LoginActivity.LoginStep(_user3, _timeout);
            CommonOperation.Delay(_loginDelay);
            TabMenu.Library.Tap();
            LibraryActivity.VerifyLibraryNotExist(_shareName);
            TabMenu.Logout.Tap();
        }
        public void ShareOnly()
        {
            string     shareName     = string.Format("{0}=Share", _version);
            string     reshareName   = string.Format("{0}=Rshr", _version);
            Permission permission    = new Permission(true, true, false, false);
            Permission allPermission = new Permission(true, true, true, true);

            ConsoleMessage.StartTest("Share library with user: Share", "ShareLibrary");
            //share on owner
            Appium.Instance.Driver.LaunchApp();
            LoginActivity.LoginStep(_user1, _timeout);
            TabMenu.Library.Tap();
            LibraryActivity.SelectAndShareLibrary(_baseLibrary, shareName);
            LibraryShareDialog.ShareWithUserStep(_team, _user2.Name, permission);
            CommonOperation.Delay(_shareDelay);
            TabMenu.Logout.Tap();

            //verify on recipient
            LoginActivity.LoginStep(_user2, _timeout);
            CommonOperation.Delay(_loginDelay);
            TabMenu.Library.Tap();
            LibraryActivity.LibraryList.FindAndTap(shareName);
            LibraryActivity.ElementList.VerifyElementCountById(20, "library_document_icon");
            //verify can't add element
            LibraryActivity.AddElement.Tap();
            LibraryPermissionErrorDialog.DialogName.VerifyText("Add Permission");
            LibraryPermissionErrorDialog.Ok.Tap();
            //verify can't delete library
            LibraryActivity.DeleteLibrary.Tap();
            LibraryPermissionErrorDialog.DialogName.VerifyText("Delete Permission");
            LibraryPermissionErrorDialog.Ok.Tap();
            //verify can't delete library element
            LibraryActivity.ElementList.FindAndTap("Add");
            LibraryElementActivity.Delete.Tap();
            LibraryPermissionErrorDialog.DialogName.VerifyText("Delete Permission");
            LibraryPermissionErrorDialog.Ok.Tap();
            LibraryElementActivity.Cancel.Tap();
            //verify can't share library
            LibraryActivity.SelectAndShareLibrary(shareName, reshareName);
            LibraryShareDialog.ShareWithUserStep(_team, _user1.Name, allPermission);
            CommonOperation.Delay(_shareDelay);
            TabMenu.Logout.Tap();

            //verify on owner
            LoginActivity.LoginStep(_user1, _timeout);
            CommonOperation.Delay(_loginDelay);
            TabMenu.Library.Tap();
            LibraryActivity.LibraryList.FindAndTap(reshareName);
            LibraryActivity.ElementList.VerifyElementCountById(20, "library_document_icon");
            TabMenu.Logout.Tap();
        }
        public void ModifyOnly()
        {
            string     shareName  = string.Format("{0}=Modify", _version);
            Permission permission = new Permission(true, false, true, false);

            ConsoleMessage.StartTest("Share library with user: Modify", "ShareLibrary");
            //share on owner
            Appium.Instance.Driver.LaunchApp();
            LoginActivity.LoginStep(_user1, _timeout);
            TabMenu.Library.Tap();
            LibraryActivity.SelectAndShareLibrary(_baseLibrary, shareName);
            LibraryShareDialog.ShareWithUserStep(_team, _user2.Name, permission);
            CommonOperation.Delay(_shareDelay);
            TabMenu.Logout.Tap();

            //verify on recipient
            LoginActivity.LoginStep(_user2, _timeout);
            CommonOperation.Delay(_loginDelay);
            TabMenu.Library.Tap();
            LibraryActivity.LibraryList.FindAndTap(shareName);
            LibraryActivity.ElementList.VerifyElementCountById(20, "library_document_icon");
            //verify can add element
            LibraryActivity.AddElement.Tap();
            LibraryElementActivity.ElementName.ClearText();
            LibraryElementActivity.ElementName.EnterText("Element1");
            LibraryElementActivity.Ok.Tap();
            LibraryActivity.ElementList.VerifyElementCountById(21, "library_document_icon");
            //verify can delete library element
            LibraryActivity.ElementList.FindAndTap("Add");
            LibraryElementActivity.Delete.Tap();
            LibraryDeleteElementDialog.Delete.Tap();
            LibraryActivity.ElementList.VerifyElementCountById(20, "library_document_icon");
            //verify can delete library
            LibraryActivity.DeleteLibrary.Tap();
            LibraryDeleteDialog.Cancel.Tap();
            //verify can't share library
            LibraryActivity.ShareLibrary.Tap();
            LibraryActivity.VerifyCantShareLibrary(shareName);
            LibraryActivity.CancelShare.Tap();
            TabMenu.Logout.Tap();

            //verify on owner
            LoginActivity.LoginStep(_user1, _timeout);
            CommonOperation.Delay(_loginDelay);
            TabMenu.Library.Tap();
            LibraryActivity.LibraryList.FindAndTap(shareName);
            LibraryActivity.ElementList.VerifyElementCountById(20, "library_document_icon");
            TabMenu.Logout.Tap();
        }
        public void Unshare()
        {
            string     shareName  = string.Format("{0}=Unshare", _version);
            Permission permission = new Permission(true, true, true, true);

            ConsoleMessage.StartTest("Share library with user: Unshare", "ShareLibrary");
            //share on owner
            Appium.Instance.Driver.LaunchApp();
            LoginActivity.LoginStep(_user1, _timeout);
            TabMenu.Library.Tap();
            LibraryActivity.SelectAndShareLibrary(_baseLibrary, shareName);
            LibraryShareDialog.ShareWithUserStep(_team, _user2.Name, permission);
            CommonOperation.Delay(_shareDelay);
            TabMenu.Logout.Tap();

            //verify on recipient
            LoginActivity.LoginStep(_user2, _timeout);
            CommonOperation.Delay(_loginDelay);
            TabMenu.Library.Tap();
            LibraryActivity.LibraryList.FindAndTap(shareName);
            LibraryActivity.ElementList.VerifyElementCountById(20, "library_document_icon");
            TabMenu.Logout.Tap();

            //unshare on owner
            LoginActivity.LoginStep(_user1, _timeout);
            TabMenu.Library.Tap();
            LibraryActivity.LibraryList.FindAndTap(shareName);
            LibraryActivity.Permission.Tap();
            LibraryShareDialog.Unshare(_user2.Name);
            LibraryShareDialog.ShareWithList.VerifyElementCountById(0, "user_picture");
            LibraryShareDialog.Ok.Tap();
            CommonOperation.Delay(_shareDelay);
            TabMenu.Logout.Tap();

            //verify on recipient, library not exist
            LoginActivity.LoginStep(_user2, _timeout);
            CommonOperation.Delay(_loginDelay);
            TabMenu.Library.Tap();
            LibraryActivity.VerifyLibraryNotExist(shareName);
        }