[Fact] //Admin_4 public void ManualWithdraw() { try { string accountId; string USDCurrency; string holdAmountField; string pendingWithdrawsField; string holdAmountBeforeWithdraw; string pendingWithdrawsAmtBeforeWithdraw; string expectedIncreasedPendingAmount; string pendingWithdrawsAmtAfterWithdraw; string amount; string fullName; string language; string comment; string bankAddress; string bankAccountNumber; string bankAccountName; string swiftCode; string toastMessage; string recentTicketID; string ticketIDValue; string dailyWithdrawAmountBeforeAccept; string dailyWithdrawAmountAfterAccept; string monthlyWithdrawAmountBeforeAccept; string monthlyWithdrawAmountAfterAccept; string dailyWithdrawsField; string monthlyWithdrawsField; string pendingWithdrawsAmtAfterAccept; accountId = TestData.GetData("TCAdmin4_UserAccountID"); USDCurrency = TestData.GetData("USDCurrency"); holdAmountField = TestData.GetData("TCAdmin4_HoldAmountField"); pendingWithdrawsField = TestData.GetData("TCAdmin4_PendingWithdrawsField"); dailyWithdrawsField = TestData.GetData("TCAdmin4_DailyWithdrawsField"); monthlyWithdrawsField = TestData.GetData("TCAdmin4_MonthlyWithdrawsField"); amount = TestData.GetData("TCAdmin4_Amount"); fullName = TestData.GetData("TCAdmin4_FullName"); language = TestData.GetData("TCAdmin4_Language"); comment = TestData.GetData("TCAdmin4_Comment"); bankAddress = TestData.GetData("TCAdmin4_BankAddress"); bankAccountNumber = TestData.GetData("TCAdmin4_BankAccountNumber"); bankAccountName = TestData.GetData("TCAdmin4_BankAccountName"); swiftCode = TestData.GetData("TCAdmin4_SwiftCode"); ticketIDValue = TestData.GetData("TCAdmin4_TicketIDValue"); AdminFunctions adminfunctions = new AdminFunctions(TestProgressLogger); AdminCommonFunctions admincommonfunctions = new AdminCommonFunctions(TestProgressLogger); AdminAccountsPage adminAccountPage = new AdminAccountsPage(TestProgressLogger); AdminTicketsPage admintickets = new AdminTicketsPage(); // 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)); // Get balances before manual withdraw. Dictionary <string, string> balancesData = adminAccountPage.GetBalances(driver, USDCurrency); holdAmountBeforeWithdraw = balancesData.GetValueOrDefault(holdAmountField); pendingWithdrawsAmtBeforeWithdraw = balancesData.GetValueOrDefault(pendingWithdrawsField); // Click on manual Withdraw button and enter details in modal. adminAccountPage.ClickOnManualWithdrawButton(driver); adminAccountPage.ManualWithdrawUSD(driver, USDCurrency, amount, fullName, language, comment, bankAddress, bankAccountNumber, bankAccountName, swiftCode); TestProgressLogger.LogCheckPoint(string.Format(LogMessage.ManualWithdrawUSD, amount)); expectedIncreasedPendingAmount = GenericUtils.AddTwoValue(pendingWithdrawsAmtBeforeWithdraw, amount); // Verify withdraw success msg. toastMessage = UserCommonFunctions.GetTextOfToastMessageInAdmin(driver, TestProgressLogger); Assert.Equal(Const.TCA4_WithdrawTicketSuccessfullyMSG, toastMessage); TestProgressLogger.LogCheckPoint(LogMessage.VerifyToastMSG); adminAccountPage.ClickOnRefreshInUserAccountSection(driver); // Get balances after manual withdraw. Dictionary <string, string> balancesDataAfter = adminAccountPage.GetBalances(driver, USDCurrency); pendingWithdrawsAmtAfterWithdraw = balancesDataAfter.GetValueOrDefault(pendingWithdrawsField); dailyWithdrawAmountBeforeAccept = balancesDataAfter.GetValueOrDefault(dailyWithdrawsField); monthlyWithdrawAmountBeforeAccept = balancesDataAfter.GetValueOrDefault(monthlyWithdrawsField); // Verify increased pending amount after manual withdraw. Assert.Equal(expectedIncreasedPendingAmount, pendingWithdrawsAmtAfterWithdraw); TestProgressLogger.LogCheckPoint(LogMessage.VerifyIncreasedPendingWithdrawAmt); recentTicketID = adminAccountPage.GetRecentTicketID(driver, USDCurrency, amount); // Navigate on Ticket-> Withdraw page and click on refresh button. admincommonfunctions.SelectTicketsMenu(); admincommonfunctions.NavigateToWithdrawTicketsTab(); admincommonfunctions.ClickOnRefreshButtonOnTicketsPage(); TestProgressLogger.LogCheckPoint(LogMessage.NavigateTicketsPage); //Verify created ticket in tickets-> withdraw page. Dictionary <string, string> withdrawTicketsFields = admintickets.GetWithdrawTicketsFieldsByTicketID(driver, recentTicketID); Assert.Equal(recentTicketID, withdrawTicketsFields.GetValueOrDefault(ticketIDValue)); admincommonfunctions.ClickOnTicketFromWithdrawTicketList(withdrawTicketsFields.GetValueOrDefault(ticketIDValue)); admincommonfunctions.ClickOnAcceptButtonFromDepositsTicketModal(); TestProgressLogger.LogCheckPoint(LogMessage.CreatedTicketsVerified); // Navigate on Accounts page. admincommonfunctions.SelectAccountsMenu(); adminAccountPage.ClickOnRefreshInUserAccountSection(driver); TestProgressLogger.LogCheckPoint(LogMessage.NavigateAccountPage); // Get balances after accept ticket. Dictionary <string, string> balancesDataAfterAccept = adminAccountPage.GetBalances(driver, USDCurrency); pendingWithdrawsAmtAfterAccept = balancesDataAfterAccept.GetValueOrDefault(pendingWithdrawsField); dailyWithdrawAmountAfterAccept = balancesDataAfterAccept.GetValueOrDefault(dailyWithdrawsField); monthlyWithdrawAmountAfterAccept = balancesDataAfterAccept.GetValueOrDefault(monthlyWithdrawsField); // Verify pending withdraws, daily withdraw and monthly withdraw amount after accept ticket. Assert.Equal(GenericUtils.SubtractTwoValue(pendingWithdrawsAmtAfterWithdraw, amount), pendingWithdrawsAmtAfterAccept); Assert.Equal(GenericUtils.AddTwoValue(dailyWithdrawAmountBeforeAccept, amount), dailyWithdrawAmountAfterAccept); Assert.Equal(GenericUtils.AddTwoValue(monthlyWithdrawAmountBeforeAccept, amount), monthlyWithdrawAmountAfterAccept); TestProgressLogger.LogCheckPoint(LogMessage.VerifiedDailyAndMonthlyWithdraw); // Logout from admin. admincommonfunctions.UserMenuBtn(); adminfunctions.AdminLogOut(); } catch (NoSuchElementException ex) { TestProgressLogger.TakeScreenshot(); TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace); TestProgressLogger.LogError(LogMessage.ManualWithdrawTestFailed, ex); throw; } catch (Exception e) { TestProgressLogger.TakeScreenshot(); TestProgressLogger.LogCheckPoint(e.Message + e.StackTrace); TestProgressLogger.LogError(LogMessage.ManualWithdrawTestFailed, e); throw e; } finally { TestProgressLogger.EndTest(); } }