public void PlaceBuyOrderWithReserveOrderType(string instruments, string ordertype, string ordersize, string limitprice, string displayquantity) { try { IWebElement instrumet = driver.FindElement(instrument); UserSetFunctions.VerifyWebElement(instrumet); UserSetFunctions.SelectDropdown(instrumet, instruments); IWebElement ordertyp = driver.FindElement(orderType); UserSetFunctions.VerifyWebElement(ordertyp); UserSetFunctions.SelectDropdown(ordertyp, ordertype); IWebElement ordersiz = driver.FindElement(orderSize); UserSetFunctions.VerifyWebElement(ordersiz); UserSetFunctions.EnterText(ordersiz, ordersize); IWebElement limitpric = driver.FindElement(limitPrice); UserSetFunctions.VerifyWebElement(limitpric); UserSetFunctions.EnterText(limitpric, limitprice); IWebElement displayquntity = driver.FindElement(displayQuntity); UserSetFunctions.VerifyWebElement(displayquntity); UserSetFunctions.EnterText(displayquntity, displayquantity); IWebElement placebuyorder = driver.FindElement(placeByOrder); UserSetFunctions.VerifyWebElement(placebuyorder); UserSetFunctions.Click(placebuyorder); } catch (Exception e) { throw e; } }
// This method verifies Current Date - 1 and all futures dates are selectable public bool VerifyStartDateSelectableDatesForCyclicReport() { int today; bool flag = false; today = GenericUtils.GetOnlyCurrentDate(); string currentDate = GenericUtils.GetCurrentDate(); UserSetFunctions.Click(StartDate()); IWebElement dateWidgetFrom = driver.FindElement(By.XPath("//table[@class='pika-table']/tbody")); //This are the columns of the from date picker table List <IWebElement> columns = new List <IWebElement>(); var dateColumn = dateWidgetFrom.FindElements(By.ClassName("is-disabled")); foreach (IWebElement fields in dateColumn) { string disabledFields = fields.Text; int fieldValueInInt = Int32.Parse(disabledFields); if (fieldValueInInt < today) { flag = true; logger.LogCheckPoint(String.Format(LogMessage.StartCurrentDateAndFutureDatePassed, currentDate)); return(flag); } else { logger.Error(String.Format(LogMessage.StartCurrentDateAndFutureDateFailed, currentDate)); return(flag); } } return(flag); }
// This method Deletes the API key, takes bool deleteFlag true // Returns true if the API Key is successfully deleted public bool VerifyDeleteButtonIsPresent(IWebDriver driver, Dictionary <string, string> apiKeyData, bool deleteFlag) { ArrayList apiKeysList = new ArrayList(); string apiKeyAdded = apiKeyData["Key"]; var flag = false; int countOfAPIKeys = driver.FindElements(By.XPath("//div[@class='flex-table__body api-key-list__body retail-api-key-list__body']/div")).Count; for (int i = 1; i <= countOfAPIKeys; i++) { int countItems = driver.FindElements(By.XPath("(//div[@class='flex-table__body api-key-list__body retail-api-key-list__body']/div)[" + i + "]/div")).Count; for (int j = 1; j <= countItems; j++) { string apiKey = driver.FindElement(By.XPath("(//div[@class='flex-table__body api-key-list__body retail-api-key-list__body']/div)[" + i + "]/div[1]")).Text; if (apiKey.Equals(apiKeyAdded)) { IWebElement deleteButton = driver.FindElement(By.XPath("(//div[@class='flex-table__body api-key-list__body retail-api-key-list__body']/div)[" + i + "]/div[5]")); if (deleteButton.Text.Equals("Delete")) { if (deleteFlag) { deleteButton.Click(); UserSetFunctions.Click(DeleteAPIKeymodalButton(driver)); flag = true; } } } } } return(flag); }
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 selects the Affiliate Program link from User Settings page public void SelectAffiliateProgram() { UserCommonFunctions.DashBoardMenuButton(driver); UserCommonFunctions.NavigateToUserSetting(driver); Thread.Sleep(2000); UserSetFunctions.Click(AffiliateProgramLink()); }
// 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>(); SelectAPIKeyCheckboxes(); Dictionary <string, bool> selectedActivities = StoreAPICheckedActivitiesData(); // Click on the Create button to create API Key UserSetFunctions.Click(CreateAPIKeyButton()); if (VerifyAPIKeyConfirmationModalIsPresent()) { // This stores the information displayed on the APIConfirmationModal apiKeyData = StoreAPIConfirmationModalData(); logger.LogCheckPoint(String.Format(LogMessage.VerifiedConfirmationModal, apiKeyData["Permissions"])); UserSetFunctions.Click(APIConfirmationButton()); if (VerifyAddedAPIKey(driver, apiKeyData, selectedActivities)) { logger.LogCheckPoint(Const.APIKeyCreationSuccessMsg); } else { logger.LogCheckPoint(Const.APIKeyCreationFailureMsg); } } else { logger.LogCheckPoint(Const.ConfirmationModalFailureMsg); } return(apiKeyData); }
// This method creates and verifies the API Key public bool CreateAndVerifyAPIKey() { bool flag = false; SelectAPIKeyCheckboxes(); Dictionary <string, bool> selectedActivities = StoreAPICheckedActivitiesData(); UserSetFunctions.Click(CreateAPIKeyButton()); if (VerifyAPIKeyConfirmationModalIsPresent()) { Dictionary <string, string> apiKeyData = new Dictionary <string, string>(); apiKeyData = StoreAPIConfirmationModalData(); logger.LogCheckPoint(String.Format(LogMessage.VerifiedConfirmationModal, apiKeyData["Permissions"])); UserSetFunctions.Click(APIConfirmationButton()); if (VerifyAddedAPIKey(driver, apiKeyData, selectedActivities)) { flag = true; } else { logger.LogCheckPoint(Const.APIKeyCreationFailureMsg); } } else { logger.LogCheckPoint(Const.ConfirmationModalFailureMsg); } return(flag); }
// 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); try { 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); } catch (Exception) { throw; } }
//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; } }
// This method selects the Trading, Deposits, Withdrawl checkboxes public void SelectAPIKeyCheckboxes() { Thread.Sleep(2000); UserSetFunctions.Click(TradingCheckbox()); UserSetFunctions.Click(DepositsCheckbox()); UserSetFunctions.Click(WithdrawlsCheckbox()); logger.LogCheckPoint(Const.SelectedAPIKeyCheckboxes); Thread.Sleep(2000); }
// 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 returns the number of affiliates public int GetnumberOfAffiliates(IWebDriver driver) { UserSetFunctions.Click(AffiliateProgramLink(driver)); string affiliates = driver.FindElement(noOfAffiliates).Text; string[] affiliatesList = affiliates.Split(" "); affiliates = affiliatesList[0]; return(Int32.Parse(affiliates)); }
// 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); }
public void AdvanceBuyLimitOrderIOC(string orderType, string instrument, string orderSize, string limitPrice) { objAdvancedOrderPage = new AdvancedOrderPage(output); objUserFunctionality = new UserFunctionality(output); objAdvancedOrderPage.PlaceBuyOrderWithImmediateOrCancelType(orderType, instrument, orderSize, limitPrice); UserSetFunctions.EnterText(driver.FindElement(advanceOrderSizeAmount), orderSize); UserSetFunctions.EnterText(driver.FindElement(advanceOrderLimitAmount), limitPrice); UserSetFunctions.Click(driver.FindElement(placeBuyOrderButton)); }
public void ConfirmSubmitReportButton() { try { UserSetFunctions.Click(ConfirmBuyOrderBtn()); } catch (Exception e) { throw e; } }
// This method will enter executionId in textfield public void EnterExecutionId(string executionId) { try { UserSetFunctions.EnterText(ExecutionIdTextField(), executionId); } catch (Exception) { throw; } }
// This method will enter tradeId in textfield public void EnterTradeId(string tradeId) { try { UserSetFunctions.EnterText(TradeIdTextField(), tradeId); } catch (Exception) { throw; } }
// This method click on sell button tab in order entry page public void SellOrderEntryBtn() { try { UserSetFunctions.Click(SellOrderEntryButton()); } catch (Exception e) { throw e; } }
// This method click on market button in order entry page public void MarketOrderTypeBtn() { try { UserSetFunctions.Click(MarketOrderTypeButton()); } catch (Exception e) { throw e; } }
// This method will enter accountId in textfield public void EnterAccountId(string accountId) { try { UserSetFunctions.EnterText(AccountIdTextField(), accountId); } catch (Exception) { throw; } }
// This method will enter userId in textfield public void EnterUserId(string userId) { try { UserSetFunctions.EnterText(UserIdTextField(), userId); } catch (Exception) { throw; } }
public void SubmitReportButton() { try { UserSetFunctions.Click(SubmitReportBtn()); } catch (Exception e) { throw e; } }
// This method enters the Sell Amount value public void EnterSellAmount(string amountEntered) { try { Thread.Sleep(2000); UserSetFunctions.EnterText(SellAmountTextField(), amountEntered); } catch (Exception e) { throw e; } }
public void SellBtn() { try { Thread.Sleep(2000); UserSetFunctions.Click(SellButton()); } catch (Exception e) { throw e; } }
//This method will click on order entry button public void OrderEntryBtn() { try { Thread.Sleep(2000); UserSetFunctions.Click(OrderEntryButton()); } catch (Exception e) { throw e; } }
//This method will click on balances button public void balancesBtn() { try { Thread.Sleep(2000); UserSetFunctions.Click(BalancesButton()); } catch (Exception e) { throw e; } }
public void SelectTimeInForce(string timeInForce) { try { UserSetFunctions.VerifyWebElement(TimeInForce(driver)); UserSetFunctions.SelectDropdown(TimeInForce(driver), timeInForce); } catch (Exception e) { throw e; } }
public void SelectPegPrice(string pegPriceType) { try { UserSetFunctions.VerifyWebElement(PegPriceDropDown(driver)); UserSetFunctions.SelectDropdown(PegPriceDropDown(driver), pegPriceType); } catch (Exception e) { throw e; } }
public void SellAndVerifyMarketOrderFlow(string instrument, IWebDriver driver, string amountPrice) { bool flag = false; Thread.Sleep(3000); CommonFunctionality.SelectDashBoardButton(driver); Thread.Sleep(2000); 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; } CommonFunctionality.SelectInstrumentFromExchange(instrument, driver); UserSetFunctions.Click(driver.FindElement(sellOrderEntryButton)); UserSetFunctions.Click(driver.FindElement(marketOrderTypeButton)); UserSetFunctions.EnterText(driver.FindElement(sellAmountTextField), amountPrice); Dictionary <string, string> balances = new Dictionary <string, string>(); if (driver.FindElement(feesText).Enabled&& driver.FindElement(orderTotalText).Enabled&& driver.FindElement(netText).Enabled) { // Storing balances in Dictionary balances = CommonFunctionality.StoreMarketAmountBalances(driver); logger.Info("For Sell Order case --> Balances stored successfully."); output.WriteLine("For Sell Order case --> Balances stored successfully."); } else { logger.Error("For Sell Order case --> Fees or Order Total or Net amount is not present"); output.WriteLine("For Sell Order case --> Fees or Order Total or Net amount is not present"); } Thread.Sleep(2000); UserSetFunctions.Click(driver.FindElement(placeSellOrderButton)); // This needs to be changed - crate locator class CommonFunctionality.FilledOrderTab(driver); CommonFunctionality.ScrollingDownVertical(driver); }
public void Login(string userName, string password) { UserSetFunctions.SelectDropdown(driver.FindElement(selectServer), "wss://apiapexqa2.alphapoint.com/WSGateway/"); UserSetFunctions.EnterText(driver.FindElement(loginName), userName); UserSetFunctions.EnterText(driver.FindElement(loginPassword), password); UserSetFunctions.Click(driver.FindElement(loginButton)); output.WriteLine("Title--------------------" + driver.Title); Assert.Equal(driver.Title.ToLower(), "APEX Web".ToLower()); //This returns new object of Home page such that it initializes the parameters of Home page after login //return new UserHomePage(driver); }