[Fact] //29 public void VerifyIOCAdvanceSellOrderMoreThanBidPrice() { try { UserFunctions userFuntionality = new UserFunctions(output); userFuntionality.LogIn(); UserCommonFunctions.DashBoardMenuButton(driver); UserCommonFunctions.SelectAnExchange(driver); UserCommonFunctions.AdvanceOrder(driver); AdvancedOrderPage advanceorder = new AdvancedOrderPage(output); advanceorder.SelectBuyOrSellTab("Sell"); advanceorder.SelectInstrumentsAndOrderType("BTCUSD", "Immediate or Cancel"); string bidPrice = advanceorder.GetAskOrBidPrice(); string increaseBidPrice = GenericUtils.IncreseAmount(bidPrice);; advanceorder.PlaceSellOrderWithImmediateOrCancelType("0.5", increaseBidPrice); string successMsg = UserCommonFunctions.GetTextOfSuccessfulMessage(driver, logger); Assert.Equal("Your order has been successfully added", successMsg); logger.Info("Verify IOC Advance Sell Order More Than BidPrice Test passed successfully."); } catch (Exception e) { GenericUtils.GetScreenshot(driver, "VerifyIOCAdvanceSellOrderMoreThanBidPrice"); logger.Error("Verify IOC Advance Sell Order More Than BidPrice Test Failed" + e); throw e; } finally { UserFunctions userFuntionality = new UserFunctions(output); UserCommonFunctions.CloseAdvancedOrderSection(driver, logger); userFuntionality.LogOut(); } }
//This method will verify the order placed in Trade Reports tab through Report Block Trade public bool VerifyTradeReportsTab(string instrument, string side, string size, string price, string fee, string placeOrderTime, string placeOrderTimePlusOneMin, string status) { try { Thread.Sleep(2000); var flag = false; string orderSize = GenericUtils.ConvertToDoubleFormat(Double.Parse(size)); string priceValue = GenericUtils.ConvertToDoubleFormat(Double.Parse(price)); string feeValue = GenericUtils.ConvertToDoubleFormat(Double.Parse(fee)); Thread.Sleep(2000); UserCommonFunctions.TradeTab(driver); string expectedRow_1 = instrument + " || " + side + " || " + orderSize + " || " + priceValue + " || " + feeValue + " || " + placeOrderTime + " || " + status; string expectedRow_2 = instrument + " || " + side + " || " + orderSize + " || " + priceValue + " || " + feeValue + " || " + placeOrderTimePlusOneMin + " || " + status; var listOfInactiveOrders = GetListOfTradeReports(); if (listOfInactiveOrders.Contains(expectedRow_1) || listOfInactiveOrders.Contains(expectedRow_2)) { flag = true; } if (flag) { logger.LogCheckPoint(String.Format(LogMessage.OrderVerifiedInTradeReportsTab, side)); } else { logger.LogCheckPoint(String.Format(LogMessage.OrderNotFoundInTradeReportsTab, side)); } return(flag); } catch (Exception e) { throw e; } }
[Fact] //26 public void VerifyIOCAdvanceBuyOrderLimitAskPrice() { try { UserFunctions userFuntionality = new UserFunctions(output); userFuntionality.LogIn(); Thread.Sleep(3000); UserCommonFunctions.DashBoardMenuButton(driver); UserCommonFunctions.SelectInstrumentFromExchange("BTCUSD", driver); string askPrice = UserCommonFunctions.GetAskPriceFromOrderBook(driver); UserCommonFunctions.AdvanceOrder(driver); AdvancedOrderPage advanceorder = new AdvancedOrderPage(output); advanceorder.SelectBuyOrSellTab("Buy"); advanceorder.SelectInstrumentsAndOrderType("BTCUSD", "Immediate or Cancel"); string reducedAskPrice = GenericUtils.ReducedAmount(askPrice); advanceorder.PlaceBuyOrderWithImmediateOrCancelType("0.5", reducedAskPrice); string successMsg = UserCommonFunctions.GetTextOfSuccessfulMessage(driver, logger); Assert.Equal("Your order has been successfully added", successMsg); logger.Info("Verify IOC Advance Buy Order Test limit ask price passed successfully."); } catch (Exception e) { GenericUtils.GetScreenshot(driver, "VerifyIOCAdvanceBuyOrderLimitAskPrice"); logger.Error("Verify IOC Advance Buy Order Test Failed" + e); throw e; } finally { UserFunctions userFunctionality = new UserFunctions(output); UserCommonFunctions.CloseAdvancedOrderSection(driver, logger); userFunctionality.LogOut(); } }
// This method selects the Affiliate Program link from User Settings page public void SelectAffiliateProgram() { UserCommonFunctions.DashBoardMenuButton(driver); UserCommonFunctions.NavigateToUserSetting(driver); Thread.Sleep(2000); UserSetFunctions.Click(AffiliateProgramLink()); }
public Dictionary <string, string> PlaceSellOrderWithReserveOrderType(string orderSize, string limitPrice, string displayQuantity) { try { string placeOrderTime; string placeOrderTimePlusOneMin; string successMsg; Dictionary <string, string> reserveSellOrderDict = new Dictionary <string, string>(); UserSetFunctions.VerifyWebElement(OrderSizeEditBox(driver)); UserSetFunctions.EnterText(OrderSizeEditBox(driver), orderSize); UserSetFunctions.VerifyWebElement(LimitPriceEditBox(driver)); UserSetFunctions.EnterText(LimitPriceEditBox(driver), limitPrice); UserSetFunctions.VerifyWebElement(DisplayQuntityEditBox(driver)); UserSetFunctions.EnterText(DisplayQuntityEditBox(driver), displayQuantity); UserSetFunctions.VerifyWebElement(PlaceSellOrderButton(driver)); UserSetFunctions.Click(PlaceSellOrderButton(driver)); successMsg = UserCommonFunctions.GetTextOfMessage(driver, logger); placeOrderTime = GenericUtils.GetCurrentTime(); placeOrderTimePlusOneMin = GenericUtils.GetCurrentTimePlusOneMinute(); Assert.Equal(Const.OrderSuccessMsg, successMsg); reserveSellOrderDict.Add("PlaceOrderTime", placeOrderTime); reserveSellOrderDict.Add("PlaceOrderTimePlusOneMin", placeOrderTimePlusOneMin); Thread.Sleep(2000); return(reserveSellOrderDict); } catch (Exception e) { throw e; } }
//This method will verify the order placed in Trade Reports tab through Report Block Trade public bool VerifyBlockTradeReportsInOpenOrderTab(string instrument, string side, string type, string size, string price, string statusWorking, string cancel) { try { Thread.Sleep(2000); var flag = false; string orderSize = GenericUtils.ConvertToDoubleFormat(Double.Parse(size)); string priceValue = GenericUtils.ConvertToDoubleFormat(Double.Parse(price)); //string feeValue = GenericUtils.ConvertToDoubleFormat(Double.Parse(fee)); UserCommonFunctions.OpenOrderTab(driver); string expectedRow = instrument + " || " + side + " || " + type + " || " + orderSize + " || " + price + " || " + statusWorking + " || " + cancel; var listOfInactiveOrders = GetListOfOpenOrdersForTradeReports(); if (listOfInactiveOrders.Contains(expectedRow)) { flag = true; } if (flag) { logger.LogCheckPoint(String.Format(LogMessage.OrderVerifiedInOpenOrdersTabPassed, side)); } else { logger.LogCheckPoint(String.Format(LogMessage.OrderVerifiedInOpenOrdersTabFailed, side)); } return(flag); } catch (Exception e) { throw e; } }
public void VerifyMarketOrderTypeAdvanceSellOrder() { try { UserFunctions userfuntionality = new UserFunctions(output); userfuntionality.LogIn(logger); Thread.Sleep(2000); AdvanceSellOrderPage objAdvanceSellOrderPage = new AdvanceSellOrderPage(driver, output); objAdvanceSellOrderPage.VerifyAdvanceSellOrder(selectInstrument, driver, enterOrderSize); Thread.Sleep(2000); string successMsg = UserCommonFunctions.GetTextOfSuccessfulMessage(driver, logger); logger.Info("Verify Market Order type Advance Sell Order passed successfully."); } catch (Exception e) { // add snapshot, logger then throw error logger.Error("Advance Sell Order Test Failed" + e); throw e; } finally { UserFunctions userFunctionality = new UserFunctions(output); UserCommonFunctions.CloseAdvancedOrderSection(driver, logger); userFunctionality.LogOut(); } }
public bool VerifySellLimitFees(string feeValue, string sellAmount, string limitPrice) { string feeCalculated; string feeFromUI; string feeInDouble; string feeComponent; string feeToCompare; string feeExpected; feeComponent = TestData.GetData("FeeComponent"); feeCalculated = GenericUtils.SellFeeAmount(sellAmount, limitPrice, feeComponent); feeInDouble = GenericUtils.ConvertToDoubleFormat(Double.Parse(feeCalculated)); feeExpected = GenericUtils.RemoveCommaFromString(feeInDouble); feeFromUI = UserCommonFunctions.GetSplitValue(feeValue); feeToCompare = GenericUtils.RemoveCommaFromString(feeFromUI); if (feeExpected.Equals(feeToCompare)) { return(true); } else { logger.LogCheckPoint(LogMessage.FeesVerificationFailed); return(false); } }
public bool VerifyNet(string netValue, string amountValue) { string feeCalculated; string netFromUI; string feeInDouble; string feeComponent; string netDifference; string netComponent; string feeExpected; feeComponent = TestData.GetData("FeeComponent"); feeCalculated = GenericUtils.FeeAmount(amountValue, feeComponent); feeInDouble = GenericUtils.ConvertToDoubleFormat(Double.Parse(feeCalculated)); feeExpected = GenericUtils.RemoveCommaFromString(feeInDouble); netFromUI = UserCommonFunctions.GetSplitValue(netValue); netComponent = GenericUtils.RemoveCommaFromString(netFromUI); netDifference = GenericUtils.GetDifferenceFromStringAfterSubstraction(amountValue, feeExpected); if (netDifference.Equals(netComponent)) { return(true); } else { logger.LogCheckPoint(LogMessage.NetVerificationFailed); return(false); } }
public bool VerifyOrderTotal(string orderTotalValue, string buyAmountValue, string marketPriceValue) { double orderTotalCalculated; string orderTotalFromUI; string orderTotalInDouble; string feeComponent; string marketPriceFromUI; string orderTotalToCompare; string orderTotalExpected; feeComponent = TestData.GetData("OrderTotalFeeComponent"); marketPriceFromUI = UserCommonFunctions.GetSplitValue(marketPriceValue); orderTotalFromUI = UserCommonFunctions.GetSplitValue(orderTotalValue); orderTotalCalculated = Double.Parse(marketPriceFromUI) * Double.Parse(buyAmountValue) * Double.Parse(feeComponent); orderTotalInDouble = GenericUtils.ConvertToDoubleFormat(orderTotalCalculated); orderTotalExpected = GenericUtils.RemoveCommaFromString(orderTotalInDouble); orderTotalToCompare = GenericUtils.RemoveCommaFromString(orderTotalFromUI); if (orderTotalExpected.Equals(orderTotalToCompare)) { return(true); } else { logger.LogCheckPoint(LogMessage.OrderTotalVerificationFailed); return(false); } }
//This method will verify the order placed in Open orders tab through Order Entry public bool VerifyOpenOrdersTab(string instrument, string side, string type, double size, string price, string placeOrderTime, string placeOrderTimePlusOneMin) { try { var flag = false; string orderSize = GenericUtils.ConvertToDoubleFormat(size); string priceValue = GenericUtils.ConvertToDoubleFormat(Double.Parse(price)); UserCommonFunctions.OpenOrderTab(driver); string expectedRow_1 = instrument + " || " + side + " || " + type + " || " + orderSize + " || " + priceValue; string expectedRow_2 = instrument + " || " + side + " || " + type + " || " + orderSize + " || " + priceValue; var listOfFilledOrders = GetListOfOpenOrders(); if (listOfFilledOrders.Contains(expectedRow_1) || listOfFilledOrders.Contains(expectedRow_2)) { logger.LogCheckPoint(string.Format(LogMessage.OpenOrdersVerifiedSuccessfully, side)); flag = true; } return(flag); } catch (Exception e) { throw e; } }
[Fact] //31 public void VerifyPlaceSellOrderWithReserveOrderType() { try { UserFunctions userFunctionality = new UserFunctions(output); userFunctionality.LogIn(); UserCommonFunctions.DashBoardMenuButton(driver); UserCommonFunctions.SelectAnExchange(driver); UserCommonFunctions.AdvanceOrder(driver); AdvancedOrderPage advanceorder = new AdvancedOrderPage(output); advanceorder.SelectBuyOrSellTab("Sell"); advanceorder.SelectInstrumentsAndOrderType("BTCUSD", "Reserve Order"); advanceorder.PlaceSellOrderWithReserveOrderType("2", "532", "1"); string successmsg = UserCommonFunctions.GetTextOfSuccessfulMessage(driver, logger); Assert.Equal("Your order has been successfully added", successmsg); logger.Info("Verify Place Sell Order With Reserve Order Type Test passed successfully."); } catch (Exception e) { GenericUtils.GetScreenshot(driver, "VerifyPlaceSellOrderWithReserveOrderType"); logger.Error("Verify Place Sell Order With Reserve Order Type Test Failed" + e); throw e; } finally { UserFunctions userFunctionality = new UserFunctions(output); UserCommonFunctions.CloseAdvancedOrderSection(driver, logger); userFunctionality.LogOut(); } }
public void TC3_VerifyBuyMarketOrder() { try { instrument = TestData.GetData("Instrument"); buyTab = TestData.GetData("BuyTab"); sellTab = TestData.GetData("SellTab"); marketOrderBuyAmount = TestData.GetData("TC3_MarketOrderBuyAmount"); feeComponent = TestData.GetData("FeeComponent"); sellOrderSize = TestData.GetData("TC3_SellOrderSize"); limitPrice = TestData.GetData("TC3_LimitPrice"); timeInForce = TestData.GetData("TC3_TimeInForce"); string feeValue; Dictionary <string, string> placeMarketBuyOrder; // Get fee based on buy amount and fee component feeValue = GenericUtils.FeeAmount(marketOrderBuyAmount, feeComponent); UserFunctions userFunctions = new UserFunctions(TestProgressLogger); UserCommonFunctions userCommonFunction = new UserCommonFunctions(TestProgressLogger); VerifyOrdersTab objVerifyOrdersTab = new VerifyOrdersTab(driver, TestProgressLogger); OrderEntryPage orderEntryPage = new OrderEntryPage(driver, TestProgressLogger); TestProgressLogger.StartTest(); // Place buy and sell order to set the last price TestProgressLogger.LogCheckPoint(String.Format(LogMessage.PlaceOrderToSetMarketBegin, limitPrice)); userCommonFunction.PlaceOrdersToSetLastPrice(driver, instrument, buyTab, sellTab, sellOrderSize, limitPrice, timeInForce, Const.USER10, Const.USER11); TestProgressLogger.LogCheckPoint(String.Format(LogMessage.PlaceOrderToSetMarketEnd, limitPrice)); // Place Limit sell order to set the market userFunctions.LogIn(TestProgressLogger, Const.USER8); userCommonFunction.CancelAndPlaceLimitSellOrder(driver, instrument, sellTab, sellOrderSize, limitPrice, timeInForce); userFunctions.LogOut(); TestProgressLogger.LogCheckPoint(String.Format(LogMessage.MarketSetupEnd, sellTab, sellOrderSize, limitPrice)); userFunctions.LogIn(TestProgressLogger, Const.USER11); // Place Market buy order with the same quantity as that of sell limit order placed placeMarketBuyOrder = orderEntryPage.PlaceMarketBuyOrder(instrument, buyTab, Double.Parse(marketOrderBuyAmount)); // Verify order is present in Filled Orders tab Assert.True(objVerifyOrdersTab.VerifyFilledOrdersTab(placeMarketBuyOrder["Instrument"], placeMarketBuyOrder["Side"], Double.Parse(placeMarketBuyOrder["BuyAmount"]), feeValue, placeMarketBuyOrder["PlaceOrderTime"], placeMarketBuyOrder["PlaceOrderTimePlusOneMin"]), Const.MarketOrderVerifiedInFilledOrders); TestProgressLogger.LogCheckPoint(String.Format(LogMessage.MarketOrderTestPassed, buyTab)); } catch (NoSuchElementException ex) { TestProgressLogger.TakeScreenshot(); TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace); TestProgressLogger.LogError(String.Format(LogMessage.MarketOrderTestFailed, buyTab), ex); throw ex; } catch (Exception e) { TestProgressLogger.TakeScreenshot(); TestProgressLogger.LogCheckPoint(e.Message + e.StackTrace); TestProgressLogger.LogError(String.Format(LogMessage.MarketOrderTestFailed, buyTab), e); throw e; } finally { TestProgressLogger.EndTest(); } }
//This method will very the details in Trade Report tab TC_33 public Dictionary <string, string> SubmitBuyTradeReport(string instrument, string buyTab, string counterPartyValue, string productBoughtPrice, string productSoldPrice, string status) { try { Dictionary <string, string> placeBlockTradeReportOrder = new Dictionary <string, string>(); var blockTradePrice = GetBlockTradePrice(productBoughtPrice, productSoldPrice); SubmitReportButton(); string feeValueText = LabelConfirmBlockTradeFeeValue().Text; placeBlockTradeReportOrder = VerifyConfirmBlockTradeElements(counterPartyValue, instrument); VerifyFinalAmountAndFinalValue(); ConfirmSubmitReportButton(); 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); objVerifyOrdersTab.VerifyTradeReportsTab(instrument, buyTab, productBoughtPrice, blockTradePrice, feeValueText, placeBlockTradeReportOrder["PlaceBlockTradeTime"], placeBlockTradeReportOrder["PlaceBlockTradeTimePlusOneMin"], status); logger.LogCheckPoint(String.Format(LogMessage.BuyBlockTradeReportTestPassed, buyTab)); } catch (Exception) { logger.LogCheckPoint(String.Format(LogMessage.BuyBlockTradeReportTestFailed, buyTab)); } try { Thread.Sleep(2000); if (CancelButton().Enabled) { logger.LogCheckPoint(string.Format(LogMessage.VerifiedCancelButtonFailed)); } } catch (Exception) { logger.LogCheckPoint(string.Format(LogMessage.VerifiedCancelButtonPassed)); } Thread.Sleep(2000); return(placeBlockTradeReportOrder); } catch (Exception e) { throw e; } }
public void TC7_VerifyBuyStopOrder() { try { string type = Const.StopMarket; instrument = TestData.GetData("Instrument"); feeComponent = TestData.GetData("FeeComponent"); orderType = TestData.GetData("OrderType"); menuTab = TestData.GetData("MenuTab"); buyTab = TestData.GetData("BuyTab"); sellTab = TestData.GetData("SellTab"); orderSize = TestData.GetData("TC7_OrderSize"); limitPrice = TestData.GetData("TC7_LimitPrice"); timeInForce = TestData.GetData("TimeInForce"); stopPrice = TestData.GetData("TC7_StopPrice"); TestProgressLogger.StartTest(); UserFunctions userFunctions = new UserFunctions(TestProgressLogger); UserCommonFunctions userCommonFunction = new UserCommonFunctions(TestProgressLogger); OrderEntryPage orderEntryPage = new OrderEntryPage(driver, TestProgressLogger); VerifyOrdersTab objVerifyOrdersTab = new VerifyOrdersTab(driver, TestProgressLogger); userCommonFunction.PlaceOrdersToSetLastPrice(driver, instrument, buyTab, sellTab, orderSize, limitPrice, timeInForce, Const.USER10, Const.USER11); userFunctions.LogIn(TestProgressLogger, Const.USER8); string askPrice = userCommonFunction.CancelAndPlaceLimitSellOrder(driver, instrument, sellTab, orderSize, limitPrice, timeInForce); UserCommonFunctions.ConfirmWindowOrder(askPrice, limitPrice, driver); userFunctions.LogOut(); TestProgressLogger.LogCheckPoint(String.Format(LogMessage.MarketSetupEnd, sellTab, orderSize, limitPrice)); userFunctions.LogIn(TestProgressLogger, Const.USER9); Dictionary <string, string> placeStopBuyOrder = orderEntryPage.PlaceStopBuyOrder(instrument, buyTab, Double.Parse(orderSize), Double.Parse(feeComponent), Double.Parse(stopPrice)); Assert.True(objVerifyOrdersTab.VerifyOpenOrdersTab(placeStopBuyOrder["Instrument"], placeStopBuyOrder["Side"], type, Double.Parse(placeStopBuyOrder["BuyAmount"]), placeStopBuyOrder["StopPrice"], placeStopBuyOrder["PlaceOrderTime"], placeStopBuyOrder["PlaceOrderTimePlusOneMin"])); TestProgressLogger.LogCheckPoint(string.Format(LogMessage.BuyStopOrderSuccessMsg, buyTab)); // This cancels all the previous open orders UserCommonFunctions.LoginAndCancelAllOrders(TestProgressLogger, driver, instrument, Const.USER8); UserCommonFunctions.LoginAndCancelAllOrders(TestProgressLogger, driver, instrument, Const.USER9); } catch (NoSuchElementException ex) { TestProgressLogger.TakeScreenshot(); TestProgressLogger.LogError(LogMessage.MarketOrderTestFailed, ex); throw ex; } catch (Exception e) { TestProgressLogger.TakeScreenshot(); TestProgressLogger.LogError(LogMessage.MarketOrderTestFailed, e); throw e; } finally { TestProgressLogger.EndTest(); UserFunctions userFunctionality = new UserFunctions(TestProgressLogger); userFunctionality.LogOut(); } }
public void TCAdmin14_OMSOrdersHistory() { try { instrument = TestData.GetData("Instrument"); buyTab = TestData.GetData("BuyTab"); sellTab = TestData.GetData("SellTab"); buyOrderSize = TestData.GetData("TCAdmin14_BuyOrderSize"); //sellOrderSize = TestData.GetData("TCAdmin13_SellOrderSize"); buyLimitPrice = TestData.GetData("TCAdmin14_BuyLimitPrice"); //sellLimitPrice = TestData.GetData("TCAdmin13_SellLimitPrice"); timeInForce = TestData.GetData("TCAdmin14_TimeInForce"); numOfOrders = TestData.GetData("TCAdmin14_NumberOfOrdersToDisplay"); orderState = TestData.GetData("TCAdmin14_OrderState"); AdminFunctions objAdminFunctions = new AdminFunctions(TestProgressLogger); AdminOMSOrdersPage adminOMSOrdersPage = new AdminOMSOrdersPage(TestProgressLogger); UserFunctions userFunctions = new UserFunctions(TestProgressLogger); UserCommonFunctions userCommonFunction = new UserCommonFunctions(TestProgressLogger); AdminCommonFunctions objAdminCommonFunctions = new AdminCommonFunctions(TestProgressLogger); Dictionary <string, string> userDetailsDict = new Dictionary <string, string>(); TestProgressLogger.StartTest(); //userFunctions.LogIn(TestProgressLogger, Const.User8); // Create Buy limit order such that the order are present in open orders tab //userCommonFunction.CancelAndPlaceLimitBuyOrder(driver, instrument, buyTab, buyOrderSize, limitPrice, timeInForce); //Login as admin objAdminFunctions.AdminLogIn(TestProgressLogger); //userDetailsDict = objAdminCommonFunctions.GetUserDetails("User_3"); // User will select the instrument from the dropdown and verify the orders placed above are present OMS orders history page or not //Assert.True(adminOMSOrdersPage.VerifySelectOMSOrdersHistoryInstrument("BTCUSD", numOfOrders), LogMessage.VerifySelectOMSOrdersInstrumentFailed); // This will verify that numbers of orders displayed is not more than the number of orders selected //Assert.True(adminOMSOrdersPage.VerifyNumOfOrdersOnHistorypage(numOfOrders, instrument), LogMessage.VerifyNumOfOrdersDisplayedFailed); // This will verify the the search functionality based on Account Id is working //Assert.True(adminOMSOrdersPage.VerifySearchOMSOrdersHistoryByAcountId(instrument, numOfOrders, userDetailsDict["AccountId"]), LogMessage.VerifySearchOMSOrdersByAcountIdFailed); // This will verify the the search functionality based on Order Id is working //Assert.True(adminOMSOrdersPage.VerifySearchOMSOrdersHistoryByOrderId(instrument, numOfOrders), LogMessage.VerifySearchOMSOrdersByUserIdFailed); Assert.True(adminOMSOrdersPage.VerifySearchRejectedOrder(instrument, numOfOrders, orderState)); } catch (NoSuchElementException ex) { TestProgressLogger.TakeScreenshot(); TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace); TestProgressLogger.LogError(LogMessage.VerifyOMSOpenOrdersTestFailed, ex); throw ex; } catch (Exception e) { TestProgressLogger.TakeScreenshot(); TestProgressLogger.LogCheckPoint(e.Message + e.StackTrace); TestProgressLogger.LogError(LogMessage.VerifyOMSOpenOrdersTestFailed, e); throw e; } finally { TestProgressLogger.EndTest(); } }
// This method verifies the persistence of Amount entered in the Order Size field public bool VerifyOrderEntryAmountPersistence(string amountEntered) { bool flag = false; string exchangeStringValueFromSite; UserCommonFunctions.DashBoardMenuButton(driver); UserCommonFunctions.SelectAnExchange(driver); Thread.Sleep(2000); exchangeStringValueFromSite = ExchangeMenuText().Text; Thread.Sleep(2000); if (exchangeStringValueFromSite.Equals(exchangeMenuString)) { logger.Info("Verification for exchangeMenu value has been passed."); UserSetFunctions.Click(MarketOrderTypeButton()); UserSetFunctions.EnterText(BuyAmountTextField(), amountEntered); UserSetFunctions.Click(LimitOrderTypeButton()); UserSetFunctions.Click(StopOrderTypeButton()); UserSetFunctions.Click(MarketOrderTypeButton()); Thread.Sleep(2000); string amountPersisted = BuyAmountTextField().GetAttribute("value"); if (amountEntered.Equals(amountPersisted)) { logger.Info("Test case has been passed for Buy Market Order Type."); flag = true; } else { logger.Info("Test case has been failed for Buy Market Order Type."); flag = false; } UserSetFunctions.Click(SellOrderEntryButton()); UserSetFunctions.EnterText(SellAmountTextField(), amountEntered); UserSetFunctions.Click(MarketOrderTypeButton()); UserSetFunctions.Click(LimitOrderTypeButton()); UserSetFunctions.Click(StopOrderTypeButton()); Thread.Sleep(2000); if (amountEntered.Equals(amountPersisted)) { logger.Info("Test case has been passed for Sell Market Order Type."); flag = true; } else { logger.Info("Test case has been failed for Sell Market Order Type."); flag = false; } } else { logger.Info("Verification for exchangeMenu value has been failed."); flag = false; } return(flag); }
// This method will verify the order placed in Filled orders tab through Order Entry public bool VerifyFilledOrdersTab(string instrument, string side, double size, string fee, string placeOrderTime, string placeOrderTimePlusOneMin) { 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 verifies the persistence of Amount entered in the Order Size field public bool VerifyOrderEntryAmountPersistence(string instrument, string amountEntered) { bool flag = false; string exchangeStringValueFromSite; UserCommonFunctions.DashBoardMenuButton(driver); UserCommonFunctions.SelectAnExchange(driver); Thread.Sleep(2000); exchangeStringValueFromSite = ExchangeMenuText().Text; if (exchangeStringValueFromSite.Equals(TestData.GetData("MenuTab"))) { logger.LogCheckPoint(LogMessage.ExchangeMenuVerifiedSuccessfully); UserCommonFunctions.SelectInstrumentFromExchange(instrument, driver); UserSetFunctions.Click(MarketOrderTypeButton()); UserSetFunctions.EnterText(BuyAmountTextField(), amountEntered); UserSetFunctions.Click(LimitOrderTypeButton()); UserSetFunctions.Click(StopOrderTypeButton()); UserSetFunctions.Click(MarketOrderTypeButton()); Thread.Sleep(2000); string amountPersisted = BuyAmountTextField().GetAttribute("value"); if (amountEntered.Equals(amountPersisted)) { logger.LogCheckPoint(String.Format(LogMessage.AmountPersistenceCheckSuccessMsg, TestData.GetData("BuyTab"))); flag = true; } else { logger.LogCheckPoint(String.Format(LogMessage.AmountPersistenceCheckFailureMsg, TestData.GetData("BuyTab"))); flag = false; } UserSetFunctions.Click(SellOrderEntryButton()); UserSetFunctions.EnterText(SellAmountTextField(), amountEntered); UserSetFunctions.Click(MarketOrderTypeButton()); UserSetFunctions.Click(LimitOrderTypeButton()); UserSetFunctions.Click(StopOrderTypeButton()); Thread.Sleep(2000); if (amountEntered.Equals(amountPersisted)) { logger.LogCheckPoint(String.Format(LogMessage.AmountPersistenceCheckSuccessMsg, TestData.GetData("SellTab"))); flag = true; } else { logger.LogCheckPoint(String.Format(LogMessage.AmountPersistenceCheckFailureMsg, TestData.GetData("SellTab"))); flag = false; } } else { logger.LogCheckPoint(LogMessage.ExchangeMenuVerificationFailed); flag = false; } return(flag); }
// 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; } }
public void TC43_VerifyBuyAndSell_SellTest() { instrument = TestData.GetData("Instrument"); sellTab = TestData.GetData("SellTab"); buyTab = TestData.GetData("BuyTab"); sellOrderSize = TestData.GetData("TC43_SellOrderSize"); limitPrice = TestData.GetData("TC43_LimitPrice"); timeInForce = TestData.GetData("TC11_TimeInForce"); UserFunctions userfuntionality = new UserFunctions(TestProgressLogger); BuyAndSellPage objBuyAndSellPage = new BuyAndSellPage(TestProgressLogger); UserFunctions userFunctions = new UserFunctions(TestProgressLogger); UserCommonFunctions userCommonFunction = new UserCommonFunctions(TestProgressLogger); try { string askPrice; TestProgressLogger.StartTest(); userFunctions.LogIn(TestProgressLogger, Const.USER6); askPrice = userCommonFunction.CancelAndPlaceLimitBuyOrder(driver, instrument, sellTab, sellOrderSize, limitPrice, timeInForce); UserCommonFunctions.ConfirmWindowOrder(askPrice, limitPrice, driver); userFunctions.LogOut(); userfuntionality.LogIn(TestProgressLogger, Const.USER8); UserCommonFunctions.DashBoardMenuButton(driver); UserCommonFunctions.NavigateToBuySell(driver); objBuyAndSellPage.SellBtn(); Assert.True(objBuyAndSellPage.VerifyMakeATransaction()); Assert.True(objBuyAndSellPage.VerifyChart()); Assert.True(objBuyAndSellPage.VerifySellOption()); Assert.True(objBuyAndSellPage.VerifyFifthRadioButtonOption()); Assert.True(objBuyAndSellPage.VerifyFifthWithBlankValues()); objBuyAndSellPage.PlaceSellOrder(instrument, sellTab); TestProgressLogger.LogCheckPoint(String.Format(LogMessage.BuyAndSell_SellTestVerificationPassed, buyTab)); } catch (NoSuchElementException ex) { TestProgressLogger.TakeScreenshot(); TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace); throw ex; } catch (Exception ex) { TestProgressLogger.TakeScreenshot(); TestProgressLogger.Error(String.Format(LogMessage.BuyAndSell_SellTestVerificationFailed, buyTab), ex); TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace); } finally { TestProgressLogger.EndTest(); UserFunctions userFunctionality = new UserFunctions(TestProgressLogger); userFunctionality.LogOut(); } }
public void TC4_VerifySellMarketOrder() { try { instrument = TestData.GetData("Instrument"); marketOrderSellAmount = TestData.GetData("TC4_MarketOrderSellAmount"); feeComponent = TestData.GetData("FeeComponent"); orderType = TestData.GetData("OrderType"); menuTab = TestData.GetData("MenuTab"); buyTab = TestData.GetData("BuyTab"); sellTab = TestData.GetData("SellTab"); buyOrderSize = TestData.GetData("TC4_MarketOrderBuyAmount"); limitPrice = TestData.GetData("TC4_LimitPrice"); timeInForce = TestData.GetData("TimeInForce"); UserFunctions userFunctions = new UserFunctions(TestProgressLogger); UserCommonFunctions userCommonFunction = new UserCommonFunctions(TestProgressLogger); OrderEntryPage orderEntryPage = new OrderEntryPage(driver, TestProgressLogger); string feeValue = GenericUtils.SellFeeAmount(buyOrderSize, limitPrice, feeComponent); TestProgressLogger.StartTest(); userCommonFunction.PlaceOrdersToSetLastPrice(driver, instrument, buyTab, sellTab, buyOrderSize, limitPrice, timeInForce, Const.USER10, Const.USER11); userFunctions.LogIn(TestProgressLogger, Const.USER8); userCommonFunction.CancelAndPlaceLimitBuyOrder(driver, instrument, buyTab, buyOrderSize, limitPrice, timeInForce); userFunctions.LogOut(); TestProgressLogger.LogCheckPoint(String.Format(LogMessage.MarketSetupEnd, buyTab, buyOrderSize, limitPrice)); userFunctions.LogIn(TestProgressLogger, Const.USER11); Dictionary <string, string> placeMarketSellOrder = orderEntryPage.PlaceMarketSellOrder(instrument, sellTab, Double.Parse(marketOrderSellAmount), Double.Parse(feeComponent)); VerifyOrdersTab objVerifyOrdersTab = new VerifyOrdersTab(driver, TestProgressLogger); Assert.True(objVerifyOrdersTab.VerifyFilledOrdersTab(placeMarketSellOrder["Instrument"], placeMarketSellOrder["Side"], Double.Parse(placeMarketSellOrder["SellAmount"]), feeValue, placeMarketSellOrder["PlaceOrderTime"], placeMarketSellOrder["PlaceOrderTimePlusOneMin"]), Const.MarketOrderVerifiedInFilledOrders); TestProgressLogger.LogCheckPoint(string.Format(LogMessage.SellMarketOrderSuccessMsg)); } catch (NoSuchElementException ex) { TestProgressLogger.TakeScreenshot(); TestProgressLogger.LogError(LogMessage.MarketOrderTestFailed, ex); throw ex; } catch (Exception e) { TestProgressLogger.TakeScreenshot(); TestProgressLogger.LogError(LogMessage.MarketOrderTestFailed, e); throw e; } finally { TestProgressLogger.EndTest(); UserFunctions userFunctionality = new UserFunctions(TestProgressLogger); userFunctionality.LogOut(); } }
public void TC35_VerifyCancelBlockTradeOrderWithoutLockedInTest() { instrument = TestData.GetData("Instrument"); counterPartyPrice = TestData.GetData("TC33_CounterPartyPrice"); productBoughtPrice = TestData.GetData("TC33_ProductBoughtPrice"); productSoldPrice = TestData.GetData("TC33_ProductSoldPrice"); UserFunctions userfuntionality = new UserFunctions(TestProgressLogger); DetailsOnLandingPage objDetailsOnLandingPage = new DetailsOnLandingPage(TestProgressLogger); ReportBlockTradePage objReportBlockTradePage = new ReportBlockTradePage(TestProgressLogger); VerifyOrdersTab objVerifyOrdersTab = new VerifyOrdersTab(driver, TestProgressLogger); try { TestProgressLogger.StartTest(); userfuntionality.LogIn(TestProgressLogger, Const.USER6); Thread.Sleep(2000); UserCommonFunctions.DashBoardMenuButton(driver); UserCommonFunctions.SelectAnExchange(driver); Assert.True(objDetailsOnLandingPage.ExchangeLinkButton()); UserCommonFunctions.SelectInstrumentFromExchange(instrument, driver); objReportBlockTradePage.ReportBlockTradeButton(); objReportBlockTradePage.VerifyReportBlockTradeWindow(); objReportBlockTradePage.SubmitBlockTradeReportForUser(counterPartyPrice, productBoughtPrice, productSoldPrice); Assert.True(objVerifyOrdersTab.VerifyCancelBlockTradeOrdersInOpenOrderTab()); Thread.Sleep(3000); TestProgressLogger.LogCheckPoint(String.Format(LogMessage.VerifiedCancelOrderButtonPassed)); TestProgressLogger.LogCheckPoint(String.Format(LogMessage.VerifiedBlockTradeWithoutLockedInCancelPassed)); TestProgressLogger.EndTest(); } catch (NoSuchElementException ex) { TestProgressLogger.TakeScreenshot(); TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace); } catch (Exception ex) { TestProgressLogger.TakeScreenshot(); TestProgressLogger.Error(String.Format(LogMessage.VerifiedCancelOrderButtonFailed)); TestProgressLogger.Error(String.Format(LogMessage.VerifiedBlockTradeWithoutLockedInCancelFailed)); TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace); } finally { TestProgressLogger.EndTest(); UserFunctions userFunctionality = new UserFunctions(TestProgressLogger); userFunctionality.LogOut(); } }
public void PlaceMultipleLimitSellOrder(string instrument, string side, string sellAmount, string limitPrice, string timeinforce) { string successMsg; string placeOrderTime; string placeOrderTimePlusOneMin; Dictionary <string, string> limitSellOrderData = new Dictionary <string, string>(); string askPrice = AskPrice(driver).Text; if (BuyOrderEntryButton().Displayed&& StopOrderTypeButton().Displayed) { UserSetFunctions.Click(OrderEntryButton()); UserSetFunctions.Click(SellOrderEntryButton()); UserSetFunctions.Click(MarketOrderTypeButton()); Thread.Sleep(1000); 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)); } UserSetFunctions.Click(PlaceSellOrderButton()); UserCommonFunctions.ConfirmWindowOrder(askPrice, limitPrice, driver); successMsg = UserCommonFunctions.GetTextOfMessage(driver, logger); placeOrderTime = GenericUtils.GetCurrentTime(); placeOrderTimePlusOneMin = GenericUtils.GetCurrentTimePlusOneMinute(); Assert.Equal(Const.OrderSuccessMsg, successMsg); logger.LogCheckPoint(String.Format(LogMessage.MarketOrderPlacedSuccessfully, side, sellAmount)); Thread.Sleep(2000); UserCommonFunctions.ScrollingDownVertical(driver); logger.LogCheckPoint(String.Format(LogMessage.LimitOrderSuccessMsg, side, sellAmount, limitPrice)); } }
public void NavigateToHomePage(string instrument) { string exchangeStringValueFromSite; UserCommonFunctions.DashBoardMenuButton(driver); UserCommonFunctions.SelectAnExchange(driver); Thread.Sleep(2000); exchangeStringValueFromSite = ExchangeMenuText().Text; Thread.Sleep(2000); if (exchangeStringValueFromSite.Equals(TestData.GetData("MenuTab"))) { logger.LogCheckPoint(LogMessage.ExchangeMenuVerifiedSuccessfully); UserCommonFunctions.SelectInstrumentFromExchange(instrument, driver); Thread.Sleep(2000); } }
public void NavigateToAdvanceOrdersSection(IWebDriver driver, string side, string instrument, string orderType) { try { UserCommonFunctions.DashBoardMenuButton(driver); UserCommonFunctions.SelectAnExchange(driver); UserCommonFunctions.CancelAllOrders(driver); logger.LogCheckPoint(String.Format(LogMessage.CancelOrders)); UserCommonFunctions.AdvanceOrder(driver); SelectBuyOrSellTab(side); SelectInstrumentsAndOrderType(instrument, orderType); } catch (Exception e) { throw e; } }
public void AdvanceSellLimitOrderIOC(string orderType, string instrument, string orderSize, string limitPrice) { string sellMarketOrderTime; UserSetFunctions.Click(SellButton()); objAdvancedOrderPage = new AdvancedOrderPage(output); objUserFunctionality = new UserFunctions(output); objAdvancedOrderPage.SelectInstrumentsAndOrderType(instrument, orderType); objAdvancedOrderPage.PlaceSellOrderWithImmediateOrCancelType(orderSize, limitPrice); sellMarketOrderTime = GenericUtils.GetCurrentTime(); Thread.Sleep(2000); UserCommonFunctions.CloseAdvancedOrderSection(driver, logger); Thread.Sleep(2000); UserSetFunctions.Click(OpenOrderTabButton()); VerifyAdvanceBuyOrderTab(instrument, "Sell", 2, limitPrice, sellMarketOrderTime); }
public void TCAdmin12_VerifyAllTradesTakenPlaceUnderTradesTabTest() { accountId = TestData.GetData("TCAdmin12_AccountIdValue"); userId = TestData.GetData("TCAdmin12_UserIdValue"); AdminFunctions objAdminFunctions = new AdminFunctions(TestProgressLogger); AdminCommonFunctions objAdminCommonFunctions = new AdminCommonFunctions(TestProgressLogger); AdminUsersPage objAdminUsersPage = new AdminUsersPage(TestProgressLogger); UserFunctions userFunctions = new UserFunctions(TestProgressLogger); UserCommonFunctions userCommonFunction = new UserCommonFunctions(TestProgressLogger); AdminTradePage objAdminTradePage = new AdminTradePage(TestProgressLogger); try { //Login as admin -> Click on "Trades" menu button objAdminFunctions.AdminLogIn(TestProgressLogger); objAdminCommonFunctions.SelectTradeMenu(); // This method with will verify the AccountId textfield //Assert.True(objAdminTradePage.VerifySearchByAccountId(accountId)); // This method with will verify the UserId textfield Assert.True(objAdminTradePage.VerifySearchByUserId(userId)); } catch (NoSuchElementException ex) { TestProgressLogger.TakeScreenshot(); TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace); TestProgressLogger.LogError(String.Format(LogMessage.VerifyRevokeUserPermissionFailed), ex); throw ex; } catch (Exception e) { TestProgressLogger.TakeScreenshot(); TestProgressLogger.LogCheckPoint(e.Message + e.StackTrace); TestProgressLogger.LogError(String.Format(LogMessage.VerifyRevokeUserPermissionFailed), e); throw e; } finally { objAdminCommonFunctions.UserMenuBtn(); objAdminFunctions.AdminLogOut(); TestProgressLogger.EndTest(); } }
// This method Creates an API Key, returns API KEY DATA Stored in API Confirmation Modal public Dictionary <string, string> CreateAPIkey(IWebDriver driver) { Dictionary <string, string> apiKeyData = new Dictionary <string, string>(); UserCommonFunctions.DashBoardMenuButton(driver); UserCommonFunctions.NavigateToUserSetting(driver); IWebElement apiKeysLink = APIKeysLink(driver); IWebElement apiKeyBtn = APIKeyButton(driver); // Verify the button is enabled if (apiKeyBtn.Enabled) { UserSetFunctions.Click(apiKeyBtn); // Verify the 3 checkboxes are displayed if (VerifyAPIKeyCheckboxesArePresent(driver)) { UserSetFunctions.Click(TradingCheckbox(driver)); UserSetFunctions.Click(DepositsCheckbox(driver)); UserSetFunctions.Click(WithdrawlsCheckbox(driver)); // This method stores the list of activities checked StoreAPICheckedActivitiesData(driver); // This method creates the new API key UserSetFunctions.Click(CreateAPIKeyButton(driver)); if (APIConfirmationModal(driver).Displayed) { apiKeyData = StoreAPIConfirmationModalData(driver); UserSetFunctions.Click(APIConfirmationButton(driver)); Assert.True(VerifyAddedAPIKey(driver, apiKeyData)); return(apiKeyData); } } } else { logger.Error("API Key button is not enabled"); } return(apiKeyData); }
//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; } }