public void TC48_VerifyCyclicReportTradeActivities()
        {
            string           reportTypeValue      = TestData.GetData("TC48_SingleReportTradeActivityValue");
            UserFunctions    objUserFunctionality = new UserFunctions(TestProgressLogger);
            TradeReportsPage objTradeReportsPage  = new TradeReportsPage(driver, TestProgressLogger);

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

                //This will verify trade activities of cyclic report and their details
                Assert.True(objTradeReportsPage.VerifyCyclicReportData(reportTypeValue, startDate));
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.VerifyCyclicReportTradeActivitiesPassed, reportTypeValue));
            }
            catch (NoSuchElementException ex)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace);
                TestProgressLogger.LogError(String.Format(LogMessage.VerifyCyclicReportTradeActivitiesFailed, reportTypeValue), ex);
                throw ex;
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(e.Message + e.StackTrace);
                TestProgressLogger.LogError(String.Format(LogMessage.VerifyCyclicReportTradeActivitiesFailed, reportTypeValue), e);
                throw e;
            }
            finally
            {
                TestProgressLogger.EndTest();
            }
        }
Example #2
0
        // This method verifies Current Date - 1 and all futures dates are selectable
        public bool VerifyStartDateSelectableDatesForCyclicReport()
        {
            int  today;
            bool flag = false;

            today = GenericUtils.GetOnlyCurrentDate();
            string currentDate = GenericUtils.GetCurrentDate();

            UserSetFunctions.Click(StartDate());
            IWebElement dateWidgetFrom = driver.FindElement(By.XPath("//table[@class='pika-table']/tbody"));
            //This are the columns of the from date picker table
            List <IWebElement> columns = new List <IWebElement>();
            var dateColumn             = dateWidgetFrom.FindElements(By.ClassName("is-disabled"));

            foreach (IWebElement fields in dateColumn)
            {
                string disabledFields  = fields.Text;
                int    fieldValueInInt = Int32.Parse(disabledFields);
                if (fieldValueInInt < today)
                {
                    flag = true;
                    logger.LogCheckPoint(String.Format(LogMessage.StartCurrentDateAndFutureDatePassed, currentDate));
                    return(flag);
                }
                else
                {
                    logger.Error(String.Format(LogMessage.StartCurrentDateAndFutureDateFailed, currentDate));
                    return(flag);
                }
            }
            return(flag);
        }
        public void TC47_VerifySingleReportTradeActivities()
        {
            string reportTypeValue;
            string startDate;
            string endDate;

            reportTypeValue = TestData.GetData("TC47_SingleReportTradeActivityValue");
            try
            {
                //Login as a User
                TestProgressLogger.StartTest();
                UserFunctions objUserFunctionality = new UserFunctions(TestProgressLogger);
                objUserFunctionality.LogIn(TestProgressLogger, Const.USER14);

                TradeReportsPage objTradeReportsPage = new TradeReportsPage(driver, TestProgressLogger);
                startDate = GenericUtils.GetCurrentDateMinusOne();
                endDate   = GenericUtils.GetCurrentDate();
                Assert.True(objTradeReportsPage.VerifySingleReportData(reportTypeValue, startDate, endDate));
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.VerifySingleReportTradeActivitiesPassed, reportTypeValue));
            }
            catch (NoSuchElementException ex)
            {
                TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace);
                throw ex;
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.VerifySingleReportTradeActivitiesFailed, reportTypeValue));
                throw e;
            }
            finally
            {
                TestProgressLogger.EndTest();
                UserFunctions userFunctionality = new UserFunctions(TestProgressLogger);
                userFunctionality.LogOut();
            }
        }
Example #4
0
        //This method will verify the trade activites of Single Report
        public bool VerifySingleReportData(string reportTypeValue, string startDate, string endDate)
        {
            bool   flag = false;
            string ConfirmationSingleReportModalValue = TestData.GetData("TC47_SingleReportConfirmationModal");

            UserCommonFunctions.DashBoardMenuButton(driver);
            UserCommonFunctions.NavigateToUserSetting(driver);
            Thread.Sleep(2000);
            UserSetFunctions.Click(TradeReportsLink());
            Thread.Sleep(1000);
            UserSetFunctions.Click(SingleReportButton());
            if (VerifySingleReportTabIsSelectedAndCyclicReportAndSingleReportTabPresent())
            {
                string confirmationModalStartDate;
                string confirmationModalEndDate;
                string expectedConfirmationModalEndDate;
                string singleReportMsg;
                string reportSummaryTextValue;
                string createdDateTimeTextValue;
                string downloadReportBtnTextValue;

                if (VerifySingleReportFields())
                {
                    Thread.Sleep(1000);
                    UserSetFunctions.Click(SingleReportsTabSelected());
                    Thread.Sleep(1000);
                    UserSetFunctions.SelectDropdown(ReportType(), reportTypeValue);

                    if (VerifyStartDateSelectableDatesForSingleReport())
                    {
                        Thread.Sleep(2000);
                        if (startDate == null)
                        {
                            startDate = GenericUtils.GetCurrentDateMinusOne();
                        }
                        Thread.Sleep(1000);
                        StartDate().SendKeys(startDate);
                        Thread.Sleep(1000);
                        flag = true;
                    }

                    UserSetFunctions.Click(EndDate());
                    Thread.Sleep(1000);
                    if (endDate == null)
                    {
                        endDate = GenericUtils.GetCurrentDate();
                    }
                    Thread.Sleep(2000);
                    EndDate().SendKeys(endDate);
                    flag = true;

                    Thread.Sleep(1000);
                    UserSetFunctions.Click(CreateTradeReportButton());
                    VerifySingleReportModalConfirmation();

                    confirmationModalStartDate       = StartDateOnConfirmationSingleReportModal().Text;
                    confirmationModalEndDate         = EndDateOnConfirmationSingleReportModal().Text;
                    expectedConfirmationModalEndDate = endDate.Trim();
                    var strtDate = DateTime.Parse(startDate.Trim());
                    var endDte   = DateTime.Parse(expectedConfirmationModalEndDate);

                    if (DateTime.Parse(confirmationModalStartDate).Equals(strtDate) && DateTime.Parse(confirmationModalEndDate).Equals(endDte))
                    {
                        logger.LogCheckPoint(String.Format(LogMessage.StartAndEndDateConfirmationModalPassed, strtDate.ToString("MM/dd/yyyy"), endDte.ToString("MM/dd/yyyy")));
                    }
                    else
                    {
                        logger.Error(String.Format(LogMessage.StartAndEndDateConfirmationModalFailed, strtDate.ToString("MM/dd/yyyy"), endDte.ToString("MM/dd/yyyy")));
                    }
                    UserSetFunctions.Click(ConfirmationModalCreateReportButton());

                    singleReportMsg = ReportCreatedSuccessMsg().Text;
                    if (singleReportMsg.Equals(Const.SingleTradeReportMsg))
                    {
                        logger.LogCheckPoint(String.Format(LogMessage.SuccessMsgPassed, ConfirmationSingleReportModalValue));
                    }
                    else
                    {
                        logger.Error(String.Format(LogMessage.SuccessMsgFailed, ConfirmationSingleReportModalValue));
                    }

                    ClickRefreshReportsButton();
                    reportSummaryTextValue     = ReportSummaryText().Text;
                    createdDateTimeTextValue   = ReportCreatedDateTimeText().Text;
                    downloadReportBtnTextValue = DownloadReport().Text;
                    VerifyDownloadableTradeReports(reportSummaryTextValue, createdDateTimeTextValue, downloadReportBtnTextValue);
                }
            }
            return(flag);
        }
Example #5
0
        //This method will verify the trade activites of Single Report
        public bool VerifySingleReportData(string reportTypeValue, string startDate, string endDate)
        {
            bool   flag = false;
            string ConfirmationSingleReportModalValue = TestData.GetData("TC47_SingleReportConfirmationModal");

            try
            {
                // Click on "Dashboard" menu button --> "UserSetting" menu button --> "Trade Reports" button
                UserCommonFunctions.DashBoardMenuButton(driver);
                UserCommonFunctions.NavigateToUserSetting(driver);
                Thread.Sleep(2000);
                UserSetFunctions.Click(TradeReportsLink());
                Thread.Sleep(1000);

                // Click on "Single Report" button
                UserSetFunctions.Click(SingleReportButton());

                // Verify if Single Report tab is selected bydefault and single, Cyclic tab is present
                if (VerifySingleReportTabIsSelectedAndCyclicReportAndSingleReportTabPresent())
                {
                    string confirmationModalStartDate;
                    string confirmationModalEndDate;
                    string expectedConfirmationModalEndDate;
                    string singleReportMsg;
                    string reportSummaryTextValue;
                    string createdDateTimeTextValue;
                    string downloadReportBtnTextValue;


                    //Verify below fields are present:accounts, report type and start date, end date
                    if (VerifySingleReportFields())
                    {
                        Thread.Sleep(1000);

                        UserSetFunctions.Click(SingleReportsTabSelected());
                        Thread.Sleep(1000);
                        UserSetFunctions.SelectDropdown(ReportType(), reportTypeValue);

                        // Verify Current Date - 1 and all previous dates are selectable
                        if (VerifyStartDateSelectableDatesForSingleReport())
                        {
                            Thread.Sleep(2000);
                            if (startDate == null)
                            {
                                startDate = GenericUtils.GetCurrentDateMinusOne();
                            }
                            Thread.Sleep(1000);

                            // Enter "Start date"
                            StartDate().SendKeys(startDate);
                            Thread.Sleep(1000);
                            flag = true;
                        }

                        // Click on "End date"
                        UserSetFunctions.Click(EndDate());
                        Thread.Sleep(1000);
                        if (endDate == null)
                        {
                            endDate = GenericUtils.GetCurrentDate();
                        }
                        Thread.Sleep(2000);
                        // Enter "End date"
                        EndDate().SendKeys(endDate);
                        flag = true;

                        Thread.Sleep(1000);

                        // Click on "Create Report" button
                        UserSetFunctions.Click(CreateTradeReportButton());

                        // Verify confirmation modal is displayed
                        VerifySingleReportModalConfirmation();

                        confirmationModalStartDate       = StartDateOnConfirmationSingleReportModal().Text;
                        confirmationModalEndDate         = EndDateOnConfirmationSingleReportModal().Text;
                        expectedConfirmationModalEndDate = endDate.Trim();
                        var strtDate = DateTime.Parse(startDate.Trim());
                        var endDte   = DateTime.Parse(expectedConfirmationModalEndDate);

                        // This will verify the start and end date in the confirmation window modal of single report
                        if (DateTime.Parse(confirmationModalStartDate).Equals(strtDate) && DateTime.Parse(confirmationModalEndDate).Equals(endDte))
                        {
                            logger.LogCheckPoint(String.Format(LogMessage.StartAndEndDateConfirmationModalPassed, strtDate.ToString("MM/dd/yyyy"), endDte.ToString("MM/dd/yyyy")));
                        }
                        else
                        {
                            logger.Error(String.Format(LogMessage.StartAndEndDateConfirmationModalFailed, strtDate.ToString("MM/dd/yyyy"), endDte.ToString("MM/dd/yyyy")));
                        }
                        UserSetFunctions.Click(ConfirmationModalCreateReportButton());
                        singleReportMsg = ReportCreatedSuccessMsg().Text;

                        // This will verify the success message after creating the a single rpeort
                        if (singleReportMsg.Equals(Const.SingleTradeReportMsg))
                        {
                            logger.LogCheckPoint(String.Format(LogMessage.SuccessMsgPassed, ConfirmationSingleReportModalValue));
                        }
                        else
                        {
                            logger.Error(String.Format(LogMessage.SuccessMsgFailed, ConfirmationSingleReportModalValue));
                        }

                        ClickRefreshReportsButton();
                        reportSummaryTextValue     = ReportSummaryText().Text;
                        createdDateTimeTextValue   = ReportCreatedDateTimeText().Text;
                        downloadReportBtnTextValue = DownloadReport().Text;

                        // Verify the "created time", Report summary is "report type" , on demand and from and to date.
                        // Verify the report is downloadable
                        VerifyDownloadableTradeReports(reportSummaryTextValue, createdDateTimeTextValue, downloadReportBtnTextValue);
                    }
                }
                return(flag);
            }
            catch (Exception)
            {
                throw;
            }
        }