Beispiel #1
0
        public void TCAdmin1_VerifyAddNewUserTest()
        {
            string userLoginName;

            userName            = TestData.GetData("TCAdmin1_UserName");
            userPassword        = TestData.GetData("TCAdmin1_UserPassword");
            userConfirmPassword = TestData.GetData("TCAdmin1_UserConfirmPassword");
            depositPermission   = TestData.GetData("TCAdmin1_DepositPermission");
            tradingPermission   = TestData.GetData("TCAdmin1_DepositTrading");
            withdrawPermission  = TestData.GetData("TCAdmin1_UserWithdraw");
            verificationLevel   = TestData.GetData("TCAdmin1_VerificationLevel");

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

            try
            {
                TestProgressLogger.StartTest();

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

                //Verify whether new user created
                Assert.True(objAdminUsersPage.CreateNewUser(userName, userPassword, userConfirmPassword, verificationLevel));

                //Verify that the new user created is having deposit, trading and withdraw permissions
                Assert.True(objAdminUsersPage.VerifyUserCreatedWithPermission(depositPermission, tradingPermission, withdrawPermission));

                objAdminCommonFunctions.UserMenuBtn();
                userLoginName = objAdminCommonFunctions.UserNameTextValue();

                // Admin LogOut
                objAdminFunctions.AdminLogOut();

                //Login using the credentials of the User created above
                // This will change only the server URL
                userFunctions.LogIn(TestProgressLogger, changeServerOnly: true);
                Assert.True(userFunctions.LogInUsingCredsFromUI(TestProgressLogger, userLoginName, userPassword));
            }

            catch (NoSuchElementException ex)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace);
                TestProgressLogger.LogError(String.Format(LogMessage.VerifyAddUserFailed), ex);
                throw ex;
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(e.Message + e.StackTrace);
                TestProgressLogger.LogError(String.Format(LogMessage.VerifyAddUserFailed), e);
                throw e;
            }
            finally
            {
                userFunctions.LogOut();
                TestProgressLogger.EndTest();
            }
        }