예제 #1
0
 public IdeasArea(MonthPage page, bool needInit) : base(page, HeaderStr, needInit)
 {
 }
예제 #2
0
 public DesiresArea(MonthPage page, bool withInitialization) : base(page, HeaderStr, withInitialization)
 {
 }
예제 #3
0
 public PurchasesArea(MonthPage page, bool needInit) : base(page, HeaderStr, needInit)
 {
 }
예제 #4
0
        public void VerifyMonthPageContents()
        {
            WebDriverWait wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(10));

            // Verify that we are actually on the home page
            HomePage homePage = new HomePage(_driver);

            Assert.IsTrue(homePage.VerifyHomePageIsDisplayed());

            // Create a list of the months links
            List <IWebElement> monthList = _driver.FindElements(By.XPath("//*[@id='header_nav']/nav/ul/li/a")).ToList();

            // Create a string list to avoid stale element exception
            List <string> monthLinks = new List <string>();

            foreach (var month in monthList)
            {
                monthLinks.Add(month.Text);
            }

            // Counter
            int counter = 0;

            // Create a button we can click
            IWebElement monthToClick;

            // Iterate through the months
            while (counter < monthList.Count)
            {
                // Find and click on desired month
                monthToClick = _driver.FindElement(By.LinkText(monthLinks[counter]));
                monthToClick.Click();

                // Create a new instance of the Month Page
                MonthPage monthPage = new MonthPage(_driver);

                // The below 'waits' allow the test to execute successfully
                // on Firefox as well as the other browsers.  I can also avoid Thread.Sleeps this way
                wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("/html/body/div[4]/h2")));
                wait.Until(ExpectedConditions.ElementIsVisible(By.Id("shoe_list")));

                // ***********************************************************************
                // ***AC1: Month should display a small Blurb of each shoe
                // ***********************************************************************
                // ***********************************************************************
                // ***What is considered a 'small Blurb'?
                // ***For this test I will use the description as the blurb
                // ***********************************************************************

                // Verify that the month page contains shoes
                Assert.IsTrue(monthPage.lstShoeContainers.Count > 0, $"The {monthLinks[counter]} page does not contain any shoes!");

                // Verify that the month page contains a small blurb for each shoe
                Assert.IsTrue(monthPage.VerifyMonthPageContainsShoesWithBlurbs(), $"The {monthLinks[counter]} page does not contain a blurb for each shoe!");

                // Verify that each shoe has an image associated with it
                Assert.IsTrue(monthPage.VerifyEachShoeContainsAnImage(), $"At least one shoe on the {monthLinks[counter]} page does not have an image showing!");

                // Verify that each shoe has a price associated with it
                Assert.IsTrue(monthPage.VerifyEachShoeHasAPrice(), $"At least one price on the {monthLinks[counter]} page field is blank!");

                // Increase the counter
                counter++;
            }
        }