コード例 #1
0
        [Fact]      //Admin_20
        public void VerifyAccountDetailsTabShowAllRelevantAccountInfo()
        {
            try
            {
                string accountId;
                string USDCurrency;
                string USDAmount;
                string commentValue;
                string amountField;
                string expectedAmount;
                string actualAmount;

                accountId    = TestData.GetData("TCAdmin4_UserAccountID");
                USDCurrency  = TestData.GetData("USDCurrency");
                USDAmount    = TestData.GetData("USDAmount");
                commentValue = TestData.GetData("TC41_Comment");
                amountField  = TestData.GetData("TCAdmin4_AmountField");

                AdminFunctions       adminfunctions       = new AdminFunctions(TestProgressLogger);
                AdminCommonFunctions admincommonfunctions = new AdminCommonFunctions(TestProgressLogger);
                AdminAccountsPage    adminAccountPage     = new AdminAccountsPage(TestProgressLogger);

                // login in admin
                adminfunctions.AdminLogIn(TestProgressLogger, Const.ADMIN1);

                // Navigate on Accounts page.
                admincommonfunctions.SelectAccountsMenu();
                admincommonfunctions.SelectAccountsTab();
                TestProgressLogger.LogCheckPoint(LogMessage.NavigateAccountPage);

                // Click on ViewAll and search by accountid and double click.
                adminAccountPage.ClickOnViewAll(driver);
                adminAccountPage.SearchByAccountID(driver, accountId);
                adminAccountPage.DoubleClickOnAccountName(driver, accountId);
                TestProgressLogger.LogCheckPoint(string.Format(LogMessage.NavigateAccountPage, accountId));

                // Verify labels under account details section.
                adminAccountPage.VerifyLabelUnderAccountDetailsSection();
                TestProgressLogger.LogCheckPoint(LogMessage.VerifyLabelsUnderAccountDetailsSection);

                // Verify labels under balances section.
                adminAccountPage.VerifyLabelsUnderBalancesSection();
                TestProgressLogger.LogCheckPoint(LogMessage.VerifyLabelsUnderBalancesSection);

                // Get balances of usd before credit amount.
                Dictionary <string, string> balancesData = adminAccountPage.GetBalances(driver, USDCurrency);

                // Credit usd amount using submit ledger entry.
                adminAccountPage.ClickOnSubmitLedgerEntryButton();
                adminAccountPage.CreditAmountInSubmintLedgerEntryModal(USDCurrency, USDAmount, commentValue);
                TestProgressLogger.LogCheckPoint(LogMessage.CreditAmountBySubmitLedgerEntry);

                // Get balances of usd after credit amount.
                adminAccountPage.ClickOnRefreshInUserAccountSection(driver);
                Dictionary <string, string> afterSubmitLedgerBalancesData = adminAccountPage.GetBalances(driver, USDCurrency);

                // Verify increased usd amount after credit by submit ledger entry.
                expectedAmount = GenericUtils.GetSumFromStringAfterAddition(balancesData.GetValueOrDefault(amountField), USDAmount);
                actualAmount   = GenericUtils.ConvertStringToDecimalFormat(afterSubmitLedgerBalancesData.GetValueOrDefault(amountField));
                Assert.Equal(expectedAmount, GenericUtils.RemoveCommaFromString(actualAmount));
                TestProgressLogger.LogCheckPoint(LogMessage.VerifyCreditedUSDAmount);

                // Verify all ticket ids in Decending order.
                Assert.True(adminAccountPage.VerifyTicketsIdInDecendingOrder());

                // Verify all ticket ids in ascending order.
                Assert.True(adminAccountPage.VerifyTicketsIdInAscendingOrder());

                // Logout from admin.
                admincommonfunctions.UserMenuBtn();
                adminfunctions.AdminLogOut();
            }
            catch (NoSuchElementException ex)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace);
                TestProgressLogger.LogError(LogMessage.AccountDetailsTabShowAllRelevantAccountInfoTestFailed, ex);
                throw;
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(e.Message + e.StackTrace);
                TestProgressLogger.LogError(LogMessage.AccountDetailsTabShowAllRelevantAccountInfoTestFailed, e);
                throw e;
            }
            finally
            {
                TestProgressLogger.EndTest();
            }
        }