Exemple #1
0
        /// <summary>
        /// check the item in the results list by index
        /// </summary>
        /// <param name="index">the item index</param>
        public void SelectItemInResultsListByIndex(int index)
        {
            ItemCentralLineItem itemCentralLineItem = ItemCentralResultsList[index];

            if (itemCentralLineItem != null)
            {
                itemCentralLineItem.CheckOnItem();
            }
            else
            {
                Assert.Fail("Could not find the Index: '" + index + "' within the Item Central Search Results list.");
            }
        }
Exemple #2
0
        /// <summary>
        /// check the item in the results list by ID
        /// </summary>
        /// <param name="itemId">the item ID</param>
        public void SelectItemInResultsListById(int itemId)
        {
            ItemCentralLineItem itemCentralLineItem = null;

            foreach (var item in ItemCentralResultsList)
            {
                if (item.ItemId == itemId)
                {
                    itemCentralLineItem = item;
                }
            }
            if (itemCentralLineItem != null)
            {
                itemCentralLineItem.CheckOnItem();
            }
            else
            {
                Assert.Fail("Could not find the Item ID: '" + itemId + "' within the Item Central Search Results list.");
            }
        }
Exemple #3
0
        /// <summary>
        /// verify the item is NOT in the results list by the ID
        /// </summary>
        /// <param name="itemId">the item ID</param>
        public void VerifyItemIsNotInResultsListById(int itemId)
        {
            Report.Write("Verifying the Item ID: '" + itemId + "' is not in the Item Central Search Results list.");
            ItemCentralLineItem itemCentralLineItem = null;

            foreach (var item in ItemCentralResultsList)
            {
                if (item.ItemId == itemId)
                {
                    itemCentralLineItem = item;
                }
            }
            if (itemCentralLineItem == null)
            {
                Report.Write("Verified the Item ID: '" + itemId + "' is not in the Item Central Search Results list.");
            }
            else
            {
                Assert.Fail("Did not expect to find the Item ID: '" + itemId + "', but the item is in the Item Central Search Results list.");
            }
        }
Exemple #4
0
        /// <summary>
        /// verify the item content in the results list by the ID
        /// </summary>
        /// <param name="itemId">the item ID</param>
        /// <param name="contents">the content</param>
        public void VerifyItemInResultsListById(int itemId, List <string> contents)
        {
            Report.Write("Verifying the expected content is within the actual content.");
            ItemCentralLineItem itemCentralLineItem = null;

            foreach (var item in ItemCentralResultsList)
            {
                if (item.ItemId == itemId)
                {
                    itemCentralLineItem = item;
                }
            }
            if (itemCentralLineItem != null)
            {
                string actual = null;
                if (Driver.WrappedDriver.GetType() == typeof(DummyDriver))
                {
                    actual =
                        "<p>This morning, I went to the <u> 1 - (A) blue  (B) purple  (C) yellow  <b>(D) orange</b>  </u>and bought some milk and eggs. I knew it was going to rain, but I forgot my <u> 2 - (A) blue  <b>(C) purple</b>  </u>and ended up getting <u> 3 - (A) blue  (B) purple  <b>(C) yellow</b>  </u>on the way.</p>";
                }
                else
                {
                    actual = itemCentralLineItem.GetItemContentText();
                }
                foreach (var content in contents)
                {
                    Assert.IsTrue(actual.Contains(content),
                                  "The expected content: '" + content + "' was not found within the actual content: '" + actual +
                                  "'.");
                    Report.Write("Verified the expected content: '" + content +
                                 "' was found within the actual content: '" + actual + "'.");
                }
            }
            else
            {
                Assert.Fail("Could not find the Item ID: '" + itemId + "' within the Item Central Search Results list.");
            }
        }
Exemple #5
0
        private void SetItemCentralResultList()
        {
            ItemCentralResultsList = new List <ItemCentralLineItem>();
            SearchResultsGrid.Wait(3);
            ItemCentralResultsWebElementList = SearchResultsRows.WaitForElements(5);
            if (Driver.WrappedDriver.GetType() == typeof(DummyDriver))
            {
                DummyWebElement dummy1 = new DummyWebElement();
                dummy1.FakeAttributeItemid    = "231270";
                dummy1.FakeAttributePassageid = "35605";
                DummyWebElement dummy2 = new DummyWebElement();
                dummy2.FakeAttributeItemid    = "231271";
                dummy2.FakeAttributePassageid = "35606";
                DummyWebElement dummy3 = new DummyWebElement();
                dummy3.FakeAttributeItemid    = "231272";
                dummy3.FakeAttributePassageid = "35607";
                DummyWebElement dummy4 = new DummyWebElement();
                dummy4.FakeAttributeItemid    = "231273";
                dummy4.FakeAttributePassageid = "35608";
                DummyWebElement dummy5 = new DummyWebElement();
                dummy5.FakeAttributeItemid    = "231274";
                dummy5.FakeAttributePassageid = "35609";
                DummyWebElement dummy6 = new DummyWebElement();
                dummy6.FakeAttributeItemid    = "231275";
                dummy6.FakeAttributePassageid = "35610";
                DummyWebElement dummy7 = new DummyWebElement();
                dummy7.FakeAttributeItemid    = "231276";
                dummy7.FakeAttributePassageid = "35611";
                DummyWebElement dummy8 = new DummyWebElement();
                dummy8.FakeAttributeItemid    = "231277";
                dummy8.FakeAttributePassageid = "35612";
                DummyWebElement dummy9 = new DummyWebElement();
                dummy9.FakeAttributeItemid    = "231278";
                dummy9.FakeAttributePassageid = "35613";
                DummyWebElement dummy10 = new DummyWebElement();
                dummy10.FakeAttributeItemid    = "231279";
                dummy10.FakeAttributePassageid = "35614";

                List <IWebElement> list = new List <IWebElement> {
                    dummy1, dummy2, dummy3, dummy4, dummy5, dummy6, dummy7, dummy8, dummy9, dummy10
                };
                ItemCentralResultsWebElementList = new ReadOnlyCollection <IWebElement>(list);
            }

            int index = 0;

            foreach (var webElement in ItemCentralResultsWebElementList)
            {
                int    itemid    = -1;
                int    passageid = -1;
                string uniqueId  = null;
                switch (ItemCentralType)
                {
                case ItemCentralType.Item:
                    itemid    = int.Parse(webElement.GetAttribute("itemid"));
                    ItemCheck = new WebElementWrapper(ByCheckItemLocator(itemid));
                    //ctl00_MainContent_ItemFinder1_ItemFinderResults1_gridResults_ctl03_chkItem
                    ItemCheck.FakeAttributeId = "ctl00_MainContent_ItemFinder1_" + ControlMiddle + "gridResults_ctl03_chkItem";
                    uniqueId = GetUniqueId(ItemCheck, ByCheckItemLocator(itemid));
                    break;

                case ItemCentralType.Passage:
                    itemid    = int.Parse(webElement.GetAttribute("passageid"));
                    ItemCheck = new WebElementWrapper(ByCheckItemLocator(itemid));
                    //ctl00_MainContent_ItemFinder1_PassageFinderResults1_gridResults_ctl03_chkPassage
                    ItemCheck.FakeAttributeId = "ctl00_MainContent_ItemFinder1_" + ControlMiddle + "gridResults_ctl03_chkItem";
                    uniqueId = GetUniqueId(ItemCheck, ByCheckItemLocator(itemid));
                    break;

                case ItemCentralType.Rubric:
                    By ByAlink = By.CssSelector("a[id*='ButtonDetails']");
                    WebElementWrapper aLinkElement = new WebElementWrapper(ByAlink);
                    if (Driver.GetType() == typeof(DummyDriver))
                    {
                        aLinkElement.FakeAttributeRubricid = "8560";
                        //ctl00_MainContent_RubricFinder1_RubricFinderResults1_gridResults_ctl03_ButtonDetails
                        aLinkElement.FakeAttributeId = "ctl00_MainContent_RubricFinder1_" + ControlMiddle + "gridResults_ctl03_ButtonDetails";
                    }
                    itemid   = int.Parse(aLinkElement.GetAttribute("rubric_id"));
                    uniqueId = GetUniqueId(aLinkElement, SearchResultsRows.By);
                    break;
                }
                Report.Write("ItemCentralLineItem by itemid: '" + itemid + "'; passageid: '{" + passageid + "'; index: '" + index + "'; uniqueId: '" + uniqueId);
                var lineItem = new ItemCentralLineItem(webElement, ItemCentralType, itemid, index, uniqueId);
                ItemCentralResultsList.Add(lineItem);
                index++;
            }
        }