Example #1
0
        public void TCAdmin5_VerifyConfigureUserPermissionTest()
        {
            addUserPermission = TestData.GetData("TCAdmin5_AddUserPermission");
            string               userName;
            string               userAccountID;
            AdminFunctions       objAdminFunctions       = new AdminFunctions(TestProgressLogger);
            AdminCommonFunctions objAdminCommonFunctions = new AdminCommonFunctions(TestProgressLogger);

            try
            {
                TestProgressLogger.StartTest();

                //Login as admin -> Click on "Users" menu button
                objAdminFunctions.AdminLogIn(TestProgressLogger);
                objAdminCommonFunctions.ClickOnUsersMenuLink();
                objAdminCommonFunctions.UsersTabBtn();

                //This will get the user name and user account ID from the user list under Users Tab
                userName      = objAdminCommonFunctions.getUserNameFromUserList();
                userAccountID = objAdminCommonFunctions.getUserAccountIDFromUserList();

                objAdminCommonFunctions.SelectUserFromUserList(driver, userName);

                //Click on "Add Permission" button -> verify all permissions with checkbox
                objAdminCommonFunctions.UserPermissionButton();
                try
                {
                    Assert.True(objAdminCommonFunctions.VerifyUserPermissionsList());
                    TestProgressLogger.LogCheckPoint(String.Format(LogMessage.VerifyUserPermissionsListPassed));
                }
                catch (Exception)
                {
                    TestProgressLogger.LogCheckPoint(String.Format(LogMessage.VerifyUserPermissionsListFailed));
                    throw;
                }
                //This will configure a permission and verify the success message
                objAdminCommonFunctions.AddUserPermissions(addUserPermission);

                //Close the permission window section
                objAdminCommonFunctions.ClosePermissionWindow();
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.VerifyConfigureUserPermissionPassed));
            }

            catch (NoSuchElementException ex)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace);
                TestProgressLogger.LogError(String.Format(LogMessage.VerifyConfigureUserPermissionFailed), ex);
                throw ex;
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(e.Message + e.StackTrace);
                TestProgressLogger.LogError(String.Format(LogMessage.VerifyConfigureUserPermissionFailed), e);
                throw e;
            }
            finally
            {
                objAdminCommonFunctions.UserMenuBtn();
                objAdminFunctions.AdminLogOut();
                TestProgressLogger.EndTest();
            }
        }