//This method returns the text of toast message in Admin
 public static string GetTextOfToastMessageInAdmin(IWebDriver driver, ProgressLogger logger)
 {
     try
     {
         IWebElement msgWebElement = GenericUtils.WaitForElementPresence(driver, toastMessageAdmin, 20);
         string      messageText   = msgWebElement.Text;
         return(messageText);
     }
     catch (Exception e)
     {
         logger.Error(LogMessage.FailedToRetrieveMessage, e);
         logger.Error(e.StackTrace);
         throw;
     }
 }
 //This method closes the Advanced Order Section
 public static void CloseAdvancedOrderSection(IWebDriver driver, ProgressLogger logger)
 {
     try
     {
         IWebElement closeAdvanced = GenericUtils.WaitForElementVisibility(driver, closeIconAdvancedOrder, 30);
         UserSetFunctions.Click(closeAdvanced);
         Thread.Sleep(2000);
     }
     catch (Exception e)
     {
         logger.Error(LogMessage.CloseAdvanceOrderSectFailureMsg, e);
         logger.Error(e.StackTrace);
         throw;
     }
 }
 //This method returns the Success and Failure messages
 public static string GetTextOfMessage(IWebDriver driver, ProgressLogger logger)
 {
     try
     {
         IWebElement msgWebElement = GenericUtils.WaitForElementVisibility(driver, messageDisplayed, 10);
         string      messageText   = msgWebElement.Text;
         return(messageText);
     }
     catch (Exception e)
     {
         logger.Error(LogMessage.FailedToRetrieveMessage, e);
         logger.Error(e.StackTrace);
         throw;
     }
 }
Beispiel #4
0
        //This method is used for User Login
        //If the user is already logged in, then this method logs out user and then logs in
        public string LogIn(ProgressLogger logger, string userName = Const.USER5, bool changeServerOnly = false)
        {
            string username = null;

            apexWebTitle = TestData.GetData("HomePageTitle");
            string userUrl        = data.UserPortal.PortalUrl;
            string userServerName = data.UserPortal.PortalServerUrl;

            driver.Navigate().GoToUrl(userUrl);
            driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(20);
            driver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(20);
            driver.Manage().Window.Size = new Size(1366, 768);
            Thread.Sleep(1000);
            if (driver.Url.EndsWith(Const.LoginText))
            {
                try
                {
                    username = UserLogin(logger, userName, userServerName, changeServerOnly);
                }
                catch (Exception e)
                {
                    logger.TakeScreenshot();
                    logger.Error(Const.UserLoginFailed, e);
                    throw e;
                }
            }
            else
            {
                try
                {
                    driver.Navigate().Refresh();
                    Thread.Sleep(2000);
                    UserSetFunctions.Click(GenericUtils.WaitForElementVisibility(driver, loggedInUserName, 30));
                    UserSetFunctions.Click(GenericUtils.WaitForElementVisibility(driver, userSignOutButton, 30));
                    Thread.Sleep(2000);
                    username = UserLogin(logger, userName, userServerName, changeServerOnly);
                }

                catch (Exception e)
                {
                    logger.Error(Const.UserLogoutFailed, e);
                    throw e;
                }
            }
            return(username);
        }
Beispiel #5
0
 //This method is used for User Logout
 public void LogOut()
 {
     try
     {
         Thread.Sleep(2000);
         if (!driver.Url.EndsWith(Const.LoginText))
         {
             UserCommonFunctions.ScrollingUpVertical(driver);
             UserSetFunctions.Click(driver.FindElement(loggedInUserName));
             UserSetFunctions.Click(driver.FindElement(userSignOutButton));
             logger.LogCheckPoint(string.Format(LogMessage.UserLoggedOutSuccessfully, username));
         }
         Thread.Sleep(2000);
     }
     catch (Exception e)
     {
         logger.Error(Const.UserLogoutFailed, e);
         throw e;
     }
 }
Beispiel #6
0
        //"Verify below details:Report summary is 'report type' , on demand and from and to date. "
        public void VerifySingleReportSummaryDetails()
        {
            string singleReportTradeActivityValue       = TestData.GetData("TC47_SingleReportTradeActivityValue");
            string singleReportTransactionActivityValue = TestData.GetData("TC47_SingleReportTransactionActivityValue");
            string singleReportTreasuryActivitytValue   = TestData.GetData("TC47_SingleReportTreasuryActivitytValue");


            string TradeActivity       = TradeActivityText().Text;
            string TransactionActivity = TransactionActivityText().Text;
            string TreasuryActivity    = TreasuryActivityText().Text;

            try
            {
                if (TradeActivity.Equals(singleReportTradeActivityValue))
                {
                    try
                    {
                        logger.LogCheckPoint(String.Format(LogMessage.SingleReportTradeActivityPassed, TradeActivity));
                    }
                    catch (Exception)
                    {
                        logger.Error(String.Format(LogMessage.SingleReportTradeActivityFailed, TradeActivity));
                    }
                }
                else if (TransactionActivity.Equals(singleReportTransactionActivityValue))
                {
                    try
                    {
                        logger.LogCheckPoint(String.Format(LogMessage.SingleReportTransactionActivityPassed, TransactionActivity));
                    }
                    catch (Exception)
                    {
                        logger.Error(String.Format(LogMessage.SingleReportTransactionActivityFailed, TransactionActivity));
                    }
                }
                else if (TreasuryActivity.Equals(singleReportTreasuryActivitytValue))
                {
                    try
                    {
                        logger.LogCheckPoint(String.Format(LogMessage.SingleReportTreasuryActivityPassed, TreasuryActivity));
                    }
                    catch (Exception)
                    {
                        logger.Error(String.Format(LogMessage.SingleReportTreasuryActivityFailed, TreasuryActivity));
                    }
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Beispiel #7
0
        public Dictionary <string, string> PlaceMarketSellOrder(string instrument, string side, double sellAmount, double feeComponent)
        {
            try
            {
                string exchangeStringValueFromSite;
                string fee             = null;
                string sellAmountValue = sellAmount.ToString();
                string successMsg;
                string placeOrderTime;
                string placeOrderTimePlusOneMin;

                Dictionary <string, string> marketSellOrderData = new Dictionary <string, string>();
                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);
                    UserCommonFunctions.CancelAllOrders(driver);
                    UserSetFunctions.Click(driver.FindElement(orderEntryButton));
                    UserSetFunctions.Click(driver.FindElement(sellOrderEntryButton));
                    UserSetFunctions.Click(driver.FindElement(marketOrderTypeButton));
                    UserSetFunctions.EnterText(SellAmountTextField(), sellAmount.ToString());
                    Thread.Sleep(2000);
                    Dictionary <string, string> balances = new Dictionary <string, string>();
                    if (OrderTotalText().Enabled&& MarketPriceText().Enabled)
                    {
                        // Storing balances in Dictionary
                        Thread.Sleep(1000);
                        balances = UserCommonFunctions.StoreOrderEntryAmountBalances(driver);
                        fee      = UserCommonFunctions.GetSplitValue(balances[Const.Fees]);
                        Assert.True(VerifySellMarketFees(balances[Const.Fees], sellAmountValue, balances[Const.MarketPrice]));
                        Assert.True(VerifyOrderTotal(balances[Const.OrderTotal], sellAmountValue, balances[Const.MarketPrice]));
                        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());
                    successMsg               = UserCommonFunctions.GetTextOfMessage(driver, logger);
                    placeOrderTime           = GenericUtils.GetCurrentTime();
                    placeOrderTimePlusOneMin = GenericUtils.GetCurrentTimePlusOneMinute();
                    Assert.Equal(Const.OrderSuccessMsg, successMsg);
                    logger.LogCheckPoint(String.Format(LogMessage.MarketOrderPlacedSuccessfully, side, sellAmount));
                    marketSellOrderData.Add("Instrument", instrument);
                    marketSellOrderData.Add("Side", side);
                    marketSellOrderData.Add("SellAmount", sellAmountValue);
                    marketSellOrderData.Add("Fee", fee);
                    marketSellOrderData.Add("PlaceOrderTime", placeOrderTime);
                    marketSellOrderData.Add("PlaceOrderTimePlusOneMin", placeOrderTimePlusOneMin);
                    Thread.Sleep(2000);
                }
                else
                {
                    logger.LogCheckPoint(LogMessage.ExchangeMenuVerificationFailed);
                }
                UserCommonFunctions.ScrollingDownVertical(driver);
                Thread.Sleep(3000);
                return(marketSellOrderData);
            }
            catch (Exception e)
            {
                logger.Error(Const.MarketSellOrderFailureMsg);
                throw e;
            }
        }