Exemplo n.º 1
0
        //This method will verify the block trade in Admin UI
        public void VerifyBlockTradeInAdmin(string accountTypeID, string counterPartyID, string instrument, string originalQuantity, string quantityExecuted)
        {
            AdminCommonFunctions objAdminCommonFunctions = new AdminCommonFunctions(logger);

            try
            {
                objAdminCommonFunctions.SelectTradeMenu();
                objAdminCommonFunctions.BlockTradeBtn();
                objAdminCommonFunctions.BlockTradeInstrumentSelection(instrument);
                objAdminCommonFunctions.BuyBlockTradeList(accountTypeID, counterPartyID, instrument, originalQuantity, quantityExecuted);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
        public void TC34_VerifyBuyBlockTradeWithOutLockedInTest()
        {
            instrument                    = TestData.GetData("Instrument");
            orderType                     = TestData.GetData("OrderType");
            menuTab                       = TestData.GetData("MenuTab");
            buyTab                        = TestData.GetData("BuyTab");
            sellTab                       = TestData.GetData("SellTab");
            orderSize                     = TestData.GetData("OrderSize");
            limitPrice                    = TestData.GetData("LimitPrice");
            timeInForce                   = TestData.GetData("TimeInForce");
            counterParty                  = TestData.GetData("TC34_CounterPartyPrice");
            counterPartyPrice             = TestData.GetData("TC34_CounterPartyPrice");
            productBoughtPrice            = TestData.GetData("TC34_ProductBoughtPrice");
            productSoldPrice              = TestData.GetData("TC34_ProductSoldPrice");
            blocktradeReportStatus        = TestData.GetData("TC34_TradeReportStatus");
            userWithBadge                 = TestData.GetData("TC34_UserWithBadge");
            userWithPermissions           = TestData.GetData("TC34_UserWithPermissions");
            submitBlockTradePermission    = TestData.GetData("TC34_SubmitBlockTradePermission");
            getOpenTradeReportsPermission = TestData.GetData("TC34_GetOpenTradeReportsPermission");
            userByID                      = TestData.GetData("TC34_UserByID");
            counterPartyAccountID         = TestData.GetData("TC34_CounterPartyAccountID");
            buyerAccountID                = TestData.GetData("TC34_BuyerAccountID");
            badgeIdNumber                 = TestData.GetData("TC34_BadgeNumber");
            status                        = TestData.GetData("TC34_Status");
            blockTradeCounterPartyID      = TestData.GetData("TC34_BLockTradeCounterPartyAccountID");

            AdminFunctions       objAdminFunctions       = new AdminFunctions(TestProgressLogger);
            AdminCommonFunctions objAdminCommonFunctions = new AdminCommonFunctions(TestProgressLogger);
            UserFunctions        userfuntionality        = new UserFunctions(TestProgressLogger);
            ReportBlockTradePage objReportBlockTradePage = new ReportBlockTradePage(TestProgressLogger);
            UserFunctions        objUserFunctions        = new UserFunctions(TestProgressLogger);


            try
            {
                TestProgressLogger.StartTest();
                objAdminFunctions.AdminLogIn(TestProgressLogger);
                objAdminCommonFunctions.UserByIDText(userByID);
                objAdminCommonFunctions.OpenUserButton();
                objAdminCommonFunctions.UserPermissionButton();
                objAdminCommonFunctions.AddSubmitBlockTradePermissions(submitBlockTradePermission);
                objAdminCommonFunctions.ClearTextBox();
                objAdminCommonFunctions.AddGetOpenTradeReportsPermissions(getOpenTradeReportsPermission);
                objAdminCommonFunctions.ClosePermissionWindow();
                Thread.Sleep(2000);
                objAdminCommonFunctions.SelectAccountsMenu();
                objAdminCommonFunctions.OpenAccountByIDText(counterPartyAccountID);
                objAdminCommonFunctions.OpenAccountBtn();
                objAdminCommonFunctions.OpenAddNewBadgeButtonForUser();
                objAdminCommonFunctions.SubmitCreateAccountBadgeButton();
                Thread.Sleep(2000);
                objAdminCommonFunctions.UserBadgeIDValue(badgeIdNumber);
                objAdminCommonFunctions.CreateBadgeAccount();
                Thread.Sleep(2000);
                objAdminCommonFunctions.UserMenuBtn();
                objAdminFunctions.AdminLogOut();
                userfuntionality.LogIn(TestProgressLogger, Const.USER6);
                Thread.Sleep(2000);
                UserCommonFunctions.DashBoardMenuButton(driver);
                UserCommonFunctions.SelectAnExchange(driver);
                UserCommonFunctions.SelectInstrumentFromExchange(instrument, driver);
                Thread.Sleep(3000);
                UserCommonFunctions.ScrollingDownVertical(driver);
                objReportBlockTradePage.ReportBlockTradeButton();
                objReportBlockTradePage.VerifyReportBlockTradeWindow();
                objReportBlockTradePage.VerifyDropdownInstrument();
                objReportBlockTradePage.VerifyCounterParty();
                objReportBlockTradePage.VerifyProductBought();
                objReportBlockTradePage.VerifyProductSold();
                objReportBlockTradePage.VerifyFees();
                objReportBlockTradePage.VerifyBalances();
                objReportBlockTradePage.SubmitBlockTradeReportWithoutLockedInCheckBox(instrument, counterPartyPrice, productBoughtPrice, productSoldPrice, counterParty, buyTab, blocktradeReportStatus);
                objUserFunctions.LogOut();


                userfuntionality.LogIn(TestProgressLogger, Const.USER5);
                Thread.Sleep(2000);
                UserCommonFunctions.DashBoardMenuButton(driver);
                UserCommonFunctions.SelectAnExchange(driver);
                UserCommonFunctions.SelectInstrumentFromExchange(instrument, driver);
                Thread.Sleep(3000);
                UserCommonFunctions.ScrollingDownVertical(driver);
                objReportBlockTradePage.ReportBlockTradeButton();
                objReportBlockTradePage.SubmitBlockTradeReportWithoutLockedInCheckBox(instrument, counterPartyPrice, productBoughtPrice, productSoldPrice, counterParty, buyTab, blocktradeReportStatus);
                objUserFunctions.LogOut();
                objAdminFunctions.AdminLogIn(TestProgressLogger);
                objAdminCommonFunctions.SelectTradeMenu();
                objAdminCommonFunctions.BlockTradeBtn();
                objAdminCommonFunctions.BlockTradeInstrumentSelection(instrument);
                objAdminCommonFunctions.VerifyBlockTradeList(blockTradeCounterPartyID, counterPartyAccountID, status, instrument, buyTab, productBoughtPrice);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.BlockTradeWithOutLockedInTestPassedMsg, buyTab));
                TestProgressLogger.EndTest();
            }
            catch (NoSuchElementException ex)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace);
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.Error(String.Format(LogMessage.BlockTradeWithOutLockedInTestFailedMsg, buyTab), e);
            }
            finally
            {
                objAdminCommonFunctions.UserMenuBtn();
                objAdminFunctions.AdminLogOut();
            }
        }
        public void TC34_VerifyBuyBlockTradeWithOutLockedInTest()
        {
            instrument                    = TestData.GetData("Instrument");
            orderType                     = TestData.GetData("OrderType");
            menuTab                       = TestData.GetData("MenuTab");
            buyTab                        = TestData.GetData("BuyTab");
            sellTab                       = TestData.GetData("SellTab");
            orderSize                     = TestData.GetData("OrderSize");
            limitPrice                    = TestData.GetData("LimitPrice");
            timeInForce                   = TestData.GetData("TimeInForce");
            counterParty                  = TestData.GetData("TC34_CounterPartyPrice");
            counterPartyPrice             = TestData.GetData("TC34_CounterPartyPrice");
            productBoughtPrice            = TestData.GetData("TC34_ProductBoughtPrice");
            productSoldPrice              = TestData.GetData("TC34_ProductSoldPrice");
            blocktradeReportStatus        = TestData.GetData("TC34_TradeReportStatus");
            userWithBadge                 = TestData.GetData("TC34_UserWithBadge");
            userWithPermissions           = TestData.GetData("TC34_UserWithPermissions");
            submitBlockTradePermission    = TestData.GetData("TC34_SubmitBlockTradePermission");
            getOpenTradeReportsPermission = TestData.GetData("TC34_GetOpenTradeReportsPermission");
            userByID                      = TestData.GetData("TC34_UserByID");
            counterPartyAccountID         = TestData.GetData("TC34_CounterPartyAccountID");
            buyerAccountID                = TestData.GetData("TC34_BuyerAccountID");
            badgeIdNumber                 = TestData.GetData("TC34_BadgeNumber");
            status                        = TestData.GetData("TC34_Status");
            blockTradeCounterPartyID      = TestData.GetData("TC34_BLockTradeCounterPartyAccountID");

            AdminFunctions       objAdminFunctions       = new AdminFunctions(TestProgressLogger);
            AdminCommonFunctions objAdminCommonFunctions = new AdminCommonFunctions(TestProgressLogger);
            UserFunctions        userfuntionality        = new UserFunctions(TestProgressLogger);
            ReportBlockTradePage objReportBlockTradePage = new ReportBlockTradePage(TestProgressLogger);
            UserFunctions        objUserFunctions        = new UserFunctions(TestProgressLogger);


            try
            {
                TestProgressLogger.StartTest();

                // The admin will create an badge to user say XYZ and provide the submitblock, getopentradereport permission to user say ABC
                // Login as Admin
                objAdminFunctions.AdminLogIn(TestProgressLogger);

                // Enter "userID"(ex. 185) in the "OpenUserbyID" textfield
                objAdminCommonFunctions.UserByIDText(userByID);

                // Click on "Open" button --> click on "Add permission" button --> provide SubmitBlockTrade and GetOpenTradeReports
                objAdminCommonFunctions.OpenUserButton();
                objAdminCommonFunctions.UserPermissionButton();
                objAdminCommonFunctions.AddSubmitBlockTradePermissions(submitBlockTradePermission);
                objAdminCommonFunctions.ClearTextBox();
                objAdminCommonFunctions.AddGetOpenTradeReportsPermissions(getOpenTradeReportsPermission);
                objAdminCommonFunctions.ClosePermissionWindow();
                Thread.Sleep(2000);

                // Click on "Accounts" menu button --> Enter "accountID"(195) in the "OpenAccountbyID" textfield --> Click on "Open" button
                objAdminCommonFunctions.SelectAccountsMenu();
                objAdminCommonFunctions.OpenAccountByIDText(counterPartyAccountID);
                objAdminCommonFunctions.OpenAccountBtn();

                // Click on "Add New Badge" button --> provide badge number and click on create button
                objAdminCommonFunctions.OpenAddNewBadgeButtonForUser();
                objAdminCommonFunctions.SubmitCreateAccountBadgeButton();
                Thread.Sleep(2000);
                objAdminCommonFunctions.UserBadgeIDValue(badgeIdNumber);
                objAdminCommonFunctions.CreateBadgeAccount();
                Thread.Sleep(2000);

                //Logout from Admin
                objAdminCommonFunctions.UserMenuBtn();
                objAdminFunctions.AdminLogOut();

                // The user XYZ will perform a submit block trade without using lockedIn and verify the various functionalities
                userfuntionality.LogIn(TestProgressLogger, Const.USER6);
                Thread.Sleep(2000);

                // Click on "Dashboard" menu button --> select an exchange --> select an instrument BTCUSD
                UserCommonFunctions.DashBoardMenuButton(driver);
                UserCommonFunctions.SelectAnExchange(driver);
                UserCommonFunctions.SelectInstrumentFromExchange(instrument, driver);
                Thread.Sleep(3000);
                UserCommonFunctions.ScrollingDownVertical(driver);

                // Click on "Report Block Trade" button
                objReportBlockTradePage.ReportBlockTradeButton();

                // Verify window for submitting block trade appears
                objReportBlockTradePage.VerifyReportBlockTradeWindow();

                // Verify drop down for "Instrument" is present
                objReportBlockTradePage.VerifyDropdownInstrument();

                //Verify "Counter Party" is present
                objReportBlockTradePage.VerifyCounterParty();

                // Verify "Product Bought" is present
                objReportBlockTradePage.VerifyProductBought();

                // Verify "Product Sold" is present
                objReportBlockTradePage.VerifyProductSold();

                // Verify "Fee" is present
                objReportBlockTradePage.VerifyFees();

                // Verify balances for both products(product bought and product sold)
                objReportBlockTradePage.VerifyBalances();

                // Verify the details present in Report block trade window and submit a Buy Block trade transaction( by user2) without LockedIn checkbox
                objReportBlockTradePage.SubmitBlockTradeReportWithoutLockedInCheckBox(instrument, counterPartyPrice, productBoughtPrice, productSoldPrice, counterParty, buyTab, blocktradeReportStatus);

                // Logout from user portal
                objUserFunctions.LogOut();

                // The user ABC will perform similar block trade provided by XYZ without using lockedIn and  using "Badge" provided by "XYZ"
                userfuntionality.LogIn(TestProgressLogger, Const.USER5);
                Thread.Sleep(2000);

                // Click on "Dashboard" menu button --> select an exchange --> select an instrument BTCUSD
                UserCommonFunctions.DashBoardMenuButton(driver);
                UserCommonFunctions.SelectAnExchange(driver);
                UserCommonFunctions.SelectInstrumentFromExchange(instrument, driver);
                Thread.Sleep(3000);
                UserCommonFunctions.ScrollingDownVertical(driver);

                //Click on "Report Block trade" button
                objReportBlockTradePage.ReportBlockTradeButton();

                // Verify the details present in Report block trade window and submit a Buy Block trade transaction( by user1) without LockedIn checkbox
                objReportBlockTradePage.SubmitBlockTradeReportWithoutLockedInCheckBox(instrument, counterPartyPrice, productBoughtPrice, productSoldPrice, counterParty, buyTab, blocktradeReportStatus);

                // Logout from user portal
                objUserFunctions.LogOut();

                // The admin will verify if submitted block trade report is present in block trade tab under trade menu section

                // Login as Admin -> Trades -> Block Trades --> select BTCUSD instrument
                objAdminFunctions.AdminLogIn(TestProgressLogger);
                objAdminCommonFunctions.SelectTradeMenu();
                objAdminCommonFunctions.BlockTradeBtn();
                objAdminCommonFunctions.BlockTradeInstrumentSelection(instrument);

                // Verify the Trade status under Block trade tab
                objAdminCommonFunctions.VerifyBlockTradeList(blockTradeCounterPartyID, counterPartyAccountID, status, instrument, buyTab, productBoughtPrice);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.BlockTradeWithOutLockedInTestPassedMsg, buyTab));
                TestProgressLogger.EndTest();
            }
            catch (NoSuchElementException e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(e.Message + e.StackTrace);
                TestProgressLogger.LogError(String.Format(LogMessage.BlockTradeWithOutLockedInTestFailedMsg, buyTab), e);
                throw e;
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(e.Message + e.StackTrace);
                TestProgressLogger.LogError(String.Format(LogMessage.BlockTradeWithOutLockedInTestFailedMsg, buyTab), e);
                throw e;
            }
            finally
            {
                objAdminCommonFunctions.UserMenuBtn();
                objAdminFunctions.AdminLogOut();
            }
        }