コード例 #1
0
        // This method will verify the order placed in Filled orders tab through Order Entry
        public bool VerifyFilledOrdersTab(string instrument, string side, double size, string fee, string placeOrderTime, string placeOrderTimePlusOneMin)
        {
            string lastPrice;
            double doubleLastPrice;
            string expectedRow_1;
            string currencyText;
            string totalAmountCalculated;
            string buyAmountValue;
            double feeValueInDouble;
            string feeValue;
            string expectedRow_2;

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

                lastPrice             = orderEntryPage.GetLastPrice();
                doubleLastPrice       = Convert.ToDouble(lastPrice);
                totalAmountCalculated = GenericUtils.FilledOrdersTotalAmount(size, doubleLastPrice);
                Thread.Sleep(2000);
                UserCommonFunctions.FilledOrderTab(driver);
                expectedRow_1 = instrument + " || " + side + " || " + buyAmountValue + " || " + lastPrice + " || " + totalAmountCalculated + " || " + feeValue + " " + currencyText;
                expectedRow_2 = instrument + " || " + side + " || " + buyAmountValue + " || " + lastPrice + " || " + totalAmountCalculated + " || " + feeValue + " " + currencyText;
                var filledOrdersList = GetListOfFilledOrders();
                if (filledOrdersList.Contains(expectedRow_1) || filledOrdersList.Contains(expectedRow_2))
                {
                    flag = true;
                }
                if (flag)
                {
                    logger.LogCheckPoint(String.Format(LogMessage.OrderVerifiedInFilledOrdersTab, side));
                }
                else
                {
                    logger.LogCheckPoint(String.Format(LogMessage.OrderNotFoundInFilledOrdersTab, side));
                }
                return(flag);
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #2
0
        // This method will verify the order placed in Filled orders tab through Order Entry
        public bool VerifyFilledOrdersTabForBuyAndSell(string instrument, string side, double size, string fee, string placeOrderTime, string placeOrderTimePlusOneMin)
        {
            var    flag = false;
            string currencyText;
            string buyAmountValue;
            string lastPrice;
            double doubleLastPrice;
            string totalAmountCalculated;
            string expectedRow_1;

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

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

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

                // This will verify the expected details with actual in filled orders tab
                if (flag)
                {
                    logger.LogCheckPoint(String.Format(LogMessage.OrderPresentInFilledOrderTabPassed, side));
                }
                else
                {
                    logger.LogCheckPoint(String.Format(LogMessage.OrderPresentInFilledOrderTabFailed, side));
                }
                return(flag);
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #3
0
        //This method will verify the order placed in Open orders tab through Order Entry
        public bool VerifyOpenOrdersTab(string instrument, string side, double sizeAmount, double stopPrice)
        {
            try {
                var    flag = false;
                string marketStopOrderTime = null;

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

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

                OrderEntryPage boe = new OrderEntryPage(driver, output);

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

                UserCommonFunctions.OpenOrderTab(driver);

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

                if (GetListOfFilledOrders().Contains(expectedRow))
                {
                    logger.Info(side + "Order Successfully verifed in Open orders tab");
                    flag = true;
                }
                return(flag);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
コード例 #4
0
        public bool BuyAndVerifyFilledOrdersTab(string instrument, string side, double size)
        {
            var flag = false;

            driver.Navigate().GoToUrl("https://apexwebqa.azurewebsites.net/exchange");
            driver.Manage().Window.Maximize();
            driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5);

            UserFunctionality objUserFunctionality = new UserFunctionality(output);

            objUserFunctionality.LogIn();

            UserHomePage selectExchange = new UserHomePage(driver, output);

            selectExchange.SelectInstrumentFromExchange(instrument);

            GenericUtils gen            = new GenericUtils(output);
            string       buyAmountValue = gen.ConvertToDecimal(size);

            BuyOrderEntry boe = new BuyOrderEntry(driver, output);
            string        buyMarketOrderTime    = boe.PlaceMaketBuyOrder(0.07);
            string        lastPrice             = boe.GetLastPrice();
            double        doubleLastPrice       = Convert.ToDouble(lastPrice);
            string        totalAmountCalculated = gen.FilledOrdersTotalAmount(size, doubleLastPrice);

            driver.FindElement(selectFilledOrdersTab).Click();

            string expectedRow = instrument + " || " + side + " || " + size + " || " + lastPrice + " || " + totalAmountCalculated + " || " + buyMarketOrderTime;

            output.WriteLine("expectedRow********* " + expectedRow);

            if (GetListOfFilledOrders().Contains(expectedRow))
            {
                output.WriteLine("Matched Expected -> " + expectedRow + " Actual -> ");
                flag = true;
            }
            return(flag);
        }