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 BuyAndVerifyMarketOrderFlow(string instrument, IWebDriver driver, string amountEntered) { Thread.Sleep(3000); // This needs to be changed - crate locator class CommonFunctionality.SelectDashBoardButton(driver); Thread.Sleep(2000); CommonFunctionality.SelectInstrumentFromExchange(instrument, driver); UserSetFunctions.Click(driver.FindElement(marketOrderTypeButton)); UserSetFunctions.EnterText(driver.FindElement(buyAmountTextField), amountEntered); Thread.Sleep(2000); 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 Buy Order case ---> Balances stored successfully."); output.WriteLine("For Buy Order case ---> Balances stored successfully."); } else { logger.Error("For Buy Order case ---> Fees or Order Total or Net amount is not present"); output.WriteLine("For Buy Order case ---> Fees or Order Total or Net amount is not present"); } // Place Buy Order UserSetFunctions.Click(driver.FindElement(placeBuyOrderButton)); // Verify the balances stored foreach (KeyValuePair <string, string> amount in balances) { output.WriteLine("Key: {0}, Value: {1}", amount.Key, amount.Value); } Thread.Sleep(2000); // This needs to be changed - crate locator class CommonFunctionality.FilledOrderTab(driver); CommonFunctionality.ScrollingDownVertical(driver); }