예제 #1
0
        public void Test_Generic()
        {
            string             json = "['hi']";
            TestStack <string> c    = JsonConvert.DeserializeObject <TestStack <string> >(json);

            Assert.AreEqual(1, c.Count);
        }
예제 #2
0
        public void Test()
        {
            string    json = "[{}]";
            TestStack c    = JsonConvert.DeserializeObject <TestStack>(json);

            Assert.AreEqual(1, c.Count);
        }
예제 #3
0
 private void EnterTextToCell(TestStack.White.UIItems.TextBox menuCell, string cell, string text)
 {
     menuCell.Text = cell;
     SendKeys.SendWait("{Enter}");
     SendKeys.SendWait(text);
     SendKeys.SendWait("{Enter}");
 }
예제 #4
0
        public void ShouldBeSuccessful()
        {
            using (var stack = new TestStack(typeof(AddProduct)))
            {
                stack.Send(new AddProductCommand("asdf"));

                stack.LastResult.ShouldBeSuccessful();
            }
        }
        public void should_not_be_successful()
        {
            using (var stack = new TestStack(typeof(AddProduct)))
            {
                stack.Send(new AddProductCommand(null));

                stack.LastResult.ShouldNotBeSuccessful();
            }
        }
예제 #6
0
        public void should_add_a_product()
        {
            using (var stack = new TestStack(typeof(AddProduct)))
            {
                stack.Send(new AddProductCommand("name"));

                stack.Domain.Find <Product>(e => e.Name == "name").Result.Count().Should().Be(1);
            }
        }
예제 #7
0
        public void a_product_with_the_name_and_description_are_added()
        {
            using (var context = new TestStack(typeof(AddProduct)))
            {
                context.Send(new AddProductCommand("abcde", ""));

                context.Domain.Find <Product>().Result.Count().Should().Be(1);
            }
        }
예제 #8
0
        public void a_validation_error_should_be_returned()
        {
            using (var context = new TestStack(typeof(AddProduct)))
            {
                context.Send(new AddProductCommand("abcde", ""));

                context.LastResult.ShouldContainMessage("A product name must be unique.");
            }
        }
예제 #9
0
        public void a_validation_error_should_be_returned()
        {
            using (var context = new TestStack(typeof(AddProduct)))
            {
                context.Send(new StockProductCommand("asdf", -1));

                context.LastResult.ShouldContainMessage("The product quantity must be greater than 0.");
            }
        }
        public void should_have_the_correct_message()
        {
            using (var stack = new TestStack(typeof(AddProduct)))
            {
                stack.Send(new AddProductCommand(null));

                stack.LastResult.ShouldContainMessage("Name cannot be null.");
            }
        }
예제 #11
0
        public void should_add_an_item_if_not_exists()
        {
            using (var context = new TestStack(typeof(AddProduct)))
            {
                context.Send(new StockProductCommand("asdf", 10));

                var target = context.Domain.Find <StockItem>(e => e.ProductId == "asdf").Result.FirstOrDefault();

                target.Should().NotBeNull();
            }
        }
예제 #12
0
        public void should_increment_the_quantity_of_existing_item()
        {
            using (var context = new TestStack(typeof(AddProduct)))
            {
                context.Send(new StockProductCommand(StockOne.ProductId, 10));

                var target = context.Domain.Find <StockItem>(e => e.ProductId == StockOne.ProductId).Result.FirstOrDefault();

                target.Quantity.Should().Be(15);
            }
        }
예제 #13
0
        //**************************************************************************************************************************************************************
        public static void CreateCompany(TestStack.White.Application qbApp, Window qbWindow, string businessName, string industry)
        {
            try
            {
                Actions.SelectMenu(qbApp, qbWindow, "File", "New Company...");
                Actions.WaitForChildWindow(qbWindow, "QuickBooks Setup", int.Parse(Sync_Timeout));

                Window QBSetupWindow = Actions.GetChildWindow(qbWindow, FrameworkLibraries.ObjMaps.QBDT.WhiteAPI.Common.Objects.QBSetup_Window_Name);
                Thread.Sleep(int.Parse(Execution_Speed));

                Actions.ClickElementByAutomationID(QBSetupWindow, FrameworkLibraries.ObjMaps.QBDT.WhiteAPI.Common.Objects.ExpressStart_Button_AutoID);
                Thread.Sleep(int.Parse(Execution_Speed));

                if (Actions.CheckElementExistsByAutomationID(QBSetupWindow, "txt_LoginEmail"))
                {
                    Actions.SetTextByAutomationID(QBSetupWindow, "txt_LoginEmail", "*****@*****.**");
                    Actions.ClickElementByAutomationID(QBSetupWindow, "btn_Next");
                    try
                    {
                        Actions.ClickElementByName(Actions.GetChildWindow(qbWindow, "Encountered a Problem"), "Skip");
                    }
                    catch (Exception) { }
                    try { Actions.ClickElementByAutomationID(QBSetupWindow, "btn_Continue"); }
                    catch (Exception) { }
                }

                Actions.SetTextByAutomationID(QBSetupWindow, FrameworkLibraries.ObjMaps.QBDT.WhiteAPI.Common.Objects.BusinessName_TxtField_AutoID, businessName);
                Actions.SetTextByAutomationID(QBSetupWindow, FrameworkLibraries.ObjMaps.QBDT.WhiteAPI.Common.Objects.IndustryList_TxtField_AutoID, "Information");
                Thread.Sleep(int.Parse(Execution_Speed));
                Actions.SelectListBoxItemByText(QBSetupWindow, "lstBox_Industry", "Information Technology");
                Actions.SelectComboBoxItemByText(QBSetupWindow, FrameworkLibraries.ObjMaps.QBDT.WhiteAPI.Common.Objects.TaxStructure_CmbBox_AutoID, "Corporation");
                Actions.SetTextByAutomationID(QBSetupWindow, FrameworkLibraries.ObjMaps.QBDT.WhiteAPI.Common.Objects.TaxID_TxtField_AutoID, "123-45-6789");
                Actions.SelectComboBoxItemByText(QBSetupWindow, FrameworkLibraries.ObjMaps.QBDT.WhiteAPI.Common.Objects.HaveEmployees_CmbBox_AutoID, "No");
                Actions.ClickElementByAutomationID(QBSetupWindow, FrameworkLibraries.ObjMaps.QBDT.WhiteAPI.Common.Objects.Continue_Button_AutoID);
                Thread.Sleep(int.Parse(Execution_Speed));
                Actions.SelectComboBoxItemByText(QBSetupWindow, FrameworkLibraries.ObjMaps.QBDT.WhiteAPI.Common.Objects.StateName_CmbBox_AutoID, "DE");
                Actions.SetTextByAutomationID(QBSetupWindow, FrameworkLibraries.ObjMaps.QBDT.WhiteAPI.Common.Objects.ZipCode_TxtField_AutoID, "DE123");
                Actions.SetTextByAutomationID(QBSetupWindow, FrameworkLibraries.ObjMaps.QBDT.WhiteAPI.Common.Objects.Phone_TxtField_AutoID, "6104567890");
                Actions.ClickElementByAutomationID(QBSetupWindow, FrameworkLibraries.ObjMaps.QBDT.WhiteAPI.Common.Objects.CreateCompany_Button_AutoID);
                Actions.WaitForAnyChildWindow(qbWindow, QBSetupWindow.Name, int.Parse(Sync_Timeout));
            }
            catch (Exception e)
            {
                String sMessage = e.Message;
                LastException.SetLastError(sMessage);
                throw new Exception(sMessage);
            }
        }
예제 #14
0
        public TestStack.White.UIItems.WindowItems.Window FindWnd(TestStack.White.Application app)
        {
            app = TestStack.White.Application.Attach("notepad");
            TestStack.White.UIItems.WindowItems.Window dlg = null;
            while (true)
            {
                try
                {
                    dlg = app.GetWindows()[1];
                    break;
                }
                catch (Exception)
                {
                    Thread.Sleep(200);
                    continue;
                }
            }

            return dlg;
        }
예제 #15
0
        //**************************************************************************************************************************************************************

        public static bool SelectMenu(TestStack.White.Application app, Window win, string level1, string level2, string level3)
        {
            try
            {
                Logger.logMessage("Function call @ :" + DateTime.Now);
                MenuBar qbMenu = app.GetWindow(win.Name).MenuBar;
                TestStack.White.UIItems.MenuItems.Menu m1 = qbMenu.MenuItem(level1);
                m1.SubMenu(level2).SubMenu(level3).Click();
                Thread.Sleep(int.Parse(Execution_Speed));
                Logger.logMessage("SelectMenu " + level1 + "->" + level2 + "->" + level3 + " - Successful");
                Logger.logMessage("------------------------------------------------------------------------------");
                return true;
            }
            catch (Exception e)
            {
                Logger.logMessage("SelectMenu " + level1 + "->" + level2 + "->" + level3 + " - Failed");
                Logger.logMessage(e.Message);
                Logger.logMessage("------------------------------------------------------------------------------");
                String sMessage = e.Message;
                LastException.SetLastError(sMessage);
                throw new Exception(sMessage);
            }
        }
예제 #16
0
        //**************************************************************************************************************************************************************

        public static bool CheckMenuEnabled(TestStack.White.Application app, Window win, string level1)
        {
            try
            {
                Logger.logMessage("Function call @ :" + DateTime.Now);
                MenuBar qbMenu = app.GetWindow(win.Name).MenuBar;
                var status = qbMenu.MenuItem(level1).Enabled;
                if (status)
                    Logger.logMessage("CheckMenuEnabled " + level1 + "->" + " - Enabled");
                else
                    Logger.logMessage("CheckMenuEnabled " + level1 + "->" + " - Disabled");
                Logger.logMessage("------------------------------------------------------------------------------");
                return status;
            }
            catch (Exception e)
            {
                Logger.logMessage("CheckMenuEnabled " + level1 + "->" + " - Failed");
                Logger.logMessage(e.Message);
                Logger.logMessage("------------------------------------------------------------------------------");
                String sMessage = e.Message;
                LastException.SetLastError(sMessage);
                throw new Exception(sMessage);
            }
        }
예제 #17
0
        //**************************************************************************************************************************************************************
        public static bool SelectMenu(TestStack.White.Application app, Window win, string level1, string level2, string level3)
        {
            try
            {
                MenuBar qbMenu = app.GetWindow(win.Name).MenuBar;
                TestStack.White.UIItems.MenuItems.Menu m1 = qbMenu.MenuItem(level1);
                m1.SubMenu(level2).SubMenu(level3).Click();

                //Menus x = m1.SubMenu(level2).ChildMenus;
                //x[0].Name;
                Thread.Sleep(int.Parse(Execution_Speed));
                return true;
            }
            catch (Exception e)
            {
                String sMessage = e.Message;
                LastException.SetLastError(sMessage);
                throw new Exception(sMessage);
            }
        }
예제 #18
0
        //**************************************************************************************************************************************************************


        public static int GetTableRowNumberByMatchingText(TestStack.White.UIItems.TableItems.Table table, int columnCount, string text)
        {
            Logger.logMessage("Function call @ :" + DateTime.Now);

            int count = 0;
            int rowNumber = 0;

            try
            {
                Logger.logMessage("GetTableRowNumberByMatchingText " + table + "->" + text);

                PropertyCondition tableElementsCondition = new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Text);
                AutomationElementCollection allTableElements = table.AutomationElement.FindAll(TreeScope.Descendants, tableElementsCondition);

                foreach (AutomationElement item in allTableElements)
                {
                    count = count + 1;
                    if (item.Current.Name.Equals(text))
                    {
                        rowNumber = (count / columnCount) + 1;
                        Logger.logMessage("GetTableRowNumberByMatchingText " + table + "->" + text + " - Successful");
                        Logger.logMessage("------------------------------------------------------------------------------");
                        break;
                    }
                }

                return rowNumber;

            }
            catch (Exception e)
            {
                Logger.logMessage("GetTableRowNumberByMatchingText " + table + "->" + text + " - Failed");
                Logger.logMessage(e.Message);
                Logger.logMessage("------------------------------------------------------------------------------");
                String sMessage = e.Message;
                LastException.SetLastError(sMessage);
                throw new Exception(sMessage);
            }
        }
예제 #19
0
        //**************************************************************************************************************************************************************
        public static bool RenameCommentedReport(TestStack.White.Application qbApp, TestStack.White.UIItems.WindowItems.Window qbWindow, string currentReportName,string newReportName)
        {
            try
            {
                bool reportExist = Reports.CheckCommentedReportExists(qbApp, qbWindow, currentReportName);
                if (reportExist)
                {
                    FrameworkLibraries.ActionLibs.WhiteAPI.Actions.SelectMenu(qbApp, qbWindow, "Reports", "Commented Reports");
                    Thread.Sleep(int.Parse(Execution_Speed));
                    qbAppWindowForSilk = _desktop.Window("/Window");
                    qbAppWindowForSilk.SetActive();
                    commentedReportListWindowForSilk = qbAppWindowForSilk.Window("@caption='Commented Reports'");
                    commentedReportListWindowForSilk.Maximize();
                    commentedReportListWindowForSilk.TextClick(currentReportName, 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("Edit Commented Report");
                    Thread.Sleep(int.Parse(Execution_Speed));
                    FrameworkLibraries.ActionLibs.WhiteAPI.Actions.SetTextByAutomationID(FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, "Save Your Commented Report"), "12402", newReportName);
                    if (FrameworkLibraries.ActionLibs.WhiteAPI.Actions.CheckWindowExists(qbWindow, "Replace Your Commented Report?"))
                    {
                        TestStack.White.UIItems.WindowItems.Window renameWindow = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, "Replace Your Commented Report?");
                        FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(renameWindow, "Yes");
                        Thread.Sleep(int.Parse(Execution_Speed));
                    }
                    FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, "Save Your Commented Report"), "OK");
                    Thread.Sleep(int.Parse(Execution_Speed));

                    //Check that the name is changed successfully
                    commentedReportListWindowForSilk.TextClick(newReportName, 1, ClickType.Left);

                    Logger.logMessage("RenameCommentedReport :  " + currentReportName + " has been Successfully renamed to " + newReportName);
                    Logger.logMessage("------------------------------------------------------------------------------");
                    return true;
                }
                else
                    Logger.logMessage("RenameCommentedReport :  ->" + currentReportName + " does not exist hence cannot cannot rename");
                    Logger.logMessage("------------------------------------------------------------------------------");
                    return false;
            }
            catch (Exception e)
            {
                Logger.logMessage("RenameCommentedReport :  " + currentReportName + " has not been renamed to " + newReportName);
                Logger.logMessage(e.Message);
                Logger.logMessage("------------------------------------------------------------------------------");
                String sMessage = e.Message;
                LastException.SetLastError(sMessage);
                throw new Exception(sMessage);
            }
        }
예제 #20
0
        //*************************************************************************************************************************************************************
        public static bool ResetQBPrefForCommentedReports(TestStack.White.Application qbApp, TestStack.White.UIItems.WindowItems.Window qbWindow)
        {
            try
            {
                qbAppWindowForSilk = _desktop.Window("/Window");
                qbAppWindowForSilk.SetActive();
                FrameworkLibraries.ActionLibs.WhiteAPI.Actions.SelectMenu(qbApp, qbWindow, "Edit", "Preferences...");
                TestStack.White.UIItems.WindowItems.Window preferencesWindow = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, "Preferences");
                SilkTest.Ntf.Window prefWindowForSilk = qbAppWindowForSilk.Window("@caption='Preferences'");
                prefWindowForSilk.TextClick("General", 1, ClickType.Left);
                Thread.Sleep(int.Parse(Execution_Speed));
                FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(preferencesWindow, "Bring back all one time messages");
                Thread.Sleep(int.Parse(Execution_Speed));

                ////check if the checkbox is selected. If yes, uncheck it
                //FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(preferencesWindow, "Turn off pop-up messages for products and services");
                //Thread.Sleep(int.Parse(Execution_Speed));

                //check if the prompt me to modify report before opening a report is checked and uncheck it if needed

                prefWindowForSilk.TextClick("Desktop View", 1, ClickType.Left);
                Thread.Sleep(int.Parse(Execution_Speed));
                if (FrameworkLibraries.ActionLibs.WhiteAPI.Actions.CheckWindowExists(qbWindow, "Save Changes"))
                {
                    TestStack.White.UIItems.WindowItems.Window saveChangesWindow = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, "Save Changes");
                    FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(saveChangesWindow, "Yes");
                    Thread.Sleep(int.Parse(Execution_Speed));
                }

                FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(preferencesWindow, "Multiple Windows");
                Thread.Sleep(int.Parse(Execution_Speed));
                prefWindowForSilk.TextClick("Reports & Graphs", 1, ClickType.Left);
                Thread.Sleep(int.Parse(Execution_Speed));
                if (FrameworkLibraries.ActionLibs.WhiteAPI.Actions.CheckWindowExists(qbWindow, "Save Changes"))
                {
                    TestStack.White.UIItems.WindowItems.Window saveChangesWindow = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, "Save Changes");
                    FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(saveChangesWindow, "Yes");
                    Thread.Sleep(int.Parse(Execution_Speed));
                }

                ////check if collapse transFrameworkLibraries.ActionLibs.WhiteAPI.Actions is checked. If yes, uncheck it
                //prefWindowForSilk.TextClick("Company Preferences", 1, ClickType.Left);
                //Thread.Sleep(int.Parse(Execution_Speed));
                //FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(preferencesWindow, "Collapse TransFrameworkLibraries.ActionLibs.WhiteAPI.Actions");
                //Thread.Sleep(int.Parse(Execution_Speed));

                FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(preferencesWindow, "OK");
                Thread.Sleep(int.Parse(Execution_Speed));

                Logger.logMessage(" QB Preferences have been set successfully");
                Logger.logMessage("------------------------------------------------------------------------------");
                return true;
            }
            catch (Exception e)
            {
                Logger.logMessage("ResetQBPrefForCommentedReports : -> Failed to save QB preferences for Commented report");
                Logger.logMessage(e.Message);
                Logger.logMessage("------------------------------------------------------------------------------");
                String sMessage = e.Message;
                LastException.SetLastError(sMessage);
                throw new Exception(sMessage);
            }
        }
예제 #21
0
파일: Form1.cs 프로젝트: JacobD10/ASAR
 private void click_ExternBtn(TestStack.White.UIItems.Button Button_)
 {
     try
     {
         if (Button_.Enabled)
         {
             Point cursorPos = System.Windows.Forms.Cursor.Position;
             Button_.Click();
             System.Windows.Forms.Cursor.Position = cursorPos;
             this.TopMost = true;
             this.TopMost = false;
             this.Activate();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Button Unavailable");
     }
 }
예제 #22
0
        //**************************************************************************************************************************************************************

        public static Window PrepareBaseState(TestStack.White.Application app)
        {
            Window qbWin = null;

            try
            {
                List<Window> windows = app.GetWindows();
                foreach (Window item in windows)
                {
                    if (item.Name.Contains("QuickBooks"))
                    {
                        qbWin = item;
                        Thread.Sleep(int.Parse(Execution_Speed));
                        break;
                    }
                }

                Logger.logMessage("PrepareBaseState " + app + " - Sucessful");
                Logger.logMessage(qbWin.Title);
                Logger.logMessage("------------------------------------------------------------------------------");

                return qbWin;

            }
            catch (Exception e)
            {
                Logger.logMessage("PrepareBaseState " + app + " - Failed");
                Logger.logMessage(e.Message);
                Logger.logMessage("------------------------------------------------------------------------------");

                String sMessage = e.Message;
                LastException.SetLastError(sMessage);
                throw new Exception(sMessage);
            }
        }
예제 #23
0
        //**************************************************************************************************************************************************************
        public static int GetTotalCommentCount(TestStack.White.Application qbApp, TestStack.White.UIItems.WindowItems.Window qbWindow, TestStack.White.UIItems.WindowItems.Window commentedReportWindow)
        {
            try
            {
                List<IUIItem> buttons = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetAllButtons(commentedReportWindow.Items);
                TestStack.White.UIItems.Button commentCountButton = null;
                int totalCount = 0;

                foreach (IUIItem button in buttons)
                {
                    if (button.Name.Contains("Comments  ("))
                    {
                        commentCountButton = (TestStack.White.UIItems.Button)button;
                        string header = commentCountButton.Name;
                        totalCount = Int32.Parse(header.Substring(header.IndexOf('(') + 1, header.IndexOf(')') - header.IndexOf('(') - 1));
                        break;
                    }
                }
                Logger.logMessage("GetTotalCommentCount :" + " -> " + "completed successful");
                Logger.logMessage("------------------------------------------------------------------------------");
                return totalCount;
            }
            catch (Exception e)
            {
                Logger.logMessage("GetTotalCommentCount :" + " -> " + "Failed");
                Logger.logMessage(e.Message);
                Logger.logMessage("------------------------------------------------------------------------------");
                String sMessage = e.Message;
                LastException.SetLastError(sMessage);
                throw new Exception(sMessage);
            }
        }
예제 #24
0
        //**************************************************************************************************************************************************************
        public static bool EditComment(TestStack.White.Application qbApp, TestStack.White.UIItems.WindowItems.Window qbWindow, string commentedReportName, string commentedReportTitle, string xyCoordinatesFileName)
        {
            try
            {
                if (Reports.OpenSavedCommentedReport(qbApp, qbWindow, commentedReportName,commentedReportTitle))
                {
                    if (CheckWhetherVisualCueExists(xyCoordinatesFileName))
                    {
                        //Get existing count of comments
                        TestStack.White.UIItems.WindowItems.Window commentedReportWindow = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, commentedReportTitle);
                        //FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickButtonByAutomationID(commentedReportWindow, "30");
                        List<IUIItem> buttons = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetAllButtons(commentedReportWindow.Items);
                        int initialCount = 0;
                        int counttAfterEdit = 0;
                        TestStack.White.UIItems.Button x = null;
                        bool isEdited = false;

                        //Get initial comments count
                        initialCount = Reports.GetTotalCommentCount(qbApp,qbWindow,commentedReportWindow);

                        // Edit the first comment
                        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));
                                FrameworkLibraries.ActionLibs.WhiteAPI.Actions.SetTextByAutomationID(commentedReportWindow, "CommentTextBox", "Comment-Edited");
                                FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(commentedReportWindow, "Save");
                                Thread.Sleep(int.Parse(Execution_Speed));
                                isEdited = true;
                            }
                        }

                        
                        //Validate that the edit commment actually updated the values
                        bool res = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.CheckElementExistsByName(commentedReportWindow, "Comment-Edited");
                        Assert.AreEqual(true, res, " Edit comment failed");

                        //check that the count remains the same after edit
                        counttAfterEdit = Reports.GetTotalCommentCount(qbApp,qbWindow,commentedReportWindow);
                        Assert.AreEqual(initialCount, counttAfterEdit);
                        // Save the commented report
                        Reports.SaveCommentedReport(qbApp,qbWindow,commentedReportWindow, commentedReportName);
                    }
                 }
                Logger.logMessage("EditComment :" + " -> " + " Edit comment for " + commentedReportName + "was successful");
                Logger.logMessage("------------------------------------------------------------------------------");
                return true;
            }
            catch (Exception e)
            {
                Logger.logMessage("EditComment :" + " -> " +" Edit comment for " + commentedReportName + "Failed");
                Logger.logMessage(e.Message);
                Logger.logMessage("------------------------------------------------------------------------------");
                String sMessage = e.Message;
                LastException.SetLastError(sMessage);
                throw new Exception(sMessage);
            }
        }
예제 #25
0
        //**************************************************************************************************************************************************************
        public static bool DeleteComment(TestStack.White.Application qbApp, TestStack.White.UIItems.WindowItems.Window qbWindow, string commentedReportName, string commentedReportTitle, string xyCoordinatesFileName)
        {
            TestStack.White.UIItems.WindowItems.Window savedsuccessfullyWindow = null;
            try
            {
                if (Reports.OpenSavedCommentedReport(qbApp, qbWindow, commentedReportName, commentedReportTitle))
                {
                    if (CheckWhetherVisualCueExists(xyCoordinatesFileName))
                    {
                        TestStack.White.UIItems.WindowItems.Window commentedReportWindow = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, commentedReportTitle);

                        int countAfterDelete = 0;
                        int countBeforeDelete = 0;
                        int temp = 0;
                        bool isDeleted = false;
                        List<IUIItem> buttons = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetAllButtons(commentedReportWindow.Items);

                        //Get the comment count before delete
                        countBeforeDelete = Reports.GetTotalCommentCount(qbApp, qbWindow, commentedReportWindow);
                        temp = countBeforeDelete;

                        //Delete the first comment
                        foreach (IUIItem button in buttons)
                        {
                            if (isDeleted == false && button.Id.Contains("Delete"))
                            {
                                FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickButtonByAutomationID(commentedReportWindow, button.Id);
                                Thread.Sleep(int.Parse(Execution_Speed));
                                TestStack.White.UIItems.WindowItems.Window deleteCommentwindow = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, "Delete This Comment?");
                                FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickButtonByName(deleteCommentwindow, "_Yes");
                                Thread.Sleep(int.Parse(Execution_Speed));
                                isDeleted = true;
                                --temp;
                            }
                        }
                        //Get the comment count after delete
                        countAfterDelete = Reports.GetTotalCommentCount(qbApp, qbWindow, commentedReportWindow);

                        //Verify that the comment count after deletion gets reduced by one
                        Assert.AreEqual(temp, countAfterDelete);

                        //save and close the updated commented report
                        commentedReportWindow = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, commentedReportTitle);
                        FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByAutomationID(commentedReportWindow, "19");
                        savedsuccessfullyWindow = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, "Saved Successfully");
                        FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(savedsuccessfullyWindow, "OK");
                        QuickBooks.ResetQBWindows(qbApp, qbWindow, false);

                        //open the updated commented report and check that the counts are retained
                        Reports.OpenSavedCommentedReport(qbApp, qbWindow, commentedReportName, commentedReportTitle);

                        ////Get the counts
                        commentedReportWindow = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, commentedReportTitle);
                        countAfterDelete = Reports.GetTotalCommentCount(qbApp, qbWindow, commentedReportWindow);
                        Assert.AreEqual(temp, countAfterDelete);

                        // Save the commented report
                        Reports.SaveCommentedReport(qbApp, qbWindow, commentedReportWindow, commentedReportName);
                    }
                }
                Logger.logMessage("DeleteComment :" + " -> " + " Delete comment for " + commentedReportName + "Failed");
                Logger.logMessage("------------------------------------------------------------------------------");
                return true;
            }
            catch (Exception e)
            {
                Logger.logMessage("DeleteComment :" + " -> " + " Delete comment for " + commentedReportName + "Failed");
                Logger.logMessage(e.Message);
                Logger.logMessage("------------------------------------------------------------------------------");
                String sMessage = e.Message;
                LastException.SetLastError(sMessage);
                throw new Exception(sMessage);
            }
        }
예제 #26
0
        //*************************************************************************************************************************************************************
        public static bool CreateCommentedReport(TestStack.White.Application qbApp, TestStack.White.UIItems.WindowItems.Window qbWindow,string reportName, string accesspoint, string defaultReportTitle, string fromDate, string toDate,string type, string commentedReportName, string defaultCommentedReportTitle)
        {
            TestStack.White.UIItems.WindowItems.Window reportWindow = null;
            TestStack.White.UIItems.WindowItems.Window commentedReportWindow = null;
            try
            {
                    //Delete if a commented report exists with the same name
                    bool reportExist = Reports.CheckCommentedReportExists(qbApp, qbWindow, commentedReportName);
                    if (reportExist)
                    {
                        Reports.DeleteCommentedReport(qbApp,qbWindow,commentedReportName);
                    }
                    QuickBooks.ResetQBWindows(qbApp, qbWindow, false);
                 
                   //Handle custom reports separately
                    if (type.ToUpper().Equals("CUSTOM"))
                    {
                        try
                        {
                            string[] reportAccessPoint = Regex.Split(accesspoint, "->");
                            FrameworkLibraries.ActionLibs.WhiteAPI.Actions.SelectMenu(qbApp, qbWindow, reportAccessPoint);
                        }
                        catch
                        {
                            Logger.logMessage("Cannot open the report : ->  " + reportName);
                            Logger.logMessage("------------------------------------------------------------------------------");
                        }
                        Thread.Sleep(int.Parse(Execution_Speed));
                        TestStack.White.UIItems.WindowItems.Window modifyReportWindow = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, "Modify Report: Custom");
                        //set date filters
                        FrameworkLibraries.ActionLibs.WhiteAPI.Actions.SendTABToWindow(modifyReportWindow);
                        FrameworkLibraries.ActionLibs.WhiteAPI.Actions.SendBCKSPACEToWindow(modifyReportWindow);
                        FrameworkLibraries.ActionLibs.WhiteAPI.Actions.SendKeysToWindow(modifyReportWindow, fromDate);
                        FrameworkLibraries.ActionLibs.WhiteAPI.Actions.SendTABToWindow(modifyReportWindow);
                        FrameworkLibraries.ActionLibs.WhiteAPI.Actions.SendBCKSPACEToWindow(modifyReportWindow);
                        FrameworkLibraries.ActionLibs.WhiteAPI.Actions.SendKeysToWindow(modifyReportWindow, toDate);
                        FrameworkLibraries.ActionLibs.WhiteAPI.Actions.SendTABToWindow(modifyReportWindow);
                        try
                        {
                            FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(modifyReportWindow, "OK");
                        }
                        catch { }
                    }
                    else
                    {
                        try
                        {
                            string[] reportAccessPoint = Regex.Split(accesspoint, "->");
                            if (reportAccessPoint[1].Equals("Inventory") || reportAccessPoint[1].Equals("Banking"))
                            {
                                FrameworkLibraries.ActionLibs.WhiteAPI.Actions.SelectMenu(qbApp, qbWindow, "Reports", reportAccessPoint[1], reportAccessPoint[2]);
                            }
                            else
                            {
                                FrameworkLibraries.ActionLibs.WhiteAPI.Actions.SelectMenu(qbApp, qbWindow, reportAccessPoint);
                            }
                            
                        }
                        catch { }
                        //      Logger.logMessage("Cannot open the report : ->  " + reportName);
                        //      Logger.logMessage("------------------------------------------------------------------------------");
                        //    return false;
                        //}
                        try
                        {
                            if (FrameworkLibraries.ActionLibs.WhiteAPI.Actions.CheckWindowExists(qbWindow, "Collapsing and Expanding Transactions"))
                            {
                                TestStack.White.UIItems.WindowItems.Window window = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, "Collapsing and Expanding Transactions");
                                try { FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(window, "OK"); }
                                catch { }
                            }
                        }
                        catch { }
                        try
                        {
                            if (FrameworkLibraries.ActionLibs.WhiteAPI.Actions.CheckWindowExists(qbWindow, "Balance Sheet by class report"))
                            {
                                TestStack.White.UIItems.WindowItems.Window window = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, "Balance Sheet by class report");
                                try { FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(window, "OK"); }
                                catch { }
                            }
                        }
                        catch { }
                        try
                        {
                            if (FrameworkLibraries.ActionLibs.WhiteAPI.Actions.CheckWindowExists(qbWindow, "Warning"))
                            {
                                TestStack.White.UIItems.WindowItems.Window window = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, "Warning");
                                try { FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(window, "Run Report"); }
                                catch { }
                            }
                        }
                        catch { }
                        try
                        {
                            if (FrameworkLibraries.ActionLibs.WhiteAPI.Actions.CheckWindowExists(qbWindow, "Update Item Percent Complete"))
                            {
                                TestStack.White.UIItems.WindowItems.Window window = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, "Update Item Percent Complete");
                                try { FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(window, "OK"); }
                                catch { }
                            }
                        }
                        catch { }
                        try
                        {
                            if (FrameworkLibraries.ActionLibs.WhiteAPI.Actions.CheckWindowExists(qbWindow, "Select Price Level"))
                            {
                                TestStack.White.UIItems.WindowItems.Window window = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, "Select Price Level");

                                try
                                {
                                    if (qbWindow.Title.Contains("COSMETICS"))
                                    {
                                        FrameworkLibraries.ActionLibs.WhiteAPI.Actions.SendKeysToWindow(window, "Beauty");
                                    }
                                    FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(window, "OK");
                                }
                                catch { }
                            }
                        }
                        catch { }
                        try
                        {
                            if (FrameworkLibraries.ActionLibs.WhiteAPI.Actions.CheckWindowExists(qbWindow, "Filter Report by Job"))
                            {
                                TestStack.White.UIItems.WindowItems.Window window = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, "Filter Report by Job");
                                try { 
                                    FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(window, "OK"); 
                                   FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(window, "Cancel");
                                }
                                catch { }
                                try
                                {
                                    if (FrameworkLibraries.ActionLibs.WhiteAPI.Actions.CheckWindowExists(qbWindow, "Warning"))
                                    {
                                        window = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, "Warning");
                                        try { FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(window, "OK"); }
                                        catch { }
                                    }
                                }
                                catch { }
                            }
                        }
                        catch { }
                        try
                        {
                            if (FrameworkLibraries.ActionLibs.WhiteAPI.Actions.CheckWindowExists(qbWindow, "Budget Report"))
                            {
                                TestStack.White.UIItems.WindowItems.Window window = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, "Budget Report");
                                try
                                {
                                    FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(window, "Next");
                                    Thread.Sleep(int.Parse(Execution_Speed));
                                }
                                catch { }
                                if (FrameworkLibraries.ActionLibs.WhiteAPI.Actions.CheckWindowExists(qbWindow, "Budget Report"))
                                {
                                    window = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, "Budget Report");
                                    try
                                    {
                                        FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(window, "Next");
                                        Thread.Sleep(int.Parse(Execution_Speed));
                                    }
                                    catch { }
                                    if (FrameworkLibraries.ActionLibs.WhiteAPI.Actions.CheckWindowExists(qbWindow, "Budget Report"))
                                    {
                                        window = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, "Budget Report");
                                        try
                                        {
                                            FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(window, "Finish");
                                        }
                                        catch { }
                                    }
                                }

                            }
                        }
                        catch { }
                        try
                        {
                            if (FrameworkLibraries.ActionLibs.WhiteAPI.Actions.CheckWindowExists(qbWindow, "Forecast Report"))
                            {
                                TestStack.White.UIItems.WindowItems.Window window = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, "Forecast Report");
                                try
                                {
                                    FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(window, "Next");
                                    Thread.Sleep(int.Parse(Execution_Speed));
                                }
                                catch { }
                                if (FrameworkLibraries.ActionLibs.WhiteAPI.Actions.CheckWindowExists(qbWindow, "Forecast Report"))
                                {
                                    window = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, "Forecast Report");
                                    try
                                    {
                                        FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(window, "Finish");
                                    }
                                    catch { }
                                }

                            }
                        }
                        catch { }
                        try
                        {
                            if (FrameworkLibraries.ActionLibs.WhiteAPI.Actions.CheckWindowExists(qbWindow, "Missing Checks"))
                            {
                                TestStack.White.UIItems.WindowItems.Window window = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, "Missing Checks");
                                FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(window, "OK");
                                Thread.Sleep(int.Parse(Execution_Speed));
                            }
                        }
                        catch { }
                        try
                        {
                            if (FrameworkLibraries.ActionLibs.WhiteAPI.Actions.CheckWindowExists(qbWindow, "Reconciliation Discrepancy Report"))
                            {
                                TestStack.White.UIItems.WindowItems.Window window = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, "Reconciliation Discrepancy Report");
                                FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(window, "OK");
                                Thread.Sleep(int.Parse(Execution_Speed));
                            }
                        }
                        catch { }
                        try
                        {
                            if (FrameworkLibraries.ActionLibs.WhiteAPI.Actions.CheckWindowExists(qbWindow, "Select Previous Reconciliation Report"))
                            {
                                TestStack.White.UIItems.WindowItems.Window window = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, "Select Previous Reconciliation Report");
                                if (qbWindow.Title.Contains("COSMETICS"))
                                {
                                    FrameworkLibraries.ActionLibs.WhiteAPI.Actions.SetTextOnElementByAutomationID(window, "4404", "Bank Of America 1171");
                                    FrameworkLibraries.ActionLibs.WhiteAPI.Actions.SendTABToWindow(qbWindow);
                                    FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(window, "Display");
                                    Thread.Sleep(int.Parse(Execution_Speed));
                                }
                                try
                                {
                                    if (FrameworkLibraries.ActionLibs.WhiteAPI.Actions.CheckWindowExists(qbWindow, "Reconciliation Report"))
                                    {
                                        window = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, "Reconciliation Report");
                                        FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(window, "OK");
                                        Thread.Sleep(int.Parse(Execution_Speed));
                                    }
                                }
                                catch { }
                            }
                        }
                        catch { }
                        try
                        {
                            FrameworkLibraries.ActionLibs.WhiteAPI.Actions.WaitForChildWindow(qbWindow, defaultReportTitle, int.Parse(Sync_Timeout));
                        }catch{}
                       //Thread.Sleep(int.Parse(Execution_Speed));
                   }

                    reportWindow = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, defaultReportTitle);
                    //Maximize the report
                    try
                    {
                        FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(reportWindow, "Maximize");
                    }
                    catch { }
                    try
                    {
                        FrameworkLibraries.ActionLibs.WhiteAPI.Actions.WaitForChildWindow(qbWindow, defaultReportTitle, int.Parse(Sync_Timeout));
                    }
                    catch { }
                    
                    if ((!fromDate.Equals(null) || !fromDate.Equals("")) || (!toDate.Equals(null)||!toDate.Equals("")))
                    {
                        if (!type.ToUpper().Equals("LIST") && !type.ToUpper().Equals("INVENTORYVALUATIONSUMMARY"))
                        {
                            //set date filters
                            FrameworkLibraries.ActionLibs.WhiteAPI.Actions.SendTABToWindow(reportWindow);
                            FrameworkLibraries.ActionLibs.WhiteAPI.Actions.SendBCKSPACEToWindow(reportWindow);
                            FrameworkLibraries.ActionLibs.WhiteAPI.Actions.SendKeysToWindow(reportWindow, fromDate);
                            FrameworkLibraries.ActionLibs.WhiteAPI.Actions.SendTABToWindow(reportWindow);
                            FrameworkLibraries.ActionLibs.WhiteAPI.Actions.SendBCKSPACEToWindow(reportWindow);
                            FrameworkLibraries.ActionLibs.WhiteAPI.Actions.SendKeysToWindow(reportWindow, toDate);
                            
                            try
                            {
                                FrameworkLibraries.ActionLibs.WhiteAPI.Actions.SendTABToWindow(reportWindow);                                                     FrameworkLibraries.ActionLibs.WhiteAPI.Actions.WaitForChildWindow(qbWindow, defaultReportTitle, int.Parse(Sync_Timeout));
                            }
                            catch { }
                        }
                    }
                    //create commented report out of it
                    FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(reportWindow, "Comment on Report");
                    try
                    {
                        if (FrameworkLibraries.ActionLibs.WhiteAPI.Actions.CheckWindowExists(qbWindow, "Commented Report"))
                        {
                            TestStack.White.UIItems.WindowItems.Window window = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, "Commented Report");
                            FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(window, "Yes");
                        }
                    }
                    catch { }
                    try
                    {
                        FrameworkLibraries.ActionLibs.WhiteAPI.Actions.WaitForChildWindow(qbWindow, defaultCommentedReportTitle, int.Parse(Sync_Timeout));
                    }
                    catch { }
                    Thread.Sleep(int.Parse(Execution_Speed));
                    commentedReportWindow = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, defaultCommentedReportTitle);

                    // Save the commented report
                    Reports.SaveCommentedReport(qbApp,qbWindow,commentedReportWindow, commentedReportName);
                    Logger.logMessage("CreateCommentedReport : -> Successfully created Commented report for " + reportName);
                    Logger.logMessage("------------------------------------------------------------------------------");
                
                   //check if the commented report window is created
                    //bool res = CheckCommentedReportExists(qbApp, qbWindow, commentedReportName);
                    //Assert.AreEqual(true, res, "Cannot find the created commented report");

                    return true;
                  }
                 catch (Exception e)
                {
                    Logger.logMessage("CreateCommentedReport : -> Failed to create Commented report for " + reportName);
                    Logger.logMessage(e.Message);
                    Logger.logMessage("------------------------------------------------------------------------------");
                    String sMessage = e.Message;
                    LastException.SetLastError(sMessage);
                    throw new Exception(sMessage);
                 }
            }
예제 #27
0
        //**************************************************************************************************************************************************************
        public static bool SelectMenu(TestStack.White.Application app, Window win, String[] args)
        {
            try
            {
                MenuBar qbMenu = app.GetWindow(win.Name).MenuBar;

                foreach (String item in args)
                {
                    qbMenu.MenuItem(item).Click();
                    Thread.Sleep(int.Parse(Execution_Speed));
                }
                return true;
            }
            catch (Exception e)
            {
                String sMessage = e.Message;
                LastException.SetLastError(sMessage);
                throw new Exception(sMessage);
            }
        }
예제 #28
0
 //**************************************************************************************************************************************************************
 public static bool SaveCommentedReport(TestStack.White.Application qbApp, TestStack.White.UIItems.WindowItems.Window qbWindow, TestStack.White.UIItems.WindowItems.Window commentedReportWindow, string saveReportName)
 {
     TestStack.White.UIItems.WindowItems.Window saveCommentedReportWindow = null;
     TestStack.White.UIItems.WindowItems.Window savedsuccessfullyWindow = null;
     bool reportExist = Reports.CheckCommentedReportExists(qbApp, qbWindow, saveReportName);
     try
     {
         if (reportExist)
         {
             commentedReportWindow.Focus();
             try {
                 FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByAutomationID(commentedReportWindow, "19");
                 //if (FrameworkLibraries.ActionLibs.WhiteAPI.Actions.CheckWindowExists(qbWindow, "Replace Your Commented Report?"))
                 //{
                 //    TestStack.White.UIItems.WindowItems.Window window = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, "Replace Your Commented Report?");
                 //    try { FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(window, "Yes"); }
                 //    catch { }
                 //}
             }catch{}
             
             try{
                 FrameworkLibraries.ActionLibs.WhiteAPI.Actions.WaitForChildWindow(qbWindow, "Saved Successfully", int.Parse(Sync_Timeout));
         }catch { }
             savedsuccessfullyWindow = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, "Saved Successfully");
             FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(savedsuccessfullyWindow, "OK");
             Thread.Sleep(int.Parse(Execution_Speed));
             Logger.logMessage("SaveCommentedReport " + " -> Save commented report for " + saveReportName + " successful");
             Logger.logMessage("------------------------------------------------------------------------------");
             return true;
         }
         else
         {
             try
             {
                 FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByAutomationID(commentedReportWindow, "19");
             }
             catch { }
             saveCommentedReportWindow = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, "Save Your Commented Report");
             FrameworkLibraries.ActionLibs.WhiteAPI.Actions.SetTextByAutomationID(saveCommentedReportWindow, "12402", saveReportName);
             
             try{
                 FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, "Save Your Commented Report"), "OK");}
             catch { }
             try
             {
                 FrameworkLibraries.ActionLibs.WhiteAPI.Actions.WaitForChildWindow(qbWindow, "Saved Successfully", int.Parse(Sync_Timeout));
             }
             catch { }
             savedsuccessfullyWindow = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, "Saved Successfully");
             FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(savedsuccessfullyWindow, "OK");
             Thread.Sleep(int.Parse(Execution_Speed));
             Logger.logMessage("SaveCommentedReport " + " -> Save commented report for " + saveReportName + " successful");
             Logger.logMessage("------------------------------------------------------------------------------");
             return true;
         }
     }
     catch (Exception e)
     {
         Logger.logMessage("SaveCommentedReport " + " -> Save commented report for " + saveReportName + " failed");
         Logger.logMessage(e.Message);
         Logger.logMessage("------------------------------------------------------------------------------");
         String sMessage = e.Message;
         LastException.SetLastError(sMessage);
         throw new Exception(sMessage);
     }
 }
예제 #29
0
        //**************************************************************************************************************************************************************
        public static Window GetAppWindow(TestStack.White.Application app, string winName)
        {
            Window win = null;

            try
            {
                List<Window> allWin = app.GetWindows();

                foreach (Window item in allWin)
                {
                    if (item.Name.Contains(winName))
                    {
                        win = item;
                        break;
                    }
                }

                return win;
            }
            catch (Exception e)
            {
                String sMessage = e.Message;
                LastException.SetLastError(sMessage);
                throw new Exception(sMessage);
            }
        }
예제 #30
0
        //**************************************************************************************************************************************************************

        public static void ResetQBWindows(TestStack.White.Application qbApp, Window qbWin, bool openFileOnNoCompany)
        {

            Logger.logMessage("                 ResetQBWindows " + " - Begin");

            List<Window> modalWin = null;
            int iteration = 0;
            bool menuEnabled = false;

            try
            {
                do
                {
                    try
                    {
                        Logger.logMessage("---------------Try-Catch Block------------------------");
                        Actions.SelectMenu(qbApp, qbWin, "Window", "Close All");
                    }
                    catch (Exception) { }

                    do
                    {
                        //Alert window handler
                        if (Actions.CheckDesktopWindowExists("Alert"))
                            Actions.CheckForAlertAndClose("Alert");

                        //Crash handler
                        if (Actions.CheckDesktopWindowExists("QuickBooks - Unrecoverable Error"))
                        {
                            Actions.QBCrashHandler();
                            break;
                        }

                        if (iteration <= 10)
                        {
                            iteration = iteration + 1;
                            modalWin = qbWin.ModalWindows();

                            foreach (Window item in modalWin)
                            {
                                //Alert window handler
                                if (Actions.CheckDesktopWindowExists("Alert"))
                                    Actions.CheckForAlertAndClose("Alert");

                                //Crash handler
                                if (Actions.CheckDesktopWindowExists("QuickBooks - Unrecoverable Error"))
                                {
                                    Actions.QBCrashHandler();
                                    break;
                                }

                                 //Enter memorize report window handler
                                else if (item.Name.Contains("Memorize Report"))
                                {
                                    try
                                    {
                                        Logger.logMessage("---------------Try-Catch Block------------------------");
                                        Actions.ClickElementByName(item, "No");
                                        Thread.Sleep(int.Parse(Execution_Speed));
                                    }
                                    catch { }
                                }

                                //Handle Save commented report popup
                                else if (item.Name.Contains("Save Your Commented Report?"))
                                {
                                    try
                                    {
                                        Logger.logMessage("---------------Try-Catch Block------------------------");
                                        Actions.ClickElementByName(item, "No");
                                        Thread.Sleep(int.Parse(Execution_Speed));
                                    }
                                    catch { }
                                }

                                try
                                {
                                    Logger.logMessage("---------------Try-Catch Block------------------------");
                                    if (Actions.CheckMenuEnabled(qbApp, qbWin, "File"))
                                    {
                                        menuEnabled = true;
                                        break;
                                    }
                                }
                                catch (Exception)
                                { }

                                //Register QB window handler
                                if (item.Name.Contains("Register QuickBooks"))
                                {
                                    try
                                    {

                                        Logger.logMessage("---------------Try-Catch Block------------------------");
                                        Actions.ClickElementByName(item, "Remind Me Later");
                                        Thread.Sleep(int.Parse(ResetWindow_Timeout));
                                    }
                                    catch { }
                                }

                                //Admin permission needed window handler
                                if (item.Name.Contains("Administrator Permissions Needed"))
                                {
                                    try
                                    {
                                        Logger.logMessage("---------------Try-Catch Block------------------------");
                                        Actions.ClickElementByName(item, "Continue");
                                        Thread.Sleep(int.Parse(ResetWindow_Timeout));
                                    }
                                    catch { }
                                }

                                //No company window handler
                                else if (item.Name.Contains("No") && openFileOnNoCompany.Equals(true))
                                {
                                    try
                                    {
                                        Logger.logMessage("---------------Try-Catch Block------------------------");
                                        QuickBooks.OpenOrUpgradeCompanyFile(PathBuilder.GetPath("DefaultCompanyFile.qbw"), qbApp, qbWin, false, false);
                                    }
                                    catch { }
                                }

                                //Update quickbooks window handler
                                else if (item.Name.Contains("Update QuickBooks"))
                                {
                                    try
                                    {
                                        Logger.logMessage("---------------Try-Catch Block------------------------");
                                        Actions.ClickElementByName(item, "Close");
                                        Thread.Sleep(int.Parse(ResetWindow_Timeout));
                                    }
                                    catch { }
                                }

                                //Payroll update window handler
                                else if (item.Name.Equals("Payroll Update"))
                                {
                                    try
                                    {
                                        Logger.logMessage("---------------Try-Catch Block------------------------");
                                        Actions.ClickElementByName(item, "Cancel");
                                        Thread.Sleep(int.Parse(ResetWindow_Timeout));
                                    }
                                    catch { }

                                    try
                                    {
                                        Logger.logMessage("---------------Try-Catch Block------------------------");
                                        Actions.ClickElementByName(item, "OK");
                                        Thread.Sleep(int.Parse(ResetWindow_Timeout));
                                    }
                                    catch { }

                                }

                                //Intuit payroll services window hadler
                                else if (item.Name.Contains("Intuit Payroll Services"))
                                {
                                    try
                                    {
                                        Logger.logMessage("---------------Try-Catch Block------------------------");
                                        Actions.ClickElementByName(item, "OK");
                                        Thread.Sleep(int.Parse(ResetWindow_Timeout));
                                    }
                                    catch { }
                                }

                                //Employer services window handler
                                else if (item.Name.Contains("Employer Services"))
                                {
                                    try
                                    {
                                        Logger.logMessage("---------------Try-Catch Block------------------------");
                                        Actions.ClickElementByName(item, "Cancel");
                                        Thread.Sleep(int.Parse(ResetWindow_Timeout));
                                    }
                                    catch { }
                                }

                                //Insights works on the accrual basis window handler
                                else if (item.Name.Equals("Insights works on the accrual basis only"))
                                {
                                    try
                                    {
                                        Logger.logMessage("---------------Try-Catch Block------------------------");
                                        Actions.ClickElementByName(item, "OK");
                                        Thread.Sleep(int.Parse(ResetWindow_Timeout));
                                    }
                                    catch { }
                                }

                                //Insights works on the accrual basis window handler
                                else if (item.Name.Contains("Insights"))
                                {
                                    try
                                    {
                                        Logger.logMessage("---------------Try-Catch Block------------------------");
                                        Actions.ClickElementByName(item, "OK");
                                        Thread.Sleep(int.Parse(ResetWindow_Timeout));
                                    }
                                    catch { }
                                }

                                //Enter memorized transactions window handler
                                else if (item.Name.Contains("Enter Memorized Transactions"))
                                {
                                    try
                                    {
                                        Logger.logMessage("---------------Try-Catch Block------------------------");
                                        Actions.ClickElementByName(Actions.GetChildWindow(qbWin, "Enter Memorized Transactions"), "Enter All Later");
                                        Thread.Sleep(int.Parse(ResetWindow_Timeout));
                                    }
                                    catch { }

                                    try
                                    {
                                        Logger.logMessage("---------------Try-Catch Block------------------------");
                                        Actions.ClickElementByName(Actions.GetChildWindow(qbWin, "Enter Memorized Transactions"), "OK");
                                        Thread.Sleep(int.Parse(ResetWindow_Timeout));
                                    }
                                    catch { }
                                }

                                //Recording transaction window handler
                                else if (item.Name.Contains("Recording Transaction"))
                                {
                                    try
                                    {
                                        Logger.logMessage("---------------Try-Catch Block------------------------");
                                        Actions.ClickElementByName(item, "No");
                                        Thread.Sleep(int.Parse(ResetWindow_Timeout));
                                    }
                                    catch { }
                                }


                                //Login window handler
                                else if (item.Name.Equals("QuickBooks Login"))
                                {
                                    Actions.SetFocusOnWindow(item);
                                    Actions.SendBCKSPACEToWindow(item);
                                    Actions.SetTextByAutomationID(item, "15922", UserName);
                                    Actions.SendTABToWindow(item);
                                    Actions.SendKeysToWindow(item, Password);
                                    Actions.ClickElementByAutomationID(item, "51");
                                    Actions.WaitForAnyChildWindow(qbWin, "QuickBooks Login", int.Parse(Sync_Timeout));
                                    Thread.Sleep(int.Parse(ResetWindow_Timeout));
                                }

                                //Error window handler
                                else if (item.Name.Contains("Error"))
                                {
                                    Actions.ClickElementByName(item, "Don't Send");
                                    Thread.Sleep(int.Parse(ResetWindow_Timeout));
                                }


                                //QB Setup window handler
                                else if (item.Name.Contains("Setup"))
                                {
                                    try
                                    {
                                        Logger.logMessage("---------------Try-Catch Block------------------------");
                                        Actions.ClickElementByName(item, "Close");
                                        Thread.Sleep(int.Parse(ResetWindow_Timeout));
                                    }
                                    catch (Exception)
                                    { }

                                    try
                                    {

                                        Logger.logMessage("---------------Try-Catch Block------------------------");
                                        Actions.ClickElementByName(item, "Yes");
                                        Thread.Sleep(int.Parse(ResetWindow_Timeout));
                                    }
                                    catch (Exception)
                                    { }

                                }

                                //Warning window handler
                                else if (item.Name.Contains("Warning"))
                                {
                                    try
                                    {
                                        Logger.logMessage("---------------Try-Catch Block------------------------");
                                        Actions.ClickElementByName(item, "OK");
                                        Thread.Sleep(int.Parse(ResetWindow_Timeout));
                                    }
                                    catch (Exception)
                                    { }

                                    try
                                    {
                                        Logger.logMessage("---------------Try-Catch Block------------------------");
                                        Actions.ClickElementByName(item, "Cancel");
                                        Thread.Sleep(int.Parse(ResetWindow_Timeout));
                                    }
                                    catch (Exception)
                                    { }

                                }

                                else
                                {
                                    item.Focus();

                                    try
                                    {
                                        Logger.logMessage("---------------Try-Catch Block------------------------");
                                        Actions.ClickElementByName(Actions.GetChildWindow(qbWin, "Recording Transaction"), "No");
                                    }
                                    catch { }

                                    try
                                    {
                                        Logger.logMessage("---------------Try-Catch Block------------------------");
                                        Actions.ClickElementByName(item, "Close");
                                        Thread.Sleep(int.Parse(ResetWindow_Timeout));
                                    }
                                    catch { }

                                    try
                                    {

                                        Logger.logMessage("---------------Try-Catch Block------------------------");
                                        Actions.ClickElementByName(item, "No");
                                        Thread.Sleep(int.Parse(ResetWindow_Timeout));
                                    }
                                    catch { }


                                    try
                                    {
                                        Logger.logMessage("---------------Try-Catch Block------------------------");
                                        item.Close();
                                        Thread.Sleep(int.Parse(ResetWindow_Timeout));
                                    }
                                    catch { }

                                    try
                                    {

                                        Logger.logMessage("---------------Try-Catch Block------------------------");
                                        Actions.ClickElementByName(item, "OK");
                                        Thread.Sleep(int.Parse(ResetWindow_Timeout));
                                    }
                                    catch { }
                                }
                            }
                            Thread.Sleep(int.Parse(Execution_Speed));
                        }
                        else
                        {
                            break;
                        }
                    }
                    while (modalWin.Count != 0 && menuEnabled.Equals(false));
                    Thread.Sleep(int.Parse(Execution_Speed));
                }
                while (!Actions.CheckMenuEnabled(qbApp, qbWin, "File"));

                Logger.logMessage("                 ResetQBWindows " + " - End");
                Logger.logMessage("------------------------------------------------------------------------------");
            }

            catch (Exception e)
            {
                Logger.logMessage("ResetQBWindows " + " - Failed");
                Logger.logMessage(e.Message);
                Logger.logMessage("------------------------------------------------------------------------------");
                String sMessage = e.Message;
                LastException.SetLastError(sMessage);
                throw new Exception(sMessage);
            }
        }
예제 #31
0
 //*************************************************************************************************************************************************************
 public static bool SaveCommentedReportDataAsPDF(TestStack.White.Application qbApp, TestStack.White.UIItems.WindowItems.Window qbWindow, string commentedReportName, string commentedReportTitle, string exportDataPath)
 {
     try
     {
         bool reportExist = Reports.CheckCommentedReportExists(qbApp, qbWindow, commentedReportName);
         if (reportExist)
         {
             Reports.OpenSavedCommentedReport(qbApp, qbWindow, commentedReportName, commentedReportTitle);
             TestStack.White.UIItems.WindowItems.Window w = FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, commentedReportTitle);
             FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(w, "Print");
             Thread.Sleep(int.Parse(Execution_Speed));
             FrameworkLibraries.ActionLibs.WhiteAPI.Actions.DesktopInstance_ClickElementByName("Save As PDF");
             Thread.Sleep(int.Parse(Execution_Speed));
             FrameworkLibraries.ActionLibs.WhiteAPI.Actions.SetTextOnElementByName(FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, "Save document as PDF"), "File name:", exportDataPath + commentedReportName + ".pdf");
             FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, "Save document as PDF"), "Save");
             try
             {
                 if (FrameworkLibraries.ActionLibs.WhiteAPI.Actions.CheckWindowExists(qbWindow, "Confirm Save As"))
                 {
                     try
                     {
                         FrameworkLibraries.ActionLibs.WhiteAPI.Actions.ClickElementByName(FrameworkLibraries.ActionLibs.WhiteAPI.Actions.GetChildWindow(qbWindow, "Confirm Save As"), "Yes");
                     }
                     catch (Exception e) { }
                 }
             }
             catch { }
             try
             {
                 FrameworkLibraries.ActionLibs.WhiteAPI.Actions.WaitForChildWindow(qbWindow, commentedReportTitle, int.Parse(Sync_Timeout));
             }
             catch (Exception e) { }
         }
         Logger.logMessage("SaveCommentedReportDataAsPDF : -> Failed to save " + commentedReportName + ".pdf" + " in " + exportDataPath);
         Logger.logMessage("------------------------------------------------------------------------------");
         return true;
     }
     catch (Exception e)
     {
         Logger.logMessage("SaveCommentedReportDataAsPDF : -> Failed to save " + commentedReportName + ".pdf" +  " in " + exportDataPath);
         Logger.logMessage(e.Message);
         Logger.logMessage("------------------------------------------------------------------------------");
         String sMessage = e.Message;
         LastException.SetLastError(sMessage);
         throw new Exception(sMessage);
     }
 }
예제 #32
0
 internal TabPage(TestStack.White.UIItems.TabItems.TabPage control, ControlAccess ControlAccess)
 {
     Control = control;
     myControlAccess = ControlAccess;
 }
예제 #33
0
        //**************************************************************************************************************************************************************
        public static void ResetQBWindows(TestStack.White.Application qbApp, Window qbWin)
        {
            List<Window> modalWin = null;
            int iteration = 0;

            try
            {
                do
                {
                    if (iteration <= 10)
                    {
                        iteration = iteration + 1;
                        modalWin = qbWin.ModalWindows();

                        foreach (Window item in modalWin)
                        {
                            //Alert window handler
                            try
                            {
                                Actions.ClickElementByName(Actions.GetAlertWindow("Alert"), "OK");
                                Thread.Sleep(int.Parse(ResetWindow_Timeout));
                            }
                            catch (Exception) { }

                            try
                            {
                                Actions.ClickElementByName(Actions.GetAlertWindow("Alert"), "No");
                                Thread.Sleep(int.Parse(ResetWindow_Timeout));
                            }
                            catch (Exception) { }

                            //Register QB window handler
                            if (item.Name.Contains("Register QuickBooks"))
                            {
                                try
                                {
                                    Actions.ClickElementByName(item, "Remind Me Later");
                                    Thread.Sleep(int.Parse(ResetWindow_Timeout));
                                }
                                catch { }
                            }

                            //No company window handler
                            else if (item.Name.Contains("No"))
                            {
                                try
                                {
                                    QuickBooks.OpenOrUpgradeCompanyFile(DefaultCompanyFilePath, qbApp, qbWin, false, false);
                                }
                                catch { }
                            }

                            //Update quickbooks window handler
                            else if (item.Name.Contains("Update QuickBooks"))
                            {
                                try
                                {
                                    Actions.ClickElementByName(item, "Close");
                                    Thread.Sleep(int.Parse(ResetWindow_Timeout));
                                }
                                catch { }
                            }

                            //Payroll update window handler
                            else if (item.Name.Equals("Payroll Update"))
                            {
                                try
                                {
                                    Actions.ClickElementByName(item, "Cancel");
                                    Thread.Sleep(int.Parse(ResetWindow_Timeout));
                                }
                                catch { }

                                try
                                {
                                    Actions.ClickElementByName(item, "OK");
                                    Thread.Sleep(int.Parse(ResetWindow_Timeout));
                                }
                                catch { }

                            }

                            //Intuit payroll services window hadler
                            else if (item.Name.Contains("Intuit Payroll Services"))
                            {
                                try
                                {
                                    Actions.ClickElementByName(item, "OK");
                                    Thread.Sleep(int.Parse(ResetWindow_Timeout));
                                }
                                catch { }
                            }

                            //Employer services window handler
                            else if (item.Name.Contains("Employer Services"))
                            {
                                try
                                {
                                    Actions.ClickElementByName(item, "Cancel");
                                    Thread.Sleep(int.Parse(ResetWindow_Timeout));
                                }
                                catch { }
                            }

                            //Insights works on the accrual basis window handler
                            else if (item.Name.Equals("Insights works on the accrual basis only"))
                            {
                                try
                                {
                                    Actions.ClickElementByName(item, "OK");
                                    Thread.Sleep(int.Parse(ResetWindow_Timeout));
                                }
                                catch { }
                            }

                            //Insights works on the accrual basis window handler
                            else if (item.Name.Contains("Insights"))
                            {
                                try
                                {
                                    Actions.ClickElementByName(item, "OK");
                                    Thread.Sleep(int.Parse(ResetWindow_Timeout));
                                }
                                catch { }
                            }

                            //Enter memorized transactions window handler
                            else if (item.Name.Contains("Enter Memorized Transactions"))
                            {
                                try
                                {
                                    Actions.ClickElementByName(Actions.GetChildWindow(qbWin, "Enter Memorized Transactions"), "Enter All Later");
                                    Thread.Sleep(int.Parse(ResetWindow_Timeout));
                                }
                                catch { }

                                try
                                {
                                    Actions.ClickElementByName(Actions.GetChildWindow(qbWin, "Enter Memorized Transactions"), "OK");
                                    Thread.Sleep(int.Parse(ResetWindow_Timeout));
                                }
                                catch { }
                            }

                            //Recording transaction window handler
                            else if (item.Name.Contains("Recording Transaction"))
                            {
                                try
                                {
                                    Actions.ClickElementByName(item, "No");
                                    Thread.Sleep(int.Parse(ResetWindow_Timeout));
                                }
                                catch { }
                            }

                            //Login window handler
                            else if (item.Name.Equals("QuickBooks Login"))
                            {
                                Actions.SetFocusOnWindow(item);
                                Actions.SendBCKSPACEToWindow(item);
                                Actions.SetTextByAutomationID(item, "15922", UserName);
                                Actions.SendTABToWindow(item);
                                Actions.SendKeysToWindow(item, Password);
                                Actions.ClickElementByAutomationID(item, "51");
                                Actions.WaitForAnyChildWindow(qbWin, "QuickBooks Login", int.Parse(Sync_Timeout));
                                Thread.Sleep(int.Parse(ResetWindow_Timeout));
                            }

                            //Error window handler
                            else if (item.Name.Contains("Error"))
                            {
                                Actions.ClickElementByName(item, "Don't Send");
                                Thread.Sleep(int.Parse(ResetWindow_Timeout));
                            }

                            //QB Setup window handler
                            else if (item.Name.Contains("Setup"))
                            {
                                try
                                {
                                    Actions.ClickElementByName(item, "Close");
                                    Thread.Sleep(int.Parse(ResetWindow_Timeout));
                                }
                                catch (Exception)
                                { }

                                try
                                {
                                    Actions.ClickElementByName(item, "Yes");
                                    Thread.Sleep(int.Parse(ResetWindow_Timeout));
                                }
                                catch (Exception)
                                { }

                            }

                            //Warning window handler
                            else if (item.Name.Contains("Warning"))
                            {
                                try
                                {
                                    Actions.ClickElementByName(item, "OK");
                                    Thread.Sleep(int.Parse(ResetWindow_Timeout));
                                }
                                catch (Exception)
                                { }
                            }

                            else
                            {
                                item.Focus();

                                try { Actions.ClickElementByName(Actions.GetChildWindow(qbWin, "Recording Transaction"), "No"); }
                                catch { }

                                try
                                {
                                    Actions.ClickElementByName(item, "Close");
                                    Thread.Sleep(int.Parse(ResetWindow_Timeout));
                                }
                                catch { }

                                try
                                {
                                    item.Close();
                                    Thread.Sleep(int.Parse(ResetWindow_Timeout));
                                }
                                catch { }

                                try
                                {
                                    Actions.ClickElementByName(item, "OK");
                                    Thread.Sleep(int.Parse(ResetWindow_Timeout));
                                }
                                catch { }
                            }
                        }
                        Thread.Sleep(int.Parse(ResetWindow_Timeout));

                        try
                        {
                            Actions.ClickElementByName(Actions.GetAlertWindow("Alert"), "OK");
                            Thread.Sleep(int.Parse(ResetWindow_Timeout));
                        }
                        catch (Exception) { }

                        try
                        {
                            Actions.ClickElementByName(Actions.GetAlertWindow("Alert"), "No");
                            Thread.Sleep(int.Parse(ResetWindow_Timeout));
                        }
                        catch (Exception) { }

                        Thread.Sleep(int.Parse(Execution_Speed));
                    }
                    else
                    {
                        break;
                    }
                }
                while (modalWin.Count != 0);
                Thread.Sleep(int.Parse(Execution_Speed));
            }

            catch (Exception e)
            {
                String sMessage = e.Message;
                LastException.SetLastError(sMessage);
                throw new Exception(sMessage);
            }
        }
예제 #34
0
 private void windowsViewer1_SelectedItemChanged(TestStack.White.UIItems.IUIItem item, string controlName)
 {
     propertiesViewer1.CurrentName = controlName;
     propertiesViewer1.Object = item;
 }
예제 #35
0
        //**************************************************************************************************************************************************************

        public static TestStack.White.UIItems.TableItems.Table GetTableInsideAPaneByIndex(Window window, TestStack.White.UIItems.Panel pane, int index)
        {
            Logger.logMessage("Function call @ :" + DateTime.Now);

            try
            {
                Logger.logMessage("GetTableInsideAPaneByIndex " + window + "->" + pane + "->" + index);

                PropertyCondition tableCondition = new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Table);
                AutomationElementCollection tableElements = pane.AutomationElement.FindAll(TreeScope.Descendants, tableCondition);
                TestStack.White.UIItems.TableItems.Table table = new TestStack.White.UIItems.TableItems.Table(tableElements[index], window.ActionListener);

                Logger.logMessage("GetTableInsideAPaneByIndex " + window + "->" + pane + "->" + index + " - Successful");
                Logger.logMessage("------------------------------------------------------------------------------");

                return table;
            }
            catch (Exception e)
            {
                Logger.logMessage("GetTableInsideAPaneByIndex " + window + "->" + pane + "->" + index + " - Failed");
                Logger.logMessage(e.Message);
                Logger.logMessage("------------------------------------------------------------------------------");
                String sMessage = e.Message;
                LastException.SetLastError(sMessage);
                throw new Exception(sMessage);
            }
        }
예제 #36
0
        //**************************************************************************************************************************************************************
        public static void OpenOrUpgradeCompanyFile(string companyFilePath, TestStack.White.Application qbApp, Window qbWindow, bool backupcopy, bool portalcopy)
        {
            try
            {
                Actions.SelectMenu(qbApp, qbWindow, "File", "Open or Restore Company...");
                Thread.Sleep(int.Parse(Execution_Speed));

                if (backupcopy)
                {
                    Actions.ClickElementByName(Actions.GetChildWindow(qbWindow, "Open or Restore Company"), "Restore a backup copy");
                    Actions.ClickElementByName(Actions.GetChildWindow(qbWindow, "Open or Restore Company"), "Next");
                    Thread.Sleep(int.Parse(Execution_Speed));
                    Actions.ClickElementByName(Actions.GetChildWindow(qbWindow, "Open or Restore Company"), "Local backup");
                    Actions.ClickElementByName(Actions.GetChildWindow(qbWindow, "Open or Restore Company"), "Next");
                    Thread.Sleep(int.Parse(Execution_Speed));

                    try
                    {
                        Actions.SetTextOnElementByName(Actions.GetChildWindow(qbWindow, "Open Backup Copy"), "File name:", companyFilePath);
                        Actions.ClickElementByName(Actions.GetChildWindow(qbWindow, "Open Backup Copy"), "Open");
                        Actions.WaitForChildWindow(qbWindow, "Open or Restore Company", int.Parse(Sync_Timeout));
                    }
                    catch (Exception) { }

                    try
                    {
                        Actions.ClickElementByName(Actions.GetChildWindow(qbWindow, "Open or Restore Company"), "Next");
                        Thread.Sleep(int.Parse(Execution_Speed));
                    }
                    catch (Exception) { }

                    try
                    {
                        Actions.SetTextOnElementByName(Actions.GetChildWindow(qbWindow, "Save Company File as"), "File name:", Utils.StringFunctions.RandomString(5));
                        Actions.ClickElementByName(Actions.GetChildWindow(qbWindow, "Save Company File as"), "Save");
                        Actions.WaitForAnyChildWindow(qbWindow, "Save Company File as", int.Parse(Sync_Timeout));
                    }
                    catch (Exception) { }

                }
                else if (portalcopy)
                {
                    Actions.ClickElementByName(Actions.GetChildWindow(qbWindow, "Open or Restore Company"), "Restore a portable file");
                    Actions.ClickElementByName(Actions.GetChildWindow(qbWindow, "Open or Restore Company"), "Next");
                    Thread.Sleep(int.Parse(Execution_Speed));

                    try
                    {
                        Actions.SetTextOnElementByName(Actions.GetChildWindow(qbWindow, "Open Portable Company File"), "File name:", companyFilePath);
                        Actions.ClickElementByName(Actions.GetChildWindow(qbWindow, "Open Portable Company File"), "Open");
                        Actions.WaitForChildWindow(qbWindow, "Open or Restore Company", int.Parse(Sync_Timeout));
                    }
                    catch (Exception) { }

                    try
                    {
                        Actions.ClickElementByName(Actions.GetChildWindow(qbWindow, "Open or Restore Company"), "Next");
                        Thread.Sleep(int.Parse(Execution_Speed));
                    }
                    catch (Exception) { }

                    try
                    {
                        Actions.SetTextOnElementByName(Actions.GetChildWindow(qbWindow, "Save Company File as"), "File name:", Utils.StringFunctions.RandomString(5));
                        Actions.ClickElementByName(Actions.GetChildWindow(qbWindow, "Save Company File as"), "Save");
                        Actions.WaitForAnyChildWindow(qbWindow, "Save Company File as", int.Parse(Sync_Timeout));
                    }
                    catch (Exception) { }

                }
                else
                {
                    Actions.ClickElementByName(Actions.GetChildWindow(qbWindow, "Open or Restore Company"), "Open a company file");
                    Actions.ClickElementByName(Actions.GetChildWindow(qbWindow, "Open or Restore Company"), "Next");
                    Thread.Sleep(int.Parse(Execution_Speed));
                    Actions.SetTextOnElementByName(Actions.GetChildWindow(qbWindow, "Open a Company"), "File name:", companyFilePath);
                    Actions.ClickElementByName(Actions.GetChildWindow(qbWindow, "Open a Company"), "Open");
                    Actions.WaitForAnyChildWindow(qbWindow, "Open a Company", int.Parse(Sync_Timeout));
                }

                List<Window> modalWin = null;
                int iteration = 0;

                do
                {
                    modalWin = qbWindow.ModalWindows();
                    iteration = iteration + 1;

                    if (iteration <= 7)
                    {
                        foreach (Window item in modalWin)
                        {

                            //QB Login window handler
                            if (item.Name.Contains("QuickBooks Login"))
                            {
                                try
                                {
                                    Actions.SetFocusOnWindow(item);
                                    Actions.SendBCKSPACEToWindow(item);
                                    Actions.SetTextByAutomationID(item, "15922", UserName);
                                    Actions.SendTABToWindow(item);
                                    Actions.SendKeysToWindow(item, Password);
                                    Actions.ClickElementByAutomationID(item, "51");
                                    Actions.WaitForAnyChildWindow(qbWindow, "QuickBooks Login", int.Parse(Sync_Timeout));
                                }
                                catch (Exception) { }
                            }

                            //Register quickbooks window handler
                            else if (item.Name.Contains("Register QuickBooks"))
                            {
                                try
                                {
                                    Actions.ClickElementByName(item, "Remind Me Later");
                                    Thread.Sleep(int.Parse(ResetWindow_Timeout));
                                }
                                catch { }
                            }

                            //Update to new version window handler - I agree
                            else if (item.Name.Contains("Update Company File for New Version") || item.Name.Contains("Update Company File to New Version"))
                            {
                                try
                                {
                                    Actions.ClickElementByName(item, "I understand that my company file will be updated to this new version of QuickBooks.");
                                }
                                catch (Exception) { }
                                try
                                {
                                    Actions.ClickElementByName(item, "Update Now");
                                    Actions.WaitForAnyChildWindow(qbWindow, "Update Company File", int.Parse(Sync_Timeout));
                                }
                                catch (Exception) { }
                            }

                            //QB Backup
                            else if (item.Name.Contains("QuickBooks Backup"))
                            {
                                try
                                {
                                    Actions.ClickElementByName(item, "OK");
                                    Actions.WaitForChildWindow(qbWindow, "Backup", int.Parse(Sync_Timeout));
                                }
                                catch (Exception) { }

                                try
                                {
                                    Actions.ClickElementByName(Actions.GetChildWindow(qbWindow, "Backup"), "Yes");
                                    Actions.WaitForAnyChildWindow(qbWindow, "Backup", int.Parse(Sync_Timeout));
                                }
                                catch (Exception) { }

                                try
                                {
                                    Actions.ClickElementByName(Actions.GetChildWindow(qbWindow, "Backup Incompatible"), "OK");
                                    Thread.Sleep(int.Parse(Execution_Speed));
                                }
                                catch (Exception) { }

                            }

                            //Backup incompatible window handler
                            else if (item.Name.Contains("Backup Incompatible"))
                            {
                                try
                                {
                                    Actions.ClickElementByName(item, "OK");
                                }
                                catch (Exception) { }
                            }

                            //Sync company file window handler
                            else if (item.Name.Contains("Sync Company File"))
                            {
                                try
                                {
                                    Actions.ClickElementByName(item, "Continue");
                                    Actions.WaitForAnyChildWindow(qbWindow, "Sync Company File", int.Parse(Sync_Timeout));
                                }
                                catch (Exception) { }
                            }

                            //QB Information window handler
                            else if (item.Name.Contains("QuickBooks Information"))
                            {
                                try
                                {
                                    Actions.ClickElementByName(item, "OK");
                                    Actions.WaitForAnyChildWindow(qbWindow, "QuickBooks Information", int.Parse(Sync_Timeout));
                                }
                                catch (Exception) { }
                            }

                            //Create backup copy window handler
                            else if (item.Name.Contains("Create Backup"))
                            {
                                try
                                {
                                    Actions.ClickElementByName(item, "Next");
                                    Thread.Sleep(int.Parse(Execution_Speed));
                                }
                                catch (Exception) { }
                            }

                            //Backup options window handler - file path
                            else if (item.Name.Equals("Backup Options"))
                            {
                                try
                                {
                                    Actions.SetTextByAutomationID(item, "2002", TestDataLocalDirectory);
                                }

                                catch (Exception) { }
                                try
                                {
                                    Actions.ClickElementByName(item, "OK");
                                }
                                catch (Exception) { }

                                try
                                {
                                    Actions.ClickElementByName(Actions.GetChildWindow(qbWindow, "QuickBooks"), "Use this Location");
                                }
                                catch (Exception) { }

                                try
                                {
                                    Actions.ClickElementByName(Actions.GetChildWindow(qbWindow, "Save Backup Copy"), "Save");
                                    Actions.WaitForAnyChildWindow(qbWindow, "Save Backup Copy", int.Parse(Sync_Timeout));
                                }
                                catch (Exception) { }
                            }

                            //Quickbooks use this location window handler
                            else if (item.Name.Contains("QuickBooks"))
                            {
                                try
                                {
                                    Actions.ClickElementByName(Actions.GetChildWindow(qbWindow, "QuickBooks"), "Use this Location");
                                    Actions.WaitForAnyChildWindow(qbWindow, "QuickBooks", int.Parse(Sync_Timeout));
                                }
                                catch(Exception)
                                {
                                }
                            }

                            //Save backup copy window handler
                            else if (item.Name.Contains("Save Backup Copy"))
                            {
                                try
                                {
                                    Actions.ClickElementByName(Actions.GetChildWindow(qbWindow, "Save Backup Copy"), "Save");
                                    Actions.WaitForAnyChildWindow(qbWindow, "Save Backup Copy", int.Parse(Sync_Timeout));
                                }
                                catch (Exception) { }

                                try
                                {
                                    Actions.ClickElementByName(Actions.GetChildWindow(qbWindow, "Update Company"), "Yes");
                                    Actions.WaitForAnyChildWindow(qbWindow, "Update Company", int.Parse(Sync_Timeout));
                                }
                                catch (Exception) { }
                            }

                            //Update company window handler
                            else if (item.Name.Contains("Update Company"))
                            {
                                try
                                {
                                    Actions.ClickElementByName(item, "Yes");
                                    Actions.WaitForAnyChildWindow(qbWindow, "Update Company", int.Parse(Sync_Timeout));
                                }
                                catch (Exception) { }

                                try
                                {
                                    Actions.ClickElementByName(item, "Continue");
                                    Actions.WaitForAnyChildWindow(qbWindow, "Update Company", int.Parse(Sync_Timeout));
                                }
                                catch (Exception) { }
                            }

                            //Enter email address window handler
                            else if (item.Name.Contains("Enter your email address"))
                            {
                                try
                                {
                                    Actions.ClickElementByName(Actions.GetChildWindow(qbWindow, "Encountered a Problem"), "Skip");
                                }
                                catch (Exception) { }

                                try
                                {
                                    Actions.ClickElementByName(item, "Close");
                                }
                                catch (Exception) { }
                            }

                            else if(item.Name.Contains("Encountered a Problem"))
                            {
                                try
                                {
                                    Actions.ClickElementByName(item, "Skip");
                                }
                                catch (Exception) { }

                            }

                            //Warning window handler
                            else if (item.Name.Contains("Warning"))
                            {
                                try
                                {
                                    Actions.ClickElementByName(item, "OK");
                                    Actions.WaitForAnyChildWindow(qbWindow, "Warning", int.Parse(Sync_Timeout));
                                }
                                catch (Exception) { }

                                try
                                {
                                    Actions.ClickElementByName(item, "Continue");
                                    Actions.WaitForAnyChildWindow(qbWindow, "Warning", int.Parse(Sync_Timeout));
                                }
                                catch (Exception) { }

                                try
                                {
                                    Actions.ClickElementByName(item, "Start");
                                    Actions.WaitForAnyChildWindow(qbWindow, "Warning", int.Parse(Sync_Timeout));
                                }
                                catch (Exception) { }

                                try
                                {
                                    Actions.ClickElementByName(Actions.GetChildWindow(qbWindow, "QuickBooks File Doctor"), "Continue");
                                }
                                catch (Exception) { }

                            }

                            //QuickBooks File Doctor window handler
                            else if (item.Name.Contains("QuickBooks File Doctor"))
                            {
                                try
                                {
                                    Actions.ClickElementByName(item, "Continue");
                                    Actions.WaitForAnyChildWindow(qbWindow, "QuickBooks File Doctor", int.Parse(Sync_Timeout));
                                }
                                catch (Exception) { }
                            }

                            //Home window handler
                            else if (item.Name.Contains("Home"))
                            {
                                try { Actions.ClickElementByName(item, "Close");
                                Thread.Sleep(int.Parse(Execution_Speed));}
                                catch (Exception) { }
                            }

                            //Enter memorized transaction window handler
                            else if (item.Name.Contains("Enter Memorized Transactions"))
                            {
                                try
                                {
                                    Actions.ClickElementByName(item, "Enter All Later");
                                    Thread.Sleep(int.Parse(Execution_Speed));
                                }
                                catch { }

                                try
                                {
                                    Actions.ClickElementByName(item, "OK");
                                    Thread.Sleep(int.Parse(Execution_Speed));
                                }
                                catch { }
                            }

                            //Enter memorized transaction window handler
                            else if (item.Name.Contains("Enter Memorized Transactions"))
                            {
                                try
                                {
                                    Actions.ClickElementByName(item, "OK");
                                    Thread.Sleep(int.Parse(Execution_Speed));
                                }
                                catch { }
                            }

                            //Insights works on accural basis window handler
                            else if (item.Name.Contains("Insights works on the accrual basis only"))
                            {
                                try
                                {
                                    Actions.ClickElementByName(item, "OK");
                                    Thread.Sleep(int.Parse(Execution_Speed));
                                }
                                catch { }
                            }

                            //Alert window handler
                            else
                            {
                                try
                                {
                                    Actions.ClickElementByName(Actions.GetAlertWindow("Alert"), "OK");
                                    Thread.Sleep(int.Parse(Execution_Speed));
                                }
                                catch (Exception) { }

                                try
                                {
                                    Actions.ClickElementByName(Actions.GetAlertWindow("Alert"), "No");
                                    Thread.Sleep(int.Parse(Execution_Speed));
                                }
                                catch (Exception) { }
                            }
                        }
                    }
                    else
                    {
                        //ResetQBWindows(qbApp, qbWindow);
                        break;
                    }
                    Thread.Sleep(int.Parse(Execution_Speed));
                }
                while (modalWin.Count != 0);
                Thread.Sleep(int.Parse(Execution_Speed));
            }
            catch (Exception e)
            {
                String sMessage = e.Message;
                LastException.SetLastError(sMessage);
                throw new Exception(sMessage);
            }
        }
예제 #37
0
        //**************************************************************************************************************************************************************

        public static List<TestStack.White.UIItems.CheckBox> GetAllTableCheckBoxElements(TestStack.White.UIItems.TableItems.Table table, Window window)
        {
            Logger.logMessage("Function call @ :" + DateTime.Now);
            List<TestStack.White.UIItems.CheckBox> elements = null;

            try
            {
                Logger.logMessage("GetAllTableCheckBoxElements " + table + "->" + window);

                PropertyCondition tableElementsCondition = new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.CheckBox);
                AutomationElementCollection allTableElements = table.AutomationElement.FindAll(TreeScope.Descendants, tableElementsCondition);

                foreach (AutomationElement item in allTableElements)
                {
                    TestStack.White.UIItems.CheckBox l = new TestStack.White.UIItems.CheckBox(item, window.ActionListener);
                    elements.Add(l);
                }

                Logger.logMessage("GetAllTableCheckBoxElements " + table + "->" + window + " - Successful");
                Logger.logMessage("------------------------------------------------------------------------------");

                return elements;
            }
            catch (Exception e)
            {
                Logger.logMessage("GetAllTableCheckBoxElements " + table + "->" + window + " - Failed");
                Logger.logMessage(e.Message);
                Logger.logMessage("------------------------------------------------------------------------------");
                String sMessage = e.Message;
                LastException.SetLastError(sMessage);
                throw new Exception(sMessage);
            }
        }
예제 #38
0
        //**************************************************************************************************************************************************************
        public static Window PrepareBaseState(TestStack.White.Application app)
        {
            Window qbWin = null;

            try
            {
                List<Window> windows = app.GetWindows();
                foreach (Window item in windows)
                {
                    if (item.Name.Contains("QuickBooks"))
                    {
                        qbWin = item;
                        Thread.Sleep(int.Parse(Execution_Speed));
                        break;
                    }
                }

                return qbWin;

            }
            catch (Exception e)
            {
                String sMessage = e.Message;
                LastException.SetLastError(sMessage);
                throw new Exception(sMessage);
            }
        }
예제 #39
0
 //**************************************************************************************************************************************************************
 public static bool DeleteCommentedReport(TestStack.White.Application qbApp, TestStack.White.UIItems.WindowItems.Window qbWindow, string reportNameToDelete)
 {
       try
          {
             //check if the report to be deleted exists
             bool reportExist = Reports.CheckCommentedReportExists(qbApp, qbWindow, reportNameToDelete);
             if (reportExist)
             {
                     FrameworkLibraries.ActionLibs.WhiteAPI.Actions.SelectMenu(qbApp, qbWindow, "Reports", "Commented Reports");
                     Thread.Sleep(int.Parse(Execution_Speed));
                     qbAppWindowForSilk = _desktop.Window("/Window");
                     qbAppWindowForSilk.SetActive();
                     commentedReportListWindowForSilk = qbAppWindowForSilk.Window("@caption='Commented Reports'");
                     commentedReportListWindowForSilk.Maximize();
                     commentedReportListWindowForSilk.TextClick(reportNameToDelete, 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");
                     Thread.Sleep(3000);
                     try
                     {
                         bool deletedReportExist = Reports.CheckCommentedReportExists(qbApp, qbWindow, reportNameToDelete);
                     if (!deletedReportExist)
                     {
                         Logger.logMessage("DeleteCommentedReport -> Specified commented report " + reportNameToDelete + " was deleted successfully ");
                         Logger.logMessage("------------------------------------------------------------------------------");
                     }
                     else
                     {
                         Logger.logMessage("DeleteCommentedReport -> Failed to delete " + reportNameToDelete);
                         Logger.logMessage("------------------------------------------------------------------------------");
                     }
                   }
                   catch (Exception e) { }
           }
             Logger.logMessage("SaveCommentedReport " + " -> Save commented report for " + reportNameToDelete + " successful");
             Logger.logMessage("------------------------------------------------------------------------------");
             return true;
       }
       catch (Exception e)
         {
             Logger.logMessage("SaveCommentedReport " + " -> Save commented report for " + reportNameToDelete + " failed");
             Logger.logMessage(e.Message);
             Logger.logMessage("------------------------------------------------------------------------------");
             String sMessage = e.Message;
             LastException.SetLastError(sMessage);
             throw new Exception(sMessage);
         }
 }
예제 #40
0
        //**************************************************************************************************************************************************************
        public static bool CreateInvoice(TestStack.White.Application qbApp, Window qbWindow, String customer, String cls, String account, String template, int invoiceNumber, int poNumber, String terms, String via, String fob, String quatity, String item, String itemDesc, bool markPending)
        {
            try
            {
                Actions.SelectMenu(qbApp, qbWindow, "Customers", "Create Invoices");
                Thread.Sleep(int.Parse(Execution_Speed));
                Window invoiceWindow = Actions.GetWindow(qbWindow, FrameworkLibraries.ObjMaps.QBDT.WhiteAPI.Invoice.Objects.CreateInvoice_Window_Name);

                try
                {
                    Actions.ClickElementByAutomationID(invoiceWindow, FrameworkLibraries.ObjMaps.QBDT.WhiteAPI.Invoice.Objects.MaximizeWindow_Button_AutoID);
                    Thread.Sleep(int.Parse(Execution_Speed));
                }
                catch (Exception)
                { }

                Actions.ClickButtonByAutomationID(invoiceWindow, "PrevBtn");
                Actions.SendKeysToWindow(invoiceWindow, customer);
                Actions.SendTABToWindow(invoiceWindow);
                Actions.SendKeysToWindow(invoiceWindow, cls);
                Actions.SendTABToWindow(invoiceWindow);
                Actions.SendKeysToWindow(invoiceWindow, account);
                Actions.SendTABToWindow(invoiceWindow);
                Actions.SendKeysToWindow(invoiceWindow, template);
                Actions.SendTABToWindow(invoiceWindow);
                Actions.SendTABToWindow(invoiceWindow);
                Actions.SendBCKSPACEToWindow(invoiceWindow);
                Actions.SendKeysToWindow(invoiceWindow, Convert.ToString(invoiceNumber));
                Actions.SendTABToWindow(invoiceWindow);
                Actions.SendTABToWindow(invoiceWindow);
                Actions.SendTABToWindow(invoiceWindow);
                Actions.SendTABToWindow(invoiceWindow);
                Actions.SendBCKSPACEToWindow(invoiceWindow);
                Actions.SendKeysToWindow(invoiceWindow, Convert.ToString(poNumber));
                Actions.SendTABToWindow(invoiceWindow);
                Actions.SendKeysToWindow(invoiceWindow, terms);
                Actions.SendTABToWindow(invoiceWindow);
                Actions.SendTABToWindow(invoiceWindow);
                Actions.SendTABToWindow(invoiceWindow);
                Actions.SendKeysToWindow(invoiceWindow, via);
                Actions.SendTABToWindow(invoiceWindow);
                Actions.SendKeysToWindow(invoiceWindow, fob);
                Actions.SendTABToWindow(invoiceWindow);
                Actions.SendKeysToWindow(invoiceWindow, quatity);
                Actions.SendTABToWindow(invoiceWindow);
                Actions.SendKeysToWindow(invoiceWindow, item);
                Actions.SendTABToWindow(invoiceWindow);
                Actions.SendSHIFT_ENDToWindow(invoiceWindow);

                if (markPending)
                { Actions.ClickButtonByAutomationID(invoiceWindow, FrameworkLibraries.ObjMaps.QBDT.WhiteAPI.Invoice.Objects.MarkPending_Button_AutoID); }

                Actions.ClickElementByName(invoiceWindow, FrameworkLibraries.ObjMaps.QBDT.WhiteAPI.Invoice.Objects.SaveClsoe_Button_Name);

                try
                {
                    Actions.ClickElementByName(Actions.GetChildWindow(qbWindow, "Recording Transaction"), "Yes");
                    Thread.Sleep(int.Parse(Execution_Speed));
                }
                catch { }

                try { Actions.ClickElementByName(Actions.GetChildWindow(qbWindow, "Enter Memorized Transactions Later"), "Ok"); }
                catch { }

                try
                {
                    Actions.ClickElementByName(Actions.GetChildWindow(qbWindow, "Information Changed"), "No");
                    Thread.Sleep(int.Parse(Execution_Speed));
                }
                catch { }

                try
                {
                    Actions.ClickElementByName(Actions.GetChildWindow(qbWindow, "Past Transactions"), "No");
                    Thread.Sleep(int.Parse(Execution_Speed));
                }
                catch { }

                try
                {
                    Actions.ClickElementByName(Actions.GetChildWindow(qbWindow, "Available Credits"), "No");
                    Thread.Sleep(int.Parse(Execution_Speed));
                }
                catch { }

                return true;

            }
            catch (Exception e)
            {
                String sMessage = e.Message;
                LastException.SetLastError(sMessage);
                throw new Exception(sMessage);
            }
        }
예제 #41
0
        //**************************************************************************************************************************************************************

        public static void ClickTextInsidePanel(Window window, TestStack.White.UIItems.Panel pane, string text)
        {
            Logger.logMessage("Function call @ :" + DateTime.Now);

            try
            {
                Logger.logMessage("ClickTextInsidePanel " + window + "->" + pane + "->" + text);
                PropertyCondition textCondition = new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Text);
                AutomationElementCollection textElements = pane.AutomationElement.FindAll(TreeScope.Descendants, textCondition);

                foreach (AutomationElement item in textElements)
                {
                    if (item.Current.Name.Equals(text))
                    {
                        var t = new TestStack.White.UIItems.Label(item, window.ActionListener);
                        t.Focus();
                        t.Click();
                        Logger.logMessage("ClickTextInsidePanel " + window + "->" + pane + "->" + text + " - Successful");
                        Logger.logMessage("------------------------------------------------------------------------------");
                        break;
                    }
                }
            }
            catch (Exception e)
            {
                Logger.logMessage("ClickTextInsidePanel " + window + "->" + pane + "->" + text + " - Failed");
                Logger.logMessage(e.Message);
                Logger.logMessage("------------------------------------------------------------------------------");
                String sMessage = e.Message;
                LastException.SetLastError(sMessage);
                throw new Exception(sMessage);
            }
        }