// 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; } }
// 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; } }
//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; } }
//This method will verify the Block Trade Trade Report of Other Party public void VerifyOtherPartyBlockTradeReportTab(string instrument, string sellTab, string counterPartyValue, string productBoughtPrice, string productSoldPrice, string status, Dictionary <string, string> otherPartyBlockTradeData) { OrderEntryPage orderEntryPage = new OrderEntryPage(driver, logger); string lastPrice = orderEntryPage.GetLastPrice(); var blockTradePrice = GetBlockTradePrice(productBoughtPrice, productSoldPrice); double feeValue = (Double.Parse(productBoughtPrice) * Double.Parse(lastPrice)) / 25; string feeValueText = GenericUtils.ConvertToDoubleFormat(feeValue); try { VerifyOrdersTab objVerifyOrdersTab = new VerifyOrdersTab(driver, logger); objVerifyOrdersTab.VerifyTradeReportsTab(instrument, sellTab, productBoughtPrice, blockTradePrice, feeValueText, otherPartyBlockTradeData["PlaceBlockTradeTime"], otherPartyBlockTradeData["PlaceBlockTradeTimePlusOneMin"], status); logger.LogCheckPoint(String.Format(LogMessage.SellBlockTradeReportTestPassed, sellTab)); } catch (Exception) { logger.LogCheckPoint(String.Format(LogMessage.SellBlockTradeReportTestFailed, sellTab)); } }