コード例 #1
0
        [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();
            }
        }
コード例 #2
0
        [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();
            }
        }