Exemplo n.º 1
0
        public void TC3_VerifyBuyMarketOrder()
        {
            try
            {
                instrument           = TestData.GetData("Instrument");
                buyTab               = TestData.GetData("BuyTab");
                sellTab              = TestData.GetData("SellTab");
                marketOrderBuyAmount = TestData.GetData("TC3_MarketOrderBuyAmount");
                feeComponent         = TestData.GetData("FeeComponent");
                sellOrderSize        = TestData.GetData("TC3_SellOrderSize");
                limitPrice           = TestData.GetData("TC3_LimitPrice");
                timeInForce          = TestData.GetData("TC3_TimeInForce");
                string feeValue;
                Dictionary <string, string> placeMarketBuyOrder;

                // Get fee based on buy amount and fee component
                feeValue = GenericUtils.FeeAmount(marketOrderBuyAmount, feeComponent);
                UserFunctions       userFunctions      = new UserFunctions(TestProgressLogger);
                UserCommonFunctions userCommonFunction = new UserCommonFunctions(TestProgressLogger);
                VerifyOrdersTab     objVerifyOrdersTab = new VerifyOrdersTab(driver, TestProgressLogger);
                OrderEntryPage      orderEntryPage     = new OrderEntryPage(driver, TestProgressLogger);

                TestProgressLogger.StartTest();
                // Place buy and sell order to set the last price
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.PlaceOrderToSetMarketBegin, limitPrice));
                userCommonFunction.PlaceOrdersToSetLastPrice(driver, instrument, buyTab, sellTab, sellOrderSize, limitPrice, timeInForce, Const.USER10, Const.USER11);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.PlaceOrderToSetMarketEnd, limitPrice));

                // Place Limit sell order to set the market
                userFunctions.LogIn(TestProgressLogger, Const.USER8);
                userCommonFunction.CancelAndPlaceLimitSellOrder(driver, instrument, sellTab, sellOrderSize, limitPrice, timeInForce);
                userFunctions.LogOut();
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.MarketSetupEnd, sellTab, sellOrderSize, limitPrice));

                userFunctions.LogIn(TestProgressLogger, Const.USER11);
                // Place Market buy order with the same quantity as that of sell limit order placed
                placeMarketBuyOrder = orderEntryPage.PlaceMarketBuyOrder(instrument, buyTab, Double.Parse(marketOrderBuyAmount));
                // Verify order is present in Filled Orders tab
                Assert.True(objVerifyOrdersTab.VerifyFilledOrdersTab(placeMarketBuyOrder["Instrument"], placeMarketBuyOrder["Side"], Double.Parse(placeMarketBuyOrder["BuyAmount"]), feeValue, placeMarketBuyOrder["PlaceOrderTime"], placeMarketBuyOrder["PlaceOrderTimePlusOneMin"]), Const.MarketOrderVerifiedInFilledOrders);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.MarketOrderTestPassed, buyTab));
            }
            catch (NoSuchElementException ex)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace);
                TestProgressLogger.LogError(String.Format(LogMessage.MarketOrderTestFailed, buyTab), ex);
                throw ex;
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(e.Message + e.StackTrace);
                TestProgressLogger.LogError(String.Format(LogMessage.MarketOrderTestFailed, buyTab), e);
                throw e;
            }
            finally
            {
                TestProgressLogger.EndTest();
            }
        }
        public void TC46_VerifyDeleteAPIKey()
        {
            UserFunctions   userFunctions    = new UserFunctions(TestProgressLogger);
            UserSettingPage userSettingsPage = new UserSettingPage(driver, TestProgressLogger);

            try
            {
                TestProgressLogger.StartTest();
                // Login as user -> Create and Delete the API Key
                userFunctions.LogIn(TestProgressLogger, Const.USER2);
                Assert.True(userSettingsPage.DeleteAPIKey(driver), LogMessage.DeleteAPIKeyFailureMsg);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.DeleteAPIKeySuccessMsg));
            }
            catch (NoSuchElementException ex)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace);
                TestProgressLogger.LogError(LogMessage.DeleteAPIKeyFailureMsg, ex);
                throw ex;
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(e.Message + e.StackTrace);
                TestProgressLogger.LogError(LogMessage.DeleteAPIKeyFailureMsg, e);
                throw e;
            }
            finally
            {
                TestProgressLogger.EndTest();
            }
        }
        public void TC48_VerifyCyclicReportTradeActivities()
        {
            string           reportTypeValue      = TestData.GetData("TC48_SingleReportTradeActivityValue");
            UserFunctions    objUserFunctionality = new UserFunctions(TestProgressLogger);
            TradeReportsPage objTradeReportsPage  = new TradeReportsPage(driver, TestProgressLogger);

            try
            {
                TestProgressLogger.StartTest();
                objUserFunctionality.LogIn(TestProgressLogger, Const.USER14);
                string startDate = GenericUtils.GetCurrentDate();

                //This will verify trade activities of cyclic report and their details
                Assert.True(objTradeReportsPage.VerifyCyclicReportData(reportTypeValue, startDate));
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.VerifyCyclicReportTradeActivitiesPassed, reportTypeValue));
            }
            catch (NoSuchElementException ex)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace);
                TestProgressLogger.LogError(String.Format(LogMessage.VerifyCyclicReportTradeActivitiesFailed, reportTypeValue), ex);
                throw ex;
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(e.Message + e.StackTrace);
                TestProgressLogger.LogError(String.Format(LogMessage.VerifyCyclicReportTradeActivitiesFailed, reportTypeValue), e);
                throw e;
            }
            finally
            {
                TestProgressLogger.EndTest();
            }
        }
        [Fact] //
        public void TC2_VerifyAmountPersistence()
        {
            try
            {
                instrument = TestData.GetData("Instrument");
                buyTab     = TestData.GetData("BuyTab");
                sellTab    = TestData.GetData("SellTab");

                TestProgressLogger.StartTest();
                UserFunctions userFunctions = new UserFunctions(TestProgressLogger);
                userFunctions.LogIn(TestProgressLogger, Const.USER5);
                OrderEntryPage orderEntryPage = new OrderEntryPage(driver, TestProgressLogger);
                Assert.True(orderEntryPage.VerifyOrderEntryAmountPersistence(instrument, TestData.GetData("PersistenceTestAmount")), LogMessage.DataNotBeingPersisted);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.AmountPersistenceSuccessMsg, buyTab, sellTab));
            }
            catch (NoSuchElementException ex)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogError(Const.AmountPersistenceFailureMsg, ex);
                throw ex;
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogError(Const.AmountPersistenceFailureMsg, e);
                throw e;
            }
            finally
            {
                TestProgressLogger.EndTest();
                UserFunctions userFunctionality = new UserFunctions(TestProgressLogger);
                userFunctionality.LogOut();
            }
        }
        public void TC46_VerifyDeleteAPIKey()
        {
            UserFunctions   userFunctions    = new UserFunctions(TestProgressLogger);
            UserSettingPage userSettingsPage = new UserSettingPage(driver, TestProgressLogger);

            try
            {
                TestProgressLogger.StartTest();
                userFunctions.LogIn(TestProgressLogger, Const.USER2);
                Assert.True(userSettingsPage.DeleteAPIKey(driver), LogMessage.DeleteAPIKeySuccessMsg);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.DeleteAPIKeySuccessMsg));
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogError(LogMessage.DeleteAPIKeyFailureMsg, e);
                throw e;
            }
            finally
            {
                TestProgressLogger.EndTest();
                UserFunctions userFunctionality = new UserFunctions(TestProgressLogger);
                userFunctionality.LogOut();
            }
        }
 public void TC44_VerifyCreateAPIKey()
 {
     try
     {
         TestProgressLogger.StartTest();
         UserFunctions userFunctions = new UserFunctions(TestProgressLogger);
         userFunctions.LogIn(TestProgressLogger, Const.USER1);
         UserSettingPage userSettingsPage = new UserSettingPage(driver, TestProgressLogger);
         Assert.True((userSettingsPage.SelectAPIKey()), LogMessage.CreateAPIKeyBtnIsPresent);
         TestProgressLogger.LogCheckPoint(String.Format(LogMessage.CreateAPIKeyBtnIsPresent));
         Assert.True((userSettingsPage.VerifyAPIKeyCheckboxesArePresent()), LogMessage.APIKeyCheckboxesArePresent);
         TestProgressLogger.LogCheckPoint(String.Format(LogMessage.APIKeyCheckboxesArePresent));
         Assert.True((userSettingsPage.CreateAndVerifyAPIKey()), LogMessage.APIKeyCreatedSuccessMsg);
         TestProgressLogger.LogCheckPoint(String.Format(LogMessage.APIKeyCreatedSuccessMsg));
     }
     catch (Exception e)
     {
         TestProgressLogger.TakeScreenshot();
         TestProgressLogger.LogError(LogMessage.CreateAPIKeyFailed, e);
         throw e;
     }
     finally
     {
         TestProgressLogger.EndTest();
         UserFunctions userFunctionality = new UserFunctions(TestProgressLogger);
         userFunctionality.LogOut();
     }
 }
        public void TCAdmin14_OMSOrdersHistory()
        {
            try
            {
                instrument   = TestData.GetData("Instrument");
                buyTab       = TestData.GetData("BuyTab");
                sellTab      = TestData.GetData("SellTab");
                buyOrderSize = TestData.GetData("TCAdmin14_BuyOrderSize");
                //sellOrderSize = TestData.GetData("TCAdmin13_SellOrderSize");
                buyLimitPrice = TestData.GetData("TCAdmin14_BuyLimitPrice");
                //sellLimitPrice = TestData.GetData("TCAdmin13_SellLimitPrice");
                timeInForce = TestData.GetData("TCAdmin14_TimeInForce");
                numOfOrders = TestData.GetData("TCAdmin14_NumberOfOrdersToDisplay");
                orderState  = TestData.GetData("TCAdmin14_OrderState");

                AdminFunctions              objAdminFunctions       = new AdminFunctions(TestProgressLogger);
                AdminOMSOrdersPage          adminOMSOrdersPage      = new AdminOMSOrdersPage(TestProgressLogger);
                UserFunctions               userFunctions           = new UserFunctions(TestProgressLogger);
                UserCommonFunctions         userCommonFunction      = new UserCommonFunctions(TestProgressLogger);
                AdminCommonFunctions        objAdminCommonFunctions = new AdminCommonFunctions(TestProgressLogger);
                Dictionary <string, string> userDetailsDict         = new Dictionary <string, string>();

                TestProgressLogger.StartTest();
                //userFunctions.LogIn(TestProgressLogger, Const.User8);
                // Create Buy limit order such that the order are present in open orders tab
                //userCommonFunction.CancelAndPlaceLimitBuyOrder(driver, instrument, buyTab, buyOrderSize, limitPrice, timeInForce);
                //Login as admin
                objAdminFunctions.AdminLogIn(TestProgressLogger);
                //userDetailsDict = objAdminCommonFunctions.GetUserDetails("User_3");
                // User will select the instrument from the dropdown and verify the orders placed above are present OMS orders history page or not
                //Assert.True(adminOMSOrdersPage.VerifySelectOMSOrdersHistoryInstrument("BTCUSD", numOfOrders), LogMessage.VerifySelectOMSOrdersInstrumentFailed);
                // This will verify that numbers of orders displayed is not more than the number of orders selected
                //Assert.True(adminOMSOrdersPage.VerifyNumOfOrdersOnHistorypage(numOfOrders, instrument), LogMessage.VerifyNumOfOrdersDisplayedFailed);
                // This will verify the the search functionality based on Account Id is working
                //Assert.True(adminOMSOrdersPage.VerifySearchOMSOrdersHistoryByAcountId(instrument, numOfOrders, userDetailsDict["AccountId"]), LogMessage.VerifySearchOMSOrdersByAcountIdFailed);
                // This will verify the the search functionality based on Order Id is working
                //Assert.True(adminOMSOrdersPage.VerifySearchOMSOrdersHistoryByOrderId(instrument, numOfOrders), LogMessage.VerifySearchOMSOrdersByUserIdFailed);
                Assert.True(adminOMSOrdersPage.VerifySearchRejectedOrder(instrument, numOfOrders, orderState));
            }
            catch (NoSuchElementException ex)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace);
                TestProgressLogger.LogError(LogMessage.VerifyOMSOpenOrdersTestFailed, ex);
                throw ex;
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(e.Message + e.StackTrace);
                TestProgressLogger.LogError(LogMessage.VerifyOMSOpenOrdersTestFailed, e);
                throw e;
            }
            finally
            {
                TestProgressLogger.EndTest();
            }
        }
        public void TC7_VerifyBuyStopOrder()
        {
            try
            {
                string type = Const.StopMarket;
                instrument   = TestData.GetData("Instrument");
                feeComponent = TestData.GetData("FeeComponent");
                orderType    = TestData.GetData("OrderType");
                menuTab      = TestData.GetData("MenuTab");
                buyTab       = TestData.GetData("BuyTab");
                sellTab      = TestData.GetData("SellTab");
                orderSize    = TestData.GetData("TC7_OrderSize");
                limitPrice   = TestData.GetData("TC7_LimitPrice");
                timeInForce  = TestData.GetData("TimeInForce");
                stopPrice    = TestData.GetData("TC7_StopPrice");

                TestProgressLogger.StartTest();
                UserFunctions       userFunctions      = new UserFunctions(TestProgressLogger);
                UserCommonFunctions userCommonFunction = new UserCommonFunctions(TestProgressLogger);
                OrderEntryPage      orderEntryPage     = new OrderEntryPage(driver, TestProgressLogger);
                VerifyOrdersTab     objVerifyOrdersTab = new VerifyOrdersTab(driver, TestProgressLogger);

                userCommonFunction.PlaceOrdersToSetLastPrice(driver, instrument, buyTab, sellTab, orderSize, limitPrice, timeInForce, Const.USER10, Const.USER11);

                userFunctions.LogIn(TestProgressLogger, Const.USER8);
                string askPrice = userCommonFunction.CancelAndPlaceLimitSellOrder(driver, instrument, sellTab, orderSize, limitPrice, timeInForce);
                UserCommonFunctions.ConfirmWindowOrder(askPrice, limitPrice, driver);
                userFunctions.LogOut();
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.MarketSetupEnd, sellTab, orderSize, limitPrice));

                userFunctions.LogIn(TestProgressLogger, Const.USER9);
                Dictionary <string, string> placeStopBuyOrder = orderEntryPage.PlaceStopBuyOrder(instrument, buyTab, Double.Parse(orderSize), Double.Parse(feeComponent), Double.Parse(stopPrice));
                Assert.True(objVerifyOrdersTab.VerifyOpenOrdersTab(placeStopBuyOrder["Instrument"], placeStopBuyOrder["Side"], type, Double.Parse(placeStopBuyOrder["BuyAmount"]), placeStopBuyOrder["StopPrice"], placeStopBuyOrder["PlaceOrderTime"], placeStopBuyOrder["PlaceOrderTimePlusOneMin"]));
                TestProgressLogger.LogCheckPoint(string.Format(LogMessage.BuyStopOrderSuccessMsg, buyTab));

                // This cancels all the previous open orders
                UserCommonFunctions.LoginAndCancelAllOrders(TestProgressLogger, driver, instrument, Const.USER8);
                UserCommonFunctions.LoginAndCancelAllOrders(TestProgressLogger, driver, instrument, Const.USER9);
            }
            catch (NoSuchElementException ex)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogError(LogMessage.MarketOrderTestFailed, ex);
                throw ex;
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogError(LogMessage.MarketOrderTestFailed, e);
                throw e;
            }
            finally
            {
                TestProgressLogger.EndTest();
                UserFunctions userFunctionality = new UserFunctions(TestProgressLogger);
                userFunctionality.LogOut();
            }
        }
        [Fact]      //Admin_22
        public void ExportAllAccountsBalancesCSVFile()
        {
            try
            {
                string allBalancesFileName;
                string toastMessage;

                allBalancesFileName = TestData.GetData("TCAdmin22_AccountsBalancesFileName");

                AdminFunctions       adminfunctions       = new AdminFunctions(TestProgressLogger);
                AdminCommonFunctions admincommonfunctions = new AdminCommonFunctions(TestProgressLogger);
                AdminAccountsPage    adminAccountPage     = new AdminAccountsPage(TestProgressLogger);
                GenericUtils         genericUtils         = new GenericUtils(TestProgressLogger);

                // login in admin
                adminfunctions.AdminLogIn(TestProgressLogger, Const.ADMIN1);

                // Navigate on Accounts page.
                admincommonfunctions.SelectAccountsMenu();
                admincommonfunctions.SelectAccountsBalancesTab();
                TestProgressLogger.LogCheckPoint(LogMessage.NavigateAccountPage);

                // Delete all previous file and download allaccounts csv file.
                genericUtils.DeleteAllFiles();
                toastMessage = adminAccountPage.ClickOnExportAllBalancesButton();
                TestProgressLogger.LogCheckPoint(LogMessage.DownloadAllBalancessCSVFile);

                // Verify success toast msg.
                Assert.Equal(toastMessage, Const.TCAdmin22_AllAccountBalancesDownloadSuccessfullyMSG);

                // Verify data in all balances csv file.
                Assert.True(adminAccountPage.VerifyAllBalancesCSVData(allBalancesFileName));
                TestProgressLogger.LogCheckPoint(LogMessage.VerifyAllBalancesCSVFile);

                // Logout from admin.
                admincommonfunctions.UserMenuBtn();
                adminfunctions.AdminLogOut();
            }
            catch (NoSuchElementException ex)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace);
                TestProgressLogger.LogError(LogMessage.ExportAllBalancesCSVFileTestFailed, ex);
                throw;
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(e.Message + e.StackTrace);
                TestProgressLogger.LogError(LogMessage.ExportAllBalancesCSVFileTestFailed, e);
                throw e;
            }
            finally
            {
                TestProgressLogger.EndTest();
            }
        }
        [Fact]      //Admin_31
        public void VerifyShowDepositKeys()
        {
            try
            {
                string accountId;
                string toastMessage;
                string product;
                string accountProvider;
                string fiatCurrency;
                product         = TestData.GetData("TCAdmin31_Product");
                accountProvider = TestData.GetData("TCAdmin31_AccountProvider");
                fiatCurrency    = TestData.GetData("TCAdmin31_FiatCurrency");
                accountId       = TestData.GetData("TCAdmin31_AccountID");
                AdminFunctions       adminfunctions       = new AdminFunctions(TestProgressLogger);
                AdminCommonFunctions admincommonfunctions = new AdminCommonFunctions(TestProgressLogger);
                AdminAccountsPage    adminAccountPage     = new AdminAccountsPage(TestProgressLogger);

                // Login in admin
                adminfunctions.AdminLogIn(TestProgressLogger, Const.ADMIN1);
                // This method is used to navigate to accounts page and select the accountId passed
                adminAccountPage.GetAccountDetailsByAccountId(accountId);
                // Submit Show Deposit Keys
                adminAccountPage.SubmitDepositKeys(product, accountProvider);
                // Verify Create DepositKey Toast success msg
                toastMessage = adminAccountPage.CreateDepositKeyToastMessage();
                Assert.Equal(Const.DepositKeySuccessMsg, toastMessage);
                TestProgressLogger.LogCheckPoint(LogMessage.VerifyToastMSG);
                // Verify No FIAT is listed in the product droplist
                Assert.True(adminAccountPage.VerifyFIATCurrencyIsNotPresent(fiatCurrency));
                // Verify multiple Deposit Key can be created
                Assert.True(adminAccountPage.VerifyMultipleDepositKey());
                // Verify Copy button functionality is working
                Assert.True(adminAccountPage.VerifyCopyDepositKey());
                // Logout from admin.
                admincommonfunctions.UserMenuBtn();
                adminfunctions.AdminLogOut();
            }
            catch (NoSuchElementException ex)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace);
                TestProgressLogger.LogError(LogMessage.VerifyShowDepositKeysTestFailed, ex);
                throw;
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(e.Message + e.StackTrace);
                TestProgressLogger.LogError(LogMessage.VerifyShowDepositKeysTestFailed, e);
                throw e;
            }
            finally
            {
                TestProgressLogger.EndTest();
            }
        }
Exemplo n.º 11
0
        public void TCAdmin6_VerifyRevokeUserPermissionTest()
        {
            revokeUserPermission = TestData.GetData("TCAdmin6_RevokeUserPermission");
            string username;

            AdminFunctions       objAdminFunctions       = new AdminFunctions(TestProgressLogger);
            AdminCommonFunctions objAdminCommonFunctions = new AdminCommonFunctions(TestProgressLogger);
            AdminUsersPage       objAdminUsersPage       = new AdminUsersPage(TestProgressLogger);

            try
            {
                TestProgressLogger.StartTest();
                //Login as admin -> Click on "Users" menu button
                objAdminFunctions.AdminLogIn(TestProgressLogger);
                objAdminCommonFunctions.ClickOnUsersMenuLink();
                objAdminCommonFunctions.UsersTabBtn();

                ////This will get the user name from the user list under Users Tab and click on any user under Users Tab
                username = objAdminCommonFunctions.getUserNameFromUserList();
                objAdminCommonFunctions.SelectUserFromUserList(driver, username);

                //Click on "Revok" button under user permission window section and observed the message
                objAdminUsersPage.ClickOnRevokePermissionButton();

                //Click on "Add Permission" button -> verify all if selected reovked user permissions present in the list of user permission
                objAdminCommonFunctions.UserPermissionButton();
                objAdminCommonFunctions.RevokedUserPermissions(revokeUserPermission);

                //Close the permission window section
                objAdminCommonFunctions.ClosePermissionWindow();
            }

            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 TC4_VerifySellMarketOrder()
        {
            try
            {
                instrument            = TestData.GetData("Instrument");
                marketOrderSellAmount = TestData.GetData("TC4_MarketOrderSellAmount");
                feeComponent          = TestData.GetData("FeeComponent");
                orderType             = TestData.GetData("OrderType");
                menuTab      = TestData.GetData("MenuTab");
                buyTab       = TestData.GetData("BuyTab");
                sellTab      = TestData.GetData("SellTab");
                buyOrderSize = TestData.GetData("TC4_MarketOrderBuyAmount");
                limitPrice   = TestData.GetData("TC4_LimitPrice");
                timeInForce  = TestData.GetData("TimeInForce");


                UserFunctions       userFunctions      = new UserFunctions(TestProgressLogger);
                UserCommonFunctions userCommonFunction = new UserCommonFunctions(TestProgressLogger);
                OrderEntryPage      orderEntryPage     = new OrderEntryPage(driver, TestProgressLogger);
                string feeValue = GenericUtils.SellFeeAmount(buyOrderSize, limitPrice, feeComponent);

                TestProgressLogger.StartTest();
                userCommonFunction.PlaceOrdersToSetLastPrice(driver, instrument, buyTab, sellTab, buyOrderSize, limitPrice, timeInForce, Const.USER10, Const.USER11);
                userFunctions.LogIn(TestProgressLogger, Const.USER8);
                userCommonFunction.CancelAndPlaceLimitBuyOrder(driver, instrument, buyTab, buyOrderSize, limitPrice, timeInForce);
                userFunctions.LogOut();
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.MarketSetupEnd, buyTab, buyOrderSize, limitPrice));

                userFunctions.LogIn(TestProgressLogger, Const.USER11);
                Dictionary <string, string> placeMarketSellOrder = orderEntryPage.PlaceMarketSellOrder(instrument, sellTab, Double.Parse(marketOrderSellAmount), Double.Parse(feeComponent));
                VerifyOrdersTab             objVerifyOrdersTab   = new VerifyOrdersTab(driver, TestProgressLogger);
                Assert.True(objVerifyOrdersTab.VerifyFilledOrdersTab(placeMarketSellOrder["Instrument"], placeMarketSellOrder["Side"], Double.Parse(placeMarketSellOrder["SellAmount"]), feeValue, placeMarketSellOrder["PlaceOrderTime"], placeMarketSellOrder["PlaceOrderTimePlusOneMin"]), Const.MarketOrderVerifiedInFilledOrders);
                TestProgressLogger.LogCheckPoint(string.Format(LogMessage.SellMarketOrderSuccessMsg));
            }
            catch (NoSuchElementException ex)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogError(LogMessage.MarketOrderTestFailed, ex);
                throw ex;
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogError(LogMessage.MarketOrderTestFailed, e);
                throw e;
            }
            finally
            {
                TestProgressLogger.EndTest();
                UserFunctions userFunctionality = new UserFunctions(TestProgressLogger);
                userFunctionality.LogOut();
            }
        }
        [Fact]      //Admin_33
        public void VerifyAccountBalances()
        {
            try
            {
                string accountId;
                string toastMessage;
                string product;
                string accountProvider;
                string fiatCurrency;
                product         = TestData.GetData("TCAdmin31_Product");
                accountProvider = TestData.GetData("TCAdmin31_AccountProvider");
                fiatCurrency    = TestData.GetData("TCAdmin31_FiatCurrency");
                accountId       = TestData.GetData("TCAdmin31_AccountID");
                AdminFunctions       adminfunctions       = new AdminFunctions(TestProgressLogger);
                AdminCommonFunctions admincommonfunctions = new AdminCommonFunctions(TestProgressLogger);
                AdminAccountsPage    adminAccountPage     = new AdminAccountsPage(TestProgressLogger);

                // Login in admin
                adminfunctions.AdminLogIn(TestProgressLogger, Const.ADMIN1);
                // Preconditions: Submit Ledger Entry for an account and product combination
                // Navigate on Accounts page.
                admincommonfunctions.SelectAccountsMenu();
                admincommonfunctions.ClickOnAccountBalancesTab();
                adminAccountPage.VerifyAccountBalancesPagination();
                // Verify that filter by product functionality is working
                adminAccountPage.VerifyFilterByProduct("USD");
                //

                // Logout from admin.
                admincommonfunctions.UserMenuBtn();
                adminfunctions.AdminLogOut();
            }
            catch (NoSuchElementException ex)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace);
                TestProgressLogger.LogError(LogMessage.VerifyShowDepositKeysTestFailed, ex);
                throw;
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(e.Message + e.StackTrace);
                TestProgressLogger.LogError(LogMessage.VerifyShowDepositKeysTestFailed, e);
                throw e;
            }
            finally
            {
                TestProgressLogger.EndTest();
            }
        }
Exemplo n.º 14
0
        public void TC45_VerifyAffiliateProgram()
        {
            string               userByID                = TestData.GetData("TC45_UserByID");
            string               affiliateTagID          = TestData.GetData("TC45_AffiliateTagID");
            string               verificationLevel       = TestData.GetData("TC45_VerificationLevel");
            AdminFunctions       objAdminFunctions       = new AdminFunctions(TestProgressLogger);
            UserFunctions        userFunctions           = new UserFunctions(TestProgressLogger);
            AdminCommonFunctions objAdminCommonFunctions = new AdminCommonFunctions(TestProgressLogger);
            UserSettingPage      userSettingsPage        = new UserSettingPage(driver, TestProgressLogger);

            try
            {
                TestProgressLogger.StartTest();
                // Login as admin
                objAdminFunctions.AdminLogIn(TestProgressLogger);
                // Select user by entering UserID
                objAdminCommonFunctions.ClickOnUsersMenuLink();
                objAdminCommonFunctions.UserByIDText(userByID);
                objAdminCommonFunctions.OpenUserButton();
                // Create Affiliate tag for the user
                objAdminCommonFunctions.AffiliateTagCreation(affiliateTagID);
                objAdminCommonFunctions.UserMenuBtn();
                objAdminFunctions.AdminLogOut();

                // Login as the user mentioned above and verify Affiliate program functionality
                userFunctions.LogIn(TestProgressLogger, Const.USER12);
                Assert.True(userSettingsPage.VerifyAffiliateProgramFunctionality(driver, verificationLevel), LogMessage.AffiliateProgramFailureMsg);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.AffiliateProgramSuccessMsg));
            }
            catch (NoSuchElementException ex)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace);
                TestProgressLogger.LogError(LogMessage.AffiliateProgramFailureMsg, ex);
                throw ex;
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(e.Message + e.StackTrace);
                TestProgressLogger.LogError(LogMessage.AffiliateProgramFailureMsg, e);
                throw e;
            }
            finally
            {
                TestProgressLogger.EndTest();
            }
        }
Exemplo n.º 15
0
        public void TCAdmin37_VerifyUserAPIKeysCreationDeletionTest()
        {
            string username;

            accountIdText   = TestData.GetData("TCAdmin19_AccountIdTextValue");
            entereAccountId = TestData.GetData("TCAdmin19_EnterAccountId");

            AdminFunctions       objAdminFunctions       = new AdminFunctions(TestProgressLogger);
            AdminCommonFunctions objAdminCommonFunctions = new AdminCommonFunctions(TestProgressLogger);
            AdminUsersPage       objAdminUsersPage       = new AdminUsersPage(TestProgressLogger);

            try
            {
                TestProgressLogger.StartTest();
                //Login as admin -> Click on "Users" menu button -> Users Tab
                objAdminUsersPage.SelectAdminUserTab();

                //Select an user from the user list and click on it
                username = objAdminCommonFunctions.getUserNameFromUserList();
                objAdminCommonFunctions.SelectUserFromUserList(driver, username);

                //Verify if entered value in accountId textfield loads the values in userTable dynamically and load the page
                Assert.True(objAdminUsersPage.VerifyAPIKeys());
            }
            catch (NoSuchElementException ex)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace);
                TestProgressLogger.LogError(String.Format(LogMessage.VerifyCreationDeletionUserKeyFailed), ex);
                throw ex;
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(e.Message + e.StackTrace);
                TestProgressLogger.LogError(String.Format(LogMessage.VerifyCreationDeletionUserKeyFailed), e);
                throw e;
            }
            finally
            {
                objAdminCommonFunctions.UserMenuBtn();
                objAdminFunctions.AdminLogOut();
                TestProgressLogger.EndTest();
            }
        }
Exemplo n.º 16
0
        public void TCAdmin16_VerifyFilterByUserId()
        {
            enterUserId   = TestData.GetData("TCAdmin16_EnterUserId");
            userIdText    = TestData.GetData("TCAdmin16_UserIdTextValue");
            EmailText     = TestData.GetData("TCAdmin16_EmailTextValue");
            AccountIdText = TestData.GetData("TCAdmin16_AccountIdTextValue");

            AdminFunctions       objAdminFunctions       = new AdminFunctions(TestProgressLogger);
            AdminCommonFunctions objAdminCommonFunctions = new AdminCommonFunctions(TestProgressLogger);
            AdminUsersPage       objAdminUsersPage       = new AdminUsersPage(TestProgressLogger);

            try
            {
                TestProgressLogger.StartTest();
                //Login as admin -> Click on "Users" menu button -> Users Tab
                objAdminUsersPage.SelectAdminUserTab();

                //Click on "ViewAll" button
                objAdminUsersPage.ClickOnViewAllButton();

                //Verify if entered value in userId textfield loads the values in userTable dynamically and load the page
                Assert.True(objAdminUsersPage.VerifyUserIdResultsLoad(enterUserId, userIdText));
            }

            catch (NoSuchElementException ex)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace);
                TestProgressLogger.LogError(String.Format(LogMessage.VerifyFilteredByFailed, userIdText), ex);
                throw ex;
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(e.Message + e.StackTrace);
                TestProgressLogger.LogError(String.Format(LogMessage.VerifyFilteredByFailed, userIdText), e);
                throw e;
            }
            finally
            {
                objAdminCommonFunctions.UserMenuBtn();
                objAdminFunctions.AdminLogOut();
                TestProgressLogger.EndTest();
            }
        }
Exemplo n.º 17
0
        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();
            }
        }
Exemplo n.º 18
0
        public void TCAdmin28_VerifyExportedByPermissionsDataTest()
        {
            selectByPermissionOption = TestData.GetData("TCAdmin28_SelectByPermissionOption");
            selectUserPermission     = TestData.GetData("TCAdmin28_SelectUserPermission");
            byPermissionUserIdValue  = TestData.GetData("TCAdmin28_UserId");

            AdminFunctions       objAdminFunctions       = new AdminFunctions(TestProgressLogger);
            AdminCommonFunctions objAdminCommonFunctions = new AdminCommonFunctions(TestProgressLogger);
            AdminUsersPage       objAdminUsersPage       = new AdminUsersPage(TestProgressLogger);
            GenericUtils         genericUtils            = new GenericUtils(TestProgressLogger);

            try
            {
                TestProgressLogger.StartTest();

                // This method is used to Delete all files from the Folder
                genericUtils.DeleteAllFiles();
                // Login as admin -> Click on "Users" menu button -> Users Tab
                objAdminUsersPage.SelectAdminUserTab();
                // Verify the "All users" exported csv file in the Admin UI
                Assert.True(objAdminUsersPage.VerifyExportByPermission(selectByPermissionOption, byPermissionUserIdValue, selectUserPermission));
            }
            catch (NoSuchElementException ex)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace);
                TestProgressLogger.LogError(String.Format(LogMessage.VerifyByPermissionExportedCSVFileFailed), ex);
                throw ex;
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(e.Message + e.StackTrace);
                TestProgressLogger.LogError(String.Format(LogMessage.VerifyByPermissionExportedCSVFileFailed), e);
                throw e;
            }
            finally
            {
                objAdminCommonFunctions.UserMenuBtn();
                objAdminFunctions.AdminLogOut();
                TestProgressLogger.EndTest();
            }
        }
        public void TCAdmin5_VerifyUserPermissionConfigureTest()
        {
            submitBlockTradePermission = TestData.GetData("TCAdmin5_SubmitBlockTradePermission");

            string               username;
            AdminFunctions       objAdminFunctions       = new AdminFunctions(TestProgressLogger);
            AdminCommonFunctions objAdminCommonFunctions = new AdminCommonFunctions(TestProgressLogger);

            try
            {
                TestProgressLogger.StartTest();

                //Login as admin -> Click on "Users" menu button
                objAdminFunctions.AdminLogIn(TestProgressLogger);
                objAdminCommonFunctions.ClickOnUsersMenuLink();
                objAdminCommonFunctions.UsersTabBtn();
                username = objAdminCommonFunctions.getUserNameFromUserList();
                objAdminCommonFunctions.SelectUserFromUserList(driver, username);
                objAdminCommonFunctions.UserPermissionButton();
                objAdminCommonFunctions.AddSubmitBlockTradePermissions(submitBlockTradePermission);
            }

            catch (NoSuchElementException ex)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace);
                TestProgressLogger.LogError(String.Format(LogMessage.VerifyAddUserPassed), ex);
                throw ex;
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(e.Message + e.StackTrace);
                TestProgressLogger.LogError(String.Format(LogMessage.VerifyAddUserFailed), e);
                throw e;
            }
            finally
            {
                TestProgressLogger.EndTest();
            }
        }
        public void TC45_VerifyAffiliateProgram()
        {
            string userByID          = TestData.GetData("TC45_UserByID");
            string affiliateTagID    = TestData.GetData("TC45_AffiliateTagID");
            string verificationLevel = TestData.GetData("TC45_VerificationLevel");

            TestProgressLogger.StartTest();
            AdminFunctions       objAdminFunctions       = new AdminFunctions(TestProgressLogger);
            UserFunctions        userFunctions           = new UserFunctions(TestProgressLogger);
            AdminCommonFunctions objAdminCommonFunctions = new AdminCommonFunctions(TestProgressLogger);
            UserSettingPage      userSettingsPage        = new UserSettingPage(driver, TestProgressLogger);

            try
            {
                objAdminFunctions.AdminLogIn(TestProgressLogger);
                objAdminCommonFunctions.ClickOnUsersMenuLink();
                objAdminCommonFunctions.UserByIDText(userByID);
                objAdminCommonFunctions.OpenUserButton();
                objAdminCommonFunctions.AffiliateTagCreation(affiliateTagID);
                objAdminCommonFunctions.UserMenuBtn();
                objAdminFunctions.AdminLogOut();
                userFunctions.LogIn(TestProgressLogger, Const.USER12);
                Assert.True(userSettingsPage.VerifyAffiliateProgramFunctionality(driver, verificationLevel));
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.AffiliateProgramSuccessMsg));
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogError(LogMessage.AffiliateProgramFailureMsg, e);
                throw e;
            }
            finally
            {
                TestProgressLogger.EndTest();
                UserFunctions userFunctionality = new UserFunctions(TestProgressLogger);
                userFunctionality.LogOut();
            }
        }
Exemplo n.º 21
0
        public void TC44_VerifyCreateAPIKey()
        {
            try
            {
                TestProgressLogger.StartTest();
                UserFunctions   userFunctions    = new UserFunctions(TestProgressLogger);
                UserSettingPage userSettingsPage = new UserSettingPage(driver, TestProgressLogger);
                userFunctions.LogIn(TestProgressLogger, Const.USER1);
                // Login -> navigate to User Settings and Select API Key
                Assert.True((userSettingsPage.SelectAPIKey()), LogMessage.CreateAPIKeyBtnIsNotPresent);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.CreateAPIKeyBtnIsPresent));
                // Verify that the checkboxes are present
                Assert.True((userSettingsPage.VerifyAPIKeyCheckboxesArePresent()), LogMessage.APIKeyCheckboxesAreNotPresent);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.APIKeyCheckboxesArePresent));
                // Create API key and verify the key is created successfully
                Assert.True((userSettingsPage.CreateAndVerifyAPIKey()), LogMessage.APIKeyCreatedFailureMsg);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.APIKeyCreatedSuccessMsg));
            }
            catch (NoSuchElementException ex)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace);
                TestProgressLogger.LogError(LogMessage.CreateAPIKeyFailed, ex);

                throw;
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(e.Message + e.StackTrace);
                TestProgressLogger.LogError(LogMessage.CreateAPIKeyFailed, e);
                throw e;
            }
            finally
            {
                TestProgressLogger.EndTest();
            }
        }
        [Fact]      //Admin_4
        public void ManualWithdraw()
        {
            try
            {
                string accountId;
                string USDCurrency;
                string holdAmountField;
                string pendingWithdrawsField;
                string holdAmountBeforeWithdraw;
                string pendingWithdrawsAmtBeforeWithdraw;
                string expectedIncreasedPendingAmount;
                string pendingWithdrawsAmtAfterWithdraw;
                string amount;
                string fullName;
                string language;
                string comment;
                string bankAddress;
                string bankAccountNumber;
                string bankAccountName;
                string swiftCode;
                string toastMessage;
                string recentTicketID;
                string ticketIDValue;
                string dailyWithdrawAmountBeforeAccept;
                string dailyWithdrawAmountAfterAccept;
                string monthlyWithdrawAmountBeforeAccept;
                string monthlyWithdrawAmountAfterAccept;
                string dailyWithdrawsField;
                string monthlyWithdrawsField;
                string pendingWithdrawsAmtAfterAccept;

                accountId             = TestData.GetData("TCAdmin4_UserAccountID");
                USDCurrency           = TestData.GetData("USDCurrency");
                holdAmountField       = TestData.GetData("TCAdmin4_HoldAmountField");
                pendingWithdrawsField = TestData.GetData("TCAdmin4_PendingWithdrawsField");
                dailyWithdrawsField   = TestData.GetData("TCAdmin4_DailyWithdrawsField");
                monthlyWithdrawsField = TestData.GetData("TCAdmin4_MonthlyWithdrawsField");
                amount            = TestData.GetData("TCAdmin4_Amount");
                fullName          = TestData.GetData("TCAdmin4_FullName");
                language          = TestData.GetData("TCAdmin4_Language");
                comment           = TestData.GetData("TCAdmin4_Comment");
                bankAddress       = TestData.GetData("TCAdmin4_BankAddress");
                bankAccountNumber = TestData.GetData("TCAdmin4_BankAccountNumber");
                bankAccountName   = TestData.GetData("TCAdmin4_BankAccountName");
                swiftCode         = TestData.GetData("TCAdmin4_SwiftCode");
                ticketIDValue     = TestData.GetData("TCAdmin4_TicketIDValue");

                AdminFunctions       adminfunctions       = new AdminFunctions(TestProgressLogger);
                AdminCommonFunctions admincommonfunctions = new AdminCommonFunctions(TestProgressLogger);
                AdminAccountsPage    adminAccountPage     = new AdminAccountsPage(TestProgressLogger);
                AdminTicketsPage     admintickets         = new AdminTicketsPage();

                // login in admin
                adminfunctions.AdminLogIn(TestProgressLogger, Const.ADMIN1);

                // Navigate on Accounts page.
                admincommonfunctions.SelectAccountsMenu();
                admincommonfunctions.SelectAccountsTab();
                TestProgressLogger.LogCheckPoint(LogMessage.NavigateAccountPage);

                // Click on ViewAll and search by accountid and double click.
                adminAccountPage.ClickOnViewAll(driver);
                adminAccountPage.SearchByAccountID(driver, accountId);
                adminAccountPage.DoubleClickOnAccountName(driver, accountId);
                TestProgressLogger.LogCheckPoint(string.Format(LogMessage.NavigateAccountPage, accountId));

                // Get balances before manual withdraw.
                Dictionary <string, string> balancesData = adminAccountPage.GetBalances(driver, USDCurrency);
                holdAmountBeforeWithdraw          = balancesData.GetValueOrDefault(holdAmountField);
                pendingWithdrawsAmtBeforeWithdraw = balancesData.GetValueOrDefault(pendingWithdrawsField);

                // Click on manual Withdraw button and enter details in modal.
                adminAccountPage.ClickOnManualWithdrawButton(driver);
                adminAccountPage.ManualWithdrawUSD(driver, USDCurrency, amount, fullName, language, comment, bankAddress, bankAccountNumber, bankAccountName, swiftCode);
                TestProgressLogger.LogCheckPoint(string.Format(LogMessage.ManualWithdrawUSD, amount));

                expectedIncreasedPendingAmount = GenericUtils.AddTwoValue(pendingWithdrawsAmtBeforeWithdraw, amount);

                // Verify withdraw success msg.
                toastMessage = UserCommonFunctions.GetTextOfToastMessageInAdmin(driver, TestProgressLogger);
                Assert.Equal(Const.TCA4_WithdrawTicketSuccessfullyMSG, toastMessage);
                TestProgressLogger.LogCheckPoint(LogMessage.VerifyToastMSG);
                adminAccountPage.ClickOnRefreshInUserAccountSection(driver);

                // Get balances after manual withdraw.
                Dictionary <string, string> balancesDataAfter = adminAccountPage.GetBalances(driver, USDCurrency);
                pendingWithdrawsAmtAfterWithdraw  = balancesDataAfter.GetValueOrDefault(pendingWithdrawsField);
                dailyWithdrawAmountBeforeAccept   = balancesDataAfter.GetValueOrDefault(dailyWithdrawsField);
                monthlyWithdrawAmountBeforeAccept = balancesDataAfter.GetValueOrDefault(monthlyWithdrawsField);

                // Verify increased pending amount after manual withdraw.
                Assert.Equal(expectedIncreasedPendingAmount, pendingWithdrawsAmtAfterWithdraw);
                TestProgressLogger.LogCheckPoint(LogMessage.VerifyIncreasedPendingWithdrawAmt);

                recentTicketID = adminAccountPage.GetRecentTicketID(driver, USDCurrency, amount);

                // Navigate on Ticket-> Withdraw page and click on refresh button.
                admincommonfunctions.SelectTicketsMenu();
                admincommonfunctions.NavigateToWithdrawTicketsTab();
                admincommonfunctions.ClickOnRefreshButtonOnTicketsPage();
                TestProgressLogger.LogCheckPoint(LogMessage.NavigateTicketsPage);

                //Verify created ticket in tickets-> withdraw page.
                Dictionary <string, string> withdrawTicketsFields = admintickets.GetWithdrawTicketsFieldsByTicketID(driver, recentTicketID);
                Assert.Equal(recentTicketID, withdrawTicketsFields.GetValueOrDefault(ticketIDValue));
                admincommonfunctions.ClickOnTicketFromWithdrawTicketList(withdrawTicketsFields.GetValueOrDefault(ticketIDValue));
                admincommonfunctions.ClickOnAcceptButtonFromDepositsTicketModal();
                TestProgressLogger.LogCheckPoint(LogMessage.CreatedTicketsVerified);

                // Navigate on Accounts page.
                admincommonfunctions.SelectAccountsMenu();
                adminAccountPage.ClickOnRefreshInUserAccountSection(driver);
                TestProgressLogger.LogCheckPoint(LogMessage.NavigateAccountPage);

                // Get balances after accept ticket.
                Dictionary <string, string> balancesDataAfterAccept = adminAccountPage.GetBalances(driver, USDCurrency);
                pendingWithdrawsAmtAfterAccept   = balancesDataAfterAccept.GetValueOrDefault(pendingWithdrawsField);
                dailyWithdrawAmountAfterAccept   = balancesDataAfterAccept.GetValueOrDefault(dailyWithdrawsField);
                monthlyWithdrawAmountAfterAccept = balancesDataAfterAccept.GetValueOrDefault(monthlyWithdrawsField);

                // Verify pending withdraws, daily withdraw and monthly withdraw amount after accept ticket.
                Assert.Equal(GenericUtils.SubtractTwoValue(pendingWithdrawsAmtAfterWithdraw, amount), pendingWithdrawsAmtAfterAccept);
                Assert.Equal(GenericUtils.AddTwoValue(dailyWithdrawAmountBeforeAccept, amount), dailyWithdrawAmountAfterAccept);
                Assert.Equal(GenericUtils.AddTwoValue(monthlyWithdrawAmountBeforeAccept, amount), monthlyWithdrawAmountAfterAccept);
                TestProgressLogger.LogCheckPoint(LogMessage.VerifiedDailyAndMonthlyWithdraw);

                // Logout from admin.
                admincommonfunctions.UserMenuBtn();
                adminfunctions.AdminLogOut();
            }
            catch (NoSuchElementException ex)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace);
                TestProgressLogger.LogError(LogMessage.ManualWithdrawTestFailed, ex);

                throw;
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(e.Message + e.StackTrace);
                TestProgressLogger.LogError(LogMessage.ManualWithdrawTestFailed, e);
                throw e;
            }
            finally
            {
                TestProgressLogger.EndTest();
            }
        }
        [Fact]      //Admin_7
        public void AddBadgeToAccount()
        {
            try
            {
                string accountId;
                string badgeNumber;
                string actualBadgeNumber;

                accountId   = TestData.GetData("TCAdmin4_UserAccountID");
                badgeNumber = TestData.GetData("TCAdmin7_BadgeNumber");


                AdminFunctions       adminfunctions       = new AdminFunctions(TestProgressLogger);
                AdminCommonFunctions admincommonfunctions = new AdminCommonFunctions(TestProgressLogger);
                AdminAccountsPage    adminAccountPage     = new AdminAccountsPage(TestProgressLogger);

                // login in admin
                adminfunctions.AdminLogIn(TestProgressLogger, Const.ADMIN1);

                // Navigate on Accounts page.
                admincommonfunctions.SelectAccountsMenu();
                admincommonfunctions.SelectAccountsTab();
                TestProgressLogger.LogCheckPoint(LogMessage.NavigateAccountPage);

                // Click on ViewAll and search by accountid and double click.
                adminAccountPage.ClickOnViewAll(driver);
                adminAccountPage.SearchByAccountID(driver, accountId);
                adminAccountPage.DoubleClickOnAccountName(driver, accountId);
                TestProgressLogger.LogCheckPoint(string.Format(LogMessage.NavigateAccountPage, accountId));

                // Add new badge.
                adminAccountPage.AddNewBadge(driver, badgeNumber);
                actualBadgeNumber = adminAccountPage.GetTextOfAccountBadges(driver);

                // Verify added badge.
                Assert.Equal(badgeNumber, actualBadgeNumber);
                TestProgressLogger.LogCheckPoint(string.Format(LogMessage.VerifiedBadgeAdded, accountId));

                // Delete Added badge.
                adminAccountPage.DeleteAccountBadge(driver);
                adminAccountPage.ClickOnYesButton(driver);

                // Logout from admin.
                admincommonfunctions.UserMenuBtn();
                adminfunctions.AdminLogOut();
            }
            catch (NoSuchElementException ex)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace);
                TestProgressLogger.LogError(LogMessage.AddBadgeToAccountTestFailed, ex);
                throw;
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(e.Message + e.StackTrace);
                TestProgressLogger.LogError(LogMessage.AddBadgeToAccountTestFailed, e);
                throw e;
            }
            finally
            {
                TestProgressLogger.EndTest();
            }
        }
        [Fact]      //Admin_8
        public void VerifyOpenOrderUnderOMSOpenOrders()
        {
            try
            {
                string accountId;
                string instrument;
                string buyTab;
                string buyOrderSize;
                string limitPrice;
                string timeInForce;
                string quantity;
                string price;

                instrument   = TestData.GetData("Instrument");
                limitPrice   = TestData.GetData("TCAdmin8_LimitPrice");
                timeInForce  = TestData.GetData("TimeInForce");
                buyTab       = TestData.GetData("BuyTab");
                buyOrderSize = TestData.GetData("TCAdmin8_BuyOrderSize");
                accountId    = TestData.GetData("TCAdmin4_UserAccountID");
                quantity     = TestData.GetData("TCAdmin8_QunatityField");
                price        = TestData.GetData("TCAdmin8_PriceField");

                AdminFunctions       adminfunctions       = new AdminFunctions(TestProgressLogger);
                AdminCommonFunctions admincommonfunctions = new AdminCommonFunctions(TestProgressLogger);
                AdminAccountsPage    adminAccountPage     = new AdminAccountsPage(TestProgressLogger);
                UserFunctions        userFunctions        = new UserFunctions(TestProgressLogger);
                UserCommonFunctions  userCommonFunction   = new UserCommonFunctions(TestProgressLogger);

                // Place sell order to set up market
                userFunctions.LogIn(TestProgressLogger, Const.USER17);
                userCommonFunction.CancelAndPlaceLimitBuyOrder(driver, instrument, buyTab, buyOrderSize, limitPrice, timeInForce);
                TestProgressLogger.LogCheckPoint(LogMessage.PlaceBuyOrder);

                // login in admin
                adminfunctions.AdminLogIn(TestProgressLogger, Const.ADMIN1);

                // Navigate on Accounts page.
                admincommonfunctions.SelectAccountsMenu();
                admincommonfunctions.SelectAccountsTab();
                TestProgressLogger.LogCheckPoint(LogMessage.NavigateAccountPage);

                // Click on ViewAll and search by accountid and double click.
                adminAccountPage.ClickOnViewAll(driver);
                adminAccountPage.SearchByAccountID(driver, accountId);
                adminAccountPage.DoubleClickOnAccountName(driver, accountId);
                TestProgressLogger.LogCheckPoint(string.Format(LogMessage.NavigateAccountPage, accountId));

                // Verify price and quantity under open order section.
                Dictionary <string, string> orderData = adminAccountPage.GetOpenOrdersInAccountsPage(driver);
                Assert.Equal(GenericUtils.ConvertStringToDecimalFormat(buyOrderSize), orderData.GetValueOrDefault(quantity));
                Assert.Equal(limitPrice, orderData.GetValueOrDefault(price));
                TestProgressLogger.LogCheckPoint(LogMessage.VerifyPriceAndQuantityInOpenOrder);

                // Click on showall link under open order section.
                adminAccountPage.ClickShowAllUnderOpenOrderSection(driver);

                // Verify price and quantity in account order page.
                Dictionary <string, string> orderDataAccountOrder = adminAccountPage.GetPriceAndQuantityInAccountOrderPage(driver);
                Assert.Equal(GenericUtils.ConvertStringToDecimalFormat(buyOrderSize), orderDataAccountOrder.GetValueOrDefault(quantity));
                Assert.Equal(limitPrice, orderDataAccountOrder.GetValueOrDefault(price));
                TestProgressLogger.LogCheckPoint(LogMessage.VerifyPriceAndQuantityInAccountOrder);

                // Logout from admin.
                admincommonfunctions.UserMenuBtn();
                adminfunctions.AdminLogOut();
            }
            catch (NoSuchElementException ex)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace);
                TestProgressLogger.LogError(LogMessage.VerifyOpenOrderUnderOMSOpenOrdersTestFailed, ex);
                throw;
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(e.Message + e.StackTrace);
                TestProgressLogger.LogError(LogMessage.VerifyOpenOrderUnderOMSOpenOrdersTestFailed, e);
                throw e;
            }
            finally
            {
                TestProgressLogger.EndTest();
            }
        }
        [Fact]      //Admin_9
        public void VerifyReportsDownloadedExportToCSV()
        {
            try
            {
                string accountId;
                string instrument;
                string buyTab;
                string buyOrderSize;
                string limitPrice;
                string timeInForce;
                string quantity;
                string price;
                string orderID;
                string openOrderFileName;
                string accountActivityFileName;
                string orderHistoryFileName;
                bool   accountActivityVal;

                instrument              = TestData.GetData("Instrument");
                limitPrice              = TestData.GetData("TCAdmin8_LimitPrice");
                timeInForce             = TestData.GetData("TimeInForce");
                buyTab                  = TestData.GetData("BuyTab");
                buyOrderSize            = TestData.GetData("TCAdmin8_BuyOrderSize");
                accountId               = TestData.GetData("TCAdmin4_UserAccountID");
                quantity                = TestData.GetData("TCAdmin8_QunatityField");
                price                   = TestData.GetData("TCAdmin8_PriceField");
                openOrderFileName       = TestData.GetData("TCAdmin9_OpenOrderFileName");
                accountActivityFileName = TestData.GetData("TCAdmin9_AccountActivityFileName");
                orderHistoryFileName    = TestData.GetData("TCAdmin9_AccountOrderHistoryFileName");

                AdminFunctions       adminfunctions       = new AdminFunctions(TestProgressLogger);
                AdminCommonFunctions admincommonfunctions = new AdminCommonFunctions(TestProgressLogger);
                AdminAccountsPage    adminAccountPage     = new AdminAccountsPage(TestProgressLogger);
                UserFunctions        userFunctions        = new UserFunctions(TestProgressLogger);
                UserCommonFunctions  userCommonFunction   = new UserCommonFunctions(TestProgressLogger);
                GenericUtils         genericUtils         = new GenericUtils(TestProgressLogger);

                // Place sell order to set up market
                userFunctions.LogIn(TestProgressLogger, Const.USER17);
                userCommonFunction.CancelAndPlaceLimitBuyOrder(driver, instrument, buyTab, buyOrderSize, limitPrice, timeInForce);
                TestProgressLogger.LogCheckPoint(LogMessage.PlaceBuyOrder);

                // login in admin
                adminfunctions.AdminLogIn(TestProgressLogger, Const.ADMIN1);

                // Navigate on Accounts page.
                admincommonfunctions.SelectAccountsMenu();
                admincommonfunctions.SelectAccountsTab();
                TestProgressLogger.LogCheckPoint(LogMessage.NavigateAccountPage);

                // Click on ViewAll and search by accountid and double click.
                adminAccountPage.ClickOnViewAll(driver);
                adminAccountPage.SearchByAccountID(driver, accountId);
                adminAccountPage.DoubleClickOnAccountName(driver, accountId);
                TestProgressLogger.LogCheckPoint(string.Format(LogMessage.NavigateAccountPage, accountId));

                // Click on showall link under open order section.
                adminAccountPage.ClickShowAllUnderOpenOrderSection(driver);
                orderID = adminAccountPage.GetOrderIDInAccountOrderPage(driver);

                // Delete All previous file and download openorder csv file and verify data.
                genericUtils.DeleteAllFiles();
                adminAccountPage.ClickExportToCSVOpenOrder(driver);
                Dictionary <string, string> openOrderData = adminAccountPage.GetOpenOrderCSVData(orderID, openOrderFileName);
                Assert.Equal(limitPrice, openOrderData.GetValueOrDefault(price));
                Assert.Equal(buyOrderSize, openOrderData.GetValueOrDefault(quantity));
                TestProgressLogger.LogCheckPoint(LogMessage.VerifyDownloadCSVFileOfOpenOrder);

                // Click on showall link under account activity section.
                adminAccountPage.SelectAccountLink(driver);
                adminAccountPage.ClickShowAllUnderAccountActivitySection(driver);

                // Delete All previous file and download transactionhistory csv file and verify data.
                genericUtils.DeleteAllFiles();
                adminAccountPage.ClickExportToCSVAccountActivity(driver);
                accountActivityVal = adminAccountPage.VerifyAccountActivityCSVData(accountActivityFileName, orderID);
                Assert.True(accountActivityVal);
                TestProgressLogger.LogCheckPoint(LogMessage.VerifyDownloadCSVFileOfAccountActivity);

                // Click on showall link under order history section.
                adminAccountPage.SelectAccountLink(driver);
                adminAccountPage.ClickOnUserAccountTab(driver);
                adminAccountPage.ClickShowAllUnderOrderHistorySection(driver);

                // Delete All previous file and download order history csv file and verify data.
                genericUtils.DeleteAllFiles();
                adminAccountPage.ClickExportToCSVOrderHistory(driver);
                accountActivityVal = adminAccountPage.VerifyAccountActivityCSVData(orderHistoryFileName, orderID);
                Assert.True(accountActivityVal);
                TestProgressLogger.LogCheckPoint(LogMessage.VerifyDownloadCSVFileOfOrderHistory);

                // Click on showall link under order history section.
                adminAccountPage.SelectAccountLink(driver);
                adminAccountPage.ClickOnUserAccountTab(driver);
                adminAccountPage.ClickShowAllUnderTradeSection(driver);

                // Delete All previous file and download trade csv file
                genericUtils.DeleteAllFiles();
                adminAccountPage.ClickExportToCSVTrade(driver);

                TestProgressLogger.LogCheckPoint(LogMessage.VerifyDownloadCSVFileOfTrade);


                // Logout from admin.
                admincommonfunctions.UserMenuBtn();
                adminfunctions.AdminLogOut();
            }
            catch (NoSuchElementException ex)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace);
                TestProgressLogger.LogError(LogMessage.VerifyReportsDownloadedExportToCSVTestFailed, ex);
                throw;
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(e.Message + e.StackTrace);
                TestProgressLogger.LogError(LogMessage.VerifyReportsDownloadedExportToCSVTestFailed, e);
                throw e;
            }
            finally
            {
                TestProgressLogger.EndTest();
            }
        }
Exemplo n.º 26
0
        public void TC1_VerifyDetailsOnLandingPageTest()
        {
            instrument             = TestData.GetData("Instrument");
            menuTab                = TestData.GetData("MenuTab");
            buyTab                 = TestData.GetData("BuyTab");
            sellTab                = TestData.GetData("SellTab");
            orderBook              = TestData.GetData("OrderBookValue");
            openOrders             = TestData.GetData("OpenOrdersValue");
            filledOrders           = TestData.GetData("FilledOrdersValue");
            InactiveOrders         = TestData.GetData("InactiveOrdersValue");
            tradeReports           = TestData.GetData("TradeReportsValue");
            depositStatus          = TestData.GetData("DepositStatusValue");
            withdrawStatus         = TestData.GetData("WithdrawStatusValue");
            pairValue              = TestData.GetData("TC1_PairValue");
            sideValue              = TestData.GetData("TC1_SideValue");
            typeValue              = TestData.GetData("TC1_TypeValue");
            sizeValue              = TestData.GetData("TC1_SizeValue");
            priceValue             = TestData.GetData("TC1_PriceValue");
            dateTimeValue          = TestData.GetData("TC1_DateTimeValue");
            statusValue            = TestData.GetData("TC1_StatusValue");
            actionValue            = TestData.GetData("TC1_ActionValue");
            actionsValue           = TestData.GetData("TC1_ActionsValue");
            idValue                = TestData.GetData("TC1_IDValue");
            totalValue             = TestData.GetData("TC1_TotalValue");
            feeValue               = TestData.GetData("TC1_FeeValue");
            executionValue         = TestData.GetData("TC1_ExecutionIDValue");
            productValue           = TestData.GetData("TC1_ProductValue");
            amountValue            = TestData.GetData("TC1_AmountValue");
            createdValue           = TestData.GetData("TC1_CreatedValue");
            priceChartValue        = TestData.GetData("TC1_PriceChartValue");
            availableBalanceValue  = TestData.GetData("TC1_AvailableBalanceValue");
            holdValue              = TestData.GetData("TC1_HoldValue");
            pendingDepositsValue   = TestData.GetData("TC1_PendingDepositsValue");
            totalBalanceValue      = TestData.GetData("TC1_TotalBalanceValue");
            recentTradesPriceValue = TestData.GetData("TC1_RecentTradesPriceValue");
            recentTradesQtyValue   = TestData.GetData("TC1_RecentTradesQtyValue");
            recentTradesTimeValue  = TestData.GetData("TC1_RecentTradesTimeValue");
            orderBookPriceValue    = TestData.GetData("TC1_OrderBookPriceValue");
            orderBookQtyValue      = TestData.GetData("TC1_OrderBookQtyValue");
            orderBookMySizeValue   = TestData.GetData("TC1_OrderBookMySizeValue");
            orderEntryMarketValue  = TestData.GetData("TC1_OrderEntryMarketValue");
            orderEntryLimitValue   = TestData.GetData("TC1_OrderEntryLimitValue");
            orderEntryStopValue    = TestData.GetData("TC1_OrderEntryStopValue");

            DetailsOnLandingPage objDetailsOnLandingPage = new DetailsOnLandingPage(TestProgressLogger);

            try
            {
                TestProgressLogger.StartTest();
                UserFunctions userFunctions = new UserFunctions(TestProgressLogger);

                // Login in user portal
                userFunctions.LogIn(TestProgressLogger, Const.USER14);

                // Click on "Dashboard" menu button --> select an exchange
                UserCommonFunctions.DashBoardMenuButton(driver);
                UserCommonFunctions.SelectAnExchange(driver);

                // Verify "Exchange" menu button
                Assert.True(objDetailsOnLandingPage.ExchangeLinkButton());

                // Select an instrument BTCUSD
                UserCommonFunctions.SelectInstrumentFromExchange(instrument, driver);

                // Verify the sub labels present in Open orders tab
                Assert.True(objDetailsOnLandingPage.VerifyOpenOrdersTab(openOrders, pairValue, sideValue, typeValue, sizeValue, priceValue, dateTimeValue, statusValue, actionValue));

                // Verify the sub labels present in filled orders tab
                Assert.True(objDetailsOnLandingPage.VerifyFilledOrdersTab(filledOrders, idValue, pairValue, sideValue, sizeValue, priceValue, totalValue, feeValue, executionValue, dateTimeValue));

                // Verify the sub labels present in Inactive orders tab
                Assert.True(objDetailsOnLandingPage.VerifyInactiveOrdersTab(filledOrders, pairValue, sideValue, typeValue, sizeValue, priceValue, dateTimeValue, statusValue));

                // Verify the sub labels present in trade reports tab
                Assert.True(objDetailsOnLandingPage.VerifyTradeReportTab(tradeReports, pairValue, sideValue, sizeValue, priceValue, feeValue, dateTimeValue, statusValue));

                // Verify the sub labels present in deposit status tab
                Assert.True(objDetailsOnLandingPage.VerifyDepositStatusTab(depositStatus, productValue, amountValue, statusValue, createdValue, feeValue));

                // Verify the sub labels present in withdraw status tab
                Assert.True(objDetailsOnLandingPage.VerifyWithdrawStatusTab(withdrawStatus, productValue, amountValue, statusValue, createdValue, feeValue, actionsValue));

                // Verify price chart label name is present
                Assert.True(objDetailsOnLandingPage.PriceChartTxt(priceChartValue));

                // Verify order entry With buy option label name is present
                Assert.True(objDetailsOnLandingPage.OrderEntryWithBuyOption());

                // Verify order entry With sell option label name is present
                Assert.True(objDetailsOnLandingPage.OrderEntryWithSellOption());

                // Click on "Balances" button
                objDetailsOnLandingPage.ClickOnBalancesButton();

                // Verify available balance label name is present
                Assert.True(objDetailsOnLandingPage.AvailableBalanceTxt(availableBalanceValue));

                // Verify available hold label name is present
                Assert.True(objDetailsOnLandingPage.HoldTxt(holdValue));

                // Verify pending deposits label name is present
                Assert.True(objDetailsOnLandingPage.PendingDepositsTxt(pendingDepositsValue));

                // Verify total balance label name is present
                Assert.True(objDetailsOnLandingPage.TotalBalanceTxt(totalBalanceValue));

                // Verify the sub labels present in order book menu tab
                Assert.True(objDetailsOnLandingPage.VerifyOrderBookMenuTab(orderBookPriceValue, orderBookQtyValue, orderBookMySizeValue));

                // Verify the sub labels present in recent trades menu tab
                Assert.True(objDetailsOnLandingPage.VerifyRecentTradesMenuTab(recentTradesPriceValue, recentTradesQtyValue, recentTradesTimeValue));

                //Click on "Order Entry" button
                objDetailsOnLandingPage.OrderEntryBtn();
                Thread.Sleep(2000);

                // Verify the sub labels present in buy order entry menu tab
                Assert.True(objDetailsOnLandingPage.VerifyBuyOrderEntryMenuAndSubMenuTab(buyTab, orderEntryMarketValue, orderEntryLimitValue, orderEntryStopValue));

                // Verify the sub labels present in sell order entry menu tab
                Assert.True(objDetailsOnLandingPage.VerifySellOrderEntryMenuAndSubMenuTab(sellTab, orderEntryMarketValue, orderEntryLimitValue, orderEntryStopValue));

                // Verify various fields in order book section
                Assert.True(objDetailsOnLandingPage.FieldsInOrderBookSection());

                // Verify advance button is present
                Assert.True(objDetailsOnLandingPage.AdvanceOrderBtn());

                // Verify order entry button is present
                Assert.True(objDetailsOnLandingPage.OrderEntryButn());

                // Verify balance button button is present
                Assert.True(objDetailsOnLandingPage.VerifyBalancesButton());

                // verify various option in the price chart
                Assert.True(objDetailsOnLandingPage.VariouOptionInPriceChart());
                TestProgressLogger.LogCheckPoint(LogMessage.VerifiedDetailInLandingPagePassed);
            }
            catch (NoSuchElementException ex)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace);
                TestProgressLogger.LogError(String.Format(LogMessage.VerifiedDetailInLandingPageFailed), ex);
                throw ex;
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(e.Message + e.StackTrace);
                TestProgressLogger.LogError(String.Format(LogMessage.VerifiedDetailInLandingPageFailed), e);
                throw e;
            }
            finally
            {
                TestProgressLogger.EndTest();
            }
        }
Exemplo n.º 27
0
        public void TC8_VerifySellStopOrder()
        {
            try
            {
                string type = Const.StopMarket;
                instrument    = TestData.GetData("Instrument");
                feeComponent  = TestData.GetData("FeeComponent");
                orderType     = TestData.GetData("OrderType");
                menuTab       = TestData.GetData("MenuTab");
                buyTab        = TestData.GetData("BuyTab");
                sellTab       = TestData.GetData("SellTab");
                orderSize     = TestData.GetData("TC8_OrderSize");
                limitPrice    = TestData.GetData("TC8_LimitPrice");
                timeInForce   = TestData.GetData("TimeInForce");
                sellStopPrice = TestData.GetData("TC8_StopPrice");
                Dictionary <string, string> placeStopSellOrder;
                UserFunctions       userFunctions      = new UserFunctions(TestProgressLogger);
                UserCommonFunctions userCommonFunction = new UserCommonFunctions(TestProgressLogger);
                OrderEntryPage      orderEntryPage     = new OrderEntryPage(driver, TestProgressLogger);
                VerifyOrdersTab     objVerifyOrdersTab = new VerifyOrdersTab(driver, TestProgressLogger);

                TestProgressLogger.StartTest();
                // Place buy and sell order to set the last price
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.PlaceOrderToSetMarketBegin, limitPrice));
                userCommonFunction.PlaceOrdersToSetLastPrice(driver, instrument, buyTab, sellTab, orderSize, limitPrice, timeInForce, Const.USER10, Const.USER11);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.PlaceOrderToSetMarketEnd, limitPrice));

                // Place Limit Buy order to set the market
                userFunctions.LogIn(TestProgressLogger, Const.USER11);
                userCommonFunction.CancelAndPlaceLimitBuyOrder(driver, instrument, buyTab, orderSize, limitPrice, timeInForce);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.MarketSetupEnd, buyTab, orderSize, limitPrice));

                userFunctions.LogIn(TestProgressLogger, Const.USER5);
                // Place Stop Buy order with Stop Price < market price
                placeStopSellOrder = orderEntryPage.PlaceStopSellOrder(instrument, sellTab, Double.Parse(orderSize), Double.Parse(feeComponent), Double.Parse(sellStopPrice));

                // Verify that the order is present in the Open Orders tab
                Assert.True(objVerifyOrdersTab.VerifyOpenOrdersTab(placeStopSellOrder["Instrument"], placeStopSellOrder["Side"], type, Double.Parse(placeStopSellOrder["SellAmount"]), placeStopSellOrder["StopPrice"], placeStopSellOrder["PlaceOrderTime"], placeStopSellOrder["PlaceOrderTimePlusOneMin"]));
                TestProgressLogger.LogCheckPoint(string.Format(LogMessage.BuyStopOrderSuccessMsg, sellTab));

                // This cancels all the previous open orders
                UserCommonFunctions.LoginAndCancelAllOrders(TestProgressLogger, driver, instrument, Const.USER11);
                UserCommonFunctions.LoginAndCancelAllOrders(TestProgressLogger, driver, instrument, Const.USER5);
            }
            catch (NoSuchElementException ex)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace);
                TestProgressLogger.LogError(String.Format(LogMessage.StopOrderTestFailed, sellTab), ex);
                throw ex;
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(e.Message + e.StackTrace);
                TestProgressLogger.LogError(String.Format(LogMessage.StopOrderTestFailed, sellTab), e);
                throw e;
            }
            finally
            {
                TestProgressLogger.EndTest();
            }
        }
Exemplo n.º 28
0
        public void TC6_VerifySellLimitOrder()
        {
            try
            {
                string type;
                string buyOrderFeeValue;
                string sellOrderFeeValue;
                string orderSizeDifference;
                instrument      = TestData.GetData("Instrument");
                orderType       = TestData.GetData("OrderType");
                menuTab         = TestData.GetData("MenuTab");
                buyTab          = TestData.GetData("BuyTab");
                sellTab         = TestData.GetData("SellTab");
                buyOrderSize    = TestData.GetData("TC6_BuyOrderSize");
                sellOrderSize   = TestData.GetData("TC6_SellOrderSize");
                incBuyOrderSize = TestData.GetData("TC6_IncreasedBuyOrderSize");
                decBuyOrderSize = TestData.GetData("TC6_DecreasedBuyOrderSize");
                limitPrice      = TestData.GetData("TC6_LimitPrice");
                timeInForce     = TestData.GetData("TC6_TimeInForce");
                feeComponent    = TestData.GetData("FeeComponent");

                type              = Const.Limit;
                buyOrderFeeValue  = GenericUtils.FeeAmount(buyOrderSize, feeComponent);
                sellOrderFeeValue = GenericUtils.SellFeeAmount(sellOrderSize, limitPrice, feeComponent);

                TestProgressLogger.StartTest();
                UserFunctions       userFunctions      = new UserFunctions(TestProgressLogger);
                UserCommonFunctions userCommonFunction = new UserCommonFunctions(TestProgressLogger);
                OrderEntryPage      orderEntryPage     = new OrderEntryPage(driver, TestProgressLogger);
                VerifyOrdersTab     objVerifyOrdersTab = new VerifyOrdersTab(driver, TestProgressLogger);

                // Place 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));

                // Scenario 1: Buy order B1 with same price is available and B1 quantity is = S1.
                userFunctions.LogIn(TestProgressLogger, Const.USER8);
                // Place Limit sell order to set the market
                Dictionary <string, string> placeLimitSellOrder = orderEntryPage.PlaceLimitSellOrder(instrument, sellTab, sellOrderSize, limitPrice, timeInForce);
                // Verify that the order is present in the Open Orders tab
                Assert.True(objVerifyOrdersTab.VerifyOpenOrdersTab(instrument, sellTab, type, Double.Parse(sellOrderSize), limitPrice, placeLimitSellOrder["PlaceOrderTime"], placeLimitSellOrder["PlaceOrderTimePlusOneMin"]));
                TestProgressLogger.LogCheckPoint(string.Format(LogMessage.LimitOrderSuccessMsg, sellTab, sellOrderSize, limitPrice));

                userFunctions.LogIn(TestProgressLogger, Const.USER9);
                // Place Limit buy order with the same price and quantity as Sell order to verify the order gets filled
                Dictionary <string, string> placeLimitBuyOrder = orderEntryPage.PlaceLimitBuyOrder(instrument, buyTab, buyOrderSize, limitPrice, timeInForce);
                // Verify order is present in Filled Orders tab
                Assert.True(objVerifyOrdersTab.VerifyFilledOrdersTab(instrument, buyTab, Double.Parse(buyOrderSize), buyOrderFeeValue, placeLimitBuyOrder["PlaceOrderTime"], placeLimitBuyOrder["PlaceOrderTimePlusOneMin"]));
                TestProgressLogger.LogCheckPoint(string.Format(LogMessage.LimitOrderSuccessMsg, buyTab, buyOrderSize, limitPrice));

                userFunctions.LogIn(TestProgressLogger, Const.USER8);
                orderEntryPage.NavigateToHomePage(instrument);
                // Verify order is present in Filled Orders tab
                Assert.True(objVerifyOrdersTab.VerifyFilledOrdersTab(instrument, sellTab, Double.Parse(sellOrderSize), sellOrderFeeValue, placeLimitSellOrder["PlaceOrderTime"], placeLimitSellOrder["PlaceOrderTimePlusOneMin"]));

                // Scenario 2: Buy order B1 with same price is available and B1 quantity is > S1.
                userFunctions.LogIn(TestProgressLogger, Const.USER8);
                // Place Limit sell order to set the market
                Dictionary <string, string> placeLimitSellOrderS2 = orderEntryPage.PlaceLimitSellOrder(instrument, sellTab, sellOrderSize, limitPrice, timeInForce);
                // Verify that the order is present in the Open Orders tab
                Assert.True(objVerifyOrdersTab.VerifyOpenOrdersTab(instrument, sellTab, type, Double.Parse(sellOrderSize), limitPrice, placeLimitSellOrderS2["PlaceOrderTime"], placeLimitSellOrderS2["PlaceOrderTimePlusOneMin"]));
                TestProgressLogger.LogCheckPoint(string.Format(LogMessage.LimitOrderSuccessMsg, sellTab, sellOrderSize, limitPrice));

                userFunctions.LogIn(TestProgressLogger, Const.USER9);
                // Place Limit buy order with the same price and quantity > Sell order to verify the order gets filled
                Dictionary <string, string> placeLimitBuyOrderS2 = orderEntryPage.PlaceLimitBuyOrder(instrument, buyTab, incBuyOrderSize, limitPrice, timeInForce);
                // Verify order is present in Filled Orders tab
                Assert.True(objVerifyOrdersTab.VerifyFilledOrdersTab(instrument, buyTab, Double.Parse(sellOrderSize), buyOrderFeeValue, placeLimitSellOrderS2["PlaceOrderTime"], placeLimitSellOrderS2["PlaceOrderTimePlusOneMin"]));
                TestProgressLogger.LogCheckPoint(string.Format(LogMessage.LimitOrderSuccessMsg, buyTab, incBuyOrderSize, limitPrice));

                userFunctions.LogIn(TestProgressLogger, Const.USER8);
                orderEntryPage.NavigateToHomePage(instrument);
                // Verify order is present in Filled Orders tab
                Assert.True(objVerifyOrdersTab.VerifyFilledOrdersTab(instrument, sellTab, Double.Parse(sellOrderSize), sellOrderFeeValue, placeLimitSellOrderS2["PlaceOrderTime"], placeLimitSellOrderS2["PlaceOrderTimePlusOneMin"]));


                // Scenario 3: Buy order B1 with same price is available and B1 quantity is < S1.
                UserCommonFunctions.LoginAndCancelAllOrders(TestProgressLogger, driver, instrument, Const.USER9);
                userFunctions.LogIn(TestProgressLogger, Const.USER8);
                // Place Limit sell order to set the market
                Dictionary <string, string> placeLimitSellOrderS3 = orderEntryPage.PlaceLimitSellOrder(instrument, sellTab, sellOrderSize, limitPrice, timeInForce);
                // Verify that the order is present in the Open Orders tab
                Assert.True(objVerifyOrdersTab.VerifyOpenOrdersTab(instrument, sellTab, type, Double.Parse(sellOrderSize), limitPrice, placeLimitSellOrderS3["PlaceOrderTime"], placeLimitSellOrderS3["PlaceOrderTimePlusOneMin"]));
                TestProgressLogger.LogCheckPoint(string.Format(LogMessage.LimitOrderSuccessMsg, sellTab, sellOrderSize, limitPrice));

                userFunctions.LogIn(TestProgressLogger, Const.USER9);
                buyOrderFeeValue = GenericUtils.FeeAmount(decBuyOrderSize, feeComponent);
                // Place Limit buy order with the same price and quantity < Sell order to verify the order gets filled
                Dictionary <string, string> placeLimitBuyOrderS3 = orderEntryPage.PlaceLimitBuyOrder(instrument, buyTab, decBuyOrderSize, limitPrice, timeInForce);
                // Verify order is present in Filled Orders tab
                Assert.True(objVerifyOrdersTab.VerifyFilledOrdersTab(instrument, buyTab, Double.Parse(decBuyOrderSize), buyOrderFeeValue, placeLimitSellOrderS3["PlaceOrderTime"], placeLimitSellOrderS3["PlaceOrderTimePlusOneMin"]));
                TestProgressLogger.LogCheckPoint(string.Format(LogMessage.LimitOrderSuccessMsg, buyTab, decBuyOrderSize, limitPrice));

                userFunctions.LogIn(TestProgressLogger, Const.USER8);
                orderEntryPage.NavigateToHomePage(instrument);
                // This will get the sell fee value based on decreased order size
                sellOrderFeeValue = GenericUtils.SellFeeAmount(decBuyOrderSize, limitPrice, feeComponent);
                // Get the difference between the sell order size and decreased buy order size
                orderSizeDifference = GenericUtils.GetDifferenceFromStringAfterSubstraction(sellOrderSize, decBuyOrderSize);
                // Verify that the order is present in the Open Orders tab
                Assert.True(objVerifyOrdersTab.VerifyOpenOrdersTab(instrument, sellTab, type, Double.Parse(orderSizeDifference), limitPrice, placeLimitSellOrderS3["PlaceOrderTime"], placeLimitSellOrderS3["PlaceOrderTimePlusOneMin"]));
                // Verify order is present in Filled Orders tab
                Assert.True(objVerifyOrdersTab.VerifyFilledOrdersTab(instrument, sellTab, Double.Parse(decBuyOrderSize), sellOrderFeeValue, placeLimitSellOrderS3["PlaceOrderTime"], placeLimitSellOrderS3["PlaceOrderTimePlusOneMin"]));

                // This step cancels the remaining order and verifies the same in Open orders tab
                UserCommonFunctions.CancelOrderBookSellOrder(driver);
                UserCommonFunctions.OpenOrderTab(driver);
                // Verify that the order is present in the Open Orders tab
                Assert.False(objVerifyOrdersTab.VerifyOpenOrdersTab(instrument, sellTab, type, Double.Parse(orderSizeDifference), limitPrice, placeLimitSellOrderS3["PlaceOrderTime"], placeLimitSellOrderS3["PlaceOrderTimePlusOneMin"]));
            }
            catch (NoSuchElementException ex)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace);
                TestProgressLogger.LogError(String.Format(LogMessage.LimitOrderTestFailed, buyTab), ex);
                throw ex;
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(e.Message + e.StackTrace);
                TestProgressLogger.LogError(String.Format(LogMessage.LimitOrderTestFailed, buyTab), e);
                throw e;
            }
            finally
            {
                TestProgressLogger.EndTest();
            }
        }
        [Fact]      //Admin_20
        public void VerifyAccountDetailsTabShowAllRelevantAccountInfo()
        {
            try
            {
                string accountId;
                string USDCurrency;
                string USDAmount;
                string commentValue;
                string amountField;
                string expectedAmount;
                string actualAmount;

                accountId    = TestData.GetData("TCAdmin4_UserAccountID");
                USDCurrency  = TestData.GetData("USDCurrency");
                USDAmount    = TestData.GetData("USDAmount");
                commentValue = TestData.GetData("TC41_Comment");
                amountField  = TestData.GetData("TCAdmin4_AmountField");

                AdminFunctions       adminfunctions       = new AdminFunctions(TestProgressLogger);
                AdminCommonFunctions admincommonfunctions = new AdminCommonFunctions(TestProgressLogger);
                AdminAccountsPage    adminAccountPage     = new AdminAccountsPage(TestProgressLogger);

                // login in admin
                adminfunctions.AdminLogIn(TestProgressLogger, Const.ADMIN1);

                // Navigate on Accounts page.
                admincommonfunctions.SelectAccountsMenu();
                admincommonfunctions.SelectAccountsTab();
                TestProgressLogger.LogCheckPoint(LogMessage.NavigateAccountPage);

                // Click on ViewAll and search by accountid and double click.
                adminAccountPage.ClickOnViewAll(driver);
                adminAccountPage.SearchByAccountID(driver, accountId);
                adminAccountPage.DoubleClickOnAccountName(driver, accountId);
                TestProgressLogger.LogCheckPoint(string.Format(LogMessage.NavigateAccountPage, accountId));

                // Verify labels under account details section.
                adminAccountPage.VerifyLabelUnderAccountDetailsSection();
                TestProgressLogger.LogCheckPoint(LogMessage.VerifyLabelsUnderAccountDetailsSection);

                // Verify labels under balances section.
                adminAccountPage.VerifyLabelsUnderBalancesSection();
                TestProgressLogger.LogCheckPoint(LogMessage.VerifyLabelsUnderBalancesSection);

                // Get balances of usd before credit amount.
                Dictionary <string, string> balancesData = adminAccountPage.GetBalances(driver, USDCurrency);

                // Credit usd amount using submit ledger entry.
                adminAccountPage.ClickOnSubmitLedgerEntryButton();
                adminAccountPage.CreditAmountInSubmintLedgerEntryModal(USDCurrency, USDAmount, commentValue);
                TestProgressLogger.LogCheckPoint(LogMessage.CreditAmountBySubmitLedgerEntry);

                // Get balances of usd after credit amount.
                adminAccountPage.ClickOnRefreshInUserAccountSection(driver);
                Dictionary <string, string> afterSubmitLedgerBalancesData = adminAccountPage.GetBalances(driver, USDCurrency);

                // Verify increased usd amount after credit by submit ledger entry.
                expectedAmount = GenericUtils.GetSumFromStringAfterAddition(balancesData.GetValueOrDefault(amountField), USDAmount);
                actualAmount   = GenericUtils.ConvertStringToDecimalFormat(afterSubmitLedgerBalancesData.GetValueOrDefault(amountField));
                Assert.Equal(expectedAmount, GenericUtils.RemoveCommaFromString(actualAmount));
                TestProgressLogger.LogCheckPoint(LogMessage.VerifyCreditedUSDAmount);

                // Verify all ticket ids in Decending order.
                Assert.True(adminAccountPage.VerifyTicketsIdInDecendingOrder());

                // Verify all ticket ids in ascending order.
                Assert.True(adminAccountPage.VerifyTicketsIdInAscendingOrder());

                // Logout from admin.
                admincommonfunctions.UserMenuBtn();
                adminfunctions.AdminLogOut();
            }
            catch (NoSuchElementException ex)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace);
                TestProgressLogger.LogError(LogMessage.AccountDetailsTabShowAllRelevantAccountInfoTestFailed, ex);
                throw;
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(e.Message + e.StackTrace);
                TestProgressLogger.LogError(LogMessage.AccountDetailsTabShowAllRelevantAccountInfoTestFailed, e);
                throw e;
            }
            finally
            {
                TestProgressLogger.EndTest();
            }
        }
        [Fact]      //Admin_30
        public void VerifyLedgerEntryDebit()
        {
            try
            {
                string accountId;
                string toastMessage;
                string product;
                bool   creditFlag;
                string amount;
                string negativeAmount;
                string comment;
                string productBalancesBeforeUpdate;
                string productBalancesAfterUpdate;
                product        = TestData.GetData("TCAdmin30_Product");
                amount         = TestData.GetData("TCAdmin30_Amount");
                negativeAmount = TestData.GetData("TCAdmin30_NegativeAmount");
                comment        = TestData.GetData("TCAdmin30_Comment");
                accountId      = TestData.GetData("TCAdmin30_AccountID");
                AdminFunctions       adminfunctions       = new AdminFunctions(TestProgressLogger);
                AdminCommonFunctions admincommonfunctions = new AdminCommonFunctions(TestProgressLogger);
                AdminAccountsPage    adminAccountPage     = new AdminAccountsPage(TestProgressLogger);
                UserFunctions        userFunctions        = new UserFunctions(TestProgressLogger);
                UserCommonFunctions  userCommonFunction   = new UserCommonFunctions(TestProgressLogger);
                GenericUtils         genericUtils         = new GenericUtils(TestProgressLogger);
                // Set creditFlag to False in case of debit amount
                creditFlag = false;

                // Login in admin
                adminfunctions.AdminLogIn(TestProgressLogger, Const.ADMIN1);
                // Navigate on Accounts page.
                admincommonfunctions.SelectAccountsMenu();
                admincommonfunctions.SelectAccountsTab();
                TestProgressLogger.LogCheckPoint(LogMessage.NavigateAccountPage);
                // Click on ViewAll and search by accountid and double click.
                adminAccountPage.ClickOnViewAll(driver);
                adminAccountPage.SearchByAccountID(driver, accountId);
                adminAccountPage.DoubleClickOnAccountName(driver, accountId);
                TestProgressLogger.LogCheckPoint(string.Format(LogMessage.NavigateAccountPage, accountId));
                // Submit Submit Ledger Entry with negative value
                adminAccountPage.SubmitLedgerEntryWithNegativeValue(product, creditFlag, negativeAmount, comment);
                // Verify submit ledger invalid request message
                toastMessage = adminAccountPage.SubmitLedgerInvalidToastMessage();
                Assert.Equal(Const.LedgerEntryInvalidRequestMsg, toastMessage);
                // Fetch the USD Account balance before update
                productBalancesBeforeUpdate = adminAccountPage.ProductAmountBalancesBeforeUpdate();
                // Submit Submit Ledger Entry
                adminAccountPage.SubmitLedgerEntry(product, creditFlag, amount, comment);
                // Verify submit ledger success msg
                toastMessage = adminAccountPage.SubmitLedgerToastMessage();
                Assert.Equal(Const.LedgerEntrySuccessMsg, toastMessage);
                TestProgressLogger.LogCheckPoint(LogMessage.VerifyToastMSG);
                adminAccountPage.ClickOnRefreshInUserAccountSection(driver);
                // Fetch the USD Account balance after update
                productBalancesAfterUpdate = adminAccountPage.ProductAmountBalancesAfterUpdate();
                // Verify that the balances are incremented by amount value
                Assert.True(adminAccountPage.VerifyUpdatedDebitBalance(amount, productBalancesBeforeUpdate, productBalancesAfterUpdate));
                // Logout from admin.
                admincommonfunctions.UserMenuBtn();
                adminfunctions.AdminLogOut();
            }
            catch (NoSuchElementException ex)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace);
                TestProgressLogger.LogError(LogMessage.VerifyLedgerEntryDebitTestFailed, ex);
                throw;
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(e.Message + e.StackTrace);
                TestProgressLogger.LogError(LogMessage.VerifyLedgerEntryDebitTestFailed, e);
                throw e;
            }
            finally
            {
                TestProgressLogger.EndTest();
            }
        }