public static void GetData()
        {
            conn = new SqlCeConnection(connectionString);
            conn.Open();
            SqlCeCommand cmd = conn.CreateCommand();
            cmd.CommandText = "Select * from TestData_For_CommentedReports where Country in ('US','All') and Category='Sanity'";

            using (SqlCeDataReader rdr = cmd.ExecuteReader())
            {
                List<ReportData> lst = new List<ReportData>();
                while (rdr.Read())
                {

                    ReportData[] rd = new ReportData[]{
                        new ReportData {
                    testName = rdr.GetString(0),
                    reportName = rdr.GetString(1),
                    accesspoint = rdr.GetString(2),
                    defaultReportTitle = rdr.GetString(3),
                    fromDate = rdr.GetString(4),
                    toDate = rdr.GetString(5),
                    defaultCommentedReportTitle = rdr.GetString(6),
                    xyCoordinatesFileName = rdr.GetString(7),
                    commentedReportName = rdr.GetString(8),
                    commentedReportTitle = rdr.GetString(9),
                    newNameForCommentedReport = rdr.GetString(10),
                    country = rdr.GetString(11),
                    suiteType = rdr.GetString(12),
                    type = rdr.GetString(13),
                    status = rdr.GetString(14)
                }
                };
                    _data.Add(rd);
                }

            }
            conn.Close();
        }
 public void US_CommentedReportTests_BATS(ReportData report)
 {
     reportData = report;
     this.BDDfy();
 }
        //*************************************************************************************************************************************************************
           public static bool Add99Comments(TestStack.White.Application qbApp, TestStack.White.UIItems.WindowItems.Window qbWindow,ReportData reportData)
           {
               try
               {
                   bool res = false;
                   QuickBooks.ResetQBWindows(qbApp, qbWindow, false);
                   res = Reports.CreateCommentedReport(qbApp, qbWindow, reportData.reportName, reportData.accesspoint, reportData.defaultReportTitle, reportData.fromDate, reportData.toDate, "noncustom", reportData.commentedReportName, reportData.defaultCommentedReportTitle);
                   Assert.AreEqual(true, res, "Create commented report failed for " + reportName);

                   QuickBooks.ResetQBWindows(qbApp, qbWindow, false);

                   int visualCueCount = 99;
                   res = Reports.AddCommentsToCommentedReport(qbApp, qbWindow, reportData.commentedReportName, reportData.commentedReportTitle, reportData.xyCoordinatesFileName, visualCueCount);
                   Assert.AreEqual(true, res, "Add comments to " + reportName + "failed");
                   QuickBooks.ResetQBWindows(qbApp, qbWindow, false);
                   Logger.logMessage("AddCommentsToAllTheVisualCues : -> Failed");
                   Logger.logMessage("------------------------------------------------------------------------------");
                   return true;
               }
               catch (Exception e)
               {
                   Logger.logMessage("AddCommentsToAllTheVisualCues : -> Failed");
                   Logger.logMessage(e.Message);
                   Logger.logMessage("------------------------------------------------------------------------------");
                   String sMessage = e.Message;
                   LastException.SetLastError(sMessage);
                   throw new Exception(sMessage);
               }
           }
        //*************************************************************************************************************************************************************

        public static bool PrintToSaveCommentedreportInTabDelimitedFormat(TestStack.White.Application qbApp, TestStack.White.UIItems.WindowItems.Window qbWindow, ReportData reportData)
        {
            Logger.logMessage("PrintToSaveCommentedreportInAsciiFormat : -> Started");
            Logger.logMessage("------------------------------------------------------------------------------");
            try
            {
                bool res = false;
                QuickBooks.ResetQBWindows(qbApp, qbWindow, false);
                res = Reports.CreateCommentedReport(qbApp, qbWindow, reportData.reportName, reportData.accesspoint, reportData.defaultReportTitle, reportData.fromDate, reportData.toDate, "noncustom", reportData.commentedReportName, reportData.defaultCommentedReportTitle);
                Assert.AreEqual(true, res, "Create commented report failed for " + reportName);

                QuickBooks.ResetQBWindows(qbApp, qbWindow, false);

                int visualCueCount = 2;
                res = Reports.AddCommentsToCommentedReport(qbApp, qbWindow, reportData.commentedReportName, reportData.commentedReportTitle, reportData.xyCoordinatesFileName, visualCueCount);
                Assert.AreEqual(true, res, "Add comments to " + reportName + "failed");
                QuickBooks.ResetQBWindows(qbApp, qbWindow, false);

                //Print commented report into specified format
                string fileName = conf.get("LogDirectory").Replace("\\\\", "\\") + commentedReportName + DateTime.Now.ToString("ddMMyyyyhhmmss");
                PrintCommentedReportInSpecifiedFormat(qbApp, qbWindow, reportData.commentedReportName, reportData.commentedReportTitle, "T", fileName);
                Assert.AreEqual(true, File.Exists(fileName + ".txt"), "Print report to specified file format failed");

                Logger.logMessage("CreateCommentedReportInCIndexFile : -> Sucessful");
                Logger.logMessage("------------------------------------------------------------------------------");
                return true;
            }
            catch (Exception e)
            {
                Logger.logMessage("CreateCommentedReportInCIndexFile : -> Failed");
                Logger.logMessage(e.Message);
                Logger.logMessage("------------------------------------------------------------------------------");
                String sMessage = e.Message;
                LastException.SetLastError(sMessage);
                throw new Exception(sMessage);
            }
        }
        //*************************************************************************************************************************************************************
        public static void RunCommentedReportTests(ReportData rd, TestStack.White.Application qbApp, TestStack.White.UIItems.WindowItems.Window qbWindow, string countryCriteria, string categoryCriteria, string connectionString, string testDataTableName, string createTableQuery, string testDataFileName)
        {
                   SqlCeConnection conn = null;
                   SqlCeCommand cmd = null;
                   string exportDataPath = "E:\\QBSilk4NetWhiteFramework\\ReportRefonte\\ExportedData\\";
            //Run the commented reports tests on each of the reports mentioned in the table
            try
            {
                    testName = rd.testName;
                    reportName = rd.reportName;
                    accesspoint = rd.accesspoint;
                    defaultReportTitle = rd.defaultReportTitle;
                    fromDate = rd.fromDate;
                    toDate = rd.toDate;
                    defaultCommentedReportTitle = rd.defaultCommentedReportTitle;
                    xyCoordinatesFileName = rd.xyCoordinatesFileName;
                    commentedReportName = rd.commentedReportName;
                    commentedReportTitle = rd.commentedReportTitle;
                    newNameForCommentedReport = rd.newNameForCommentedReport;
                    type = rd.type;
                    status = rd.status;

                    if (!(status.ToString().Equals("Pass")) && !status.ToString().Equals("DoNotRun"))
                    {
                        bool res = false;
                        QuickBooks.ResetQBWindows(qbApp, qbWindow, false);
                        res = Reports.CreateCommentedReport(qbApp, qbWindow, reportName, accesspoint, defaultReportTitle, fromDate, toDate, type, commentedReportName, defaultCommentedReportTitle);
                        Assert.AreEqual(true,res,"Create commented report failed for "+reportName);
                        QuickBooks.ResetQBWindows(qbApp, qbWindow, false);
                        res = Reports.AddCommentsToCommentedReport(qbApp, qbWindow, commentedReportName, commentedReportTitle, xyCoordinatesFileName, 5);
                        Assert.AreEqual(true, res, "Add comments to " + reportName + "failed");
                        //QuickBooks.ResetQBWindows(qbApp, qbWindow, false);
                        //res = Reports.EditComment(qbApp, qbWindow, commentedReportName, commentedReportTitle, xyCoordinatesFileName);
                        //Assert.AreEqual(true, res, "Edit comments to " + reportName + "failed");
                        //QuickBooks.ResetQBWindows(qbApp, qbWindow, false);
                        //res = Reports.DeleteComment(qbApp, qbWindow, commentedReportName, commentedReportTitle, xyCoordinatesFileName);
                        //Assert.AreEqual(true, res, "Delete comments to " + reportName + "failed");
                        //QuickBooks.ResetQBWindows(qbApp, qbWindow, false);
                        //res = Reports.SaveCommentedReportDataAsPDF(qbApp, qbWindow, commentedReportName, commentedReportTitle, exportDataPath);
                        //Assert.AreEqual(true, res, "Save as PDF failed for " + reportName);
                        //QuickBooks.ResetQBWindows(qbApp, qbWindow, false);
                        //res = Reports.RenameCommentedReport(qbApp, qbWindow, commentedReportName, newNameForCommentedReport);
                        //Assert.AreEqual(true, res, "Renaming commented report " + reportName + "failed");
                        //QuickBooks.ResetQBWindows(qbApp, qbWindow, false);
                       // res = Reports.DeleteCommentedReport(qbApp, qbWindow, newNameForCommentedReport);
                        //Assert.AreEqual(true, res, "Delete commented report " + reportName + "failed");
                        //QuickBooks.ResetQBWindows(qbApp, qbWindow, false);

                        conn = new SqlCeConnection(connectionString);
                        conn.Open();
                        if (Reports.CheckTableExists(conn, testDataTableName))
                        {
                            cmd = conn.CreateCommand();
                            cmd.CommandText = "update " + testDataTableName + " set TestStatus ='Pass' where ReportName='" + reportName + "'";
                            cmd.ExecuteNonQuery();
                        }
                        conn.Close();
                    }

                }
            catch (Exception e)
            {
                conn = new SqlCeConnection(connectionString);
                conn.Open();
                if (Reports.CheckTableExists(conn, testDataTableName))
                {
                    cmd = conn.CreateCommand();
                    cmd.CommandText = "update " + testDataTableName + " set TestStatus ='Fail' where ReportName='" + reportName + "'";
                    cmd.ExecuteNonQuery();
                }
                Logger.logMessage(e.Message);
                conn.Close();
            }
        }
        //*************************************************************************************************************************************************************
        public static void TrackUserIdentityForComments(TestStack.White.Application qbApp, TestStack.White.UIItems.WindowItems.Window qbWindow, ReportData reportData)
        {
            Logger.logMessage(" In TrackUserIdentityForComments Method - started");
            Logger.logMessage("------------------------------------------------------------------------------");
            try
            {
                bool res = false;
                if (CheckCommentedReportExists(qbApp, qbWindow, reportData.commentedReportName))
                {
                    DeleteCommentedReport(qbApp, qbWindow, reportData.commentedReportName);
                }

               
                QuickBooks.ResetQBWindows(qbApp, qbWindow, false);

                res = Reports.CreateCommentedReport(qbApp, qbWindow, reportData.reportName, reportData.accesspoint, reportData.defaultReportTitle, reportData.fromDate, reportData.toDate, "noncustom", reportData.commentedReportName, reportData.defaultCommentedReportTitle);
                Assert.AreEqual(true, res, "Create commented report failed for " + reportData.reportName);
                QuickBooks.ResetQBWindows(qbApp, qbWindow, false);


                int visualCueCount = 1;
                res = Reports.CheckCommentsCreatedByModifiedByValues(qbApp, qbWindow, reportData.commentedReportName, reportData.commentedReportTitle, reportData.xyCoordinatesFileName, visualCueCount);
                
                QuickBooks.ResetQBWindows(qbApp, qbWindow, false);

                Logger.logMessage("TrackUserIdentityForComments : -> Successful");
                Logger.logMessage("------------------------------------------------------------------------------");

            }
            catch (Exception e)
            {
                Logger.logMessage("TrackUserIdentityForComments : -> Failed");
                Logger.logMessage(e.Message);
                Logger.logMessage("------------------------------------------------------------------------------");
                String sMessage = e.Message;
                LastException.SetLastError(sMessage);
                throw new Exception(sMessage);
            }
        }
        //*************************************************************************************************************************************************************
        public static bool DeleteCommentedRepertWhichIsInUse(TestStack.White.Application qbApp, TestStack.White.UIItems.WindowItems.Window qbWindow, ReportData reportData)
        {
            Logger.logMessage("DeleteCommentedRepertWhichIsInUse : -> Started");
            Logger.logMessage("------------------------------------------------------------------------------");
            try
            {
                bool res = false;
                QuickBooks.ResetQBWindows(qbApp, qbWindow, false);
                res = Reports.CreateCommentedReport(qbApp, qbWindow, reportData.reportName, reportData.accesspoint, reportData.defaultReportTitle, reportData.fromDate, reportData.toDate, "noncustom", reportData.commentedReportName, reportData.defaultCommentedReportTitle);
                Assert.AreEqual(true, res, "Create commented report failed for " + reportName);
                QuickBooks.ResetQBWindows(qbApp, qbWindow, false);
               
                //Open saved Commented report
                Reports.OpenSavedCommentedReport(qbApp, qbWindow, reportData.commentedReportName, reportData.commentedReportTitle);

                    qbAppWindowForSilk = _desktop.Window("/Window");
                    qbAppWindowForSilk.SetActive();
                    commentedReportListWindowForSilk = qbAppWindowForSilk.Window("@caption='Commented Reports'");
                    commentedReportListWindowForSilk.Maximize();
                    commentedReportListWindowForSilk.TextClick(reportData.commentedReportName, 1, ClickType.Left);
                    TestStack.White.UIItems.WindowItems.Window commentedReportListWindow = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, "Commented Reports");
                    FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(commentedReportListWindow, "Commented Reports");
                    Thread.Sleep(int.Parse(Execution_Speed));
                    FrameworkLibraries.ActionLibs.WhiteAPI.Actions.DesktopInstance_ClickElementByName("Delete Commented Report");
                    Thread.Sleep(int.Parse(Execution_Speed));
                    FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, "Delete This Commented Report?"), "Yes");
                try{
                if(Actions.CheckWindowExists(qbWindow,"Warning"))
                    Actions.ClickElementByName(Actions.GetChildWindow(qbWindow,"Warning"),"OK");
                }catch{}
                QuickBooks.ResetQBWindows(qbApp, qbWindow, false);


                Logger.logMessage("DeleteCommentedRepertWhichIsInUse : -> Succeeded");
                Logger.logMessage("------------------------------------------------------------------------------");
                return true;
            }
            catch (Exception e)
            {
                Logger.logMessage("DeleteCommentedRepertWhichIsInUse : -> Failed");
                Logger.logMessage(e.Message);
                Logger.logMessage("------------------------------------------------------------------------------");
                String sMessage = e.Message;
                LastException.SetLastError(sMessage);
                throw new Exception(sMessage);
            }

        }
        //*************************************************************************************************************************************************************

        public static void ScrollCommentedReportWindow(TestStack.White.Application qbApp, TestStack.White.UIItems.WindowItems.Window qbWindow, ReportData reportData)
        {
            Logger.logMessage(" In ScrollCommentedReportWindow Method");
            Logger.logMessage("------------------------------------------------------------------------------");
            try
            {
                /* if (CheckCommentedReportExists(qbApp, qbWindow, reportData.commentedReportName))
                 {
                     DeleteCommentedReport(qbApp, qbWindow, reportData.commentedReportName);
                 }

                 bool res = false;
                 QuickBooks.ResetQBWindows(qbApp, qbWindow, false);

                 res = Reports.CreateCommentedReport(qbApp, qbWindow, reportData.reportName, reportData.accesspoint, reportData.defaultReportTitle, reportData.fromDate, reportData.toDate, "noncustom", reportData.commentedReportName, reportData.defaultCommentedReportTitle);
                 Assert.AreEqual(true, res, "Create commented report failed for " + reportData.reportName);
                 QuickBooks.ResetQBWindows(qbApp, qbWindow, false);*/

                OpenSavedCommentedReport(qbApp, qbWindow, reportData.commentedReportName, reportData.commentedReportTitle);
                var items = Actions.GetChildWindow(qbWindow, reportData.commentedReportTitle).Items;

                TestStack.White.UIItems.WindowItems.Window w = Actions.GetChildWindow(qbWindow, reportData.commentedReportTitle);
                w.ScrollBars.Vertical.ScrollDown();
                double startPosition = w.ScrollBars.Horizontal.MinimumValue;
                double endPosition = w.ScrollBars.Horizontal.MaximumValue;
                //int a = w.ScrollBars.Horizontal.MinimumValue;
                while (startPosition != endPosition)
                {//"DownButton"
                    try { Actions.ClickElementByAutomationID(w, "DownButton"); }
                    catch (Exception e) { }
                    startPosition = w.ScrollBars.Horizontal.Value;
                    w.ScrollBars.Horizontal.ScrollRight();
                    bool t = w.ScrollBars.Horizontal.IsScrollable;

                }

                startPosition = w.ScrollBars.Horizontal.MaximumValue;
                endPosition = w.ScrollBars.Horizontal.MinimumValue;
                //int a = w.ScrollBars.Horizontal.MinimumValue;
                while (startPosition != endPosition)
                {
                    w.ScrollBars.Horizontal.ScrollLeft();
                    startPosition = w.ScrollBars.Horizontal.Value;
                }

                startPosition = w.ScrollBars.Vertical.MinimumValue;
                endPosition = w.ScrollBars.Vertical.MaximumValue;
                //int a = w.ScrollBars.Horizontal.MinimumValue;
                while (startPosition != endPosition)
                {
                    w.ScrollBars.Vertical.ScrollDown();
                    startPosition = w.ScrollBars.Vertical.Value;
                }

                startPosition = w.ScrollBars.Vertical.MaximumValue;
                endPosition = w.ScrollBars.Vertical.MinimumValue;
                //int a = w.ScrollBars.Horizontal.MinimumValue;
                while (startPosition != endPosition)
                {
                    w.ScrollBars.Vertical.ScrollUp();
                    startPosition = w.ScrollBars.Vertical.Value;
                }


                Logger.logMessage("ScrollCommentedReportWindow : -> Successful");
                Logger.logMessage("------------------------------------------------------------------------------");

            }
            catch (Exception e)
            {
                Logger.logMessage("ScrollCommentedReportWindow : -> Failed");
                Logger.logMessage(e.Message);
                Logger.logMessage("------------------------------------------------------------------------------");
                String sMessage = e.Message;
                LastException.SetLastError(sMessage);
                throw new Exception(sMessage);
            }
        }
        //*************************************************************************************************************************************************************
        public static void OpeningMultipleInstancesOfSameCommentedReport(TestStack.White.Application qbApp, TestStack.White.UIItems.WindowItems.Window qbWindow, ReportData reportData)
        {

            Logger.logMessage(" In OpeningMultipleInstancesOfSameCommentedReport Method");
            Logger.logMessage("------------------------------------------------------------------------------");
            try
            {
                if (CheckCommentedReportExists(qbApp, qbWindow, reportData.commentedReportName))
                {
                    DeleteCommentedReport(qbApp, qbWindow, reportData.commentedReportName);
                }

                bool res = false;
                QuickBooks.ResetQBWindows(qbApp, qbWindow, false);

                res = Reports.CreateCommentedReport(qbApp, qbWindow, reportData.reportName, reportData.accesspoint, reportData.defaultReportTitle, reportData.fromDate, reportData.toDate, "noncustom", reportData.commentedReportName, reportData.defaultCommentedReportTitle);
                Assert.AreEqual(true, res, "Create commented report failed for " + reportData.reportName);
                QuickBooks.ResetQBWindows(qbApp, qbWindow, false);


                //Check CommentedReportsWindow Does not open multiple times
                OpenSavedCommentedReport(qbApp, qbWindow, reportData.commentedReportName, reportData.commentedReportTitle);
                OpenSavedCommentedReport(qbApp, qbWindow, reportData.commentedReportName, reportData.commentedReportTitle);
                OpenSavedCommentedReport(qbApp, qbWindow, reportData.commentedReportName, reportData.commentedReportTitle);
                List<TestStack.White.UIItems.WindowItems.Window> a = qbApp.GetWindows();

                int count = 0;
                foreach (TestStack.White.UIItems.WindowItems.Window item in a)
                {
                    if (item.Name.Contains(reportData.commentedReportTitle))
                    {
                        ++count;
                    }
                }
                Assert.AreEqual(1, count, "Commented report window count mismatches");
                Logger.logMessage("OpeningMultipleInstancesOfSameCommentedReport : -> Successful");
                Logger.logMessage("------------------------------------------------------------------------------");

            }
            catch (Exception e)
            {
                Logger.logMessage("OpeningMultipleInstancesOfSameCommentedReport : -> Failed");
                Logger.logMessage(e.Message);
                Logger.logMessage("------------------------------------------------------------------------------");
                String sMessage = e.Message;
                LastException.SetLastError(sMessage);
                throw new Exception(sMessage);
            }

        }
        //*************************************************************************************************************************************************************

        public static bool CreateContributedCommentedReport(TestStack.White.Application qbApp, TestStack.White.UIItems.WindowItems.Window qbWindow, ReportData reportData)
        {
            Logger.logMessage("In CreateContributedCommentedReport loop- started");
            Logger.logMessage("------------------------------------------------------------------------------");

            TestStack.White.UIItems.WindowItems.Window reportWindow = null;
            bool res = false;
            try
            {
                if (CheckCommentedReportExists(qbApp, qbWindow, reportData.commentedReportName))
                {
                    DeleteCommentedReport(qbApp, qbWindow, reportData.commentedReportName);
                }
                try
                {
                    string[] reportAccessPoint = Regex.Split(reportData.accesspoint, "->");
                    FrameworkLibraries.ActionLibs.WhiteAPI.Actions.SelectMenu(qbApp, qbWindow, reportAccessPoint);
                    FrameworkLibraries.ActionLibs.WhiteAPI.Actions.WaitForChildWindow(qbWindow, "Report Center", int.Parse("5000"));
                }
                catch (Exception e)
                {
                    Logger.logMessage("Cannot open the report : ->  " + reportName);
                    Logger.logMessage("------------------------------------------------------------------------------");
                }
                try
                {

                    TestStack.White.UIItems.WindowItems.Window reportCenterWindow = Actions.GetChildWindow(qbWindow, "Report Center");

                    FrameworkLibraries.ActionLibs.WhiteAPI.Actions.SetTextOnElementByAutomationID(reportCenterWindow, "textBox", "");
                    FrameworkLibraries.ActionLibs.WhiteAPI.Actions.SetTextOnElementByAutomationID(reportCenterWindow, "textBox", "CR2095");
                    FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickButtonByAutomationID(reportCenterWindow, "SearchBtn");
                    FrameworkLibraries.ActionLibs.WhiteAPI.Actions.WaitForElementVisible(reportCenterWindow, "Search Results", int.Parse(Sync_Timeout));
                    FrameworkLibraries.ActionLibs.WhiteAPI.Actions.DoubleClickElementByName(reportCenterWindow, "Profit & Loss By Month");
                    FrameworkLibraries.ActionLibs.WhiteAPI.Actions.DoubleClickElementByName(reportCenterWindow, "Profit & Loss By Month");             

                    FrameworkLibraries.ActionLibs.WhiteAPI.Actions.WaitForChildWindow(qbWindow, reportData.defaultReportTitle, int.Parse(Sync_Timeout));
                }
                catch (Exception e) { }
                Thread.Sleep(int.Parse(Execution_Speed));

                reportWindow = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, reportData.defaultReportTitle);
                //Maximize the report
                try
                {
                    FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(reportWindow, "Maximize");
                }
                catch (Exception e) { }
                try
                {
                    FrameworkLibraries.ActionLibs.WhiteAPI.Actions.WaitForChildWindow(qbWindow, reportData.defaultReportTitle, int.Parse(Sync_Timeout));

                    //create commented report out of it
                    FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(Actions.GetChildWindow(qbWindow, reportData.defaultReportTitle), "Comment on Report");
                    FrameworkLibraries.ActionLibs.WhiteAPI.Actions.WaitForChildWindow(qbWindow, reportData.defaultCommentedReportTitle, int.Parse(Sync_Timeout));
                }
                catch (Exception e) { }
                Thread.Sleep(int.Parse(Execution_Speed));
                TestStack.White.UIItems.WindowItems.Window commentedReportWindow = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, reportData.defaultCommentedReportTitle);

                // Save the commented report
                Reports.SaveCommentedReport(qbApp, qbWindow, commentedReportWindow, reportData.commentedReportName);
                //check if the commented report window is created
                bool found = CheckCommentedReportExists(qbApp, qbWindow, reportData.commentedReportName);
                Assert.AreEqual(true, found, "Cannot find the created commented report");
                QuickBooks.ResetQBWindows(qbApp, qbWindow, false);

                Logger.logMessage("CreateCommentedReport : -> Successfully created contributed Commented report  " + reportData.commentedReportName);
                Logger.logMessage("------------------------------------------------------------------------------");
                return true;

            }
            catch (Exception e)
            {
                Logger.logMessage("CreateContributedCommentedReport : -> Failed");
                Logger.logMessage(e.Message);
                Logger.logMessage("------------------------------------------------------------------------------");
                throw new Exception(e.Message);
            }
        }
        //*************************************************************************************************************************************************************

        public static void CreateCommentedReportWithExistingNameOfADeletedReport(TestStack.White.Application qbApp, TestStack.White.UIItems.WindowItems.Window qbWindow, ReportData reportData)
        {
            Logger.logMessage(" In CreateCommentedReportWithExistingName Method - started");
            Logger.logMessage("------------------------------------------------------------------------------");
            try
            {
                if (CheckCommentedReportExists(qbApp, qbWindow, reportData.commentedReportName))
                {
                    DeleteCommentedReport(qbApp, qbWindow, reportData.commentedReportName);
                }

                bool res = false;
                QuickBooks.ResetQBWindows(qbApp, qbWindow, false);

                res = Reports.CreateCommentedReport(qbApp, qbWindow, reportData.reportName, reportData.accesspoint, reportData.defaultReportTitle, reportData.fromDate, reportData.toDate, "noncustom", reportData.commentedReportName, reportData.defaultCommentedReportTitle);
                Assert.AreEqual(true, res, "Create commented report failed for " + reportName);
                QuickBooks.ResetQBWindows(qbApp, qbWindow, false);

                if (CheckCommentedReportExists(qbApp, qbWindow, reportData.commentedReportName))
                {
                    DeleteCommentedReport(qbApp, qbWindow, reportData.commentedReportName);
                }

                res = Reports.CreateCommentedReport(qbApp, qbWindow, reportData.reportName, reportData.accesspoint, reportData.defaultReportTitle, reportData.fromDate, reportData.toDate, "noncustom", reportData.commentedReportName, reportData.defaultCommentedReportTitle);
                Assert.AreEqual(true, res, "Create commented report failed for " + reportData.reportName);
                QuickBooks.ResetQBWindows(qbApp, qbWindow, false);

                Logger.logMessage("CreateCommentedReportWithExistingNameOfADeletedReport : -> Successful");
                Logger.logMessage("------------------------------------------------------------------------------");

            }
            catch (Exception e)
            {
                Logger.logMessage("CreateCommentedReportWithExistingNameOfADeletedReport : -> Failed");
                Logger.logMessage(e.Message);
                Logger.logMessage("------------------------------------------------------------------------------");
                String sMessage = e.Message;
                LastException.SetLastError(sMessage);
                throw new Exception(sMessage);
            }
        }
        //*************************************************************************************************************************************************************

        public static bool CreateMemorizedReport(TestStack.White.Application qbApp, TestStack.White.UIItems.WindowItems.Window qbWindow, ReportData reportData, string memorizedReportName)
        {
            Logger.logMessage("In CreateMemorizedReport loop");
            Logger.logMessage("------------------------------------------------------------------------------");

            TestStack.White.UIItems.WindowItems.Window reportWindow = null;
            bool res = false;
            try
            {
                if (CheckMemorizedReportExists(qbApp, qbWindow, memorizedReportName))
                {
                    DeleteMemorizedReport(qbApp, qbWindow, memorizedReportName);
                }
                try
                {
                    string[] reportAccessPoint = Regex.Split(reportData.accesspoint, "->");
                    FrameworkLibraries.ActionLibs.WhiteAPI.Actions.SelectMenu(qbApp, qbWindow, reportAccessPoint);
                }
                catch
                {
                    Logger.logMessage("Cannot open the report : ->  " + reportName);
                    Logger.logMessage("------------------------------------------------------------------------------");
                }
                try
                {
                    FrameworkLibraries.ActionLibs.WhiteAPI.Actions.WaitForChildWindow(qbWindow, reportData.defaultReportTitle, int.Parse(Sync_Timeout));
                }
                catch { }
                Thread.Sleep(int.Parse(Execution_Speed));

                reportWindow = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, reportData.defaultReportTitle);
                //Maximize the report
                try
                {
                    FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(reportWindow, "Maximize");
                }
                catch { }
                try
                {
                    FrameworkLibraries.ActionLibs.WhiteAPI.Actions.WaitForChildWindow(qbWindow, reportData.defaultReportTitle, int.Parse(Sync_Timeout));
                }
                catch { }

                FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(qbWindow, "Customize Report");
                TestStack.White.UIItems.WindowItems.Window modifyReportWindow = Actions.GetChildWindow(qbWindow, "Modify Report: Profit  Loss");
                FrameworkLibraries.ActionLibs.WhiteAPI.Actions.SendTABToWindow(modifyReportWindow);
                FrameworkLibraries.ActionLibs.WhiteAPI.Actions.SendBCKSPACEToWindow(modifyReportWindow);
                FrameworkLibraries.ActionLibs.WhiteAPI.Actions.SendKeysToWindow(modifyReportWindow, reportData.fromDate);
                FrameworkLibraries.ActionLibs.WhiteAPI.Actions.SendTABToWindow(modifyReportWindow);
                FrameworkLibraries.ActionLibs.WhiteAPI.Actions.SendBCKSPACEToWindow(modifyReportWindow);
                FrameworkLibraries.ActionLibs.WhiteAPI.Actions.SendKeysToWindow(modifyReportWindow, reportData.toDate);
                FrameworkLibraries.ActionLibs.WhiteAPI.Actions.SendTABToWindow(modifyReportWindow);

                FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByAutomationID(modifyReportWindow, "10208");
                FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByAutomationID(modifyReportWindow, "10211");
                FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByAutomationID(modifyReportWindow, "10214");
                FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByAutomationID(modifyReportWindow, "51");

                try
                {
                    FrameworkLibraries.ActionLibs.WhiteAPI.Actions.WaitForChildWindow(qbWindow, reportData.defaultReportTitle, int.Parse(Sync_Timeout));
                }
                catch { }
                FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByAutomationID(reportWindow, "5");
                TestStack.White.UIItems.WindowItems.Window memorizeReportWindow = Actions.GetChildWindow(qbWindow, "Memorize Report");
                FrameworkLibraries.ActionLibs.WhiteAPI.Actions.SetTextByAutomationID(memorizeReportWindow, "15501", memorizedReportName);
                FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByAutomationID(memorizeReportWindow, "15502");

                FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByAutomationID(memorizeReportWindow, "51");
                try
                {
                    FrameworkLibraries.ActionLibs.WhiteAPI.Actions.WaitForChildWindow(qbWindow, memorizedReportName, int.Parse(Sync_Timeout));
                }
                catch { }
                QuickBooks.ResetQBWindows(qbApp, qbWindow, false);
                res = true;
                return res;
            }
            catch (Exception e)
            {
                Logger.logMessage("AddCommentsToAllTheVisualCues : -> Failed");
                Logger.logMessage(e.Message);
                Logger.logMessage("------------------------------------------------------------------------------");
                throw new Exception(e.Message);
            }
        }
        //*************************************************************************************************************************************************************
        public static void CreateMemorizedCommentedReport(TestStack.White.Application qbApp, TestStack.White.UIItems.WindowItems.Window qbWindow, ReportData reportData, string memorizedReportName)
        {
            Logger.logMessage("In CreateMemorizedCommentedReport loop");
            Logger.logMessage("------------------------------------------------------------------------------");
            //Create Memorized report
            //Reports.CreateMemorizedReport(qbApp, qbWindow, reportData, memorizedReportName);

            try
            {
                bool res = false;
                QuickBooks.ResetQBWindows(qbApp, qbWindow, false);
                string accessPoint = "Reports->Memorized Reports->Accountant->" + memorizedReportName;


                res = Reports.CreateCommentedReport(qbApp, qbWindow, reportData.reportName, accessPoint, memorizedReportName, reportData.fromDate, reportData.toDate, "noncustom", reportData.commentedReportName, reportData.defaultCommentedReportTitle);
                Assert.AreEqual(true, res, "Create commented report failed for " + reportName);

                QuickBooks.ResetQBWindows(qbApp, qbWindow, false);

                int visualCueCount = 2;
                res = Reports.AddCommentsToCommentedReport(qbApp, qbWindow, reportData.commentedReportName, reportData.commentedReportTitle, reportData.xyCoordinatesFileName, visualCueCount);
                Assert.AreEqual(true, res, "Add comments to " + reportName + "failed");
                QuickBooks.ResetQBWindows(qbApp, qbWindow, false);
                Logger.logMessage("AddCommentsToAllTheVisualCues : -> Failed");
                Logger.logMessage("------------------------------------------------------------------------------");
                //return true;
            }
            catch (Exception e)
            {
                Logger.logMessage("AddCommentsToAllTheVisualCues : -> Failed");
                Logger.logMessage(e.Message);
                Logger.logMessage("------------------------------------------------------------------------------");
                String sMessage = e.Message;
                LastException.SetLastError(sMessage);
                throw new Exception(sMessage);
            }
        }
        //*************************************************************************************************************************************************************
        public static bool Add2000CharactersComment(TestStack.White.Application qbApp, TestStack.White.UIItems.WindowItems.Window qbWindow, ReportData reportData)
        {
            try
            {
                bool res = false;
                QuickBooks.ResetQBWindows(qbApp, qbWindow, false);
                res = Reports.CreateCommentedReport(qbApp, qbWindow, reportData.reportName, reportData.accesspoint, reportData.defaultReportTitle, reportData.fromDate, reportData.toDate, "noncustom", reportData.commentedReportName, reportData.defaultCommentedReportTitle);
                Assert.AreEqual(true, res, "Create commented report failed for " + reportName);
                QuickBooks.ResetQBWindows(qbApp, qbWindow, false);
                int visualCueCount = 1;
                string TwoThousandCharsCommentText = "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890";
                res = Reports.Add2000CharsCommentsToCommentedReport(qbApp, qbWindow, reportData.commentedReportName, reportData.commentedReportTitle, reportData.xyCoordinatesFileName, visualCueCount, TwoThousandCharsCommentText);
                Assert.AreEqual(true, res, "Add comments to " + reportName + "failed");
                QuickBooks.ResetQBWindows(qbApp, qbWindow, false);

                // check that the 2000 chars are saved 
                if (Reports.OpenSavedCommentedReport(qbApp, qbWindow, reportData.commentedReportName, reportData.commentedReportTitle))
                {
                    TestStack.White.UIItems.WindowItems.Window commentedReportWindow = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, reportData.commentedReportTitle);
                    Thread.Sleep(int.Parse(Execution_Speed));
                    List<IUIItem> buttons = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetAllButtons(commentedReportWindow.Items);
                    TestStack.White.UIItems.Button x = null;
                    bool isEdited = false;

                    // Get the comment value and check
                    foreach (IUIItem button in buttons)
                    {
                        if (isEdited == false && button.Id.Contains("Edit"))
                        {
                            x = (TestStack.White.UIItems.Button)button;
                            FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickButtonByAutomationID(commentedReportWindow, button.Id);
                            Thread.Sleep(int.Parse(Execution_Speed));

                            string text = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetTextByAutomationID(commentedReportWindow, "CommentTextBox");
                            Assert.AreEqual(TwoThousandCharsCommentText, text, "Characters mismatch");
                            FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(commentedReportWindow, "Cancel");
                            Thread.Sleep(int.Parse(Execution_Speed));
                            QuickBooks.ResetQBWindows(qbApp, qbWindow, false);
                        }
                    }
                }
                Logger.logMessage("Add2000CharsCommentsToCommentedReport : -> Succeeded");
                Logger.logMessage("------------------------------------------------------------------------------");
                return true;
            }
            catch (Exception e)
            {
                Logger.logMessage("Add2000CharsCommentsToCommentedReport : -> Failed");
                Logger.logMessage(e.Message);
                Logger.logMessage("------------------------------------------------------------------------------");
                String sMessage = e.Message;
                LastException.SetLastError(sMessage);
                throw new Exception(sMessage);
            }
        }
 public void Add99Comments()
 {
     reportData = new ReportData();
     reportData.testName = "Profit&Loss Detail";
     reportData.reportName = "Profit & Loss &Detail";
     reportData.accesspoint = "Reports->Company & &Financial->Profit & Loss &Detail";
      reportData.defaultReportTitle = "Profit  Loss Detail";
      reportData.fromDate = "01012011";
      reportData.toDate = "01012011";
      reportData.defaultCommentedReportTitle = "Comment on Report: Profit  Loss Detail";
      reportData.xyCoordinatesFileName = "Profit & Loss Detail";
      reportData.commentedReportName = "99comments";
      reportData.commentedReportTitle = "Comment on Report: 99comments";
      Reports.Add99Comments(qbApp, qbWindow, reportData);
  }
 public void US_CommentedReportTests_Regression(ReportData report)
 {
     reportData = report;
     this.BDDfy();
 }