Beispiel #1
0
        // This method verifies that the Single and Cyclic Report tabs are present
        // By default Cyclic Reports tab is selected
        public bool VerifyCyclicReportTabIsSelectedAndSingleReportAndCyclicReportTabPresent()
        {
            string singleReport = TestData.GetData("TC48_SingleReportValue");
            string cyclicReport = TestData.GetData("TC48_CyclicReportValue");
            bool   flag         = false;

            Thread.Sleep(1000);
            if (SingleReportText().Text.Equals(singleReport) && CyclicReportText().Text.Equals(cyclicReport))
            {
                if (CyclicReportsTabSelected().Displayed)
                {
                    flag = true;
                    logger.LogCheckPoint(String.Format(LogMessage.CyclicReportAndSingleReportPassed, singleReport, cyclicReport));
                    return(flag);
                }
                else
                {
                    logger.Error(String.Format(LogMessage.CyclicReportAndSingleReportFailed, singleReport, cyclicReport));
                    UserSetFunctions.Click(CyclicReportTab());
                }
            }
            return(flag);
        }
 public Dictionary <string, string> PlaceTrailingStopLimitSellOrder(string orderSize, string trailingAmount, string limitOffset, string pegPriceValue, string timeInForce)
 {
     try
     {
         Dictionary <string, string> placeSellOrderDict = new Dictionary <string, string>();
         UserSetFunctions.EnterText(OrderSizeEditBox(driver), orderSize);
         UserSetFunctions.EnterText(TrailingAmountEditBox(driver), trailingAmount);
         UserSetFunctions.EnterText(LimitOffset(driver), limitOffset);
         SelectPegPrice(pegPriceValue);
         SelectTimeInForce(timeInForce);
         UserSetFunctions.Click(PlaceSellOrderButton(driver));
         string placeOrderTime           = GenericUtils.GetCurrentTime();
         string placeOrderTimePlusOneMin = GenericUtils.GetCurrentTimePlusOneMinute();
         placeSellOrderDict.Add("PlaceOrderTime", placeOrderTime);
         placeSellOrderDict.Add("PlaceOrderTimePlusOneMin", placeOrderTimePlusOneMin);
         Thread.Sleep(2000);
         return(placeSellOrderDict);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 // Click on receive button of instruments.
 public void ClickOnInstrumentReceiveButton(IWebDriver driver, string instrumentname)
 {
     try
     {
         Thread.Sleep(6000);
         IReadOnlyCollection <IWebElement> arr = driver.FindElements(By.XPath("//div[@class='wallet-card-grid']/div"));
         for (int i = 1; i <= arr.Count; i++)
         {
             IWebElement div        = driver.FindElement(By.XPath("//div[@class='wallet-card-grid']/div[" + i + "]/div//span"));
             string      instrument = div.Text;
             if (instrument.Contains(instrumentname))
             {
                 IWebElement sendicon = driver.FindElement(By.XPath("//div[@class='wallet-card-grid']/div[" + i + "]/div[3]/div[2]/div[2]/span"));
                 UserSetFunctions.Click(sendicon);
                 break;
             }
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
        // This method verify the open orders name label and their child menu label name
        public bool VerifySellOrderEntryMenuAndSubMenuTab(string sell, string market, string limit, string stop)
        {
            try
            {
                var       flag        = false;
                ArrayList expectedRow = new ArrayList();
                expectedRow.Add(market);
                expectedRow.Add(limit);
                expectedRow.Add(stop);

                var listOfOrderEntryMenu = GetOrderEntryMenuList();
                UserSetFunctions.Click(SellOrderEntryButton());
                var listOfOrderyEntryRowSubMenu = GetOrderEntrySubMenuList();

                if (listOfOrderEntryMenu.Contains(sell))
                {
                    flag = true;
                    try
                    {
                        logger.LogCheckPoint(string.Format(LogMessage.SellMenuOrderEntryPassed, sell));
                    }
                    catch (Exception)
                    {
                        logger.LogCheckPoint(string.Format(LogMessage.SellMenuOrderEntryFailed, sell));
                    }
                    Assert.Equal(expectedRow, listOfOrderyEntryRowSubMenu);
                    logger.LogCheckPoint(string.Format(LogMessage.SellSubMenuOrderEntryPassed, market, limit, stop, sell));
                    return(flag);
                }
                return(flag);
            }
            catch (Exception)
            {
                logger.LogCheckPoint(string.Format(LogMessage.SellSubMenuOrderEntryFailed, market, limit, stop, sell));
                throw;
            }
        }
        public void PlaceBuyOrderWithImmediateOrCancelType(string instruments, string ordertype, string ordersize, string limitprice)
        {
            try
            {
                IWebElement instrumet = driver.FindElement(instrument);
                UserSetFunctions.SelectDropdown(instrumet, instruments);

                IWebElement ordertyp = driver.FindElement(orderType);
                UserSetFunctions.SelectDropdown(ordertyp, ordertype);

                IWebElement ordersiz = driver.FindElement(orderSize);
                UserSetFunctions.EnterText(ordersiz, ordersize);

                IWebElement limitpric = driver.FindElement(limitPrice);
                UserSetFunctions.EnterText(limitpric, limitprice);

                IWebElement placebuyorder = driver.FindElement(placeByOrder);
                UserSetFunctions.Click(placebuyorder);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Beispiel #6
0
        //This method will perform buy trade report(Will be use by TC_35)
        public void SubmitBlockTradeReportForUser(string counterPartyPrice, string producBoughtPrice, string productSoldPrice)
        {
            try
            {
                OrderEntryPage orderEntryPage = new OrderEntryPage(driver, logger);
                //ReportBlockTradeButton();
                UserSetFunctions.EnterText(CounterPartyTextField(), counterPartyPrice);
                UserSetFunctions.EnterText(ProductBoughtTextField(), producBoughtPrice);
                UserSetFunctions.EnterText(ProductSoldTextField(), productSoldPrice);
                Thread.Sleep(2000);
                SubmitReportButton();
                Thread.Sleep(2000);
                ConfirmSubmitReportButton();
                Thread.Sleep(2000);
                string expectedBuyTradeReportOrderMsg = BuyTradeReportOrderMsg().Text;
                string actualCancelMsg = UserCommonFunctions.GetTextOfMessage(driver, logger);

                string actualBuyTradeReportOrderMsg = string.Format(LogMessage.BuyTradeReportOrderMesgSuccess);
                string expectedCancelMsg            = string.Format(LogMessage.BuyTradeReportOrderMesgCanceled);
                try
                {
                    Assert.Equal(expectedBuyTradeReportOrderMsg, actualBuyTradeReportOrderMsg);
                    logger.LogCheckPoint(string.Format(LogMessage.BuyTradeReportOrderMesgSuccess));
                }
                catch (Exception)
                {
                    logger.LogCheckPoint(string.Format(LogMessage.BuyTradeReportOrderMesgCanceled));
                }
                Thread.Sleep(2000);
                UserSetFunctions.Click(CloseReportBlockTradeWindowSection());
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Beispiel #7
0
        // This method verifies affiliates program
        public bool VerifyAffiliateProgramFunctionality(IWebDriver driver, string verificationLevel)
        {
            var    flag = false;
            int    initialAffiliates;
            string registeredUser;
            string affiliateTagURL;
            int    affiliatesAfterUserRegistration;

            UserFunctions        userFunctions           = new UserFunctions(logger);
            AdminFunctions       objAdminFunctions       = new AdminFunctions(logger);
            AdminCommonFunctions objAdminCommonFunctions = new AdminCommonFunctions(logger);

            try
            {
                //  This method selects the Affiliate Program link from User Settings page
                SelectAffiliateProgram();
                // Get existing number of affilites for the logged in user
                initialAffiliates = GetnumberOfAffiliates(driver);
                logger.LogCheckPoint(String.Format(LogMessage.AffiliateProgramInitialAffiliates, initialAffiliates));
                // Copy the affiliate tag URL and navigate to the URL
                UserSetFunctions.Click(CopyAffiliateTagButton());
                affiliateTagURL = AffiliateTagDesc().Text;
                logger.LogCheckPoint(String.Format(LogMessage.AffiliateProgramURLCopied, affiliateTagURL));
                userFunctions.LogOut();
                driver.Navigate().GoToUrl(affiliateTagURL);
                // Change the server URL
                userFunctions.LogIn(logger, changeServerOnly: true);

                // Register a new user
                registeredUser = userFunctions.RegisterNewUser(driver);

                // Login as Admin and complete KYC of the registered user
                try
                {
                    objAdminFunctions.AdminLogIn(logger);
                    logger.LogCheckPoint(String.Format(LogMessage.KYCStarted, registeredUser));
                    objAdminCommonFunctions.ClickOnUsersMenuLink();
                    objAdminCommonFunctions.SelectUserFromUserList(driver, registeredUser);
                    // Edit the User Email Verified status to checked
                    objAdminCommonFunctions.EditUserEmailStatus(registeredUser);
                    // Scroll don to User Accounts section and open the user account
                    UserCommonFunctions.ScrollingDownVertical(driver);
                    objAdminCommonFunctions.OpenAccountFromUserPage();
                    // Edit the Verification Level of the user to 3
                    objAdminCommonFunctions.EditUserVerificationLevel(verificationLevel);
                    logger.LogCheckPoint(String.Format(LogMessage.KYCSuccess, registeredUser));
                    objAdminCommonFunctions.UserMenuBtn();
                    objAdminFunctions.AdminLogOut();
                }
                catch (Exception)
                {
                    logger.TakeScreenshot();
                    logger.LogCheckPoint(String.Format(LogMessage.KYCFailure, registeredUser));
                    throw;
                }

                // Login as the user and verify the number of affiliates
                userFunctions.LogIn(logger, Const.USER12);
                SelectAffiliateProgram();
                affiliatesAfterUserRegistration = GetnumberOfAffiliates(driver);
                // The number of affiliates should increase by 1 -> Return true
                if ((affiliatesAfterUserRegistration - initialAffiliates) == 1)
                {
                    flag = true;
                    logger.LogCheckPoint(String.Format(LogMessage.AffiliateProgramFinalAffiliates, affiliatesAfterUserRegistration));
                }
            }
            catch (NoSuchElementException)
            {
                logger.TakeScreenshot();
                throw;
            }
            catch (Exception)
            {
                logger.TakeScreenshot();
                throw;
            }
            return(flag);
        }
        // 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;
            }
        }
        // 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 #10
0
        //This method will verify the trade activites of Cyclic Report
        public bool VerifyCyclicReportData(string reportTypeValue, string startDate)
        {
            bool   flag = false;
            string ConfirmationCyclicReportModalValue;
            string confirmationModalStartDate;
            string cyclicReportMSg;
            string cyclicReportSummaryTextValue;
            string cyclicReportFrequencyTextValue;
            string cyclicReportCreatedDateTimeTextValue;
            string cyclicReportActionTextValue;
            string noReportMsg;
            string reportSummaryTextValue;
            string createdDateTimeTextValue;
            string downloadReportBtnTextValue;

            ConfirmationCyclicReportModalValue = TestData.GetData("TC48_CyclicReportConfirmationModal");
            UserCommonFunctions.DashBoardMenuButton(driver);
            UserCommonFunctions.NavigateToUserSetting(driver);
            Thread.Sleep(2000);
            UserSetFunctions.Click(TradeReportsLink());
            Thread.Sleep(1000);
            UserSetFunctions.Click(CyclicReportButton());
            if (VerifyCyclicReportTabIsSelectedAndSingleReportAndCyclicReportTabPresent())
            {
                if (VerifyCyclicReportFields() && VerifyCyclicReportFrequencyDropdownValues())
                {
                    Thread.Sleep(1000);
                    UserSetFunctions.Click(CyclicReportsTabSelected());
                    Thread.Sleep(1000);
                    UserSetFunctions.SelectDropdown(ReportType(), reportTypeValue);
                    if (VerifyStartDateSelectableDatesForCyclicReport())
                    {
                        Thread.Sleep(2000);
                        if (startDate == null)
                        {
                            startDate = GenericUtils.GetCurrentDatePlusOne();
                        }
                        Thread.Sleep(1000);
                        StartDate().SendKeys(startDate);
                        flag = true;
                    }


                    UserSetFunctions.Click(CreateCyclicReportButton());
                    VerifyCyclicReportModalConfirmation();

                    confirmationModalStartDate = StartDateOnConfirmationSingleReportModal().Text;
                    var strtDate = DateTime.Parse(startDate.Trim());

                    if (DateTime.Parse(confirmationModalStartDate).Equals(strtDate))
                    {
                        logger.LogCheckPoint(String.Format(LogMessage.StartDateOnCyclicReportConfirmationModalPassed, strtDate.ToString("MM/dd/yyyy")));
                    }
                    else
                    {
                        logger.Error(String.Format(LogMessage.StartDateOnCyclicReportConfirmationModalFailed, strtDate.ToString("MM/dd/yyyy")));
                    }
                    UserSetFunctions.Click(ConfirmationModalCreateReportButton());
                    cyclicReportMSg = ReportCreatedSuccessMsg().Text;
                    if (cyclicReportMSg.Equals(Const.CyclicTradeReportMsg))
                    {
                        logger.LogCheckPoint(String.Format(LogMessage.SuccessMsgPassed, ConfirmationCyclicReportModalValue));
                    }
                    else
                    {
                        logger.Error(String.Format(LogMessage.SuccessMsgFailed, ConfirmationCyclicReportModalValue));
                    }

                    cyclicReportSummaryTextValue         = CyclicReportSummaryText().Text;
                    cyclicReportFrequencyTextValue       = CyclicReportFrequencyText().Text;
                    cyclicReportCreatedDateTimeTextValue = CyclicReportCreatedDateTimeText().Text;
                    cyclicReportActionTextValue          = CyclicReportActionText().Text;

                    VerifyTopMostOfCyclicTradeReports(cyclicReportSummaryTextValue, cyclicReportFrequencyTextValue, cyclicReportCreatedDateTimeTextValue, cyclicReportActionTextValue);
                    UserSetFunctions.Click(CancelReport());

                    noReportMsg = NoReportIsAvailableText().Text;
                    if (noReportMsg.Equals(Const.noReportAvailableMsg))
                    {
                        logger.LogCheckPoint(String.Format(LogMessage.VerifyNoReportAvailablePassed, noReportMsg));
                    }
                    else
                    {
                        logger.Error(String.Format(LogMessage.VerifyNoReportAvailableFailed, noReportMsg));
                    }
                }

                //Need to work for cyclic report and wait for an hour till the report is present in Report available window section
                reportSummaryTextValue     = ReportSummaryText().Text;
                createdDateTimeTextValue   = ReportCreatedDateTimeText().Text;
                downloadReportBtnTextValue = DownloadReport().Text;
                VerifyDownloadableTradeReports(reportSummaryTextValue, createdDateTimeTextValue, downloadReportBtnTextValue);
            }
            return(flag);
        }
Beispiel #11
0
        //This method will verify the trade activites of Single Report
        public bool VerifySingleReportData(string reportTypeValue, string startDate, string endDate)
        {
            bool   flag = false;
            string ConfirmationSingleReportModalValue = TestData.GetData("TC47_SingleReportConfirmationModal");

            try
            {
                // Click on "Dashboard" menu button --> "UserSetting" menu button --> "Trade Reports" button
                UserCommonFunctions.DashBoardMenuButton(driver);
                UserCommonFunctions.NavigateToUserSetting(driver);
                Thread.Sleep(2000);
                UserSetFunctions.Click(TradeReportsLink());
                Thread.Sleep(1000);

                // Click on "Single Report" button
                UserSetFunctions.Click(SingleReportButton());

                // Verify if Single Report tab is selected bydefault and single, Cyclic tab is present
                if (VerifySingleReportTabIsSelectedAndCyclicReportAndSingleReportTabPresent())
                {
                    string confirmationModalStartDate;
                    string confirmationModalEndDate;
                    string expectedConfirmationModalEndDate;
                    string singleReportMsg;
                    string reportSummaryTextValue;
                    string createdDateTimeTextValue;
                    string downloadReportBtnTextValue;


                    //Verify below fields are present:accounts, report type and start date, end date
                    if (VerifySingleReportFields())
                    {
                        Thread.Sleep(1000);

                        UserSetFunctions.Click(SingleReportsTabSelected());
                        Thread.Sleep(1000);
                        UserSetFunctions.SelectDropdown(ReportType(), reportTypeValue);

                        // Verify Current Date - 1 and all previous dates are selectable
                        if (VerifyStartDateSelectableDatesForSingleReport())
                        {
                            Thread.Sleep(2000);
                            if (startDate == null)
                            {
                                startDate = GenericUtils.GetCurrentDateMinusOne();
                            }
                            Thread.Sleep(1000);

                            // Enter "Start date"
                            StartDate().SendKeys(startDate);
                            Thread.Sleep(1000);
                            flag = true;
                        }

                        // Click on "End date"
                        UserSetFunctions.Click(EndDate());
                        Thread.Sleep(1000);
                        if (endDate == null)
                        {
                            endDate = GenericUtils.GetCurrentDate();
                        }
                        Thread.Sleep(2000);
                        // Enter "End date"
                        EndDate().SendKeys(endDate);
                        flag = true;

                        Thread.Sleep(1000);

                        // Click on "Create Report" button
                        UserSetFunctions.Click(CreateTradeReportButton());

                        // Verify confirmation modal is displayed
                        VerifySingleReportModalConfirmation();

                        confirmationModalStartDate       = StartDateOnConfirmationSingleReportModal().Text;
                        confirmationModalEndDate         = EndDateOnConfirmationSingleReportModal().Text;
                        expectedConfirmationModalEndDate = endDate.Trim();
                        var strtDate = DateTime.Parse(startDate.Trim());
                        var endDte   = DateTime.Parse(expectedConfirmationModalEndDate);

                        // This will verify the start and end date in the confirmation window modal of single report
                        if (DateTime.Parse(confirmationModalStartDate).Equals(strtDate) && DateTime.Parse(confirmationModalEndDate).Equals(endDte))
                        {
                            logger.LogCheckPoint(String.Format(LogMessage.StartAndEndDateConfirmationModalPassed, strtDate.ToString("MM/dd/yyyy"), endDte.ToString("MM/dd/yyyy")));
                        }
                        else
                        {
                            logger.Error(String.Format(LogMessage.StartAndEndDateConfirmationModalFailed, strtDate.ToString("MM/dd/yyyy"), endDte.ToString("MM/dd/yyyy")));
                        }
                        UserSetFunctions.Click(ConfirmationModalCreateReportButton());
                        singleReportMsg = ReportCreatedSuccessMsg().Text;

                        // This will verify the success message after creating the a single rpeort
                        if (singleReportMsg.Equals(Const.SingleTradeReportMsg))
                        {
                            logger.LogCheckPoint(String.Format(LogMessage.SuccessMsgPassed, ConfirmationSingleReportModalValue));
                        }
                        else
                        {
                            logger.Error(String.Format(LogMessage.SuccessMsgFailed, ConfirmationSingleReportModalValue));
                        }

                        ClickRefreshReportsButton();
                        reportSummaryTextValue     = ReportSummaryText().Text;
                        createdDateTimeTextValue   = ReportCreatedDateTimeText().Text;
                        downloadReportBtnTextValue = DownloadReport().Text;

                        // Verify the "created time", Report summary is "report type" , on demand and from and to date.
                        // Verify the report is downloadable
                        VerifyDownloadableTradeReports(reportSummaryTextValue, createdDateTimeTextValue, downloadReportBtnTextValue);
                    }
                }
                return(flag);
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #12
0
        //This method will verify the trade activites of Single Report
        public bool VerifySingleReportData(string reportTypeValue, string startDate, string endDate)
        {
            bool   flag = false;
            string ConfirmationSingleReportModalValue = TestData.GetData("TC47_SingleReportConfirmationModal");

            UserCommonFunctions.DashBoardMenuButton(driver);
            UserCommonFunctions.NavigateToUserSetting(driver);
            Thread.Sleep(2000);
            UserSetFunctions.Click(TradeReportsLink());
            Thread.Sleep(1000);
            UserSetFunctions.Click(SingleReportButton());
            if (VerifySingleReportTabIsSelectedAndCyclicReportAndSingleReportTabPresent())
            {
                string confirmationModalStartDate;
                string confirmationModalEndDate;
                string expectedConfirmationModalEndDate;
                string singleReportMsg;
                string reportSummaryTextValue;
                string createdDateTimeTextValue;
                string downloadReportBtnTextValue;

                if (VerifySingleReportFields())
                {
                    Thread.Sleep(1000);
                    UserSetFunctions.Click(SingleReportsTabSelected());
                    Thread.Sleep(1000);
                    UserSetFunctions.SelectDropdown(ReportType(), reportTypeValue);

                    if (VerifyStartDateSelectableDatesForSingleReport())
                    {
                        Thread.Sleep(2000);
                        if (startDate == null)
                        {
                            startDate = GenericUtils.GetCurrentDateMinusOne();
                        }
                        Thread.Sleep(1000);
                        StartDate().SendKeys(startDate);
                        Thread.Sleep(1000);
                        flag = true;
                    }

                    UserSetFunctions.Click(EndDate());
                    Thread.Sleep(1000);
                    if (endDate == null)
                    {
                        endDate = GenericUtils.GetCurrentDate();
                    }
                    Thread.Sleep(2000);
                    EndDate().SendKeys(endDate);
                    flag = true;

                    Thread.Sleep(1000);
                    UserSetFunctions.Click(CreateTradeReportButton());
                    VerifySingleReportModalConfirmation();

                    confirmationModalStartDate       = StartDateOnConfirmationSingleReportModal().Text;
                    confirmationModalEndDate         = EndDateOnConfirmationSingleReportModal().Text;
                    expectedConfirmationModalEndDate = endDate.Trim();
                    var strtDate = DateTime.Parse(startDate.Trim());
                    var endDte   = DateTime.Parse(expectedConfirmationModalEndDate);

                    if (DateTime.Parse(confirmationModalStartDate).Equals(strtDate) && DateTime.Parse(confirmationModalEndDate).Equals(endDte))
                    {
                        logger.LogCheckPoint(String.Format(LogMessage.StartAndEndDateConfirmationModalPassed, strtDate.ToString("MM/dd/yyyy"), endDte.ToString("MM/dd/yyyy")));
                    }
                    else
                    {
                        logger.Error(String.Format(LogMessage.StartAndEndDateConfirmationModalFailed, strtDate.ToString("MM/dd/yyyy"), endDte.ToString("MM/dd/yyyy")));
                    }
                    UserSetFunctions.Click(ConfirmationModalCreateReportButton());

                    singleReportMsg = ReportCreatedSuccessMsg().Text;
                    if (singleReportMsg.Equals(Const.SingleTradeReportMsg))
                    {
                        logger.LogCheckPoint(String.Format(LogMessage.SuccessMsgPassed, ConfirmationSingleReportModalValue));
                    }
                    else
                    {
                        logger.Error(String.Format(LogMessage.SuccessMsgFailed, ConfirmationSingleReportModalValue));
                    }

                    ClickRefreshReportsButton();
                    reportSummaryTextValue     = ReportSummaryText().Text;
                    createdDateTimeTextValue   = ReportCreatedDateTimeText().Text;
                    downloadReportBtnTextValue = DownloadReport().Text;
                    VerifyDownloadableTradeReports(reportSummaryTextValue, createdDateTimeTextValue, downloadReportBtnTextValue);
                }
            }
            return(flag);
        }
Beispiel #13
0
 // This method selects Limit button for Sell side
 public void SelectSellLimitButton()
 {
     UserSetFunctions.Click(SellOrderEntryButton());
     UserSetFunctions.Click(LimitOrderTypeButton());
 }
Beispiel #14
0
        // This method verifies affiliates program
        public bool VerifyAffiliateProgramFunctionality(IWebDriver driver, string verificationLevel)
        {
            var    flag = false;
            int    initialAffiliates;
            string registeredUser;
            string affiliateTagURL;

            UserFunctions        userFunctions           = new UserFunctions(logger);
            AdminFunctions       objAdminFunctions       = new AdminFunctions(logger);
            AdminCommonFunctions objAdminCommonFunctions = new AdminCommonFunctions(logger);

            try
            {
                SelectAffiliateProgram();
                initialAffiliates = GetnumberOfAffiliates(driver);
                logger.LogCheckPoint(String.Format(LogMessage.AffiliateProgramInitialAffiliates, initialAffiliates));
                UserSetFunctions.Click(CopyAffiliateTagButton());
                affiliateTagURL = AffiliateTagDesc().Text;
                logger.LogCheckPoint(String.Format(LogMessage.AffiliateProgramURLCopied, affiliateTagURL));
                userFunctions.LogOut();
                driver.Navigate().GoToUrl(affiliateTagURL);
                userFunctions.LogIn(logger, changeServerOnly: true);

                // Register a new user
                registeredUser = userFunctions.RegisterNewUser(driver);

                // Login as Admin and complete KYC of the registered user
                try
                {
                    objAdminFunctions.AdminLogIn(logger);
                    logger.LogCheckPoint(String.Format(LogMessage.KYCStarted, registeredUser));
                    objAdminCommonFunctions.ClickOnUsersMenuLink();
                    objAdminCommonFunctions.SelectUserFromUserList(driver, registeredUser);
                    objAdminCommonFunctions.EditUserEmailStatus(registeredUser);
                    UserCommonFunctions.ScrollingDownVertical(driver);
                    objAdminCommonFunctions.OpenAccountFromUserPage();
                    objAdminCommonFunctions.EditUserVerificationLevel(verificationLevel);
                    logger.LogCheckPoint(String.Format(LogMessage.KYCSuccess, registeredUser));
                    objAdminCommonFunctions.UserMenuBtn();
                    objAdminFunctions.AdminLogOut();
                }
                catch (Exception e)
                {
                    logger.TakeScreenshot();
                    logger.LogCheckPoint(String.Format(LogMessage.KYCFailure, registeredUser));
                    throw e;
                }

                // Login as the user and verify the number of affiliates
                userFunctions.LogIn(logger, Const.USER12);
                SelectAffiliateProgram();
                int affiliatesAfterUserRegistration = GetnumberOfAffiliates(driver);
                if ((affiliatesAfterUserRegistration - initialAffiliates) == 1)
                {
                    flag = true;
                    logger.LogCheckPoint(String.Format(LogMessage.AffiliateProgramFinalAffiliates, affiliatesAfterUserRegistration));
                }
            }
            catch (NoSuchElementException ex)
            {
                logger.TakeScreenshot();
                throw ex;
            }
            catch (Exception e)
            {
                logger.TakeScreenshot();
                throw e;
            }
            return(flag);
        }
        //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;
            }
        }
Beispiel #16
0
        //Limit sell Order
        public Dictionary <string, string> PlaceLimitSellOrder(string instrument, string side, string sellAmount, string limitPrice, string timeinforce)
        {
            string exchangeStringValueFromSite;
            string successMsg;
            string placeOrderTime;
            string placeOrderTimePlusOneMin;

            Dictionary <string, string> limitSellOrderData = new Dictionary <string, string>();

            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);
                UserCommonFunctions.CancelAllOrders(driver);
                string askPrice = AskPrice(driver).Text;
                if (BuyOrderEntryButton().Displayed&& StopOrderTypeButton().Displayed)
                {
                    Thread.Sleep(1000);
                    UserSetFunctions.Click(OrderEntryButton());
                    UserSetFunctions.Click(SellOrderEntryButton());
                    UserSetFunctions.Click(LimitOrderTypeButton());
                    UserSetFunctions.EnterText(SellAmountTextField(), sellAmount);
                    UserSetFunctions.EnterText(LimitPriceTextBox(), limitPrice);
                    UserSetFunctions.SelectDropdown(TimeInForce(), timeinforce);
                    // Verify Market Price, Fees and Order Total
                    Dictionary <string, string> balances = new Dictionary <string, string>();
                    if (OrderTotalText().Enabled&& MarketPriceText().Enabled)
                    {
                        // Storing balances in Dictionary
                        Thread.Sleep(1000);
                        balances = UserCommonFunctions.StoreOrderEntryAmountBalances(driver);
                        Assert.True(VerifySellLimitFees(balances[Const.Fees], sellAmount, limitPrice));
                        Assert.True(VerifyLimitOrderTotal(balances[Const.OrderTotal], sellAmount, limitPrice));
                        Assert.True(VerifySellOrderNet(balances[Const.Net], balances[Const.Fees], balances[Const.OrderTotal]));
                        logger.LogCheckPoint(string.Format(LogMessage.BalancesVerifiedSuccessfully, side, balances[Const.Fees], balances[Const.OrderTotal], balances[Const.Net]));
                    }
                    else
                    {
                        logger.LogCheckPoint(string.Format(LogMessage.BalancesVerificationFailed, side));
                    }
                    Thread.Sleep(1000);
                    UserSetFunctions.Click(PlaceSellOrderButton());
                    UserCommonFunctions.ConfirmWindowOrder(askPrice, limitPrice, driver);
                    successMsg               = UserCommonFunctions.GetTextOfMessage(driver, logger);
                    placeOrderTime           = GenericUtils.GetCurrentTime();
                    placeOrderTimePlusOneMin = GenericUtils.GetCurrentTimePlusOneMinute();
                    Thread.Sleep(1000);
                    Assert.Equal(Const.OrderSuccessMsg, successMsg);
                    limitSellOrderData.Add("PlaceOrderTime", placeOrderTime);
                    limitSellOrderData.Add("PlaceOrderTimePlusOneMin", placeOrderTimePlusOneMin);
                    Thread.Sleep(2000);
                    UserCommonFunctions.ScrollingDownVertical(driver);
                    logger.LogCheckPoint(String.Format(LogMessage.LimitOrderSuccessMsg, side, sellAmount, limitPrice));
                }
            }
            return(limitSellOrderData);
        }
Beispiel #17
0
        public Dictionary <string, string> PlaceStopSellOrder(string instrument, string side, double sellAmount, double feeComponent, double stopPrice)
        {
            string exchangeStringValueFromSite;
            string fee             = (sellAmount * feeComponent).ToString();
            string sellAmountValue = sellAmount.ToString();
            string successMsg;
            string placeOrderTime;
            string placeOrderTimePlusOneMin;
            string stopPriceValue = stopPrice.ToString();

            Dictionary <string, string> stopSellOrderData = new Dictionary <string, string>();

            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);
                if (SellOrderEntryButton().Displayed&& StopOrderTypeButton().Displayed)
                {
                    UserSetFunctions.Click(OrderEntryButton());
                    UserSetFunctions.Click(SellOrderEntryButton());
                    UserSetFunctions.Click(StopOrderTypeButton());
                    UserSetFunctions.EnterText(SellAmountTextField(), sellAmount.ToString());
                    UserSetFunctions.EnterText(StopPriceTextField(), stopPrice.ToString());
                    Thread.Sleep(2000);

                    // Verify Market Price, Fees and Order Total
                    Dictionary <string, string> balances = new Dictionary <string, string>();
                    if (OrderTotalText().Enabled&& MarketPriceText().Enabled)
                    {
                        // Storing balances in Dictionary
                        Thread.Sleep(1000);
                        balances = UserCommonFunctions.StoreOrderEntryAmountBalances(driver);
                        Assert.True(VerifySellLimitFees(balances[Const.Fees], sellAmountValue, stopPriceValue));
                        Assert.True(VerifyLimitOrderTotal(balances[Const.OrderTotal], sellAmountValue, stopPriceValue));
                        Assert.True(VerifySellOrderNet(balances[Const.Net], balances[Const.Fees], balances[Const.OrderTotal]));
                        logger.LogCheckPoint(string.Format(LogMessage.BalancesVerifiedSuccessfully, side, balances[Const.Fees], balances[Const.OrderTotal], balances[Const.Net]));
                    }
                    else
                    {
                        logger.LogCheckPoint(string.Format(LogMessage.BalancesVerificationFailed, side));
                    }
                    UserSetFunctions.Click(PlaceSellOrderButton());
                    successMsg               = UserCommonFunctions.GetTextOfMessage(driver, logger);
                    placeOrderTime           = GenericUtils.GetCurrentTime();
                    placeOrderTimePlusOneMin = GenericUtils.GetCurrentTimePlusOneMinute();
                    Assert.Equal(Const.OrderSuccessMsg, successMsg);
                    logger.LogCheckPoint(String.Format(LogMessage.MarketOrderPlacedSuccessfully, side, sellAmount));
                    stopSellOrderData.Add("Instrument", instrument);
                    stopSellOrderData.Add("Side", side);
                    stopSellOrderData.Add("SellAmount", sellAmountValue);
                    stopSellOrderData.Add("StopPrice", stopPriceValue);
                    stopSellOrderData.Add("PlaceOrderTime", placeOrderTime);
                    stopSellOrderData.Add("PlaceOrderTimePlusOneMin", placeOrderTimePlusOneMin);
                    Thread.Sleep(2000);
                    UserCommonFunctions.ScrollingDownVertical(driver);
                    logger.LogCheckPoint(string.Format(LogMessage.VerifyStopSellOrderSuccess, side, sellAmountValue, stopPriceValue));
                }
                else
                {
                    logger.LogCheckPoint(LogMessage.ExchangeMenuVerificationFailed);
                }
            }
            return(stopSellOrderData);
        }
Beispiel #18
0
        public Dictionary <string, string> PlaceMarketSellOrder(string instrument, string side, double sellAmount, double feeComponent)
        {
            try
            {
                string exchangeStringValueFromSite;
                string fee             = null;
                string sellAmountValue = sellAmount.ToString();
                string successMsg;
                string placeOrderTime;
                string placeOrderTimePlusOneMin;

                Dictionary <string, string> marketSellOrderData = new Dictionary <string, string>();
                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);
                    UserCommonFunctions.CancelAllOrders(driver);
                    UserSetFunctions.Click(driver.FindElement(orderEntryButton));
                    UserSetFunctions.Click(driver.FindElement(sellOrderEntryButton));
                    UserSetFunctions.Click(driver.FindElement(marketOrderTypeButton));
                    UserSetFunctions.EnterText(SellAmountTextField(), sellAmount.ToString());
                    Thread.Sleep(2000);
                    Dictionary <string, string> balances = new Dictionary <string, string>();
                    if (OrderTotalText().Enabled&& MarketPriceText().Enabled)
                    {
                        // Storing balances in Dictionary
                        Thread.Sleep(1000);
                        balances = UserCommonFunctions.StoreOrderEntryAmountBalances(driver);
                        fee      = UserCommonFunctions.GetSplitValue(balances[Const.Fees]);
                        Assert.True(VerifySellMarketFees(balances[Const.Fees], sellAmountValue, balances[Const.MarketPrice]));
                        Assert.True(VerifyOrderTotal(balances[Const.OrderTotal], sellAmountValue, balances[Const.MarketPrice]));
                        Assert.True(VerifySellOrderNet(balances[Const.Net], balances[Const.Fees], balances[Const.OrderTotal]));
                        logger.LogCheckPoint(string.Format(LogMessage.BalancesVerifiedSuccessfully, side, balances[Const.Fees], balances[Const.OrderTotal], balances[Const.Net]));
                    }
                    else
                    {
                        logger.LogCheckPoint(string.Format(LogMessage.BalancesVerificationFailed, side));
                    }

                    UserSetFunctions.Click(PlaceSellOrderButton());
                    successMsg               = UserCommonFunctions.GetTextOfMessage(driver, logger);
                    placeOrderTime           = GenericUtils.GetCurrentTime();
                    placeOrderTimePlusOneMin = GenericUtils.GetCurrentTimePlusOneMinute();
                    Assert.Equal(Const.OrderSuccessMsg, successMsg);
                    logger.LogCheckPoint(String.Format(LogMessage.MarketOrderPlacedSuccessfully, side, sellAmount));
                    marketSellOrderData.Add("Instrument", instrument);
                    marketSellOrderData.Add("Side", side);
                    marketSellOrderData.Add("SellAmount", sellAmountValue);
                    marketSellOrderData.Add("Fee", fee);
                    marketSellOrderData.Add("PlaceOrderTime", placeOrderTime);
                    marketSellOrderData.Add("PlaceOrderTimePlusOneMin", placeOrderTimePlusOneMin);
                    Thread.Sleep(2000);
                }
                else
                {
                    logger.LogCheckPoint(LogMessage.ExchangeMenuVerificationFailed);
                }
                UserCommonFunctions.ScrollingDownVertical(driver);
                Thread.Sleep(3000);
                return(marketSellOrderData);
            }
            catch (Exception e)
            {
                logger.Error(Const.MarketSellOrderFailureMsg);
                throw e;
            }
        }
Beispiel #19
0
        //This method will perform a simple Block Buy trade operation(Used for TC_34)
        public void SubmitBlockTradeReportWithoutLockedInCheckBox(string instrument, string counterPartyValue, string producBoughtPrice, string productSoldPrice, string counterPartyPrice, string buyTab, string status)
        {
            placeBlockTradeDateTimeOfBlockTrade           = TestData.GetData("TC34_PlaceBlockTradeTime");
            placeBlockTradeDateTimePlusOneMinOfBlockTrade = TestData.GetData("TC34_PlaceBlockTradeTimePlusOneMin");
            typeValue   = TestData.GetData("TC34_Type");
            statusValue = TestData.GetData("TC34_Status");
            cancelValue = TestData.GetData("TC35_Cancel");
            try
            {
                OrderEntryPage orderEntryPage = new OrderEntryPage(driver, logger);
                UserSetFunctions.EnterText(CounterPartyTextField(), counterPartyPrice);
                UserSetFunctions.EnterText(ProductBoughtTextField(), producBoughtPrice);
                UserSetFunctions.EnterText(ProductSoldTextField(), productSoldPrice);
                Thread.Sleep(2000);
                string productBought       = ProductBoughtTextField().GetAttribute(string.Format(LogMessage.ProductBoughtTextFieldAttributeValue));
                double actualProductBought = double.Parse(productBought);

                string productSold       = ProductSoldTextField().GetAttribute(string.Format(LogMessage.ProductSoldTextFieldAttributeValue));
                double actualProductSold = double.Parse(productSold);

                string orderTotalAmountStringValue = OrderTotalAmount().Text;
                string orderTotalAmountdigits      = orderTotalAmountStringValue.Split(" ")[1];
                double doubleOrderTotalPrice       = Double.Parse(orderTotalAmountdigits);

                string receivedAmountStringValue = ReceivedAmount().Text;
                string receivedAmountdigits      = receivedAmountStringValue.Split(" ")[1];
                double doubleReceivedPrice       = Double.Parse(receivedAmountdigits);

                string feeAmountStringValue = FeeAmount().Text;
                string feeAmountdigits      = feeAmountStringValue.Split(" ")[1];
                double doubleFeePrice       = Double.Parse(feeAmountdigits);

                double receivedBTCAmount = actualProductBought - doubleFeePrice;

                //This will verify if product Sold is equal to Order Total amount.
                try
                {
                    Assert.Equal(actualProductSold, doubleOrderTotalPrice);
                    logger.LogCheckPoint(string.Format(LogMessage.ProductSoldEqualsToOrderTotal, actualProductSold, doubleOrderTotalPrice));
                }
                catch (Exception)
                {
                    logger.LogCheckPoint(string.Format(LogMessage.ProductSoldNotEqualsToOrderTotal, actualProductBought, doubleOrderTotalPrice));
                }

                //This will verify if Receiver amount is deducted after fee.
                try
                {
                    Assert.Equal(receivedBTCAmount, doubleOrderTotalPrice);
                    logger.LogCheckPoint(string.Format(LogMessage.VerifiedReceivedBTCAmountAfterFeeDeductingPassed, receivedBTCAmount, actualProductBought));
                }
                catch (Exception)
                {
                    logger.LogCheckPoint(string.Format(LogMessage.VerifiedReceivedBTCAmountAfterFeeDeductingFailed, receivedBTCAmount, doubleFeePrice));
                }
                Thread.Sleep(2000);
                SubmitReportButton();
                Thread.Sleep(2000);
                VerifyFinalAmountAndFinalValue();
                string feeValueText    = LabelConfirmBlockTradeFeeValue().Text;
                var    blockTradePrice = GetBlockTradePrice(producBoughtPrice, productSoldPrice);
                //string dateText;
                //string expectedBlockTradeDate;
                //Dictionary<string, string> placeBlockTradeReportOrder = new Dictionary<string, string>();
                //dateText = LabelConfirmBlockTradeDate().Text;
                //expectedBlockTradeDate = dateText;
                //string actualBlockTradeDate = GenericUtils.GetCurrentTime();
                //string actualBlockTradeDatePlusOneMin = GenericUtils.GetCurrentTimePlusOneMinute();
                //placeBlockTradeReportOrder.Add(placeBlockTradeDateTimeOfBlockTrade, actualBlockTradeDate);
                //placeBlockTradeReportOrder.Add(placeBlockTradeDateTimePlusOneMinOfBlockTrade, actualBlockTradeDatePlusOneMin);
                Thread.Sleep(2000);
                ConfirmSubmitReportButton();
                Thread.Sleep(2000);
                string expectedBuyTradeReportOrderMsg = BuyTradeReportOrderMsg().Text;
                string actualCancelMsg = UserCommonFunctions.GetTextOfMessage(driver, logger);
                string actualBuyTradeReportOrderMsg = String.Format(LogMessage.BuyTradeReportOrderMesgSuccess);
                string expectedCancelMsg            = String.Format(LogMessage.BuyTradeReportOrderMesgCanceled);
                try
                {
                    Assert.Equal(expectedBuyTradeReportOrderMsg, actualBuyTradeReportOrderMsg);
                    logger.LogCheckPoint(string.Format(LogMessage.BuyTradeReportOrderMesgSuccess));
                }
                catch (Exception)
                {
                    logger.LogCheckPoint(string.Format(LogMessage.BuyTradeReportOrderMesgCanceled));
                }

                Thread.Sleep(2000);
                UserSetFunctions.Click(CloseReportBlockTradeWindowSection());
                try
                {
                    VerifyOrdersTab objVerifyOrdersTab = new VerifyOrdersTab(driver, logger);
                    //Need to create a logic to cehck if block trade oorder comings in open trade order
                    objVerifyOrdersTab.VerifyBlockTradeReportsInOpenOrderTab(instrument, buyTab, typeValue, producBoughtPrice, blockTradePrice, statusValue, cancelValue);
                    logger.LogCheckPoint(String.Format(LogMessage.BuyBlockTradeReportInOpenTabWithWorkingStatusPassed, buyTab));
                }
                catch (Exception)
                {
                    logger.LogCheckPoint(String.Format(LogMessage.BuyBlockTradeReportInOpenTabWithWorkingStatusFailed, buyTab));
                }
            }

            catch (Exception e)
            {
                throw e;
            }
        }
Beispiel #20
0
        //This method will verify the trade activites of Cyclic Report
        public bool VerifyCyclicReportData(string reportTypeValue, string startDate)
        {
            bool   flag = false;
            string ConfirmationCyclicReportModalValue;
            string confirmationModalStartDate;
            string cyclicReportMSg;
            string cyclicReportSummaryTextValue;
            string cyclicReportFrequencyTextValue;
            string cyclicReportCreatedDateTimeTextValue;
            string cyclicReportActionTextValue;
            string noReportMsg;
            string reportSummaryTextValue;
            string createdDateTimeTextValue;
            string downloadReportBtnTextValue;

            ConfirmationCyclicReportModalValue = TestData.GetData("TC48_CyclicReportConfirmationModal");

            try
            {
                // Click on "Dashboard" menu button --> "UserSetting" menu button --> "Trade Reports" button
                UserCommonFunctions.DashBoardMenuButton(driver);
                UserCommonFunctions.NavigateToUserSetting(driver);
                Thread.Sleep(2000);
                UserSetFunctions.Click(TradeReportsLink());
                Thread.Sleep(1000);

                // Click on "Cyclical Report" button
                UserSetFunctions.Click(CyclicReportButton());

                // Verify if Cyclic Report tab is selected bydefault and single, Cyclic tab is present
                if (VerifyCyclicReportTabIsSelectedAndSingleReportAndCyclicReportTabPresent())
                {
                    //Verify below fields are present:accounts, report type and start date, frequency
                    // Verify Frequency has dropdown values hourly, daily, weekly, monthly and annual
                    if (VerifyCyclicReportFields() && VerifyCyclicReportFrequencyDropdownValues())
                    {
                        Thread.Sleep(1000);
                        UserSetFunctions.Click(CyclicReportsTabSelected());
                        Thread.Sleep(1000);
                        UserSetFunctions.SelectDropdown(ReportType(), reportTypeValue);
                        if (VerifyStartDateSelectableDatesForCyclicReport(startDate))
                        {
                            Thread.Sleep(2000);
                            if (startDate == null)
                            {
                                startDate = GenericUtils.GetCurrentDatePlusOne();
                            }
                            flag = true;
                        }

                        // Click on "Create" button
                        UserSetFunctions.Click(CreateCyclicReportButton());

                        // Verify the details in cyclic report confirmation modal window
                        VerifyCyclicReportModalConfirmation();

                        confirmationModalStartDate = StartDateOnConfirmationSingleReportModal().Text;
                        var strtDate = DateTime.Parse(startDate.Trim());

                        // This will verify the start date in the confirmation window modal of cyclic report
                        if (DateTime.Parse(confirmationModalStartDate).Equals(strtDate))
                        {
                            logger.LogCheckPoint(String.Format(LogMessage.StartDateOnCyclicReportConfirmationModalPassed, strtDate.ToString("MM/dd/yyyy")));
                        }
                        else
                        {
                            logger.Error(String.Format(LogMessage.StartDateOnCyclicReportConfirmationModalFailed, strtDate.ToString("MM/dd/yyyy")));
                        }

                        // Click on "Schedule Report" button
                        UserSetFunctions.Click(ConfirmationModalCreateReportButton());
                        cyclicReportMSg = ReportCreatedSuccessMsg().Text;

                        // Verify the success message
                        if (cyclicReportMSg.Equals(Const.CyclicTradeReportMsg))
                        {
                            logger.LogCheckPoint(String.Format(LogMessage.SuccessMsgPassed, ConfirmationCyclicReportModalValue));
                        }
                        else
                        {
                            logger.Error(String.Format(LogMessage.SuccessMsgFailed, ConfirmationCyclicReportModalValue));
                        }

                        cyclicReportSummaryTextValue         = CyclicReportSummaryText().Text;
                        cyclicReportFrequencyTextValue       = CyclicReportFrequencyText().Text;
                        cyclicReportCreatedDateTimeTextValue = CyclicReportCreatedDateTimeText().Text;
                        cyclicReportActionTextValue          = CyclicReportActionText().Text;

                        // Verify Report is available under "Cyclic reports" section, Report Summary is "Report Type"
                        // Verify the frequency and created date
                        // Verify delete button is available
                        VerifyTopMostOfCyclicTradeReports(cyclicReportSummaryTextValue, cyclicReportFrequencyTextValue, cyclicReportCreatedDateTimeTextValue, cyclicReportActionTextValue);

                        // Click on "Cancel Report" button
                        UserSetFunctions.Click(CancelReport());

                        noReportMsg = NoReportIsAvailableText().Text;

                        // Verify that the report is removed from "Cyclic reports" section
                        if (noReportMsg.Equals(Const.noReportAvailableMsg))
                        {
                            logger.LogCheckPoint(String.Format(LogMessage.VerifyNoReportAvailablePassed, noReportMsg));
                        }
                        else
                        {
                            logger.Error(String.Format(LogMessage.VerifyNoReportAvailableFailed, noReportMsg));
                        }
                    }

                    //Need to work for cyclic report and wait for an hour till the report is present in Report available window section
                    reportSummaryTextValue     = ReportSummaryText().Text;
                    createdDateTimeTextValue   = ReportCreatedDateTimeText().Text;
                    downloadReportBtnTextValue = DownloadReport().Text;
                    VerifyDownloadableTradeReports(reportSummaryTextValue, createdDateTimeTextValue, downloadReportBtnTextValue);
                    return(true);
                }
                return(flag);
            }
            catch (Exception)
            {
                throw;
            }
        }
        public bool VerifyingPersistantAmount(string amountEntered)
        {
            bool flag = false;

            CommonFunctionality.SelectDashBoardButton(driver);
            CommonFunctionality.NavigateToExchange(driver);
            Thread.Sleep(3000);
            string exchangeStringValueFromSite = driver.FindElement(exchangeMenuText).Text;

            Thread.Sleep(3000);

            if (exchangeStringValueFromSite.Equals(exchangeMenuString))
            {
                Assert.True(true, "Verification for exchangeMenu value has been passed.");
                output.WriteLine("Verification for exchangeMenu value has been passed.");
                flag = true;
            }
            else
            {
                Assert.False(false, "Verification for exchangeMenu value has been failed.");
                output.WriteLine("Verification for exchangeMenu value has been failed.");
                flag = false;
            }

            UserSetFunctions.Click(driver.FindElement(marketOrderTypeButton));
            UserSetFunctions.EnterText(driver.FindElement(buyAmountTextField), amountEntered);
            UserSetFunctions.Click(driver.FindElement(limitOrderTypeButton));
            UserSetFunctions.Click(driver.FindElement(stopOrderTypeButton));
            UserSetFunctions.Click(driver.FindElement(marketOrderTypeButton));

            Thread.Sleep(2000);
            string amountPersisted = driver.FindElement(buyAmountTextField).GetAttribute("value");

            output.WriteLine("Amount Persisted - > " + amountPersisted);
            if (amountEntered.Equals(amountPersisted))
            {
                Assert.True(true, "Test case has been passed for Buy Market Order Type.");
                output.WriteLine("Test case has been passed for Buy Market Order Type.");
                flag = true;
            }
            else
            {
                Assert.False(false, "Test case has been failed for Buy Market Order Type.");
                output.WriteLine("Test case has been failed for Buy Market Order Type.");
                flag = false;
            }

            UserSetFunctions.Click(driver.FindElement(sellOrderEntryButton));
            UserSetFunctions.Click(driver.FindElement(marketOrderTypeButton));
            UserSetFunctions.Click(driver.FindElement(sellAmountTextField));
            UserSetFunctions.Click(driver.FindElement(limitOrderTypeButton));
            UserSetFunctions.Click(driver.FindElement(stopOrderTypeButton));
            Thread.Sleep(2000);

            output.WriteLine("Amount Persisted - > " + amountPersisted);
            if (amountEntered.Equals(amountPersisted))
            {
                Assert.True(true, "Test case has been passed for Sell Market Order Type.");
                output.WriteLine("Test case has been passed for Sell Market Order Type.");
                flag = true;
            }
            else
            {
                Assert.False(false, "Test case has been failed for Sell Market Order Type.");
                output.WriteLine("Test case has been failed for Sell Market Order Type.");
                flag = false;
            }
            CommonFunctionality.LogOut(driver);
            Thread.Sleep(4000);
            driver.Close();
            return(flag);
        }
Beispiel #22
0
 public void ClickPlaceSellOrder()
 {
     UserSetFunctions.Click(PlaceSellOrderButton());
 }
 //This method Logs out the User
 public void Logout()
 {
     Thread.Sleep(2000);
     UserSetFunctions.Click(driver.FindElement(loggedInUserName));
     UserSetFunctions.Click(driver.FindElement(signOutButton));
 }
Beispiel #24
0
 //This method will click on "Report Block Trade" button
 public void ReportBlockTradeButton()
 {
     UserSetFunctions.Click(ReportBlockTradeBtn());
 }