コード例 #1
0
        //This method will verify the order placed in Trade Reports tab through Report Block Trade
        public bool VerifyTradeReportsTab(string instrument, string side, string size, string price, string fee, string placeOrderTime, string placeOrderTimePlusOneMin, string status)
        {
            try
            {
                Thread.Sleep(2000);
                var    flag       = false;
                string orderSize  = GenericUtils.ConvertToDoubleFormat(Double.Parse(size));
                string priceValue = GenericUtils.ConvertToDoubleFormat(Double.Parse(price));
                string feeValue   = GenericUtils.ConvertToDoubleFormat(Double.Parse(fee));
                Thread.Sleep(2000);
                UserCommonFunctions.TradeTab(driver);
                string expectedRow_1 = instrument + " || " + side + " || " + orderSize + " || " + priceValue + " || " + feeValue + " || " + placeOrderTime + " || " + status;
                string expectedRow_2 = instrument + " || " + side + " || " + orderSize + " || " + priceValue + " || " + feeValue + " || " + placeOrderTimePlusOneMin + " || " + status;

                var listOfInactiveOrders = GetListOfTradeReports();
                if (listOfInactiveOrders.Contains(expectedRow_1) || listOfInactiveOrders.Contains(expectedRow_2))
                {
                    flag = true;
                }
                if (flag)
                {
                    logger.LogCheckPoint(String.Format(LogMessage.OrderVerifiedInTradeReportsTab, side));
                }
                else
                {
                    logger.LogCheckPoint(String.Format(LogMessage.OrderNotFoundInTradeReportsTab, side));
                }
                return(flag);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
コード例 #2
0
        //This method will verify the order placed in Open orders tab through Order Entry
        public bool VerifyOpenOrdersTab(string instrument, string side, string type, double size, string price, string placeOrderTime, string placeOrderTimePlusOneMin)
        {
            try
            {
                var    flag       = false;
                string orderSize  = GenericUtils.ConvertToDoubleFormat(size);
                string priceValue = GenericUtils.ConvertToDoubleFormat(Double.Parse(price));

                UserCommonFunctions.OpenOrderTab(driver);
                string expectedRow_1 = instrument + " || " + side + " || " + type + " || " + orderSize + " || " + priceValue;
                string expectedRow_2 = instrument + " || " + side + " || " + type + " || " + orderSize + " || " + priceValue;


                var listOfFilledOrders = GetListOfOpenOrders();
                if (listOfFilledOrders.Contains(expectedRow_1) || listOfFilledOrders.Contains(expectedRow_2))
                {
                    logger.LogCheckPoint(string.Format(LogMessage.OpenOrdersVerifiedSuccessfully, side));
                    flag = true;
                }
                return(flag);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
コード例 #3
0
        public bool VerifySellLimitFees(string feeValue, string sellAmount, string limitPrice)
        {
            string feeCalculated;
            string feeFromUI;
            string feeInDouble;
            string feeComponent;
            string feeToCompare;
            string feeExpected;

            feeComponent  = TestData.GetData("FeeComponent");
            feeCalculated = GenericUtils.SellFeeAmount(sellAmount, limitPrice, feeComponent);
            feeInDouble   = GenericUtils.ConvertToDoubleFormat(Double.Parse(feeCalculated));
            feeExpected   = GenericUtils.RemoveCommaFromString(feeInDouble);
            feeFromUI     = UserCommonFunctions.GetSplitValue(feeValue);
            feeToCompare  = GenericUtils.RemoveCommaFromString(feeFromUI);
            if (feeExpected.Equals(feeToCompare))
            {
                return(true);
            }
            else
            {
                logger.LogCheckPoint(LogMessage.FeesVerificationFailed);
                return(false);
            }
        }
コード例 #4
0
        //This method will verify the order placed in Trade Reports tab through Report Block Trade
        public bool VerifyBlockTradeReportsInOpenOrderTab(string instrument, string side, string type, string size, string price, string statusWorking, string cancel)
        {
            try
            {
                Thread.Sleep(2000);
                var    flag       = false;
                string orderSize  = GenericUtils.ConvertToDoubleFormat(Double.Parse(size));
                string priceValue = GenericUtils.ConvertToDoubleFormat(Double.Parse(price));
                //string feeValue = GenericUtils.ConvertToDoubleFormat(Double.Parse(fee));
                UserCommonFunctions.OpenOrderTab(driver);
                string expectedRow = instrument + " || " + side + " || " + type + " || " + orderSize + " || " + price + " || " + statusWorking + " || " + cancel;

                var listOfInactiveOrders = GetListOfOpenOrdersForTradeReports();
                if (listOfInactiveOrders.Contains(expectedRow))
                {
                    flag = true;
                }
                if (flag)
                {
                    logger.LogCheckPoint(String.Format(LogMessage.OrderVerifiedInOpenOrdersTabPassed, side));
                }
                else
                {
                    logger.LogCheckPoint(String.Format(LogMessage.OrderVerifiedInOpenOrdersTabFailed, side));
                }
                return(flag);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
コード例 #5
0
        public bool VerifyNet(string netValue, string amountValue)
        {
            string feeCalculated;
            string netFromUI;
            string feeInDouble;
            string feeComponent;
            string netDifference;
            string netComponent;
            string feeExpected;

            feeComponent  = TestData.GetData("FeeComponent");
            feeCalculated = GenericUtils.FeeAmount(amountValue, feeComponent);
            feeInDouble   = GenericUtils.ConvertToDoubleFormat(Double.Parse(feeCalculated));
            feeExpected   = GenericUtils.RemoveCommaFromString(feeInDouble);
            netFromUI     = UserCommonFunctions.GetSplitValue(netValue);
            netComponent  = GenericUtils.RemoveCommaFromString(netFromUI);
            netDifference = GenericUtils.GetDifferenceFromStringAfterSubstraction(amountValue, feeExpected);
            if (netDifference.Equals(netComponent))
            {
                return(true);
            }
            else
            {
                logger.LogCheckPoint(LogMessage.NetVerificationFailed);
                return(false);
            }
        }
コード例 #6
0
        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;
            }
        }
コード例 #7
0
        public bool VerifyOrderTotal(string orderTotalValue, string buyAmountValue, string marketPriceValue)
        {
            double orderTotalCalculated;
            string orderTotalFromUI;
            string orderTotalInDouble;
            string feeComponent;
            string marketPriceFromUI;
            string orderTotalToCompare;
            string orderTotalExpected;

            feeComponent         = TestData.GetData("OrderTotalFeeComponent");
            marketPriceFromUI    = UserCommonFunctions.GetSplitValue(marketPriceValue);
            orderTotalFromUI     = UserCommonFunctions.GetSplitValue(orderTotalValue);
            orderTotalCalculated = Double.Parse(marketPriceFromUI) * Double.Parse(buyAmountValue) * Double.Parse(feeComponent);
            orderTotalInDouble   = GenericUtils.ConvertToDoubleFormat(orderTotalCalculated);
            orderTotalExpected   = GenericUtils.RemoveCommaFromString(orderTotalInDouble);
            orderTotalToCompare  = GenericUtils.RemoveCommaFromString(orderTotalFromUI);
            if (orderTotalExpected.Equals(orderTotalToCompare))
            {
                return(true);
            }
            else
            {
                logger.LogCheckPoint(LogMessage.OrderTotalVerificationFailed);
                return(false);
            }
        }
コード例 #8
0
        // This method will verify the order placed in Filled orders tab through Order Entry
        public bool VerifyFilledOrdersTab(string instrument, string side, double size, string fee, string placeOrderTime, string placeOrderTimePlusOneMin)
        {
            string lastPrice;
            double doubleLastPrice;
            string expectedRow_1;
            string currencyText;
            string totalAmountCalculated;
            string buyAmountValue;
            double feeValueInDouble;
            string feeValue;
            string expectedRow_2;

            try
            {
                var            flag           = false;
                OrderEntryPage orderEntryPage = new OrderEntryPage(driver, logger);
                buyAmountValue   = GenericUtils.ConvertToDoubleFormat(size);
                feeValueInDouble = Double.Parse(fee);
                feeValue         = GenericUtils.ConvertToDoubleFormat(feeValueInDouble);
                if (side.Equals(TestData.GetData("BuyTab")))
                {
                    orderEntryPage.SelectBuyLimitButton();
                    currencyText = AmountCurrencyNameText();
                }
                else
                {
                    orderEntryPage.SelectSellLimitButton();
                    currencyText = PriceCurrencyNameText();
                }

                lastPrice             = orderEntryPage.GetLastPrice();
                doubleLastPrice       = Convert.ToDouble(lastPrice);
                totalAmountCalculated = GenericUtils.FilledOrdersTotalAmount(size, doubleLastPrice);
                Thread.Sleep(2000);
                UserCommonFunctions.FilledOrderTab(driver);
                expectedRow_1 = instrument + " || " + side + " || " + buyAmountValue + " || " + lastPrice + " || " + totalAmountCalculated + " || " + feeValue + " " + currencyText;
                expectedRow_2 = instrument + " || " + side + " || " + buyAmountValue + " || " + lastPrice + " || " + totalAmountCalculated + " || " + feeValue + " " + currencyText;
                var filledOrdersList = GetListOfFilledOrders();
                if (filledOrdersList.Contains(expectedRow_1) || filledOrdersList.Contains(expectedRow_2))
                {
                    flag = true;
                }
                if (flag)
                {
                    logger.LogCheckPoint(String.Format(LogMessage.OrderVerifiedInFilledOrdersTab, side));
                }
                else
                {
                    logger.LogCheckPoint(String.Format(LogMessage.OrderNotFoundInFilledOrdersTab, side));
                }
                return(flag);
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #9
0
        private String CalculateFee(string selectedBTCToBuyStringValue)
        {
            double feeConstant = Double.Parse(TestData.GetData("FeeComponent"));
            var    fee         = Double.Parse(selectedBTCToBuyStringValue) * feeConstant;
            //fee.ToString("N9");
            var    feeDouble = GenericUtils.ConvertToDoubleFormat(fee);
            string fees      = feeDouble.ToString().Substring(0, 10);

            return(fees);
        }
コード例 #10
0
        // This method will verify the order placed in Filled orders tab through Order Entry
        public bool VerifyFilledOrdersTabForBuyAndSell(string instrument, string side, double size, string fee, string placeOrderTime, string placeOrderTimePlusOneMin)
        {
            var    flag = false;
            string currencyText;
            string buyAmountValue;
            string lastPrice;
            double doubleLastPrice;
            string totalAmountCalculated;
            string expectedRow_1;

            try
            {
                OrderEntryPage orderEntryPage = new OrderEntryPage(driver, logger);
                buyAmountValue = GenericUtils.ConvertToDoubleFormat(size);
                if (side.Equals(TestData.GetData("BuyTab")))
                {
                    orderEntryPage.SelectBuyLimitButton();
                    currencyText = AmountCurrencyNameText();
                }
                else
                {
                    orderEntryPage.SelectSellLimitButton();
                    currencyText = PriceCurrencyNameText();
                }

                lastPrice             = orderEntryPage.GetLastPrice();
                doubleLastPrice       = Convert.ToDouble(lastPrice);
                totalAmountCalculated = GenericUtils.FilledOrdersTotalAmount(size, doubleLastPrice);
                Thread.Sleep(2000);

                // Click on Filled order tab
                UserCommonFunctions.FilledOrderTab(driver);
                expectedRow_1 = instrument + " || " + side + " || " + buyAmountValue + " || " + lastPrice + " || " + totalAmountCalculated + " || " + fee + " " + currencyText;
                var filledOrdersList = GetListOfFilledOrders();
                if (filledOrdersList.Contains(expectedRow_1))
                {
                    flag = true;
                }

                // This will verify the expected details with actual in filled orders tab
                if (flag)
                {
                    logger.LogCheckPoint(String.Format(LogMessage.OrderPresentInFilledOrderTabPassed, side));
                }
                else
                {
                    logger.LogCheckPoint(String.Format(LogMessage.OrderPresentInFilledOrderTabFailed, side));
                }
                return(flag);
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #11
0
        //This method will get the trailing price in case of Sell order
        public static string GetSellOrderTrailingPrice(string limitPrice, string trailingAmount)
        {
            double trailingPrice;
            string limitPriceValue;
            string trailingAmountValue;

            limitPriceValue     = GenericUtils.ConvertToDoubleFormat(Double.Parse(limitPrice));
            trailingAmountValue = GenericUtils.ConvertToDoubleFormat(Double.Parse(trailingAmount));
            trailingPrice       = Double.Parse(limitPriceValue) - Double.Parse(trailingAmountValue);
            return(trailingPrice.ToString());
        }
コード例 #12
0
        public bool VerifyAdvanceBuyOrderTab(string instrument, string side, double size, string limitPrice, string buyMarketOrderTime)
        {
            bool   flag           = false;
            string buyAmountValue = GenericUtils.ConvertToDoubleFormat(size);
            string expectedRow    = instrument + " || " + side + " || " + size + " || " + limitPrice + " || " + buyMarketOrderTime;

            if (GetListOfOpenOrders().Contains(expectedRow))
            {
                output.WriteLine("Matched Expected -> " + expectedRow + " Actual -> ");
                flag = true;
            }
            return(flag);
        }
コード例 #13
0
 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;
     }
 }
コード例 #14
0
 // (Buy order)This method will calculate the final buy BTC quantity()
 private String GetBuyBitcoinQuantity(double bTCBalanceInDoubleValue, double selectedBTCToBuyDoubleValue, string feeValue)
 {
     try
     {
         double fee = double.Parse(feeValue);
         string finalBTCQty;
         var    finalBTCQuantity = (bTCBalanceInDoubleValue + selectedBTCToBuyDoubleValue) - fee;
         finalBTCQty = GenericUtils.ConvertToDoubleFormat(finalBTCQuantity);
         return(GenericUtils.RemoveCommaFromString(finalBTCQty));
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #15
0
 // (Sell order)This method will calculate the final sell BTC quantity
 private string GetSellBitcoinQuantity(double bTCBalanceInDoubleValue, double selectedBTCToSellDoubleValue)
 {
     try
     {
         double finalBTCQuantity;
         string finalBTCQty;
         finalBTCQuantity = bTCBalanceInDoubleValue - selectedBTCToSellDoubleValue;
         finalBTCQty      = GenericUtils.ConvertToDoubleFormat(finalBTCQuantity);
         return(GenericUtils.RemoveCommaFromString(finalBTCQty));
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #16
0
        // This method verifies that a particular row is present in the OMS Orders Sell Side Book
        public bool VerifyOMSOrdersSellSideBook(string accountId, string userId, string price, string quantity, string orderType)
        {
            string expectedRow;
            string quantityValue;
            bool   flag = false;

            quantityValue = GenericUtils.ConvertToDoubleFormat(Double.Parse(quantity));
            expectedRow   = accountId + " || " + userId + " || " + price + " || " + quantityValue + " || " + orderType;
            var sellOrdersList = GetListOfOMSOrdersSellSideBook();

            if (sellOrdersList.Contains(expectedRow))
            {
                flag = true;
            }
            return(flag);
        }
コード例 #17
0
        //This method will verify the order placed in Open orders tab through Order Entry
        public bool VerifyOpenOrdersTab(string instrument, string side, double sizeAmount, double stopPrice)
        {
            try {
                var    flag = false;
                string marketStopOrderTime = null;

                UserFunctions userfuntionality = new UserFunctions(output);
                userfuntionality.LogIn(logger);

                UserCommonFunctions.DashBoardMenuButton(driver);
                Thread.Sleep(2000);
                UserCommonFunctions.SelectAnExchange(driver);

                OrderEntryPage boe = new OrderEntryPage(driver, output);

                if (side.Equals("Buy"))
                {
                    marketStopOrderTime = boe.PlaceStopBuyOrder(sizeAmount, stopPrice);
                }
                else if (side.Equals("Sell"))
                {
                    marketStopOrderTime = boe.PlaceStopSellOrder(sizeAmount, stopPrice);
                }
                string buyAmountValue        = GenericUtils.ConvertToDoubleFormat(sizeAmount);
                string lastPrice             = boe.GetLastPrice();
                double doubleLastPrice       = Convert.ToDouble(lastPrice);
                string totalAmountCalculated = GenericUtils.FilledOrdersTotalAmount(sizeAmount, doubleLastPrice);

                UserCommonFunctions.OpenOrderTab(driver);

                string expectedRow = instrument + " || " + side + " || " + sizeAmount + " || " + lastPrice + " || " + totalAmountCalculated + " || " + marketStopOrderTime;

                if (GetListOfFilledOrders().Contains(expectedRow))
                {
                    logger.Info(side + "Order Successfully verifed in Open orders tab");
                    flag = true;
                }
                return(flag);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
コード例 #18
0
        //This method will verify the Block Trade Trade Report of Other Party
        public void VerifyOtherPartyBlockTradeReportTab(string instrument, string sellTab, string counterPartyValue, string productBoughtPrice, string productSoldPrice, string status, Dictionary <string, string> otherPartyBlockTradeData)
        {
            OrderEntryPage orderEntryPage  = new OrderEntryPage(driver, logger);
            string         lastPrice       = orderEntryPage.GetLastPrice();
            var            blockTradePrice = GetBlockTradePrice(productBoughtPrice, productSoldPrice);
            double         feeValue        = (Double.Parse(productBoughtPrice) * Double.Parse(lastPrice)) / 25;
            string         feeValueText    = GenericUtils.ConvertToDoubleFormat(feeValue);

            try
            {
                VerifyOrdersTab objVerifyOrdersTab = new VerifyOrdersTab(driver, logger);
                objVerifyOrdersTab.VerifyTradeReportsTab(instrument, sellTab, productBoughtPrice, blockTradePrice, feeValueText, otherPartyBlockTradeData["PlaceBlockTradeTime"], otherPartyBlockTradeData["PlaceBlockTradeTimePlusOneMin"], status);
                logger.LogCheckPoint(String.Format(LogMessage.SellBlockTradeReportTestPassed, sellTab));
            }
            catch (Exception)
            {
                logger.LogCheckPoint(String.Format(LogMessage.SellBlockTradeReportTestFailed, sellTab));
            }
        }
コード例 #19
0
        // This method will verify the order placed in inactive orders tab through Order Entry
        public bool VerifyInactiveOrdersTab(string instrument, string side, string type, double size, string price, string placeOrderTime, string placeOrderTimePlusOneMin, string status)
        {
            var    flag = false;
            string orderSize;
            string priceValue;
            string expectedRow_1;
            string expectedRow_2;

            try
            {
                orderSize  = GenericUtils.ConvertToDoubleFormat(size);
                priceValue = GenericUtils.ConvertToDoubleFormat(Double.Parse(price));

                UserCommonFunctions.InactiveTab(driver);
                expectedRow_1 = instrument + " || " + side + " || " + type + " || " + orderSize + " || " + priceValue + " || " + status;
                expectedRow_2 = instrument + " || " + side + " || " + type + " || " + orderSize + " || " + priceValue + " || " + status;

                var listOfInactiveOrders = GetListOfInactiveOrders();

                //This will verify the expected details with actual in inactive orders tab
                if (listOfInactiveOrders.Contains(expectedRow_1) || listOfInactiveOrders.Contains(expectedRow_2))
                {
                    flag = true;
                }
                if (flag)
                {
                    logger.LogCheckPoint(String.Format(LogMessage.OrderVerifiedInInactiveOrdersTab, side));
                }
                else
                {
                    logger.LogCheckPoint(String.Format(LogMessage.OrderNotFoundInInactiveOrdersTab, side));
                }
                return(flag);
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #20
0
        // 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;
            }
        }
コード例 #21
0
        // This method calculates order total in case of limit buy order
        public bool VerifyLimitOrderTotal(string orderTotalValue, string amountValue, string limitPriceValue)
        {
            double orderTotalCalculated;
            string orderTotalFromUI;
            string orderTotalInDouble;
            string orderTotalToCompare;
            string orderTotalExpected;

            orderTotalFromUI     = UserCommonFunctions.GetSplitValue(orderTotalValue);
            orderTotalCalculated = Double.Parse(limitPriceValue) * Double.Parse(amountValue);
            orderTotalInDouble   = GenericUtils.ConvertToDoubleFormat(orderTotalCalculated);
            orderTotalExpected   = GenericUtils.RemoveCommaFromString(orderTotalInDouble);
            orderTotalToCompare  = GenericUtils.RemoveCommaFromString(orderTotalFromUI);
            if (orderTotalExpected.Equals(orderTotalToCompare))
            {
                return(true);
            }
            else
            {
                logger.LogCheckPoint(LogMessage.OrderTotalVerificationFailed);
                return(false);
            }
        }
コード例 #22
0
        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;
            }
        }
コード例 #23
0
        //This will place an sell order in BuyAndSell page
        public void PlaceSellOrder(string instrument, string side)
        {
            VerifyOrdersTab objVerifyOrdersTab      = new VerifyOrdersTab(driver, logger);
            string          bTCBalanceTextValue     = BTCBalances().Text;
            string          feeFactor               = TestData.GetData("FeeComponent");
            double          bTCBalanceInDoubleValue = Double.Parse(bTCBalanceTextValue);
            string          actualBTCBalance        = GenericUtils.ConvertToDoubleFormat(bTCBalanceInDoubleValue);


            string usdBalanceTextValue = USDBalances().Text;
            string usdBalance          = usdBalanceTextValue.Split("$")[1];

            Thread.Sleep(1000);
            RadioBtn();
            Thread.Sleep(1000);
            var    transactionOverviewDetails = GetSellTransactionOverView();
            var    priceText   = transactionOverviewDetails["Price"].Split(" ")[0];//price amount without any tag
            string USDCurrency = TestData.GetData("USDCurrency");
            string selected100DollarTextValue   = selected100USD().Text;
            string selected100DollarPrice       = selected100DollarTextValue.Split("$")[1];
            Double selected100DollarDoublePrice = Double.Parse(selected100DollarPrice);//Limit amount without any tag(USD 100)
            string selected100DollarPriceValue  = GenericUtils.ConvertToDoubleFormat(selected100DollarDoublePrice) + " " + USDCurrency;

            string selectedBTCToSellTextValue = SelectedBTCToSell().Text;
            string feeCurrency = TestData.GetData("CurrencyName");
            Double selectedBTCToSellDoubleValue = Double.Parse(selectedBTCToSellTextValue);//BTCTOSell amount without any tag
            string selectedBTCToSellStringValue = GenericUtils.ConvertToDoubleFormat(selectedBTCToSellDoubleValue);

            string feeValue  = GenericUtils.SellFeeAmount(selectedBTCToSellStringValue, priceText, feeFactor);//Fee amount without any tag(USD fee)
            string feeValues = feeValue + " " + USDCurrency;

            Thread.Sleep(1000);
            if (transactionOverviewDetails["TransactionCost"].Contains(selected100DollarPriceValue) && transactionOverviewDetails["BTCToSell"].Contains(selectedBTCToSellStringValue) &&
                transactionOverviewDetails["Fee"].Contains(feeValues))
            {
                logger.LogCheckPoint(String.Format(LogMessage.TransactionOverviewDetailsPassed, side));
                UserSetFunctions.Click(SellBitcoinWithUSDButton());
            }
            else
            {
                logger.LogCheckPoint(String.Format(LogMessage.TransactionOverviewDetailsFailed, side));
            }

            string placeOrderTime                     = GenericUtils.GetCurrentTime();
            string placeOrderTimePlusOneMin           = GenericUtils.GetCurrentTimePlusOneMinute();
            string limitPriceOnConfirmationOrderValue = GenericUtils.ConvertToDoubleFormat(selected100DollarDoublePrice) + " " + USDCurrency;
            string feeOnConfirmationOrderValue        = USDCurrency + " " + feeValue;
            string btcToSellAmount                    = BtcToSellValueOnConfirmOrder().Text;

            var finalQtyConfirmationOrderValues = selected100DollarDoublePrice - double.Parse(feeValue);

            Thread.Sleep(1000);
            var finalQtyConfirmationOrderValue = USDCurrency + " " + GenericUtils.ConvertTo8DigitAfterDecimal(finalQtyConfirmationOrderValues);

            Thread.Sleep(2000);
            var sellConfirmationDetails = GetSellConfirmationOverView();

            if (sellConfirmationDetails["BTCToSell"].Contains(btcToSellAmount) &&
                sellConfirmationDetails["LimitPrice"].Contains(limitPriceOnConfirmationOrderValue) &&
                sellConfirmationDetails["Fee"].Contains(feeOnConfirmationOrderValue) &&
                sellConfirmationDetails["FinalQantity"].Contains(finalQtyConfirmationOrderValue) &&
                (sellConfirmationDetails["Date"].Contains(placeOrderTime) || sellConfirmationDetails["Date"].Contains(placeOrderTimePlusOneMin)))
            {
                logger.LogCheckPoint(String.Format(LogMessage.ConfirmationModalDetailsPassed, side));
            }
            else
            {
                logger.LogCheckPoint(String.Format(LogMessage.ConfirmationModalDetailsFailed, side));
            }
            UserSetFunctions.Click(ConfirmSellOrderButton());
            string orderPlacedSuccessMsg = SuccessMsg().Text;

            try
            {
                Assert.Equal(orderPlacedSuccessMsg, Const.SuccessBuySellOrderMsg);
                logger.LogCheckPoint(String.Format(LogMessage.VerifiedBuySellOrderSuccessMsg, side));
            }
            catch (Exception)
            {
                logger.LogCheckPoint(String.Format(LogMessage.VerifiedBuySellOrderFailedMsg, side));
            }
            Thread.Sleep(1000);
            UserSetFunctions.Click(OKSellButton());
            Thread.Sleep(1000);
            UserSetFunctions.Click(BuyAndSellMenuButton());
            Thread.Sleep(1000);
            UserCommonFunctions.SelectAnExchange(driver);
            Thread.Sleep(1000);
            UserCommonFunctions.ScrollingDownVertical(driver);
            Assert.True(objVerifyOrdersTab.VerifyFilledOrdersTabForBuyAndSell(instrument, side, Double.Parse(selectedBTCToSellStringValue), feeValue, placeOrderTime, placeOrderTimePlusOneMin));

            Thread.Sleep(1000);
            UserCommonFunctions.DashBoardMenuButton(driver);
            Thread.Sleep(1000);
            UserSetFunctions.Click(BuyAndSellButton());
            Thread.Sleep(1000);

            string btcQty = GetSellBitcoinQuantity(bTCBalanceInDoubleValue, selectedBTCToSellDoubleValue);
            string usdBal = "$" + GetSellUSDBalances(usdBalance, feeValue);

            Thread.Sleep(1000);

            string currentbTCQuantity = BTCBalances().Text;
            string finalbTCQuantity   = GenericUtils.RemoveCommaFromString(currentbTCQuantity);

            string currentUSDBalance  = USDBalances().Text;
            string finalUSDBalance    = GenericUtils.RemoveCommaFromString(currentUSDBalance);
            string usdDeductionAmount = TestData.GetData("TC42_USDDeductionAmount");

            try
            {
                Assert.Equal(finalbTCQuantity, btcQty);
                logger.LogCheckPoint(String.Format(LogMessage.FinalBTCQantityPassed, side));
            }

            catch (Exception e)
            {
                logger.LogCheckPoint(String.Format(LogMessage.FinalBTCQantityPassed, side));
                throw e;
            }

            try
            {
                Assert.Equal(finalUSDBalance, usdBal);
                logger.LogCheckPoint(String.Format(LogMessage.FinalUSDBalancePassed, side, usdDeductionAmount));
            }

            catch (Exception e)
            {
                logger.LogCheckPoint(String.Format(LogMessage.FinalUSDBalanceFailed, side, usdDeductionAmount));
                throw e;
            }
        }
コード例 #24
0
        // This will place an buy order in BuyAndSell page
        public void PlaceBuyOrder(string instrument, string side)
        {
            VerifyOrdersTab objVerifyOrdersTab = new VerifyOrdersTab(driver, logger);

            try
            {
                // Get BTC balance from Balances section on UI and convert into Double format
                string bTCBalanceTextValue     = BTCBalances().Text;
                Double bTCBalanceInDoubleValue = Double.Parse(bTCBalanceTextValue);
                string actualBTCBalance        = GenericUtils.ConvertToDoubleFormat(bTCBalanceInDoubleValue);
                // Get USD balance from Balances section on UI and convert into Double format
                string usdBalanceTextValue = USDBalances().Text;
                string usdBalance          = usdBalanceTextValue.Split(Const.AddDollarSign)[1];
                Thread.Sleep(1000);
                // This method will click on first radio button having option - $100
                RadioBtn();
                Thread.Sleep(1000);
                // Store all the details present in TransactionOverView Section
                var transactionOverviewDetails = GetBuyTransactionOverView();
                // Get price text from transactionOverviewDetails and split based on white space
                var priceText = transactionOverviewDetails["Price"].Split(Const.AddWhiteSpace)[0];
                // Gets "USD" as string to append with currency value for comparison
                string USDCurrency = TestData.GetData("USDCurrency");
                // Get 100DollarTextValue from Amount section on UI and convert into Double format
                string selected100DollarTextValue   = selected100USD().Text;
                string selected100DollarPrice       = selected100DollarTextValue.Split(Const.AddDollarSign)[1];
                Double selected100DollarDoublePrice = Double.Parse(selected100DollarPrice);
                string selected100DollarPriceValue  = GenericUtils.ConvertToDoubleFormat(selected100DollarDoublePrice) + Const.AddWhiteSpace + USDCurrency;
                // Get BTCToBuyTextValue from Amount section on UI and convert into Double format
                string selectedBTCToBuyTextValue = SelectedBTCToBuy().Text;
                string feeCurrency = TestData.GetData("CurrencyName");
                Double selectedBTCToBuyDoubleValue = Double.Parse(selectedBTCToBuyTextValue);
                string selectedBTCToBuyStringValue = GenericUtils.ConvertToDoubleFormat(selectedBTCToBuyDoubleValue);
                string feeValue  = CalculateFee(selectedBTCToBuyStringValue);
                string feeValues = feeValue + Const.AddWhiteSpace + feeCurrency;
                Thread.Sleep(1000);

                // This will verify the details of "TransactionCost", "BTCToBuy" and "Fee" components in Buy&Sell page
                if (transactionOverviewDetails["TransactionCost"].Contains(selected100DollarPriceValue) &&
                    transactionOverviewDetails["BTCToBuy"].Contains(selectedBTCToBuyStringValue) &&
                    transactionOverviewDetails["Fee"].Contains(feeValues))
                {
                    logger.LogCheckPoint(String.Format(LogMessage.TransactionOverviewDetailsPassed, side));
                    UserSetFunctions.Click(BuyBitcoinWithUSDButton());
                }
                else
                {
                    logger.LogCheckPoint(String.Format(LogMessage.TransactionOverviewDetailsFailed, side));
                }

                string placeOrderTime           = GenericUtils.GetCurrentTime();
                string placeOrderTimePlusOneMin = GenericUtils.GetCurrentTimePlusOneMinute();
                // This gets the limit Price On Confirmation Order Value
                string limitPriceOnConfirmationOrderValue = GenericUtils.ConvertDoubleToString(selected100DollarDoublePrice) + Const.AddWhiteSpace + USDCurrency;
                string feeOnConfirmationOrderValue        = feeCurrency + Const.AddWhiteSpace + feeValue;

                // Get the final quantity amount(btcToBuyAmount-feeValue)
                string finalQtyDiff = GenericUtils.GetDifferenceFromStringAfterSubstraction(selectedBTCToBuyTextValue, feeValue);
                var    finalQtyConfirmationOrderValues = feeCurrency + Const.AddWhiteSpace + Decimal.Parse(finalQtyDiff).ToString("0.00");

                Thread.Sleep(2000);
                var buyConfirmationDetails = GetBuyConfirmationOverView();

                // This will verify the details of "BTCToBuy", "LimitPrice", "Fee", "FinalQantity" and "Date" in the confirmation window
                if (buyConfirmationDetails["BTCToBuy"].Contains(selectedBTCToBuyTextValue) &&
                    buyConfirmationDetails["LimitPrice"].Contains(selected100DollarPriceValue) &&
                    buyConfirmationDetails["Fee"].Contains(feeOnConfirmationOrderValue) &&
                    buyConfirmationDetails["FinalQantity"].Contains(finalQtyConfirmationOrderValues) &&
                    (buyConfirmationDetails["Date"].Contains(placeOrderTime) || buyConfirmationDetails["Date"].Contains(placeOrderTimePlusOneMin)))
                {
                    logger.LogCheckPoint(String.Format(LogMessage.ConfirmationModalDetailsPassed, side));
                }
                else
                {
                    logger.LogCheckPoint(String.Format(LogMessage.ConfirmationModalDetailsFailed, side));
                }

                // Click on "Confirm Buy Order" button
                UserSetFunctions.Click(ConfirmBuyOrderButton());
                string orderPlacedSuccessMsg = SuccessMsg().Text;

                // This will verify the success message of placed buy order
                try
                {
                    Assert.Equal(orderPlacedSuccessMsg, Const.SuccessBuySellOrderMsg);
                    logger.LogCheckPoint(String.Format(LogMessage.BuySellOrderPassedMsg, side));
                }
                catch (Exception)
                {
                    logger.LogCheckPoint(String.Format(LogMessage.BuySellOrderFailedMsg, side));
                }
                Thread.Sleep(1000);
                for (int i = 0; i <= 2; i++)
                {
                    try
                    {
                        // Click on "OK" button
                        UserSetFunctions.Click(OKBuyButton());
                        break;
                    }
                    catch (StaleElementReferenceException)
                    {
                    }
                }
                for (int i = 0; i <= 2; i++)
                {
                    try
                    {
                        UserSetFunctions.Click(BuyAndSellMenuButton());
                        break;
                    }
                    catch (StaleElementReferenceException)
                    {
                    }
                }

                // Click on exchange Menu button
                UserCommonFunctions.SelectAnExchange(driver);

                //Scroll down to the Filled order tabs
                UserCommonFunctions.ScrollingDownVertical(driver);

                // verify the order placed in Filled orders tab through Order Entry
                Assert.True(objVerifyOrdersTab.VerifyFilledOrdersTabForBuyAndSell(instrument, side, Double.Parse(selectedBTCToBuyStringValue), feeValue, placeOrderTime, placeOrderTimePlusOneMin));

                Thread.Sleep(1000);

                //Click on Dashboard menu button --> Buy&Sell menu button
                UserCommonFunctions.DashBoardMenuButton(driver);
                Thread.Sleep(1000);
                UserSetFunctions.Click(BuyAndSellButton());
                Thread.Sleep(1000);

                // Calculate the buy BTC amount
                string btcQty = GetBuyBitcoinQuantity(bTCBalanceInDoubleValue, selectedBTCToBuyDoubleValue, feeValue);
                // Calculate the buy USD amount
                string usdBal = Const.AddDollarSign + GetBuyUSDBalances(usdBalance);

                Thread.Sleep(1000);
                // BTC balance from the Balances section post transaction
                string currentbTCQuantity = BTCBalances().Text;
                string finalbTCQuantity   = GenericUtils.RemoveCommaFromString(currentbTCQuantity);
                // USD balance from the Balances section post transaction
                string currentUSDBalance  = USDBalances().Text;
                string finalUSDBalance    = GenericUtils.RemoveCommaFromString(currentUSDBalance);
                string usdDeductionAmount = TestData.GetData("TC42_USDDeductionAmount");

                // This will verify the value of final btc amount with the caluclated amount
                try
                {
                    Assert.Equal(finalbTCQuantity, btcQty);
                    logger.LogCheckPoint(String.Format(LogMessage.FinalBTCQantityPassed, side));
                }
                catch (Exception)
                {
                    logger.LogCheckPoint(String.Format(LogMessage.FinalBTCQantityPassed, side));
                    throw;
                }

                // This will verify the value of final USD balance with the caluclated amount
                try
                {
                    Assert.Equal(finalUSDBalance, usdBal);
                    logger.LogCheckPoint(String.Format(LogMessage.FinalUSDBalancePassed, side, usdDeductionAmount));
                }

                catch (Exception)
                {
                    logger.LogCheckPoint(String.Format(LogMessage.FinalUSDBalanceFailed, side, usdDeductionAmount));
                    throw;
                }
            }

            catch (Exception)
            {
                throw;
            }
        }
コード例 #25
0
        // This method place an sell order in BuyAndSell page
        public void PlaceSellOrder(string instrument, string side)
        {
            string          bTCBalanceTextValue;
            string          feeFactor;
            string          actualBTCBalance;
            string          usdBalanceTextValue;
            string          usdBalance;
            string          USDCurrency;
            string          selected100DollarTextValue;
            string          selected100DollarPrice;
            Double          selected100DollarDoublePrice;
            Double          selectedBTCToSellDoubleValue;
            string          selected100DollarPriceValue;
            string          selectedBTCToSellTextValue;
            string          feeCurrency;
            string          selectedBTCToSellStringValue;
            string          feeValue;
            string          feeValues;
            string          orderPlacedSuccessMsg;
            string          placeOrderTime;
            string          placeOrderTimePlusOneMin;
            string          limitPriceOnConfirmationOrderValue;
            string          feeOnConfirmationOrderValue;
            string          btcToSellAmount;
            string          btcQty;
            string          usdBal;
            string          currentbTCQuantity;
            string          finalbTCQuantity;
            string          currentUSDBalance;
            string          finalUSDBalance;
            string          usdDeductionAmount;
            VerifyOrdersTab objVerifyOrdersTab = new VerifyOrdersTab(driver, logger);

            try
            {
                // Get BTC balance from Balances section on UI and convert into Double format
                bTCBalanceTextValue = BTCBalances().Text;
                feeFactor           = TestData.GetData("FeeComponent");
                Double bTCBalanceInDoubleValue = Double.Parse(bTCBalanceTextValue);
                actualBTCBalance = GenericUtils.ConvertToDoubleFormat(bTCBalanceInDoubleValue);

                // Get USD balance from Balances section on UI and convert into Double format
                usdBalanceTextValue = USDBalances().Text;
                usdBalance          = usdBalanceTextValue.Split(Const.AddDollarSign)[1];
                Thread.Sleep(1000);

                // This method will click on first radio button having option - $100
                RadioBtn();
                Thread.Sleep(1000);

                // Store all the details present in TransactionOverView Section
                var transactionOverviewDetails = GetSellTransactionOverView();

                // Get price text from transactionOverviewDetails and split based on white space
                var priceText = transactionOverviewDetails["Price"].Split(Const.AddWhiteSpace)[0];
                // Gets "USD" as string to append with currency value for comparison
                USDCurrency = TestData.GetData("USDCurrency");
                // Get 100DollarTextValue from Amount section on UI and convert into Double format
                selected100DollarTextValue = selected100USD().Text;
                selected100DollarPrice     = selected100DollarTextValue.Split(Const.AddDollarSign)[1];

                selected100DollarDoublePrice = Double.Parse(selected100DollarPrice);
                selected100DollarPriceValue  = GenericUtils.ConvertToDoubleFormat(selected100DollarDoublePrice) + Const.AddWhiteSpace + USDCurrency;

                // Get BTCToSellTextValue from Amount section on UI and convert into Double format
                selectedBTCToSellTextValue = SelectedBTCToSell().Text;
                feeCurrency = TestData.GetData("CurrencyName");

                selectedBTCToSellDoubleValue = Double.Parse(selectedBTCToSellTextValue);
                selectedBTCToSellStringValue = GenericUtils.ConvertToDoubleFormat(selectedBTCToSellDoubleValue);

                // Get calcualted fee
                feeValue  = GenericUtils.SellFeeAmount(selectedBTCToSellStringValue, priceText, feeFactor);
                feeValues = feeValue + Const.AddWhiteSpace + USDCurrency;
                Thread.Sleep(1000);

                // This will verify the details of "TransactionCost", "BTCToSell" and "Fee" components in Buy&Sell page
                if (transactionOverviewDetails["TransactionCost"].Contains(selected100DollarPriceValue) && transactionOverviewDetails["BTCToSell"].Contains(selectedBTCToSellStringValue) &&
                    transactionOverviewDetails["Fee"].Contains(feeValues))
                {
                    logger.LogCheckPoint(String.Format(LogMessage.TransactionOverviewDetailsPassed, side));
                    UserSetFunctions.Click(SellBitcoinWithUSDButton());
                }
                else
                {
                    logger.LogCheckPoint(String.Format(LogMessage.TransactionOverviewDetailsFailed, side));
                }

                placeOrderTime                     = GenericUtils.GetCurrentTime();
                placeOrderTimePlusOneMin           = GenericUtils.GetCurrentTimePlusOneMinute();
                limitPriceOnConfirmationOrderValue = GenericUtils.ConvertToDoubleFormat(selected100DollarDoublePrice) + Const.AddWhiteSpace + USDCurrency;
                feeOnConfirmationOrderValue        = USDCurrency + Const.AddWhiteSpace + feeValue;
                btcToSellAmount                    = BtcToSellValueOnConfirmOrder().Text;

                // Calculated Sell BTC amount
                var finalQtyConfirmationOrderValues = selected100DollarDoublePrice - double.Parse(feeValue);

                Thread.Sleep(1000);
                // Calculated buy USD amount
                var finalQtyConfirmationOrderValue = USDCurrency + Const.AddWhiteSpace + GenericUtils.ConvertTo8DigitAfterDecimal(finalQtyConfirmationOrderValues);
                Thread.Sleep(2000);

                // Store all the details present in TransactionOverView Section
                var sellConfirmationDetails = GetSellConfirmationOverView();

                // This will verify the details of "BTCToSell", "LimitPrice", "Fee", "FinalQantity" and "Date" in the confirmation window
                if (sellConfirmationDetails["BTCToSell"].Contains(btcToSellAmount) &&
                    sellConfirmationDetails["LimitPrice"].Contains(limitPriceOnConfirmationOrderValue) &&
                    sellConfirmationDetails["Fee"].Contains(feeOnConfirmationOrderValue) &&
                    sellConfirmationDetails["FinalQantity"].Contains(finalQtyConfirmationOrderValue) &&
                    (sellConfirmationDetails["Date"].Contains(placeOrderTime) || sellConfirmationDetails["Date"].Contains(placeOrderTimePlusOneMin)))
                {
                    logger.LogCheckPoint(String.Format(LogMessage.ConfirmationModalDetailsPassed, side));
                }
                else
                {
                    logger.LogCheckPoint(String.Format(LogMessage.ConfirmationModalDetailsFailed, side));
                }

                //Click on "Confirm Sell Order" button
                UserSetFunctions.Click(ConfirmSellOrderButton());
                orderPlacedSuccessMsg = SuccessMsg().Text;

                // This will verify the success message of placed sell order
                try
                {
                    Assert.Equal(orderPlacedSuccessMsg, Const.SuccessBuySellOrderMsg);
                    logger.LogCheckPoint(String.Format(LogMessage.BuySellOrderPassedMsg, side));
                }
                catch (Exception)
                {
                    logger.LogCheckPoint(String.Format(LogMessage.BuySellOrderFailedMsg, side));
                }
                Thread.Sleep(3000);

                // Click on "OK" button
                UserSetFunctions.Click(OKSellButton());
                Thread.Sleep(1000);

                // Click on "Buy&Sell" menu button --> exchange button--> scroll down to filled order tab
                UserSetFunctions.Click(BuyAndSellMenuButton());
                Thread.Sleep(1000);
                UserCommonFunctions.SelectAnExchange(driver);
                Thread.Sleep(1000);
                UserCommonFunctions.ScrollingDownVertical(driver);

                // This will verify filled orders tab after placing successfull sell order
                Assert.True(objVerifyOrdersTab.VerifyFilledOrdersTabForBuyAndSell(instrument, side, Double.Parse(selectedBTCToSellStringValue), feeValue, placeOrderTime, placeOrderTimePlusOneMin));
                Thread.Sleep(1000);
                UserCommonFunctions.DashBoardMenuButton(driver);
                Thread.Sleep(1000);
                UserSetFunctions.Click(BuyAndSellButton());
                Thread.Sleep(1000);

                // Get the final sell quantity amount(btcBalance-btcToSellAmount)

                btcQty = GetSellBitcoinQuantity(bTCBalanceInDoubleValue, selectedBTCToSellDoubleValue);
                usdBal = Const.AddDollarSign + GetSellUSDBalances(usdBalance, feeValue);

                Thread.Sleep(1000);

                // BTC balance from the Balances section post transaction
                currentbTCQuantity = BTCBalances().Text;
                finalbTCQuantity   = GenericUtils.RemoveCommaFromString(currentbTCQuantity);

                // USD balance from the Balances section post transaction
                currentUSDBalance  = USDBalances().Text;
                finalUSDBalance    = GenericUtils.RemoveCommaFromString(currentUSDBalance);
                usdDeductionAmount = TestData.GetData("TC42_USDDeductionAmount");

                // This will verify the value of final btc quantity
                try
                {
                    Assert.Equal(finalbTCQuantity, btcQty);
                    logger.LogCheckPoint(String.Format(LogMessage.FinalBTCQantityPassed, side));
                }

                catch (Exception)
                {
                    logger.LogCheckPoint(String.Format(LogMessage.FinalBTCQantityFailed, side));
                    throw;
                }

                // This will verify the value of final USD balance
                try
                {
                    Assert.Equal(finalUSDBalance, usdBal);
                    logger.LogCheckPoint(String.Format(LogMessage.FinalUSDBalancePassed, side, usdDeductionAmount));
                }

                catch (Exception)
                {
                    logger.LogCheckPoint(String.Format(LogMessage.FinalUSDBalanceFailed, side, usdDeductionAmount));
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }