public void VerifyAmountInTransferSentRequestsSection(IWebDriver driver, string username, string recivedamount) { string actualrecivedamt = null; try { Thread.Sleep(6000); IReadOnlyCollection <IWebElement> arr = driver.FindElements(By.XPath("//div[@class='flex-table__body transfers__body']/div")); for (int i = 1; i <= arr.Count; i++) { IWebElement div = driver.FindElement(By.XPath("//div[@class='flex-table__body transfers__body']/div[" + i + "]/div[1]/div/div[2]")); string instrument = div.Text; if (instrument.Contains(username)) { IWebElement amount = driver.FindElement(By.XPath("//div[@class='flex-table__body transfers__body']/div[" + i + "]/div[2]/div/div[1]")); actualrecivedamt = amount.Text; break; } } string expectedrecivedamount = GenericUtils.ConvertToDoubleFormat(GenericUtils.ConvertStringToDouble(recivedamount)); Assert.Equal(expectedrecivedamount, actualrecivedamt); } catch (Exception e) { throw e; } }
public string ReducedAvailableBalanceOnDetailsPage(string holdAmt, string btcTotlaAmount) { double hold = GenericUtils.ConvertStringToDouble(holdAmt); double btctotal = GenericUtils.ConvertStringToDouble(btcTotlaAmount); double holdwithbtctotal = hold + btctotal; return(Convert.ToString(holdwithbtctotal)); }
public string IncreseHoldOnDetailsPage(string holdAmt, string btcTotalAmount) { double hold = GenericUtils.ConvertStringToDouble(holdAmt); double btctotal = GenericUtils.ConvertStringToDouble(btcTotalAmount); double holdwithbtctotal = hold + btctotal; return(Convert.ToString(holdwithbtctotal)); }
public string VerifyAvailableBalanceOnDetailsPage(string holdAmt, string totalBalance) { double hold = GenericUtils.ConvertStringToDouble(holdAmt); double btctotal = GenericUtils.ConvertStringToDouble(totalBalance); double availableBalance = btctotal - hold; return(Convert.ToString(availableBalance)); }
public void VerifyConfirmationModal(IWebDriver driver, string email, string sendBtcAmount) { try { string btcAmount = driver.FindElement(btcAmountOnConfirm).Text.Split(" ")[0]; string expectedEmail = driver.FindElement(recipientsEmail).Text; Assert.Equal(expectedEmail, email); string expectedBtc = GenericUtils.ConvertToDoubleFormat(GenericUtils.ConvertStringToDouble(sendBtcAmount)); Assert.Equal(expectedBtc, btcAmount); } catch (Exception e) { throw e; } }
// Verify amount in transfer section. public void VerifyAmountInTransferSection(IWebDriver driver, string userName, string receivedAmount) { string actualAmountFromUI; string usernameFromUI; string expectedRow; string actualRow = null; string receivedAmountInDouble; try { receivedAmountInDouble = GenericUtils.ConvertToDoubleFormat(GenericUtils.ConvertStringToDouble(receivedAmount)); expectedRow = userName + " || " + receivedAmountInDouble; IWebElement pagination = driver.FindElement(nextPagination); if (pagination.Enabled) { pagination.Click(); } Thread.Sleep(6000); IReadOnlyCollection <IWebElement> arr = driver.FindElements(By.XPath("//div[@class='flex-table__body transfers__body']/div")); for (int i = 1; i <= arr.Count; i++) { IWebElement div = driver.FindElement(By.XPath("//div[@class='flex-table__body transfers__body']/div[" + i + "]/div[1]/div/div[2]")); usernameFromUI = div.Text.Split(" ")[1]; IWebElement amount = driver.FindElement(By.XPath("//div[@class='flex-table__body transfers__body']/div[" + i + "]/div[2]/div/div[1]")); actualAmountFromUI = amount.Text; actualRow = usernameFromUI + " || " + actualAmountFromUI; if (actualRow.Equals(expectedRow)) { break; } } Assert.Equal(expectedRow, actualRow); } catch (Exception) { throw; } }
public void TC36_SendExternalWallets() { try { string emailAddress; string gmailPassword; string successMsg; string currentBalanceOfUser3; string holdBalance; string availableBalance; string btcAmount; string minerFees; string btcTotalaAmount; string withdrawSuccessMsg; string increasedHoldAmount; string incresedHoldBalance; string TotalBalance; string reducedAvailableBalance; string hold; string expectedReducedAvailableBalance; string statusID; string mailSubject; string withdrawSuccess; string acceptedticketStatus; string totalBalance; string expectedReducedHoldBalance; string expectedReducedTotalBalance; string linkUrl; string ticketStatusNew; instrument = TestData.GetData("Instrument"); currencyName = TestData.GetData("CurrencyName"); comment = TestData.GetData("Comment"); amountOfBtcToSend = TestData.GetData("AmountOfBtcToSend"); withdrawStatus = TestData.GetData("WithdrawStatus"); emailAddress = TestData.GetData("User_14EmailAddress"); gmailPassword = TestData.GetData("GmailUser_Test1Password"); mailSubject = TestData.GetData("GmailMailSubject_ConfirmYourWithdraw"); acceptedticketStatus = TestData.GetData("AcceptedTicketStatus"); ticketStatusNew = TestData.GetData("TicketStatus"); TestProgressLogger.StartTest(); UserFunctions userFunctions = new UserFunctions(TestProgressLogger); userFunctions.LogIn(TestProgressLogger, Const.USER12); TestProgressLogger.LogCheckPoint(String.Format(LogMessage.UserLoggedInSuccessfully, Const.USER12)); UserCommonFunctions.DashBoardMenuButton(driver); UserCommonFunctions.NavigateToWallets(driver); TestProgressLogger.LogCheckPoint(String.Format(LogMessage.NavigateWalletsPage)); WalletPage walletpage = new WalletPage(); walletpage.ClickOnInstrumentReceiveButton(driver, currencyName); walletpage.CopyAddressToReceiveBTC(driver); successMsg = UserCommonFunctions.GetTextOfMessage(driver, TestProgressLogger); Assert.Equal(Const.CopyAddressSuccessMsg, successMsg); TestProgressLogger.LogCheckPoint(String.Format(LogMessage.RecievedAddressCopied, Const.USER12)); walletpage.CloseSendOrReciveSection(driver); userFunctions.LogOut(); TestProgressLogger.LogCheckPoint(String.Format(LogMessage.UserLoggedOutSuccessfully, Const.USER12)); userFunctions.LogIn(TestProgressLogger, Const.USER14); TestProgressLogger.LogCheckPoint(String.Format(LogMessage.UserLoggedInSuccessfully, Const.USER14)); UserCommonFunctions.DashBoardMenuButton(driver); UserCommonFunctions.NavigateToWallets(driver); TestProgressLogger.LogCheckPoint(String.Format(LogMessage.NavigateWalletsPage)); currentBalanceOfUser3 = walletpage.GetInstrumentCurrentBalance(driver, currencyName); walletpage.ClickInstrumentDetails(driver, currencyName); walletpage.GetHoldAvailablePendingDepositTotalBalanceOnDetailsPage(driver); holdBalance = walletpage.HoldBalanceDetailsPage; availableBalance = walletpage.AvailableBalanceDetailsPage; walletpage.ClickSendButtonOnDetailsPage(driver); walletpage.SendBitCoinExternalWallet(driver, comment, amountOfBtcToSend); TestProgressLogger.LogCheckPoint(String.Format(LogMessage.SendBitCoinSuccessfully, amountOfBtcToSend)); btcAmount = walletpage.GetBtcAmountOnConfirmation(driver); minerFees = walletpage.GetMinerFeesOnConfirmation(driver); btcTotalaAmount = GenericUtils.GetSumFromStringAfterAddition(btcAmount, minerFees); walletpage.ClickConfirmButton(driver); withdrawSuccessMsg = UserCommonFunctions.GetTextOfMessage(driver, TestProgressLogger); Assert.Equal(Const.WithdrawSuccessMsg, withdrawSuccessMsg); increasedHoldAmount = GenericUtils.GetSumFromStringAfterAddition(holdBalance, btcTotalaAmount); walletpage.GetHoldAvailablePendingDepositTotalBalanceOnDetailsPage(driver); incresedHoldBalance = walletpage.HoldBalanceDetailsPage; TotalBalance = walletpage.TotalBalanceDetailsPage; reducedAvailableBalance = walletpage.AvailableBalanceDetailsPage; hold = GenericUtils.ConvertToDoubleFormat(GenericUtils.ConvertStringToDouble(increasedHoldAmount)); Assert.Equal(hold, incresedHoldBalance); TestProgressLogger.LogCheckPoint(LogMessage.HoldAmountIncreasedSuccessfully); expectedReducedAvailableBalance = GenericUtils.GetDifferenceFromStringAfterSubstraction(availableBalance, btcTotalaAmount); Assert.Equal(expectedReducedAvailableBalance, GenericUtils.RemoveCommaFromString(reducedAvailableBalance)); TestProgressLogger.LogCheckPoint(LogMessage.AvailableAmountReducedSuccessfully); statusID = walletpage.GetStatusID(driver); userFunctions.LogOut(); TestProgressLogger.LogCheckPoint(String.Format(LogMessage.UserLoggedOutSuccessfully, Const.USER14)); AdminFunctions adminfunctions = new AdminFunctions(TestProgressLogger); adminfunctions.AdminLogIn(TestProgressLogger, Const.ADMIN1); AdminCommonFunctions admincommonfunctions = new AdminCommonFunctions(TestProgressLogger); admincommonfunctions.SelectTicketsMenu(); admincommonfunctions.VerifyStatus(driver, statusID, withdrawStatus); TestProgressLogger.LogCheckPoint(String.Format(LogMessage.CreatedTicketStatusVerified, statusID)); admincommonfunctions.UserMenuBtn(); adminfunctions.AdminLogOut(); TestProgressLogger.LogCheckPoint(String.Format(LogMessage.AdminUserLogoutSuccessfully, Const.ADMIN1)); GmailCommonFunctions gmailobj = new GmailCommonFunctions(); linkUrl = gmailobj.Gmail(driver, emailAddress, gmailPassword, mailSubject); driver.Navigate().GoToUrl(linkUrl); withdrawSuccess = walletpage.GetWithdrawConfirmedMsg(driver); Assert.Equal(LogMessage.WithdrawSuccessfullyConfirmMsg, withdrawSuccess); walletpage.ClickOnGoToExchange(driver); TestProgressLogger.LogCheckPoint(LogMessage.WithdrawConfirmedMassage); adminfunctions.AdminLogIn(TestProgressLogger, Const.ADMIN1); admincommonfunctions = new AdminCommonFunctions(TestProgressLogger); admincommonfunctions.SelectTicketsMenu(); admincommonfunctions.VerifyStatus(driver, statusID, ticketStatusNew); admincommonfunctions.DoubleClickOnCreatedDepositTicket(driver, statusID); admincommonfunctions.ClickOnAcceptButtonFromDepositsTicketModal(); admincommonfunctions.VerifyStatus(driver, statusID, acceptedticketStatus); TestProgressLogger.LogCheckPoint(LogMessage.VerifiedTicketStatus); admincommonfunctions.UserMenuBtn(); adminfunctions.AdminLogOut(); TestProgressLogger.LogCheckPoint(String.Format(LogMessage.AdminUserLogoutSuccessfully, Const.ADMIN1)); userFunctions.LogIn(TestProgressLogger, Const.USER14); TestProgressLogger.LogCheckPoint(String.Format(LogMessage.UserLoggedInSuccessfully, Const.USER14)); UserCommonFunctions.DashBoardMenuButton(driver); UserCommonFunctions.NavigateToWallets(driver); TestProgressLogger.LogCheckPoint(String.Format(LogMessage.NavigateWalletsPage)); currentBalanceOfUser3 = walletpage.GetInstrumentCurrentBalance(driver, currencyName); walletpage.ClickInstrumentDetails(driver, currencyName); walletpage.GetHoldAvailablePendingDepositTotalBalanceOnDetailsPage(driver); holdBalance = walletpage.HoldBalanceDetailsPage; totalBalance = walletpage.TotalBalanceDetailsPage; expectedReducedHoldBalance = GenericUtils.GetDifferenceFromStringAfterSubstraction(incresedHoldBalance, btcTotalaAmount); Assert.Equal(expectedReducedHoldBalance, GenericUtils.RemoveCommaFromString(holdBalance)); TestProgressLogger.LogCheckPoint(LogMessage.HoldBalanceVerified); expectedReducedTotalBalance = GenericUtils.GetDifferenceFromStringAfterSubstraction(TotalBalance, btcTotalaAmount); Assert.Equal(expectedReducedTotalBalance, GenericUtils.RemoveCommaFromString(totalBalance)); TestProgressLogger.LogCheckPoint(LogMessage.TotalBalanceVerified); userFunctions.LogOut(); TestProgressLogger.LogCheckPoint(String.Format(LogMessage.UserLoggedOutSuccessfully, Const.USER14)); TestProgressLogger.EndTest(); } catch (Exception e) { TestProgressLogger.TakeScreenshot(); TestProgressLogger.Error(LogMessage.SendExternalWalletsTestFailed, e); throw e; } }