Exemple #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 TCAdmin12_VerifyAllTradesTakenPlaceUnderTradesTabTest()
        {
            accountId = TestData.GetData("TCAdmin12_AccountIdValue");
            userId    = TestData.GetData("TCAdmin12_UserIdValue");

            AdminFunctions       objAdminFunctions       = new AdminFunctions(TestProgressLogger);
            AdminCommonFunctions objAdminCommonFunctions = new AdminCommonFunctions(TestProgressLogger);
            AdminUsersPage       objAdminUsersPage       = new AdminUsersPage(TestProgressLogger);
            UserFunctions        userFunctions           = new UserFunctions(TestProgressLogger);
            UserCommonFunctions  userCommonFunction      = new UserCommonFunctions(TestProgressLogger);
            AdminTradePage       objAdminTradePage       = new AdminTradePage(TestProgressLogger);

            try
            {
                //Login as admin -> Click on "Trades" menu button
                objAdminFunctions.AdminLogIn(TestProgressLogger);
                objAdminCommonFunctions.SelectTradeMenu();
                // This method with will verify the AccountId textfield
                //Assert.True(objAdminTradePage.VerifySearchByAccountId(accountId));

                // This method with will verify the UserId textfield
                Assert.True(objAdminTradePage.VerifySearchByUserId(userId));
            }
            catch (NoSuchElementException ex)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace);
                TestProgressLogger.LogError(String.Format(LogMessage.VerifyRevokeUserPermissionFailed), ex);
                throw ex;
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(e.Message + e.StackTrace);
                TestProgressLogger.LogError(String.Format(LogMessage.VerifyRevokeUserPermissionFailed), e);
                throw e;
            }
            finally
            {
                objAdminCommonFunctions.UserMenuBtn();
                objAdminFunctions.AdminLogOut();
                TestProgressLogger.EndTest();
            }
        }
        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 TCAdmin11_VerifyTradesUnderTradesTabTest()
        {
            instrument    = TestData.GetData("Instrument");
            marketOrder   = TestData.GetData("MarketOrder");
            menuTab       = TestData.GetData("MenuTab");
            sellTab       = TestData.GetData("SellTab");
            buyTab        = TestData.GetData("BuyTab");
            buyOrderSize  = TestData.GetData("TC9_BuyOrderSize");
            sellOrderSize = TestData.GetData("TC9_SellOrderSize");
            limitPrice    = TestData.GetData("TC9_LimitPrice");
            timeInForce   = TestData.GetData("TC9_TimeInForce");

            tradeIdValueTextValue     = TestData.GetData("TCAdmin11_TradeIdValueTextValue");
            productPairValueTextValue = TestData.GetData("TCAdmin11_ProductPairValueTextValue");
            sideValueTextValue        = TestData.GetData("TCAdmin11_SideValueTextValue");
            qantityValueTextValue     = TestData.GetData("TCAdmin11_QantityValueTextValue");
            executionIdValueTextValue = TestData.GetData("TCAdmin11_ExecutionIdValueTextValue");


            AdminFunctions       objAdminFunctions       = new AdminFunctions(TestProgressLogger);
            AdminCommonFunctions objAdminCommonFunctions = new AdminCommonFunctions(TestProgressLogger);
            AdminUsersPage       objAdminUsersPage       = new AdminUsersPage(TestProgressLogger);
            UserFunctions        userFunctions           = new UserFunctions(TestProgressLogger);
            UserCommonFunctions  userCommonFunction      = new UserCommonFunctions(TestProgressLogger);
            AdminTradePage       objAdminTradePage       = new AdminTradePage(TestProgressLogger);

            try
            {
                TestProgressLogger.StartTest();

                // Create Buy and Sell Order to set the last price
                //TestProgressLogger.LogCheckPoint(String.Format(LogMessage.PlaceOrderToSetMarketBegin, limitPrice));
                //userCommonFunction.PlaceOrdersToSetLastPrice(driver, instrument, buyTab, sellTab, buyOrderSize, limitPrice, timeInForce, Const.USER10, Const.USER11);
                //TestProgressLogger.LogCheckPoint(String.Format(LogMessage.PlaceOrderToSetMarketEnd, limitPrice));


                //Login as admin -> Click on "Trades" menu button
                objAdminFunctions.AdminLogIn(TestProgressLogger);
                objAdminCommonFunctions.SelectTradeMenu();

                //Select an instrument under trade tab
                Assert.True(objAdminTradePage.VerifyTradeOrderUnderTradesTab());
            }
            catch (NoSuchElementException ex)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace);
                // TestProgressLogger.LogError(String.Format(LogMessage.VerifyRevokeUserPermissionFailed), ex);
                throw ex;
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(e.Message + e.StackTrace);
                //TestProgressLogger.LogError(String.Format(LogMessage.VerifyRevokeUserPermissionFailed), e);
                throw e;
            }
            finally
            {
                objAdminCommonFunctions.UserMenuBtn();
                objAdminFunctions.AdminLogOut();
                TestProgressLogger.EndTest();
            }
        }
        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();
            }
        }