예제 #1
0
        // This method verifies the number of orders displayed.
        public bool VerifyNumOfOrdersDisplayed(string numOfOrders, string instrument)
        {
            bool flag = false;
            AdminCommonFunctions objAdminCommonFunctions = new AdminCommonFunctions(logger);

            try
            {
                int numberOfOrders = Int32.Parse(numOfOrders);
                objAdminCommonFunctions.SelectOMSOrdersInstrument(instrument);
                Thread.Sleep(1000);
                // This select the number of orders to be displayed from the orders dropdown
                SelectOMSOrdersInstrument(numOfOrders);
                Thread.Sleep(1000);
                int countOfBuySideOrders  = driver.FindElements(buySideBookRow).Count;
                int countOfSellSideOrders = driver.FindElements(sellSideBookRow).Count;
                if ((countOfBuySideOrders <= numberOfOrders) && (countOfSellSideOrders <= numberOfOrders))
                {
                    flag = true;
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(flag);
        }
        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();
            }
        }
        [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();
            }
        }
        [Fact]      //Admin_3
        public void UpdateAccountInformation()
        {
            try
            {
                string accountId;
                string updatedAccountName;
                string actualUpdatedAccountName;
                string accountNameOnAccontDetails;

                accountId = TestData.GetData("TCAdmin4_UserAccountID");

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

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

                // Navigate on Accounts page.
                admincommonfunctions.SelectAccountsMenu();
                admincommonfunctions.SelectAccountsTab();
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.NavigateWalletsPage));

                // Double click on particular user and edit account name.
                adminAccountPage.ClickOnViewAll(driver);
                adminAccountPage.SearchByAccountID(driver, accountId);
                adminAccountPage.DoubleClickOnAccountName(driver, accountId);
                adminAccountPage.EditAccountInformation(driver);
                updatedAccountName = adminAccountPage.EditAccountName(driver);
                adminAccountPage.ClickOnSaveButton(driver);

                // Verify updated account name on account details.
                accountNameOnAccontDetails = adminAccountPage.GetAccountNameOnAccountDetails(driver);
                Assert.Equal(updatedAccountName, accountNameOnAccontDetails);
                admincommonfunctions.UserMenuBtn();
                adminFunctions.AdminLogOut();

                // Log in user portal
                userFunctions.LogIn(TestProgressLogger, Const.USER17);

                // Verify update account name on user portal.
                actualUpdatedAccountName = userFunctions.GetTextOfLoggedInUser();
                Assert.Equal(updatedAccountName, actualUpdatedAccountName);
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.Error("", e);
                throw e;
            }
        }
예제 #6
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();
            }
        }
        [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();
            }
        }
        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();
            }
        }
예제 #9
0
        //This method will verify the block trade in Admin UI
        public void VerifyBlockTradeInAdmin(string accountTypeID, string counterPartyID, string instrument, string originalQuantity, string quantityExecuted)
        {
            AdminCommonFunctions objAdminCommonFunctions = new AdminCommonFunctions(logger);

            try
            {
                objAdminCommonFunctions.SelectTradeMenu();
                objAdminCommonFunctions.BlockTradeBtn();
                objAdminCommonFunctions.BlockTradeInstrumentSelection(instrument);
                objAdminCommonFunctions.BuyBlockTradeList(accountTypeID, counterPartyID, instrument, originalQuantity, quantityExecuted);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
예제 #10
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();
            }
        }
예제 #11
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();
            }
        }
예제 #12
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();
            }
        }
예제 #13
0
        // This selects the instrument on the OMS Open orders page and verifies the related orders in the buy and sell side books
        public bool VerifySelectOMSOpenOrdersInstrument(Dictionary <string, string> userDetailsDict, string instrument, string buyPrice, string sellPrice, string buyQuantity, string sellQuantity, string orderType)
        {
            bool orderFoundFlag = false;
            AdminCommonFunctions objAdminCommonFunctions = new AdminCommonFunctions(logger);

            try
            {
                objAdminCommonFunctions.ClickOnOMSOrdersMenuLink();
                objAdminCommonFunctions.SelectOMSOrdersInstrument(instrument);
                Thread.Sleep(1000);
                orderFoundFlag = VerifyOMSOrdersBuySideBook(userDetailsDict["AccountId"], userDetailsDict["UserId"], buyPrice, buyQuantity, orderType);
                orderFoundFlag = VerifyOMSOrdersSellSideBook(userDetailsDict["AccountId"], userDetailsDict["UserId"], sellPrice, sellQuantity, orderType);
            }
            catch (Exception)
            {
                throw;
            }
            return(orderFoundFlag);
        }
예제 #14
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();
            }
        }
예제 #15
0
        /// <summary>
        ///  Methods related to OMS Oders History tab
        /// </summary>

        // This selects the instrument on the OMS Open orders page and verifies the related orders in the buy and sell side books
        public bool VerifySelectOMSOrdersHistoryInstrument(string instrument, string numberOfRecords)
        {
            bool orderFoundFlag = false;
            AdminCommonFunctions objAdminCommonFunctions = new AdminCommonFunctions(logger);

            try
            {
                objAdminCommonFunctions.ClickOnOMSOrdersMenuLink();
                ClickOMSOrdersHistoryTab();
                objAdminCommonFunctions.SelectOMSOrdersInstrument(instrument);
                Thread.Sleep(1000);
                orderFoundFlag = ScrollAndVerifyInstrument(instrument, numberOfRecords);
            }
            catch (Exception)
            {
                throw;
            }
            return(orderFoundFlag);
        }
예제 #16
0
        // This method navigates to OMS Orders History page and clears all filters
        public void ClearOrderHistoryFilters(string instrument, string numOfOrders)
        {
            AdminCommonFunctions objAdminCommonFunctions = new AdminCommonFunctions(logger);

            try
            {
                objAdminCommonFunctions.ClickOnOMSOrdersMenuLink();
                ClickOMSOrdersHistoryTab();
                objAdminCommonFunctions.SelectOMSOrdersInstrument(instrument);
                SelectOMSOrdersInstrument(numOfOrders);
                ClickMoreFiltersLink();
                AccountIdTextBox().Clear();
                UserIdTextBox().Clear();
                OrderIdTextBox().Clear();
            }
            catch (Exception)
            {
                throw;
            }
        }
        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();
            }
        }
예제 #18
0
        // This method verifies the number of orders displayed on OMS Orders History page
        public bool VerifyNumOfOrdersOnHistorypage(string numberOfRecords, string instrument)
        {
            bool flag = false;
            int  totalCount;
            int  count;
            int  totalCountOfOrders = 0;
            AdminCommonFunctions objAdminCommonFunctions = new AdminCommonFunctions(logger);

            try
            {
                int numberOfOrders = Int32.Parse(numberOfRecords);
                objAdminCommonFunctions.SelectOMSOrdersInstrument(instrument);
                Thread.Sleep(1000);
                // This select the number of orders to be displayed from the orders dropdown
                SelectOMSOrdersInstrument(numberOfRecords);
                Thread.Sleep(1000);
                Actions actions          = new Actions(driver);
                EventFiringWebDriver evw = new EventFiringWebDriver(driver);
                totalCount = Int32.Parse(numberOfRecords);
                count      = totalCount / 10;
                for (int j = 1; j <= count; j++)
                {
                    for (int i = 1; i <= 10; i++)
                    {
                        totalCountOfOrders++;
                    }
                    var queryString = "document.querySelector('div.ReactVirtualized__Grid.ReactVirtualized__Table__Grid').scrollTop=";
                    evw.ExecuteScript(queryString + (j * 440));
                    Thread.Sleep(1000);
                }
                if ((totalCountOfOrders <= numberOfOrders))
                {
                    flag = true;
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(flag);
        }
        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();
            }
        }
예제 #20
0
        // Add filter by userId and verify that only the details of the userId which was passed on filter is displayed in Buy side and Sell side order book
        public bool VerifySearchOMSOrdersByUserId(string instrument, string userId)
        {
            bool userIdFoundFlag = false;
            AdminCommonFunctions objAdminCommonFunctions = new AdminCommonFunctions(logger);

            try
            {
                objAdminCommonFunctions.ClickOnOMSOrdersMenuLink();
                objAdminCommonFunctions.SelectOMSOrdersInstrument(instrument);
                ClickMoreFiltersLink();
                AccountIdTextBox().Clear();
                UserIdTextBox().Clear();
                UserIdTextBox().SendKeys(userId);
                ClickMoreFiltersLink();
                userIdFoundFlag = VerifyUserIdInBuySideBook(userId);
                userIdFoundFlag = VerifyUserIdInSellSideBook(userId);
                return(userIdFoundFlag);
            }
            catch (Exception)
            {
                throw;
            }
        }
        public void TC41_WalletsDepositFiatcurrency()
        {
            try
            {
                string ticketStatus;
                string AcceptedticketStatus;
                string amount;
                string availableBalanceAfterDeposit;
                string availableBalanceAfterAccept;
                string totalBalance;
                string pendingBalance;
                string withdrawSuccessMsg;
                string pendingBalanceAfterDeposit;
                string expectedPendingBalanceAfterDeposit;
                string expectedPendingBalanceAfterAccept;
                string ticketID;
                string expectedAvailableBalanceAfterAccept;

                currencyName         = TestData.GetData("USDCurrency");
                comment              = TestData.GetData("TC41_Comment");
                amount               = TestData.GetData("USDAmount");
                fullName             = TestData.GetData("FullName");
                language             = TestData.GetData("TC40_Language");
                bankAddress          = TestData.GetData("TC40_BankAddress");
                bankAccountNumber    = TestData.GetData("TC40_BankAccountNumber");
                bankName             = TestData.GetData("TC40_BankName");
                swiftCode            = TestData.GetData("TC40_SwiftCode");
                withdrawStatus       = TestData.GetData("WithdrawStatus");
                ticketStatus         = TestData.GetData("TicketStatus");
                AcceptedticketStatus = TestData.GetData("AcceptedTicketStatus");

                TestProgressLogger.StartTest();
                UserFunctions userFunctions = new UserFunctions(TestProgressLogger);
                userFunctions.LogIn(TestProgressLogger, Const.USER15);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.UserLoggedInSuccessfully, Const.USER15));

                UserCommonFunctions.DashBoardMenuButton(driver);
                UserCommonFunctions.NavigateToWallets(driver);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.NavigateWalletsPage));

                WalletPage walletpage = new WalletPage();
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.StoreCurrentBalance, Const.USER15));
                walletpage.ClickInstrumentDetails(driver, currencyName);
                walletpage.GetHoldAvailablePendingDepositTotalBalanceOnDetailsPage(driver);
                pendingBalance = walletpage.PendingDepositDetailsPage;
                totalBalance   = walletpage.TotalBalanceDetailsPage;
                walletpage.ClickDepositButtonOnDetails(driver);
                walletpage.SendUSDDeposit(driver, fullName, amount, comment);
                walletpage.VerifyUSDDepositOnConfirmationModal(driver, fullName, amount, comment);
                walletpage.ClickOnConfirmUSDModalButton(driver);
                TestProgressLogger.LogCheckPoint(LogMessage.ConfirmationModalVerified);
                withdrawSuccessMsg = UserCommonFunctions.GetTextOfMessage(driver, TestProgressLogger);
                Assert.Equal(LogMessage.USDDepositSuccessMsg, withdrawSuccessMsg);
                ticketID = walletpage.GetDepositUSDTicketID(driver);
                GenericUtils.RefreshPage(driver);
                walletpage.GetHoldAvailablePendingDepositTotalBalanceOnDetailsPage(driver);
                pendingBalanceAfterDeposit         = walletpage.PendingDepositDetailsPage;
                availableBalanceAfterDeposit       = walletpage.AvailableBalanceDetailsPage;
                expectedPendingBalanceAfterDeposit = GenericUtils.GetSumFromStringAfterAddition(pendingBalance, amount);
                Assert.Equal(expectedPendingBalanceAfterDeposit, GenericUtils.RemoveCommaFromString(pendingBalanceAfterDeposit));
                userFunctions.LogOut();
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.UserLoggedOutSuccessfully, Const.USER15));

                AdminFunctions adminfunctions = new AdminFunctions(TestProgressLogger);
                adminfunctions.AdminLogIn(TestProgressLogger, Const.ADMIN1);

                AdminCommonFunctions admincommonfunctions = new AdminCommonFunctions(TestProgressLogger);
                admincommonfunctions.SelectTicketsMenu();
                admincommonfunctions.NavigateToDepositTicketsTab();
                admincommonfunctions.VerifyStatus(driver, ticketID, ticketStatus);
                TestProgressLogger.LogCheckPoint(LogMessage.VerifiedTicketStatusAsNew);
                admincommonfunctions.DoubleClickOnCreatedDepositTicket(driver, ticketID);
                admincommonfunctions.ClickOnAcceptButtonFromDepositsTicketModal();
                admincommonfunctions.VerifyStatus(driver, ticketID, AcceptedticketStatus);
                TestProgressLogger.LogCheckPoint(LogMessage.VerifiedTicketStatusAsAccepted);
                admincommonfunctions.UserMenuBtn();
                adminfunctions.AdminLogOut();
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.AdminUserLogoutSuccessfully, Const.ADMIN1));

                userFunctions.LogIn(TestProgressLogger, Const.USER15);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.UserLoggedInSuccessfully, Const.USER15));
                UserCommonFunctions.DashBoardMenuButton(driver);
                UserCommonFunctions.NavigateToWallets(driver);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.NavigateWalletsPage));
                walletpage.ClickInstrumentDetails(driver, currencyName);
                walletpage.GetHoldAvailablePendingDepositTotalBalanceOnDetailsPage(driver);
                pendingBalance = walletpage.PendingDepositDetailsPage;
                availableBalanceAfterAccept = walletpage.AvailableBalanceDetailsPage;

                expectedPendingBalanceAfterAccept = GenericUtils.GetDifferenceFromStringAfterSubstraction(pendingBalanceAfterDeposit, amount);
                Assert.Equal(expectedPendingBalanceAfterAccept, GenericUtils.RemoveCommaFromString(pendingBalance));
                TestProgressLogger.LogCheckPoint(LogMessage.PendingBalanceVerified);

                expectedAvailableBalanceAfterAccept = GenericUtils.GetSumFromStringAfterAddition(availableBalanceAfterDeposit, amount);
                Assert.Equal(expectedAvailableBalanceAfterAccept, GenericUtils.RemoveCommaFromString(availableBalanceAfterAccept));
                TestProgressLogger.LogCheckPoint(LogMessage.AvailableBalanceVerified);

                userFunctions.LogOut();
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.UserLoggedOutSuccessfully, Const.USER15));

                TestProgressLogger.EndTest();
                TestProgressLogger.LogCheckPoint(LogMessage.WalletsDepositFiatcurrencyTestPassed);
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.Error(LogMessage.WalletsDepositFiatcurrencyTestFailed, e);
                throw e;
            }
        }
        public void TC40_WalletsWithdrawFiatcurrency()
        {
            try
            {
                string emailAddress;
                string gmailPassword;
                string amounttowithdraw;
                string currentUSDBalance;
                string fee;
                string remainingBalance;
                string amountToWithdrawAndFees;
                string expectedRemainingBalance;
                string holdBalance;
                string totalBalance;
                string availableBalance;
                string withdrawSuccessMsg;
                string holdBalanceAfterDeposit;
                string availableBalanceAfterDeposit;
                string expectedAvailableBalanceAfterDeposit;
                string expectedHoldBalanceAfterDeposit;
                string statusID;
                string linkUrl;
                string ticketStatus;
                string withdrawSuccess;
                string mailSubject;
                string totalBalanceAfterDeposit;
                string expectedTotalBalanceAfterDeposit;


                currencyName          = TestData.GetData("USDCurrency");
                comment               = TestData.GetData("TC40_Comment");
                amountOfUSDToWithdraw = TestData.GetData("USDAmount");
                fullName              = TestData.GetData("FullName");
                language              = TestData.GetData("TC40_Language");
                bankAddress           = TestData.GetData("TC40_BankAddress");
                bankAccountNumber     = TestData.GetData("TC40_BankAccountNumber");
                bankName              = TestData.GetData("TC40_BankName");
                swiftCode             = TestData.GetData("TC40_SwiftCode");
                withdrawStatus        = TestData.GetData("WithdrawStatus");
                emailAddress          = TestData.GetData("User_14EmailAddress");
                gmailPassword         = TestData.GetData("GmailUser_Test1Password");
                mailSubject           = TestData.GetData("GmailMailSubject_ConfirmYourWithdraw");
                ticketStatus          = TestData.GetData("FullyProcessedTicketStatus");

                TestProgressLogger.StartTest();
                UserFunctions userFunctions = new UserFunctions(TestProgressLogger);
                userFunctions.LogIn(TestProgressLogger, Const.USER15);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.UserLoggedInSuccessfully, Const.USER15));

                UserCommonFunctions.DashBoardMenuButton(driver);
                UserCommonFunctions.NavigateToWallets(driver);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.NavigateWalletsPage));

                WalletPage walletpage = new WalletPage();
                walletpage.ClickInstrumentDetails(driver, currencyName);
                walletpage.GetHoldAvailablePendingDepositTotalBalanceOnDetailsPage(driver);
                holdBalance      = walletpage.HoldBalanceDetailsPage;
                availableBalance = walletpage.AvailableBalanceDetailsPage;
                walletpage.ClickWithdrawButtonOnDetails(driver);

                walletpage.WithdrawUSD(driver, amountOfUSDToWithdraw, fullName, language, comment, bankAddress, bankAccountNumber, bankName, swiftCode);
                amounttowithdraw  = walletpage.GetAmountToWithdraw(driver);
                currentUSDBalance = walletpage.GetCurrentUSDBalance(driver);
                fee = walletpage.GetFee(driver);
                remainingBalance         = walletpage.GetRemainingBalance(driver);
                amountToWithdrawAndFees  = GenericUtils.GetSumFromStringAfterAddition(amounttowithdraw, fee);
                expectedRemainingBalance = GenericUtils.GetDifferenceFromStringAfterSubstraction(currentUSDBalance, amountToWithdrawAndFees);
                Assert.Equal(expectedRemainingBalance, GenericUtils.RemoveCommaFromString(remainingBalance));
                TestProgressLogger.LogCheckPoint(LogMessage.RemainingBalanceVerifiedOnBalanceSection);

                walletpage.ClickOnWithdrawUSDButton(driver);
                walletpage.VerifyWithdrawUSDOnConfirmationModal(driver, amountOfUSDToWithdraw, fullName, language, comment, bankAddress, bankAccountNumber, bankName, swiftCode, fee);
                walletpage.ClickOnConfirmUSDModalButton(driver);
                TestProgressLogger.LogCheckPoint(LogMessage.ConfirmationModalVerified);
                withdrawSuccessMsg = UserCommonFunctions.GetTextOfMessage(driver, TestProgressLogger);
                Assert.Equal(LogMessage.USDWithdrawSuccessMsg, withdrawSuccessMsg);

                walletpage.GetHoldAvailablePendingDepositTotalBalanceOnDetailsPage(driver);
                holdBalanceAfterDeposit              = walletpage.HoldBalanceDetailsPage;
                availableBalanceAfterDeposit         = walletpage.AvailableBalanceDetailsPage;
                totalBalanceAfterDeposit             = walletpage.TotalBalanceDetailsPage;
                expectedAvailableBalanceAfterDeposit = GenericUtils.GetDifferenceFromStringAfterSubstraction(availableBalance, amountToWithdrawAndFees);
                Assert.Equal(expectedAvailableBalanceAfterDeposit, GenericUtils.RemoveCommaFromString(availableBalanceAfterDeposit));
                TestProgressLogger.LogCheckPoint(LogMessage.RemainingBalanceVerified);
                expectedHoldBalanceAfterDeposit = GenericUtils.GetSumFromStringAfterAddition(holdBalance, amountToWithdrawAndFees);
                Assert.Equal(expectedHoldBalanceAfterDeposit, holdBalanceAfterDeposit);
                TestProgressLogger.LogCheckPoint(LogMessage.HoldBalanceVerified);

                statusID = walletpage.GetStatusID(driver);
                userFunctions.LogOut();
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.UserLoggedOutSuccessfully, Const.USER15));

                AdminFunctions adminfunctions = new AdminFunctions(TestProgressLogger);
                adminfunctions.AdminLogIn(TestProgressLogger, Const.ADMIN1);

                AdminCommonFunctions admincommonfunctions = new AdminCommonFunctions(TestProgressLogger);
                admincommonfunctions.SelectTicketsMenu();
                admincommonfunctions.VerifyStatus(driver, statusID, withdrawStatus);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.CreatedTicketStatusVerified, statusID));
                admincommonfunctions.UserMenuBtn();
                adminfunctions.AdminLogOut();
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.AdminUserLogoutSuccessfully, Const.ADMIN1));

                GmailCommonFunctions gmailobj = new GmailCommonFunctions();
                linkUrl = gmailobj.Gmail(driver, emailAddress, gmailPassword, mailSubject);
                driver.Navigate().GoToUrl(linkUrl);
                withdrawSuccess = walletpage.GetWithdrawConfirmedMsg(driver);
                Assert.Equal(LogMessage.WithdrawSuccessfullyConfirmMsg, withdrawSuccess);
                walletpage.ClickOnGoToExchange(driver);
                TestProgressLogger.LogCheckPoint(LogMessage.WithdrawConfirmedMassage);

                adminfunctions.AdminLogIn(TestProgressLogger, Const.ADMIN1);
                admincommonfunctions = new AdminCommonFunctions(TestProgressLogger);
                admincommonfunctions.SelectTicketsMenu();
                admincommonfunctions.VerifyStatus(driver, statusID, ticketStatus);
                TestProgressLogger.LogCheckPoint(LogMessage.VerifiedTicketStatus);
                admincommonfunctions.UserMenuBtn();
                adminfunctions.AdminLogOut();
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.AdminUserLogoutSuccessfully, Const.ADMIN1));

                userFunctions.LogIn(TestProgressLogger, Const.USER15);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.UserLoggedInSuccessfully, Const.USER15));

                UserCommonFunctions.DashBoardMenuButton(driver);
                UserCommonFunctions.NavigateToWallets(driver);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.NavigateWalletsPage));

                walletpage.ClickInstrumentDetails(driver, currencyName);
                walletpage.GetHoldAvailablePendingDepositTotalBalanceOnDetailsPage(driver);
                holdBalance  = walletpage.HoldBalanceDetailsPage;
                totalBalance = walletpage.TotalBalanceDetailsPage;

                expectedTotalBalanceAfterDeposit = GenericUtils.GetDifferenceFromStringAfterSubstraction(totalBalanceAfterDeposit, amountToWithdrawAndFees);
                Assert.Equal(expectedTotalBalanceAfterDeposit, GenericUtils.RemoveCommaFromString(totalBalance));
                TestProgressLogger.LogCheckPoint(LogMessage.TotalBalanceVerified);

                expectedHoldBalanceAfterDeposit = GenericUtils.GetDifferenceFromStringAfterSubstraction(holdBalanceAfterDeposit, amountToWithdrawAndFees);
                Assert.Equal(expectedHoldBalanceAfterDeposit, holdBalance);
                TestProgressLogger.LogCheckPoint(LogMessage.HoldBalanceVerified);

                userFunctions.LogOut();
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.UserLoggedOutSuccessfully, Const.USER15));

                TestProgressLogger.EndTest();
                TestProgressLogger.LogCheckPoint(LogMessage.WalletsWithdrawFiatcurrencyTestPassed);
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.Error(LogMessage.WalletsWithdrawFiatcurrencyTestFailed, e);
                throw e;
            }
        }
        public void TC36_SendExternalWallets()
        {
            try
            {
                string emailAddress;
                string gmailPassword;
                string successMsg;
                string currentBalanceOfUser3;
                string holdBalance;
                string availableBalance;
                string btcAmount;
                string minerFees;
                string btcTotalaAmount;
                string withdrawSuccessMsg;
                string increasedHoldAmount;
                string incresedHoldBalance;
                string TotalBalance;
                string reducedAvailableBalance;
                string hold;
                string expectedReducedAvailableBalance;
                string statusID;
                string mailSubject;
                string withdrawSuccess;
                string acceptedticketStatus;
                string totalBalance;
                string expectedReducedHoldBalance;
                string expectedReducedTotalBalance;
                string linkUrl;
                string ticketStatusNew;

                instrument           = TestData.GetData("Instrument");
                currencyName         = TestData.GetData("CurrencyName");
                comment              = TestData.GetData("Comment");
                amountOfBtcToSend    = TestData.GetData("AmountOfBtcToSend");
                withdrawStatus       = TestData.GetData("WithdrawStatus");
                emailAddress         = TestData.GetData("User_14EmailAddress");
                gmailPassword        = TestData.GetData("GmailUser_Test1Password");
                mailSubject          = TestData.GetData("GmailMailSubject_ConfirmYourWithdraw");
                acceptedticketStatus = TestData.GetData("AcceptedTicketStatus");
                ticketStatusNew      = TestData.GetData("TicketStatus");

                TestProgressLogger.StartTest();
                UserFunctions userFunctions = new UserFunctions(TestProgressLogger);
                userFunctions.LogIn(TestProgressLogger, Const.USER12);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.UserLoggedInSuccessfully, Const.USER12));

                UserCommonFunctions.DashBoardMenuButton(driver);
                UserCommonFunctions.NavigateToWallets(driver);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.NavigateWalletsPage));

                WalletPage walletpage = new WalletPage();
                walletpage.ClickOnInstrumentReceiveButton(driver, currencyName);
                walletpage.CopyAddressToReceiveBTC(driver);
                successMsg = UserCommonFunctions.GetTextOfMessage(driver, TestProgressLogger);
                Assert.Equal(Const.CopyAddressSuccessMsg, successMsg);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.RecievedAddressCopied, Const.USER12));
                walletpage.CloseSendOrReciveSection(driver);
                userFunctions.LogOut();
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.UserLoggedOutSuccessfully, Const.USER12));

                userFunctions.LogIn(TestProgressLogger, Const.USER14);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.UserLoggedInSuccessfully, Const.USER14));
                UserCommonFunctions.DashBoardMenuButton(driver);
                UserCommonFunctions.NavigateToWallets(driver);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.NavigateWalletsPage));

                currentBalanceOfUser3 = walletpage.GetInstrumentCurrentBalance(driver, currencyName);
                walletpage.ClickInstrumentDetails(driver, currencyName);
                walletpage.GetHoldAvailablePendingDepositTotalBalanceOnDetailsPage(driver);
                holdBalance      = walletpage.HoldBalanceDetailsPage;
                availableBalance = walletpage.AvailableBalanceDetailsPage;
                walletpage.ClickSendButtonOnDetailsPage(driver);
                walletpage.SendBitCoinExternalWallet(driver, comment, amountOfBtcToSend);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.SendBitCoinSuccessfully, amountOfBtcToSend));
                btcAmount       = walletpage.GetBtcAmountOnConfirmation(driver);
                minerFees       = walletpage.GetMinerFeesOnConfirmation(driver);
                btcTotalaAmount = GenericUtils.GetSumFromStringAfterAddition(btcAmount, minerFees);
                walletpage.ClickConfirmButton(driver);
                withdrawSuccessMsg = UserCommonFunctions.GetTextOfMessage(driver, TestProgressLogger);
                Assert.Equal(Const.WithdrawSuccessMsg, withdrawSuccessMsg);

                increasedHoldAmount = GenericUtils.GetSumFromStringAfterAddition(holdBalance, btcTotalaAmount);
                walletpage.GetHoldAvailablePendingDepositTotalBalanceOnDetailsPage(driver);
                incresedHoldBalance     = walletpage.HoldBalanceDetailsPage;
                TotalBalance            = walletpage.TotalBalanceDetailsPage;
                reducedAvailableBalance = walletpage.AvailableBalanceDetailsPage;
                hold = GenericUtils.ConvertToDoubleFormat(GenericUtils.ConvertStringToDouble(increasedHoldAmount));
                Assert.Equal(hold, incresedHoldBalance);
                TestProgressLogger.LogCheckPoint(LogMessage.HoldAmountIncreasedSuccessfully);

                expectedReducedAvailableBalance = GenericUtils.GetDifferenceFromStringAfterSubstraction(availableBalance, btcTotalaAmount);
                Assert.Equal(expectedReducedAvailableBalance, GenericUtils.RemoveCommaFromString(reducedAvailableBalance));
                TestProgressLogger.LogCheckPoint(LogMessage.AvailableAmountReducedSuccessfully);
                statusID = walletpage.GetStatusID(driver);
                userFunctions.LogOut();
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.UserLoggedOutSuccessfully, Const.USER14));

                AdminFunctions adminfunctions = new AdminFunctions(TestProgressLogger);
                adminfunctions.AdminLogIn(TestProgressLogger, Const.ADMIN1);

                AdminCommonFunctions admincommonfunctions = new AdminCommonFunctions(TestProgressLogger);
                admincommonfunctions.SelectTicketsMenu();
                admincommonfunctions.VerifyStatus(driver, statusID, withdrawStatus);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.CreatedTicketStatusVerified, statusID));
                admincommonfunctions.UserMenuBtn();
                adminfunctions.AdminLogOut();
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.AdminUserLogoutSuccessfully, Const.ADMIN1));

                GmailCommonFunctions gmailobj = new GmailCommonFunctions();
                linkUrl = gmailobj.Gmail(driver, emailAddress, gmailPassword, mailSubject);
                driver.Navigate().GoToUrl(linkUrl);
                withdrawSuccess = walletpage.GetWithdrawConfirmedMsg(driver);
                Assert.Equal(LogMessage.WithdrawSuccessfullyConfirmMsg, withdrawSuccess);
                walletpage.ClickOnGoToExchange(driver);
                TestProgressLogger.LogCheckPoint(LogMessage.WithdrawConfirmedMassage);

                adminfunctions.AdminLogIn(TestProgressLogger, Const.ADMIN1);
                admincommonfunctions = new AdminCommonFunctions(TestProgressLogger);
                admincommonfunctions.SelectTicketsMenu();
                admincommonfunctions.VerifyStatus(driver, statusID, ticketStatusNew);

                admincommonfunctions.DoubleClickOnCreatedDepositTicket(driver, statusID);
                admincommonfunctions.ClickOnAcceptButtonFromDepositsTicketModal();
                admincommonfunctions.VerifyStatus(driver, statusID, acceptedticketStatus);
                TestProgressLogger.LogCheckPoint(LogMessage.VerifiedTicketStatus);
                admincommonfunctions.UserMenuBtn();
                adminfunctions.AdminLogOut();
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.AdminUserLogoutSuccessfully, Const.ADMIN1));

                userFunctions.LogIn(TestProgressLogger, Const.USER14);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.UserLoggedInSuccessfully, Const.USER14));
                UserCommonFunctions.DashBoardMenuButton(driver);
                UserCommonFunctions.NavigateToWallets(driver);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.NavigateWalletsPage));

                currentBalanceOfUser3 = walletpage.GetInstrumentCurrentBalance(driver, currencyName);
                walletpage.ClickInstrumentDetails(driver, currencyName);
                walletpage.GetHoldAvailablePendingDepositTotalBalanceOnDetailsPage(driver);
                holdBalance  = walletpage.HoldBalanceDetailsPage;
                totalBalance = walletpage.TotalBalanceDetailsPage;

                expectedReducedHoldBalance = GenericUtils.GetDifferenceFromStringAfterSubstraction(incresedHoldBalance, btcTotalaAmount);
                Assert.Equal(expectedReducedHoldBalance, GenericUtils.RemoveCommaFromString(holdBalance));
                TestProgressLogger.LogCheckPoint(LogMessage.HoldBalanceVerified);

                expectedReducedTotalBalance = GenericUtils.GetDifferenceFromStringAfterSubstraction(TotalBalance, btcTotalaAmount);
                Assert.Equal(expectedReducedTotalBalance, GenericUtils.RemoveCommaFromString(totalBalance));
                TestProgressLogger.LogCheckPoint(LogMessage.TotalBalanceVerified);

                userFunctions.LogOut();
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.UserLoggedOutSuccessfully, Const.USER14));
                TestProgressLogger.EndTest();
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.Error(LogMessage.SendExternalWalletsTestFailed, e);
                throw e;
            }
        }
        public void TC33_VerifyBuyBlockTradeWithLockedInTest()
        {
            instrument                    = TestData.GetData("Instrument");
            orderType                     = TestData.GetData("OrderType");
            menuTab                       = TestData.GetData("MenuTab");
            buyTab                        = TestData.GetData("BuyTab");
            sellTab                       = TestData.GetData("SellTab");
            orderSize                     = TestData.GetData("OrderSize");
            limitPrice                    = TestData.GetData("LimitPrice");
            timeInForce                   = TestData.GetData("TimeInForce");
            counterParty                  = TestData.GetData("TC33_CounterPartyPrice");
            counterPartyPrice             = TestData.GetData("TC33_CounterPartyPrice");
            productBoughtPrice            = TestData.GetData("TC33_ProductBoughtPrice");
            productSoldPrice              = TestData.GetData("TC33_ProductSoldPrice");
            wrongCounterParty             = TestData.GetData("TC33_IncorrectCounterParty");
            blocktradeReportStatus        = TestData.GetData("TC33_TradeReportStatus");
            userWithBadge                 = TestData.GetData("TC33_UserWithBadge");
            userWithPermissions           = TestData.GetData("TC33_UserWithPermissions");
            submitBlockTradePermission    = TestData.GetData("TC33_SubmitBlockTradePermission");
            getOpenTradeReportsPermission = TestData.GetData("TC33_GetOpenTradeReportsPermission");
            userByID                      = TestData.GetData("TC33_UserByID");
            counterPartyAccountID         = TestData.GetData("TC33_CounterPartyAccountID");
            buyerAccountID                = TestData.GetData("TC33_BuyerAccountID");
            badgeIdNumber                 = TestData.GetData("TC33_BadgeNumber");
            state            = TestData.GetData("TC33_State");
            firstPermission  = TestData.GetData("TC33_GetOpenTradeReports");
            SecondPermission = TestData.GetData("TC33_SubmitBlockTrade");

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

            try
            {
                TestProgressLogger.StartTest();
                objAdminFunctions.AdminLogIn(TestProgressLogger);
                objAdminCommonFunctions.UserByIDText(userByID);
                objAdminCommonFunctions.OpenUserButton();
                objAdminCommonFunctions.UserPermissionButton();
                objAdminCommonFunctions.AddSubmitBlockTradePermissions(submitBlockTradePermission);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.FirstPermissionGivenPassed, firstPermission));
                objAdminCommonFunctions.ClearTextBox();
                objAdminCommonFunctions.AddGetOpenTradeReportsPermissions(getOpenTradeReportsPermission);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.SecondPermissionGivenPassed, SecondPermission));
                objAdminCommonFunctions.ClosePermissionWindow();
                Thread.Sleep(2000);
                objAdminCommonFunctions.SelectAccountsMenu();
                objAdminCommonFunctions.OpenAccountByIDText(counterPartyAccountID);
                objAdminCommonFunctions.OpenAccountBtn();
                objAdminCommonFunctions.OpenAddNewBadgeButtonForUser();
                objAdminCommonFunctions.SubmitCreateAccountBadgeButton();
                Thread.Sleep(2000);
                objAdminCommonFunctions.UserBadgeIDValue(badgeIdNumber);
                objAdminCommonFunctions.CreateBadgeAccount();
                objAdminCommonFunctions.UserMenuBtn();
                objAdminFunctions.AdminLogOut();
                userfuntionality.LogIn(TestProgressLogger, Const.USER6);
                Thread.Sleep(2000);
                UserCommonFunctions.DashBoardMenuButton(driver);
                UserCommonFunctions.SelectAnExchange(driver);
                UserCommonFunctions.SelectInstrumentFromExchange(instrument, driver);
                Thread.Sleep(3000);
                UserCommonFunctions.ScrollingDownVertical(driver);
                objReportBlockTradePage.ReportBlockTradeButton();
                objReportBlockTradePage.VerifyReportBlockTradeWindow();
                objReportBlockTradePage.VerifyDropdownInstrument();
                objReportBlockTradePage.VerifyCounterParty();
                objReportBlockTradePage.VerifyLockedInCheckbox();
                objReportBlockTradePage.VerifyProductBought();
                objReportBlockTradePage.VerifyProductSold();
                objReportBlockTradePage.VerifyFees();
                objReportBlockTradePage.VerifyBalances();
                objReportBlockTradePage.VerifyElementsAndSubmitBlockTradeReport(counterPartyPrice, wrongCounterParty, productBoughtPrice, productSoldPrice);
                var otherPartyBlockTradeData = objReportBlockTradePage.SubmitBuyTradeReport(instrument, buyTab, counterPartyPrice, productBoughtPrice, productSoldPrice, blocktradeReportStatus);
                objUserFunctions.LogOut();
                userfuntionality.LogIn(TestProgressLogger, Const.USER5);
                Thread.Sleep(2000);
                UserCommonFunctions.DashBoardMenuButton(driver);
                UserCommonFunctions.SelectAnExchange(driver);
                UserCommonFunctions.SelectInstrumentFromExchange(instrument, driver);
                Thread.Sleep(3000);
                UserCommonFunctions.ScrollingDownVertical(driver);
                objReportBlockTradePage.VerifyOtherPartyBlockTradeReportTab(instrument, sellTab, counterPartyPrice, productBoughtPrice, productSoldPrice, blocktradeReportStatus, otherPartyBlockTradeData);
                objUserFunctions.LogOut();
                objAdminFunctions.AdminLogIn(TestProgressLogger);
                objReportBlockTradePage.VerifyBlockTradeInAdmin(buyerAccountID, counterPartyAccountID, instrument, productBoughtPrice, productBoughtPrice);
                TestProgressLogger.EndTest();
            }
            catch (NoSuchElementException ex)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace);
            }
            catch (Exception ex)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.Error(String.Format(LogMessage.BlockTradeWithLockedInTestFailedMsg, buyTab), ex);
                TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace);
            }
            finally
            {
                objAdminCommonFunctions.UserMenuBtn();
                objAdminFunctions.AdminLogOut();
            }
        }
        [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_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();
            }
        }
        [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_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();
            }
        }
        [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();
            }
        }