예제 #1
0
        public void AddNewNotice(string noticetype, string searchtext)
        {
            Thread.Sleep(KortextGlobals.s);
            Klick.On(CreateNoticeButton);
            Thread.Sleep(KortextGlobals.s);
            if (noticetype == "Alert")
            {
                new SelectElement(NoticeTypeList).SelectByIndex(1);
            }
            else if (noticetype == "News")
            {
                new SelectElement(NoticeTypeList).SelectByIndex(2);
            }
            else
            {
                Console.WriteLine("Incorrect Notice Type Passed. Selecting NEWS to continue.");
                new SelectElement(NoticeTypeList).SelectByIndex(2);
            }

            WaitFind.FindElem(NoticeSubjectTextField, 10).Clear();
            Klick.On(NoticeSubjectTextField);
            Thread.Sleep(KortextGlobals.s);
            NoticeSubjectTextField.SendKeys(searchtext);
            Thread.Sleep(KortextGlobals.s);

            WaitFind.FindElem(NoticeBodyTextField, 10).Clear();
            Klick.On(NoticeBodyTextField);
            Thread.Sleep(KortextGlobals.s);
            NoticeBodyTextField.SendKeys("ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()?<>,.:;");
            Thread.Sleep(KortextGlobals.s);

            Klick.On(NoticeSaveButton);
            statusreturntext = Pages.PearlEditBuffer.StatusMessage();
            if (statusreturntext != "Message added")
            {
                Console.WriteLine("Error while Creating New Notice." + statusreturntext);
            }
            else
            {
                Console.WriteLine("Creating Notice Successful");
            }
            Thread.Sleep(KortextGlobals.s);
            Console.WriteLine("Searching Notices after Creation.");
            SearchNotices(searchtext);
        }
예제 #2
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.");
            }
        }