示例#1
0
        //// Child 'Marlon Casson' under Pending Bookings
        //[FindsBy(How = How.LinkText, Using = "Marlon Casson")]
        //public IWebElement lnkChild1 { get; set; }

        //// Child 'Marlon Casson' under Pending Bookings
        //[FindsBy(How = How.LinkText, Using = "Tony Casson")]
        //public IWebElement lnkChild2 { get; set; }

        private bool ValidationBooking(IWebDriver driver, string TestName, string Name)
        {
            log.Info("Booking Manager Validation Test Case: ");

            AimyClick(driver, chkAllTerms);

            IReadOnlyCollection <IWebElement> elements = null;

            try
            {
                elements = WebDriverExtensions.FindElements(driver,
                                                            By.LinkText(Name),
                                                            10);
            }
            catch (Exception)
            {
                if (elements == null)
                {
                    log.Info("[FAIL] " + TestName);
                    log.Info("'" + Name + "' does NOT exist under " + TestName + ". FAILED!");
                    return(false);
                }
            }
            log.Info("[PASS] " + TestName);
            log.Info("The child '" + Name + "' exist under " + TestName + ". PASSED!");
            return(true);
        }
示例#2
0
        public bool IsParentBeenRestoredToParentManagePage(IWebDriver driver, string ParentName)
        {
            log.Info("Parent Archive Restore Validation Test");
            Common.WaitBySleeping(GlobalVariable.iShortWait);
            sURL = GlobalVariable.sURL + "Parent/Management";
            driver.Navigate().GoToUrl(sURL);
            Common.WaitBySleeping(GlobalVariable.iShortWait);
            IWebElement txtCategory = WebDriverExtensions.FindElement(driver, By.Id("category"), 2);

            AimySendKeys(driver, txtCategory, ParentName);
            txtCategory.SendKeys(Keys.Enter);
            Thread.Sleep(2000);
            IReadOnlyCollection <IWebElement> elements = null;

            try
            {
                elements = WebDriverExtensions.FindElements(driver,
                                                            By.XPath("html/body/div[3]/div[3]/div[2]/table/tbody/tr[1]/td[3]/div/p[1]/b"),
                                                            10);
            }
            catch (Exception)
            {
                if (elements == null)
                {
                    log.Info("[FAIL]: '" + ParentName + "' has NOT been found.");
                    return(false);
                }
            }
            log.Info("[PASS]: '" + ParentName + "' has been RESTORED!");
            return(true);
        }
示例#3
0
        public bool ValidationAttendanceExist(IWebDriver driver, string ChildName)
        {
            sURL = GlobalVariable.sURL + "RollSheet/AttendanceManager";
            driver.Navigate().GoToUrl(sURL);

            Common.WaitBySleeping(GlobalVariable.iShortWait);

            IReadOnlyCollection <IWebElement> selectors = WebDriverExtensions.FindElements(driver,
                                                                                           By.XPath("html/body/div[3]/div[5]/span[1]/span/span[2]/span"), 10);

            if (selectors.Count != 0)
            {
                foreach (var selector in selectors)
                {
                    AimyClick(driver, selector);
                    break;
                }
            }

            Common.WaitBySleeping(GlobalVariable.iShortWait);
            AimyClick(driver, ddlTerm3);

            Common.WaitBySleeping(GlobalVariable.iShortWait);

            bool exist = ValidationAttendance(driver, "AttendanceManager - Attendance Checking",
                                              ChildName);

            return(exist);
        }
示例#4
0
 public static IWebDriver WaitToClear(this IWebDriver driver, SelectorBase selector)
 {
     if (driver == null)
     {
         throw new ArgumentNullException("driver");
     }
     if (selector == null)
     {
         throw new ArgumentNullException("selector");
     }
     new WebDriverWait(driver, DefaultWaitTimeSpan).Until <bool>(d => WebDriverExtensions.FindElements(d, selector).Count < 1);
     return(driver);
 }
示例#5
0
        public bool IsParentUnlocked(IWebDriver driver, string ParentName)
        {
            Common.WaitBySleeping(GlobalVariable.iShortWait);
            IReadOnlyCollection <IWebElement> TableRows = WebDriverExtensions.FindElements(driver,
                                                                                           By.XPath("html/body/div[3]/div[3]/div[2]/table/tbody/tr"), 2);

            for (int t = 0; t < TableRows.Count; t++)
            {
                if (TableRows.ElementAt(t) != null)
                {
                    if (!String.IsNullOrEmpty(TableRows.ElementAt(t).GetAttribute("style")))
                    {
                        if (TableRows.ElementAt(t).GetAttribute("style").Equals("background-color: rgb(239, 201, 201);"))
                        {
                            // filter for this parent
                            IWebElement txtCategory = WebDriverExtensions.FindElement(driver, By.Id("category"), 2);

                            AimySendKeys(driver, txtCategory, ParentName);
                            txtCategory.SendKeys(Keys.Enter);

                            // locate the 'profile' dropdown list
                            WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(500));
                            wait.PollingInterval = TimeSpan.FromSeconds(2);
                            wait.Until(
                                ExpectedConditions.ElementExists(By.CssSelector("span.caret.split-dropdown-caret")));

                            IReadOnlyCollection <IWebElement> items =
                                driver.FindElements(By.CssSelector("span.caret.split-dropdown-caret"));
                            // click on 'profile'dropdown list
                            foreach (var item in items)
                            {
                                item.Click();
                                break;
                            }

                            Thread.Sleep(2000);
                            AimyClick(driver, menuItemUnlock);
                            Thread.Sleep(2000);
                            AimyClick(driver, buttonOK);

                            return(true);
                        }
                    }
                }
            }
            return(true);
        }
示例#6
0
 public void StepsForBookingWizard1(IWebDriver driver, bool needSecondChild = false)
 {
     if (!IsFirstChildSelected(driver))
     {
         AimyClick(driver, lblChild1);
         if (needSecondChild)
         {
             IReadOnlyCollection <IWebElement> elems = WebDriverExtensions.FindElements(driver, By.XPath("html/body/div[3]/div[2]/div/div[1]/div/div[2]/label"), 2);
             if (elems.Count >= 2)
             {
                 AimyClick(driver, lblChild2);
             }
             else
             {
                 throw new Exception("The second child is NOT available!!");
             }
         }
     }
     Thread.Sleep(2000);
     AimyClick(driver, btnNext);
 }
示例#7
0
        public bool IsParentBeenRestoredFromAchiveList(IWebDriver driver, string ParentName)
        {
            log.Info("Parent Archive Restore Validation Test");

            IReadOnlyCollection <IWebElement> elements = null;

            try
            {
                elements = WebDriverExtensions.FindElements(driver,
                                                            By.LinkText("Restore"),
                                                            5);
            }
            catch (Exception)
            {
                if (elements == null)
                {
                    log.Info("[PASS] We expect that there should NO '" + ParentName + "' been found.");
                    return(true);
                }
            }
            log.Info("[FAIL] There is '" + ParentName + "' which should NOT be!");
            return(false);
        }
        private bool ValidationChildAchive(IWebDriver driver, string TestName)
        {
            log.Info("Children Management Validation Test Case: ");
            IReadOnlyCollection <IWebElement> elements = null;

            try
            {
                elements = WebDriverExtensions.FindElements(driver,
                                                            By.LinkText("Profile"),
                                                            10);
            }
            catch (Exception)
            {
                if (elements == null)
                {
                    log.Info("[PASS] " + TestName);
                    log.Info("We expect that there should NO 'Profile' link for this parent.");
                    return(true);
                }
            }
            log.Info("[FAIL] " + TestName);
            log.Info("There is 'Profile' link for this parent!");
            return(false);
        }
示例#9
0
        public bool IsParentLocked(IWebDriver driver, string ParentName)
        {
            log.Info("Parent Manager - FindTheLockedParent : Validation Test Case: ");

            Common.WaitBySleeping(GlobalVariable.iShortWait);
            IReadOnlyCollection <IWebElement> TableRows = WebDriverExtensions.FindElements(driver,
                                                                                           By.XPath("html/body/div[3]/div[3]/div[2]/table/tbody/tr"), 2);


            for (int t = 0; t < TableRows.Count; t++)
            {
                if (TableRows.ElementAt(t) != null)
                {
                    if (!String.IsNullOrEmpty(TableRows.ElementAt(t).GetAttribute("style")))
                    {
                        if (TableRows.ElementAt(t).GetAttribute("style").Equals("background-color: rgb(239, 201, 201);"))
                        {
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }