Exemplo n.º 1
0
        public void TC42_VerifyBuyAndSell_BuyTest()
        {
            instrument    = TestData.GetData("Instrument");
            sellTab       = TestData.GetData("SellTab");
            buyTab        = TestData.GetData("BuyTab");
            sellOrderSize = TestData.GetData("TC11_SellOrderSize");
            limitPrice    = TestData.GetData("TC11_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.CancelAndPlaceLimitSellOrder(driver, instrument, sellTab, sellOrderSize, limitPrice, timeInForce);
                UserCommonFunctions.ConfirmWindowOrder(askPrice, limitPrice, driver);
                userFunctions.LogOut();

                userfuntionality.LogIn(TestProgressLogger, Const.USER5);
                UserCommonFunctions.DashBoardMenuButton(driver);
                UserCommonFunctions.NavigateToBuySell(driver);
                Assert.True(objBuyAndSellPage.VerifyMakeATransaction());
                Assert.True(objBuyAndSellPage.VerifyChart());
                Assert.True(objBuyAndSellPage.VerifyBuyOption());
                Assert.True(objBuyAndSellPage.VerifyFifthRadioButtonOption());
                Assert.True(objBuyAndSellPage.VerifyFifthWithBlankValues());
                objBuyAndSellPage.PlaceBuyOrder(instrument, buyTab);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.BuyAndSell_BuyTestVerificationPassed, 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_BuyTestVerificationFailed, buyTab), ex);
                TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace);
            }
            finally
            {
                TestProgressLogger.EndTest();
                UserFunctions userFunctionality = new UserFunctions(TestProgressLogger);
                userFunctionality.LogOut();
            }
        }
Exemplo n.º 2
0
        public void TC42_VerifyBuyAndSell_BuyTest()
        {
            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("TC43_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.USER8);

                // Setting up market by placing Limit sell Order
                askPrice = userCommonFunction.CancelAndPlaceLimitSellOrder(driver, instrument, sellTab, sellOrderSize, limitPrice, timeInForce);

                // Navigate to Buy&Sell page and place a buy order
                userfuntionality.LogIn(TestProgressLogger, Const.USER14);

                // Click on -> Dashboad Menu button -> Buy&Sell button
                UserCommonFunctions.DashBoardMenuButton(driver);
                UserCommonFunctions.NavigateToBuySell(driver);

                // Verify "Make a Transaction" window
                Assert.True(objBuyAndSellPage.VerifyMakeATransaction());

                // Verify "Chart details" section
                Assert.True(objBuyAndSellPage.VerifyChart());

                // Verify "Buy" option is selected by default
                Assert.True(objBuyAndSellPage.VerifyBuyOption());

                // Verify 5th button with blank values is selected
                Assert.True(objBuyAndSellPage.VerifyFifthRadioButtonOption());
                Assert.True(objBuyAndSellPage.VerifyFifthWithBlankValues());

                // Place a buy order and verify the amount details
                objBuyAndSellPage.PlaceBuyOrder(instrument, buyTab);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.BuyAndSell_BuyTestVerificationPassed, buyTab));
            }
            catch (NoSuchElementException ex)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace);
                TestProgressLogger.LogError(String.Format(LogMessage.BuyAndSell_BuyTestVerificationFailed, buyTab), ex);
                throw ex;
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(e.Message + e.StackTrace);
                TestProgressLogger.LogError(String.Format(LogMessage.BuyAndSell_BuyTestVerificationFailed, buyTab), e);
                throw e;
            }
            finally
            {
                TestProgressLogger.EndTest();
            }
        }