Example #1
0
        public void TCAdmin2_VerifyUsersAccountAssignedOrUnassignedTest()
        {
            userPassword        = TestData.GetData("TCAdmin2_UserPassword");
            invalidAccountID    = TestData.GetData("TCAdmin2_InvalidAccountID");
            userName            = TestData.GetData("TCAdmin1_UserName");
            newUserPassword     = TestData.GetData("TCAdmin1_UserPassword");
            userConfirmPassword = TestData.GetData("TCAdmin1_UserConfirmPassword");
            verificationLevel   = TestData.GetData("TCAdmin1_VerificationLevel");

            AdminFunctions       objAdminFunctions       = new AdminFunctions(TestProgressLogger);
            AdminCommonFunctions objAdminCommonFunctions = new AdminCommonFunctions(TestProgressLogger);
            UserFunctions        userfuntionality        = new UserFunctions(TestProgressLogger);
            AdminUsersPage       objAdminUsersPage       = new AdminUsersPage(TestProgressLogger);

            try
            {
                TestProgressLogger.StartTest();

                ////Login as admin -> Click on "Users" menu button -> Users Tab
                objAdminUsersPage.SelectAdminUserTab();

                //pre-requites of creating new user to perform assign and unassign test case
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.NewUserCreationInitiated));
                objAdminUsersPage.CreateNewUser(userName, newUserPassword, userConfirmPassword, verificationLevel);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.NewUserCreationCompleted, userName));

                //Click on "Users" Tab button
                objAdminCommonFunctions.UsersTabBtn();

                //Verify the login after unassign account ID to user
                Assert.True(objAdminUsersPage.VerifyLoginUsingUnassignedAccount(userPassword));

                Thread.Sleep(2000);
                //Login as admin -> Click on "Users" menu button -> Users Tab
                objAdminUsersPage.SelectAdminUserTab();

                //Verify the login after assign account ID to user
                Assert.True(objAdminUsersPage.VerifyLoginUsingAssignedAccount(userPassword));

                Thread.Sleep(2000);
                //Login as admin -> Click on "Users" menu button -> Users Tab
                objAdminUsersPage.SelectAdminUserTab();

                //Verify the login after assign invalid account ID to user
                Assert.True(objAdminUsersPage.VerifyNonexistentAccount(invalidAccountID));
            }
            catch (NoSuchElementException ex)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace);
                TestProgressLogger.LogError(String.Format(LogMessage.VerifyAssignedOrUnassignedAccountFailed), ex);
                throw ex;
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(e.Message + e.StackTrace);
                TestProgressLogger.LogError(String.Format(LogMessage.VerifyAssignedOrUnassignedAccountFailed), e);
                throw e;
            }
            finally
            {
                objAdminCommonFunctions.UserMenuBtn();
                objAdminFunctions.AdminLogOut();
                TestProgressLogger.EndTest();
            }
        }