Beispiel #1
0
        // This method is used to login using the credentials captured from UI after unassigning the account
        public bool LogInUsingCredsAfterUnassignAccount(ProgressLogger logger, string userName, string userPassword)
        {
            bool flag = false;

            try
            {
                UserSetFunctions.EnterText(GenericUtils.WaitForElementPresence(driver, userLoginName, 15), userName);
                UserSetFunctions.EnterText(GenericUtils.WaitForElementPresence(driver, userLoginPassword, 15), userPassword);
                UserSetFunctions.Click(GenericUtils.WaitForElementPresence(driver, userLoginButton, 15));

                //When trying to login using credential after unassigining the account then page is showing blank
                //So in case we have used below condition to check login.
                //Once login failed error messges shows then use below comment code in if condition
                //LoginErrorMsg().Text.Equals(Const.LoginErrroMsg)
                if (driver.Title.ToLower().Equals(apexWebTitle.ToLower()))
                {
                    flag = true;
                }

                if (flag)
                {
                    logger.LogCheckPoint(String.Format(LogMessage.VerifyLoginAfterUnassignAccountPassed, userName));
                }
                else
                {
                    logger.LogCheckPoint(String.Format(LogMessage.VerifyLoginAfterUnassignAccountFailed, userName));
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(flag);
        }
Beispiel #2
0
        // This method is used to login using the credentials captured from UI after assigning the account
        public bool LogInUsingCredsAfterAssignAccount(ProgressLogger logger, string userName, string userPassword)
        {
            bool flag = false;

            try
            {
                UserSetFunctions.EnterText(GenericUtils.WaitForElementPresence(driver, userLoginName, 15), userName);
                UserSetFunctions.EnterText(GenericUtils.WaitForElementPresence(driver, userLoginPassword, 15), userPassword);
                UserSetFunctions.Click(GenericUtils.WaitForElementPresence(driver, userLoginButton, 15));
                if (driver.Title.ToLower().Equals(apexWebTitle.ToLower()))
                {
                    flag = true;
                }

                if (flag)
                {
                    logger.LogCheckPoint(String.Format(LogMessage.VerifyLoginAfterAssignAccountPassed, userName));
                    Thread.Sleep(2000);
                    LogOut();
                }
                else
                {
                    logger.LogCheckPoint(String.Format(LogMessage.VerifyLoginAfterAssignAccountFailed, userName));
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(flag);
        }
        //This method is a prerequisite for cancelling all existing orders and placing a sell limit order
        public string CancelAndPlaceLimitSellOrder(IWebDriver driver, string instrument, string sellTab, string orderSize, string limitPrice, string timeInForce)
        {
            string askPrice;

            logger.LogCheckPoint(String.Format(LogMessage.MarketSetupBegin, sellTab, orderSize, limitPrice));
            OrderEntryPage orderEntryPage = new OrderEntryPage(driver, logger);

            orderEntryPage.PlaceLimitSellOrder(instrument, sellTab, orderSize, limitPrice, timeInForce);
            askPrice = AskPrice(driver).Text;
            return(askPrice);
        }
        //This method will login to admin portal
        public void AdminLogIn(ProgressLogger logger, string userName = Const.ADMIN1)
        {
            try
            {
                username = data.AdminPortal.Users[userName].UserName;
                password = data.AdminPortal.Users[userName].Password;
                string userUrl        = data.AdminPortal.PortalUrl;
                string userServerName = data.AdminPortal.PortalServerUrl;

                driver.Navigate().GoToUrl(userUrl);
                driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(20);
                driver.Manage().Window.Size = new Size(1366, 768);

                UserSetFunctions.EnterText(AdminUserName(), username);
                UserSetFunctions.EnterText(AdminUserPassword(), password);
                UserSetFunctions.Click(AdminSignIn());
                Assert.Equal(driver.Title.ToLower(), Const.AdminLoginTitle.ToLower());
                logger.LogCheckPoint(String.Format(LogMessage.AdminLoginSuccessfullMsg, userName));
                Thread.Sleep(2000);
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #5
0
 private string UserLogin(ProgressLogger logger, string userName, string userServerName, bool changeServerOnly = false)
 {
     try
     {
         string defaultSelectedServer;
         username = data.UserPortal.Users[userName].UserName;
         password = data.UserPortal.Users[userName].Password;
         IWebElement   serverWebElement = driver.FindElement(selectServer);
         SelectElement selectObj        = new SelectElement(serverWebElement);
         defaultSelectedServer = selectObj.SelectedOption.Text;
         Thread.Sleep(1000);
         if (!(userServerName.Equals(defaultSelectedServer)))
         {
             UserSetFunctions.SelectDropdown(serverWebElement, userServerName);
         }
         Thread.Sleep(1000);
         if (changeServerOnly)
         {
             return(null);
         }
         UserSetFunctions.EnterText(GenericUtils.WaitForElementPresence(driver, userLoginName, 15), username);
         UserSetFunctions.EnterText(GenericUtils.WaitForElementPresence(driver, userLoginPassword, 15), password);
         UserSetFunctions.Click(GenericUtils.WaitForElementPresence(driver, userLoginButton, 15));
         Assert.Equal(driver.Title.ToLower(), apexWebTitle.ToLower());
         logger.LogCheckPoint(string.Format(LogMessage.UserLoggedInSuccessfully, username));
         Thread.Sleep(2000);
         return(username);
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #6
0
 //This method is used for User Logout
 public void LogOut()
 {
     try
     {
         Thread.Sleep(2000);
         if (!driver.Url.EndsWith(Const.LoginText))
         {
             UserCommonFunctions.ScrollingUpVertical(driver);
             UserSetFunctions.Click(driver.FindElement(loggedInUserName));
             UserSetFunctions.Click(driver.FindElement(userSignOutButton));
             logger.LogCheckPoint(string.Format(LogMessage.UserLoggedOutSuccessfully, username));
         }
         Thread.Sleep(2000);
     }
     catch (Exception e)
     {
         logger.LogError(LogMessage.UserLogoutFailed, e);
         throw;
     }
 }
 //This method will click on Sign Out button
 public void AdminLogOut()
 {
     try
     {
         Thread.Sleep(2000);
         UserSetFunctions.Click(AdminSignout());
         logger.LogCheckPoint(String.Format(LogMessage.AdminLogoutSuccessfullMsg));
     }
     catch (Exception e)
     {
         throw e;
     }
 }
        // This method with will verify the AccountId textfield
        public bool VerifySearchByAccountId(string accountId)
        {
            bool flag = false;
            int  totalCountOfAccountItemsBeforeSearch;
            int  totalCountOfAccountItemsAfterSearch;

            try
            {
                totalCountOfAccountItemsBeforeSearch = totalCountOfTradeItems();
                ClickOnShowSearchButton();
                EnterAccountId(accountId);
                ClickOnSearchButton();
                Thread.Sleep(2000);
                totalCountOfAccountItemsAfterSearch = totalCountOfTradeItems();

                if (!totalCountOfAccountItemsBeforeSearch.Equals(totalCountOfAccountItemsAfterSearch))
                {
                    flag = true;
                }

                if (flag)
                {
                    logger.LogCheckPoint(String.Format(LogMessage.VerifySearchByAccountIdPassed, accountId));
                }
                else
                {
                    logger.LogCheckPoint(String.Format(LogMessage.VerifySearchByAccountIdFailed, accountId));
                }
                UserSetFunctions.Clear(AccountIdTextField());
                driver.Navigate().Refresh();
                Thread.Sleep(1000);
                ClickOnShowSearchButton();
            }
            catch (Exception)
            {
                throw;
            }
            return(flag);
        }
Beispiel #9
0
 //This method will click on "LoyaltyToken" Button in User settings page
 public bool GetFeeText()
 {
     try
     {
         bool flag = false;
         Thread.Sleep(2000);
         string feeText = MarketOrderFees().Text;
         if (feeText.Contains(Const.LoyaltyToken))
         {
             flag = true;
             logger.LogCheckPoint(String.Format(LogMessage.AppliedFeeIsLTC, feeText));
         }
         else
         {
             logger.LogCheckPoint(String.Format(LogMessage.AppliedFeeIsNotLTC, feeText));
         }
         return(flag);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public void NavigateToAdvanceOrdersSection(IWebDriver driver, string side, string instrument, string orderType)
 {
     try
     {
         UserCommonFunctions.DashBoardMenuButton(driver);
         UserCommonFunctions.SelectAnExchange(driver);
         UserCommonFunctions.CancelAllOrders(driver);
         logger.LogCheckPoint(String.Format(LogMessage.CancelOrders));
         UserCommonFunctions.AdvanceOrder(driver);
         SelectBuyOrSellTab(side);
         SelectInstrumentsAndOrderType(instrument, orderType);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Beispiel #11
0
        // This method searches for Rejected order on History page -> Double clicks to select it and returns the rejected reason
        public bool VerifySearchRejectedOrder(string instrument, string numberOfRecords, string orderState)
        {
            bool    flag = false;
            string  orderStatusText;
            int     totalCount;
            int     count;
            Actions actions          = new Actions(driver);
            EventFiringWebDriver evw = new EventFiringWebDriver(driver);

            totalCount = Int32.Parse(numberOfRecords);
            count      = totalCount / 10;
            for (int j = 1; j <= count; j++)
            {
                for (int i = 1; i <= 10; i++)
                {
                    By orderStatusFromUI = By.XPath("//div[@class='ReactVirtualized__Grid__innerScrollContainer']/div[" + i + "]/div[4]");
                    orderStatusText = driver.FindElement(orderStatusFromUI).Text;
                    IWebElement orderStatusElement = driver.FindElement(By.XPath("//div[@class='ReactVirtualized__Grid__innerScrollContainer']/div[" + i + "]/div[4]"));
                    if ((orderStatusText.Equals(orderState)))
                    {
                        actions.DoubleClick(orderStatusElement).Build().Perform();
                        flag = true;
                        goto Endloop;
                    }
                }
                var queryString = "document.querySelector('div.ReactVirtualized__Grid.ReactVirtualized__Table__Grid').scrollTop=";
                evw.ExecuteScript(queryString + (j * 440));
                Thread.Sleep(1000);
            }
Endloop:
            if (RejectReasonTitleElement().Text.Equals(Const.RejectReasonTitle))
            {
                flag = true;
                logger.LogCheckPoint(String.Format(LogMessage.OrderRejectedReason, RejectReasonValue().Text));
            }
            return(flag);
        }
        //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)
        {
            try
            {
                var            flag = false;
                string         currencyText;
                OrderEntryPage orderEntryPage   = new OrderEntryPage(driver, logger);
                string         buyAmountValue   = GenericUtils.ConvertToDoubleFormat(size);
                double         feeValueInDouble = Double.Parse(fee);
                string         feeValue         = GenericUtils.ConvertToDoubleFormat(feeValueInDouble);
                if (side.Equals(TestData.GetData("BuyTab")))
                {
                    orderEntryPage.SelectBuyLimitButton();
                    currencyText = AmountCurrencyNameText();
                }
                else
                {
                    orderEntryPage.SelectSellLimitButton();
                    currencyText = PriceCurrencyNameText();
                }

                string lastPrice             = orderEntryPage.GetLastPrice();
                double doubleLastPrice       = Convert.ToDouble(lastPrice);
                string totalAmountCalculated = GenericUtils.FilledOrdersTotalAmount(size, doubleLastPrice);
                Thread.Sleep(2000);
                UserCommonFunctions.FilledOrderTab(driver);
                string expectedRow_1    = instrument + " || " + side + " || " + buyAmountValue + " || " + lastPrice + " || " + totalAmountCalculated + " || " + feeValue + " " + currencyText;
                string 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 e)
            {
                throw e;
            }
        }
Beispiel #13
0
        public void NavigateToHomePage(string instrument)
        {
            string exchangeStringValueFromSite;

            UserCommonFunctions.DashBoardMenuButton(driver);
            UserCommonFunctions.SelectAnExchange(driver);
            Thread.Sleep(2000);
            exchangeStringValueFromSite = ExchangeMenuText().Text;
            Thread.Sleep(2000);
            if (exchangeStringValueFromSite.Equals(TestData.GetData("MenuTab")))
            {
                logger.LogCheckPoint(LogMessage.ExchangeMenuVerifiedSuccessfully);
                UserCommonFunctions.SelectInstrumentFromExchange(instrument, driver);
                Thread.Sleep(2000);
            }
        }
        // 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;
            }
        }
Beispiel #15
0
        //"Verify below details:Report summary is 'report type' , on demand and from and to date. "
        public void VerifySingleReportSummaryDetails()
        {
            string singleReportTradeActivityValue       = TestData.GetData("TC47_SingleReportTradeActivityValue");
            string singleReportTransactionActivityValue = TestData.GetData("TC47_SingleReportTransactionActivityValue");
            string singleReportTreasuryActivitytValue   = TestData.GetData("TC47_SingleReportTreasuryActivitytValue");


            string TradeActivity       = TradeActivityText().Text;
            string TransactionActivity = TransactionActivityText().Text;
            string TreasuryActivity    = TreasuryActivityText().Text;

            try
            {
                if (TradeActivity.Equals(singleReportTradeActivityValue))
                {
                    try
                    {
                        logger.LogCheckPoint(String.Format(LogMessage.SingleReportTradeActivityPassed, TradeActivity));
                    }
                    catch (Exception)
                    {
                        logger.Error(String.Format(LogMessage.SingleReportTradeActivityFailed, TradeActivity));
                    }
                }
                else if (TransactionActivity.Equals(singleReportTransactionActivityValue))
                {
                    try
                    {
                        logger.LogCheckPoint(String.Format(LogMessage.SingleReportTransactionActivityPassed, TransactionActivity));
                    }
                    catch (Exception)
                    {
                        logger.Error(String.Format(LogMessage.SingleReportTransactionActivityFailed, TransactionActivity));
                    }
                }
                else if (TreasuryActivity.Equals(singleReportTreasuryActivitytValue))
                {
                    try
                    {
                        logger.LogCheckPoint(String.Format(LogMessage.SingleReportTreasuryActivityPassed, TreasuryActivity));
                    }
                    catch (Exception)
                    {
                        logger.Error(String.Format(LogMessage.SingleReportTreasuryActivityFailed, TreasuryActivity));
                    }
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
        //This will place an buy order in BuyAndSell page
        public void PlaceBuyOrder(string instrument, string side)
        {
            VerifyOrdersTab objVerifyOrdersTab      = new VerifyOrdersTab(driver, logger);
            string          bTCBalanceTextValue     = BTCBalances().Text;
            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 = GetBuyTransactionOverView();
            var    priceText   = transactionOverviewDetails["Price"].Split(" ")[0];
            string USDCurrency = TestData.GetData("USDCurrency");
            string selected100DollarTextValue   = selected100USD().Text;
            string selected100DollarPrice       = selected100DollarTextValue.Split("$")[1];
            Double selected100DollarDoublePrice = Double.Parse(selected100DollarPrice);
            string selected100DollarPriceValue  = GenericUtils.ConvertToDoubleFormat(selected100DollarDoublePrice) + " " + USDCurrency;

            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 + " " + feeCurrency;
            string btcToBuyAmount = SelectedBTCToBuy().Text;

            Thread.Sleep(1000);
            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();
            string limitPriceOnConfirmationOrderValue = GenericUtils.ConvertDoubleToString(selected100DollarDoublePrice) + " " + USDCurrency;
            string feeOnConfirmationOrderValue        = feeCurrency + " " + feeValue;

            string finalQtyDiff = GenericUtils.GetDifferenceFromStringAfterSubstraction(btcToBuyAmount, feeValue);
            var    finalQtyConfirmationOrderValues = feeCurrency + " " + Decimal.Parse(finalQtyDiff).ToString("0.00");

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

            if (buyConfirmationDetails["BTCToBuy"].Contains(btcToBuyAmount) &&
                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));
            }

            UserSetFunctions.Click(ConfirmBuyOrderButton());
            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(OKBuyButton());
            UserSetFunctions.Click(BuyAndSellMenuButton());
            UserCommonFunctions.SelectAnExchange(driver);
            UserCommonFunctions.ScrollingDownVertical(driver);
            Assert.True(objVerifyOrdersTab.VerifyFilledOrdersTabForBuyAndSell(instrument, side, Double.Parse(selectedBTCToBuyStringValue), feeValue, placeOrderTime, placeOrderTimePlusOneMin));

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

            string btcQty = GetBuyBitcoinQuantity(bTCBalanceInDoubleValue, selectedBTCToBuyDoubleValue, feeValue);
            string usdBal = "$" + GetBuyUSDBalances(usdBalance);

            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(currentbTCQuantity, btcQty);
                logger.LogCheckPoint(String.Format(LogMessage.FinalBTCQantityPassed, side));
            }

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

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

            catch (Exception e)
            {
                logger.LogCheckPoint(String.Format(LogMessage.FinalUSDBalanceFailed, side, usdDeductionAmount));
                throw e;
            }
        }
Beispiel #17
0
        // This method Deletes the API key, takes bool deleteFlag true
        // Returns true if the API Key is successfully deleted
        public bool VerifyDeleteButtonIsPresent(Dictionary <string, string> apiKeyData, bool deleteFlag)
        {
            Thread.Sleep(2000);
            string    apiKeyAdded;
            ArrayList apiKeysList = new ArrayList();

            apiKeyAdded = apiKeyData[Const.APIKey];
            var flag = false;
            // This stores the count of the total number of API Keys
            int countOfAPIKeys = driver.FindElements(By.XPath("//div[@class='flex-table__body api-key-list__body retail-api-key-list__body']/div")).Count;

            // Loop through all the rows and delete the API key created
            for (int i = 1; i <= countOfAPIKeys; i++)
            {
                int countItems = driver.FindElements(By.XPath("(//div[@class='flex-table__body api-key-list__body retail-api-key-list__body']/div)[" + i + "]/div")).Count;
                for (int j = 1; j <= countItems; j++)
                {
                    string apiKey = driver.FindElement(By.XPath("(//div[@class='flex-table__body api-key-list__body retail-api-key-list__body']/div)[" + i + "]/div[1]")).Text;
                    if (apiKey.Equals(apiKeyAdded))
                    {
                        IWebElement deleteButton = driver.FindElement(By.XPath("(//div[@class='flex-table__body api-key-list__body retail-api-key-list__body']/div)[" + i + "]/div[5]"));
                        if (deleteButton.Text.Equals(Const.APIDeleteButton))
                        {
                            if (deleteFlag)
                            {
                                deleteButton.Click();
                                UserSetFunctions.Click(DeleteAPIKeymodalButton());
                                flag = true;
                            }
                        }
                    }
                }
            }
            if (flag)
            {
                logger.LogCheckPoint(Const.DeleteAPIKeyIsPresent);
            }
            else
            {
                logger.LogCheckPoint(Const.DeleteAPIKeyIsNotPresent);
            }
            return(flag);
        }
Beispiel #18
0
        //This method will verify various option in the price chart
        public bool VariouOptionInPriceChart()
        {
            bool flag = false;

            try
            {
                flag = true;
                driver.SwitchTo().Frame(driver.FindElement(priceChartFrame));
                Thread.Sleep(2000);
                if (IntervalsToolButton().Enabled&& IndicatorToolButton().Enabled&& FullscreenModeToolButton().Enabled&& IconHideButton().Enabled&& IconFormatButton().Enabled&& IconDeleteButton().Enabled)
                {
                    logger.LogCheckPoint(string.Format(LogMessage.VerifiedVariousOptionInPriceChartPassed));
                }
                driver.SwitchTo().ParentFrame();
            }
            catch (Exception e)
            {
                logger.LogCheckPoint(string.Format(LogMessage.VerifiedVariousOptionInPriceChartFailed));
                throw e;
            }
            return(flag);
        }
Beispiel #19
0
        //This will verify the visibility Report Block Trade Window
        public void VerifyReportBlockTradeWindow()
        {
            string reportBlockTradeMsg      = string.Format(LogMessage.ReportBlockTradeMsg);
            string msgFromReportTradeWindow = ReportBlockTradeWindowTitle().Text;

            Thread.Sleep(2000);
            try
            {
                try
                {
                    Assert.Equal(msgFromReportTradeWindow, reportBlockTradeMsg);
                    logger.LogCheckPoint(string.Format(LogMessage.VerifiedReportBlockTradeWindowAppeared));
                }
                catch (Exception)
                {
                    logger.LogCheckPoint(string.Format(LogMessage.VerifiedReportBlockTradeWindowNotAppeared));
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }