示例#1
0
        public void UpdateTag(string oldtagname, string newtagname)
        {
            WaitFind.FindElem(FilterTagTextField, 10).Clear();
            Klick.On(FilterTagTextField);
            Thread.Sleep(KortextGlobals.s);
            FilterTagTextField.SendKeys(oldtagname);
            Thread.Sleep(KortextGlobals.s);

            List <NgWebElement> TagsSearched = new List <NgWebElement>(Driver.ngDriver.FindElements(NgBy.Repeater("row in adminTags.displayedCollection")));

            if (TagsSearched.Count > 0)
            {
                foreach (IWebElement TagSearched in TagsSearched)
                {
                    IWebElement TagTitle = TagSearched.FindElement(TagTitle_locator);
                    if (TagTitle.Text == oldtagname)
                    {
                        Klick.On(TagTitle);
                        WaitFind.FindElem(TagUpdateTextField, 10).Clear();
                        Klick.On(TagUpdateTextField);
                        Thread.Sleep(KortextGlobals.s);
                        TagUpdateTextField.SendKeys(newtagname);

                        Klick.On(TagUpdateSubmit);
                        statusreturntext = Pages.PearlEditBuffer.StatusMessage();
                        if (statusreturntext == "Tag updated")
                        {
                            Console.WriteLine("Tag Update Successful from " + oldtagname + " to " + newtagname);
                            FilterTags(oldtagname);
                            FilterTags(newtagname);
                        }
                        else
                        {
                            Console.WriteLine("Error while updating tag from " + oldtagname + " to " + newtagname + "." + statusreturntext);
                            FilterTags(oldtagname);
                            FilterTags(newtagname);
                        }
                        break;
                    }
                }
            }
            else
            {
                Console.WriteLine(oldtagname + " Tag not found to be updated");
            }
        }
示例#2
0
        public void DeleteTags(string searchtext)
        {
            WaitFind.FindElem(FilterTagTextField, 10).Clear();
            Klick.On(FilterTagTextField);
            Thread.Sleep(KortextGlobals.s);
            FilterTagTextField.SendKeys(searchtext);
            Thread.Sleep(KortextGlobals.s);

            List <NgWebElement> TagsSearched = new List <NgWebElement>(Driver.ngDriver.FindElements(NgBy.Repeater("row in adminTags.displayedCollection")));

            if (TagsSearched.Count > 0)
            {
                foreach (IWebElement TagSearched in TagsSearched)
                {
                    IWebElement TagTitle = TagSearched.FindElement(TagTitle_locator);
                    if (TagTitle.Text == searchtext)
                    {
                        try
                        {
                            IWebElement TagFindList = TagSearched.FindElement(TagFindPage_locator);
                        }
                        catch
                        {
                            IWebElement TagDeleteButton = TagSearched.FindElement(TagDelete_locator);
                            Klick.On(TagDeleteButton);
                            statusreturntext = Pages.PearlEditBuffer.StatusMessage();
                            if (statusreturntext != "Tag deleted")
                            {
                                Console.WriteLine("Error while Deleting Tag." + statusreturntext);
                            }
                            else
                            {
                                Console.WriteLine("Deleting Tag Successful");
                            }
                            break;
                        }
                    }
                }
            }
            else
            {
                Console.WriteLine(searchtext + " Tag not found to be deleted");
            }
            Console.WriteLine("Searching Tag after Deleting");
            FilterTags(searchtext);
        }
示例#3
0
        public void FilterTags(string searchtext)
        {
            int i = 0;

            Driver.Instance.Navigate().Refresh();
            Thread.Sleep(KortextGlobals.ll);
            WaitFind.FindElem(FilterTagTextField, 10).Clear();
            Klick.On(FilterTagTextField);
            Thread.Sleep(KortextGlobals.s);
            FilterTagTextField.SendKeys(searchtext);
            Thread.Sleep(KortextGlobals.s);

            List <NgWebElement> TagsSearched = new List <NgWebElement>(Driver.ngDriver.FindElements(NgBy.Repeater("row in adminTags.displayedCollection")));

            if (TagsSearched.Count > 0)
            {
                foreach (IWebElement TagSearched in TagsSearched)
                {
                    IWebElement TagTitle = TagSearched.FindElement(TagTitle_locator);
                    if (TagTitle.Text == searchtext)
                    {
                        Console.WriteLine(searchtext + " Tag found");
                        i = 1;
                        break;
                    }
                }
                if (i == 0)
                {
                    Console.WriteLine(searchtext + " Tag not found");
                }
            }
            else
            {
                Console.WriteLine(searchtext + " Tag not found");
            }
        }
示例#4
0
        private void MaterialsAssociated_function()
        {
            List <NgWebElement> TagsSearched = new List <NgWebElement>(Driver.ngDriver.FindElements(NgBy.Repeater("row in adminTags.displayedCollection")));

            if (TagsSearched.Count > 0)
            {
                foreach (IWebElement TagSearched in TagsSearched)
                {
                    Thread.Sleep(KortextGlobals.s);
                    IList <IWebElement> TagFindPage = new List <IWebElement>(TagSearched.FindElements(TagFindPage_locator));
                    if (TagFindPage.Count > 0)
                    {
                        if (TagFindPage[0].Displayed)
                        {
                            materialsiconfound_flag = 1;
                            IWebElement TagCountMaterials = TagSearched.FindElement(TagListCount_locator);
                            expected_count = TagCountMaterials.Text;
                            Console.WriteLine("TagCountMaterials Text = " + TagCountMaterials.Text);
                            expected_count = expected_count.Replace(" FIND_IN_PAGE", "");
                            Klick.On(TagFindPage[0]);
                            Thread.Sleep(KortextGlobals.s);
                            IWebElement ListsPageSubTitle = Driver.Instance.FindElement(locator);
                            if (ListsPageSubTitle.Text == "search Materials")
                            {
                                IList <IWebElement> SelectPages = Driver.Instance.FindElements(MaterialsSelectPage_locator);
                                if (SelectPages.Count > 0)
                                {
                                    foreach (IWebElement SelectPage in SelectPages)
                                    {
                                        Klick.On(SelectPage);
                                        List <NgWebElement> ListsUsed = new List <NgWebElement>(Driver.ngDriver.FindElements(NgBy.Repeater("row in adminSearch.displayedCollection")));
                                        actual_count = actual_count + ListsUsed.Count;
                                        Thread.Sleep(KortextGlobals.s);
                                    }
                                }
                                else
                                {
                                    List <NgWebElement> ListsUsed = new List <NgWebElement>(Driver.ngDriver.FindElements(NgBy.Repeater("row in adminSearch.displayedCollection")));
                                    actual_count = actual_count + ListsUsed.Count;
                                    Thread.Sleep(KortextGlobals.s);
                                }

                                if (Convert.ToString(actual_count) == expected_count)
                                {
                                    Console.WriteLine("The number of Materials Match in FIND_IN_PAGE. expected_count" + expected_count + ". actual_count " + actual_count);
                                }
                                else
                                {
                                    Console.WriteLine("The number of Materials DO NOT match in FIND_IN_PAGE. expected_count" + expected_count + ". actual_count " + actual_count);
                                }
                                Driver.Instance.Url = currentURL;
                            }
                            else
                            {
                                Console.WriteLine("Landed to an incorrect page." + ListsPageSubTitle.Text);
                                Driver.Instance.Navigate().Back();
                                break;
                            }
                            break;
                        }
                    }
                }
            }
            else
            {
                Console.WriteLine("No Tags present in the system");
            }
        }