예제 #1
0
 private string SearchAndReturnNewNoticeName(string username)
 {
     //search for TestUser and increment suffix until you find one that hasn't been created yet.
     //Return that user name to be added.
     usernameappend = 1;
     for (int i = 0; i < i + 1; i++)
     {
         int found_flag = 0;
         UserNameText = username + usernameappend;
         Thread.Sleep(KortextGlobals.s);
         IList <IWebElement> SearchNoticeField = Driver.Instance.FindElements(SearchField_locator);
         if (SearchNoticeField.Count > 0)
         {
             WaitFind.FindElem(SearchNoticeField[1], 10).Clear();
             Klick.On(SearchNoticeField[1]);
             Thread.Sleep(KortextGlobals.s);
             SearchNoticeField[1].SendKeys(UserNameText);
             Thread.Sleep(KortextGlobals.s);
             try
             {
                 List <NgWebElement> NoticesSearched = new List <NgWebElement>(Driver.ngDriver.FindElements(NgBy.Repeater("row in adminSysMess.displayedCollection")));
                 if (NoticesSearched.Count > 0)
                 {
                     foreach (IWebElement NoticeSearched in NoticesSearched)
                     {
                         Driver.HighlightElement(NoticeSearched);
                         IWebElement NoticeName = NoticeSearched.FindElement(NoticeName_locator);
                         if (NoticeName.Text == UserNameText)
                         {
                             found_flag     = 1;
                             usernameappend = usernameappend + 1;
                             break;
                         }
                     }
                     if (found_flag == 0)
                     {
                         Console.WriteLine("Notice Name found." + UserNameText);
                         return(UserNameText);
                     }
                 }
                 else
                 {
                     Console.WriteLine("Notice Name found." + UserNameText);
                     return(UserNameText);
                 }
             }
             catch (Exception e)
             {
                 Console.WriteLine("Search -" + UserNameText + " Notice Not Found; Using this Notice Name " + e.Message);
                 return(UserNameText);
             }
         }
         else
         {
             Console.WriteLine("Could not find the Search Field in SearchName function.");
         }
     }
     return(UserNameText);
 }
예제 #2
0
        public void ViewNotice(string searchtext)
        {
            Driver.Instance.Navigate().Refresh();
            Thread.Sleep(KortextGlobals.l);

            IList <IWebElement> SearchNoticeField = Driver.Instance.FindElements(SearchField_locator);

            if (SearchNoticeField.Count > 0)
            {
                WaitFind.FindElem(SearchNoticeField[1], 10).Clear();
                Klick.On(SearchNoticeField[1]);
                Thread.Sleep(KortextGlobals.s);
                SearchNoticeField[1].SendKeys(searchtext);
                Thread.Sleep(KortextGlobals.s);

                List <NgWebElement> NoticesSearched = new List <NgWebElement>(Driver.ngDriver.FindElements(NgBy.Repeater("row in adminSysMess.displayedCollection")));
                if (NoticesSearched.Count > 0)
                {
                    foreach (IWebElement NoticeSearched in NoticesSearched)
                    {
                        IWebElement NoticeNameField = NoticeSearched.FindElement(NoticeName_locator);
                        if (NoticeNameField.Text == searchtext)
                        {
                            IWebElement NoticeViewButton = NoticeSearched.FindElement(ViewNotice_locator);
                            Klick.On(NoticeViewButton);
                            if (ViewNoticeHeader.Displayed)
                            {
                                Console.WriteLine("Viewing Notice Successful." + searchtext);
                                Klick.On(NoticeCancelButton);
                                break;
                            }
                            else
                            {
                                Console.WriteLine("Error while Viewing Notice." + searchtext);
                                Driver.Instance.Navigate().Refresh();
                                Thread.Sleep(KortextGlobals.l);
                                break;
                            }
                        }
                    }
                }
                else
                {
                    Console.WriteLine(searchtext + " Notice not found to be Viewed");
                }
            }
            else
            {
                Console.WriteLine("Could not find the Search Field in View Notice function.");
            }
        }
예제 #3
0
        public void SearchNotices(string searchtext)
        {
            int i = 0;

            Driver.Instance.Navigate().Refresh();
            Thread.Sleep(KortextGlobals.l);

            IList <IWebElement> SearchNoticeField = Driver.Instance.FindElements(SearchField_locator);

            if (SearchNoticeField.Count > 0)
            {
                WaitFind.FindElem(SearchNoticeField[1], 10).Clear();
                Klick.On(SearchNoticeField[1]);
                Thread.Sleep(KortextGlobals.s);
                SearchNoticeField[1].SendKeys(searchtext);
                Thread.Sleep(KortextGlobals.s);

                List <NgWebElement> NoticesSearched = new List <NgWebElement>(Driver.ngDriver.FindElements(NgBy.Repeater("row in adminSysMess.displayedCollection")));
                if (NoticesSearched.Count > 0)
                {
                    foreach (IWebElement NoticeSearched in NoticesSearched)
                    {
                        IWebElement NoticeName = NoticeSearched.FindElement(NoticeName_locator);
                        if (NoticeName.Text == searchtext)
                        {
                            Console.WriteLine(searchtext + " Notice found");
                            i = 1;
                            break;
                        }
                    }
                    if (i == 0)
                    {
                        Console.WriteLine(searchtext + " Notice not found");
                    }
                }
                else
                {
                    Console.WriteLine(searchtext + " Notice not found");
                }
            }
            else
            {
                Console.WriteLine("Could not find the Search Field in Search function.");
            }
        }
예제 #4
0
        public void UpdateNotice(string noticename, string noticefield, string newnoticetext)
        {
            Driver.Instance.Navigate().Refresh();
            Thread.Sleep(KortextGlobals.l);

            IList <IWebElement> SearchNoticeField = Driver.Instance.FindElements(SearchField_locator);

            if (SearchNoticeField.Count > 0)
            {
                WaitFind.FindElem(SearchNoticeField[1], 10).Clear();
                Klick.On(SearchNoticeField[1]);
                Thread.Sleep(KortextGlobals.s);
                SearchNoticeField[1].SendKeys(noticename);
                Thread.Sleep(KortextGlobals.s);

                List <NgWebElement> NoticesSearched = new List <NgWebElement>(Driver.ngDriver.FindElements(NgBy.Repeater("row in adminSysMess.displayedCollection")));
                if (NoticesSearched.Count > 0)
                {
                    foreach (IWebElement NoticeSearched in NoticesSearched)
                    {
                        IWebElement NoticeNameField = NoticeSearched.FindElement(NoticeName_locator);
                        if (NoticeNameField.Text == noticename)
                        {
                            Driver.HighlightElement(NoticeSearched);
                            IWebElement NoticeEditButton = NoticeSearched.FindElement(NoticeEdit_locator);
                            Klick.On(NoticeEditButton);
                            if (noticefield == "Subject")
                            {
                                WaitFind.FindElem(NoticeSubjectTextField, 10).Clear();
                                Klick.On(NoticeSubjectTextField);
                                Thread.Sleep(KortextGlobals.s);
                                NoticeSubjectTextField.SendKeys(newnoticetext);
                            }
                            else if (noticefield == "Body")
                            {
                                WaitFind.FindElem(NoticeBodyTextField, 10).Clear();
                                Klick.On(NoticeBodyTextField);
                                Thread.Sleep(KortextGlobals.s);
                                NoticeBodyTextField.SendKeys(newnoticetext);
                            }
                            else
                            {
                                Console.WriteLine("Incorrect Notice Field provided." + noticefield);
                                break;
                            }
                            Klick.On(NoticeSaveButton);
                            statusreturntext = Pages.PearlEditBuffer.StatusMessage();
                            if (statusreturntext == "Message updated")
                            {
                                Console.WriteLine("Notice Update Successful for " + noticename + "," + noticefield);
                            }
                            else if (statusreturntext == "Could not update tag")
                            {
                                Console.WriteLine("Error while updating Notice for " + noticename + "," + noticefield + "." + statusreturntext);
                            }
                            if (noticefield == "Subject")
                            {
                                SearchNotices(newnoticetext);
                            }
                            else if (noticefield == "Body")
                            {
                                SearchNotices(noticename);
                            }
                            break;
                        }
                    }
                }
                else
                {
                    Console.WriteLine(noticename + " Notice not found to be updated");
                }
            }
            else
            {
                Console.WriteLine("Could not find the Search Field in Update function.");
            }
        }