コード例 #1
0
        public void ShouldBeAbleToBuyDeal()
        {
            InitialPage.GoTo();

            var closebutton = Driver.Instance.FindElement(By.ClassName("close"));

            closebutton.Click();

            var firstdeal           = Driver.Instance.FindElement(By.XPath("//img[@data-priority = '1']"));
            IJavaScriptExecutor jse = (IJavaScriptExecutor)Driver.Instance;

            jse.ExecuteScript("arguments[0].click();", firstdeal);

            var buynow = By.XPath("//div[@class='deal-page-container clear-fix']//a[contains(text(), 'Buy Now')]");
            var wait   = new WebDriverWait(Driver.Instance, TimeSpan.FromSeconds(10));

            wait.Until(ExpectedConditions.ElementIsVisible(buynow));
            var buy = Driver.Instance.FindElement(buynow);

            jse.ExecuteScript("arguments[0].click();", buy);

            var newcustomer = By.XPath("//ul//li[text()[contains(.,'New customer')]]");

            wait.Until(ExpectedConditions.ElementIsVisible(newcustomer));
            var actualvalue = GetText(Driver.Instance, newcustomer);

            Assert.AreEqual(actualvalue, "NEW CUSTOMER");
        }
コード例 #2
0
        public void ShouldBeAbleToLogin()
        {
            InitialPage.GoTo();
            var subscribeLocator = By.XPath("//span[contains(@class, 'title') and text() = 'Subscribe to Gogroopie']");

            var wait = new WebDriverWait(Driver.Instance, TimeSpan.FromSeconds(10));

            wait.Until(ExpectedConditions.ElementIsVisible(subscribeLocator));

            Assert.IsTrue(InitialPage.IsAt(), "Failed to load tha page.");
            Assert.IsTrue(InitialPage.IsAtSubscribeToGogroopie(Driver.Instance, subscribeLocator), "Not at subscribe screen.");
        }
コード例 #3
0
        public void ShouldBeAbleToGoToProductsAndAssertDropdown()
        {
            InitialPage.GoTo();

            var Xbutton = Driver.Instance.FindElement(By.ClassName("close"));

            Xbutton.Click();


            var products            = Driver.Instance.FindElement(By.XPath("//a[@href='/products/']"));
            IJavaScriptExecutor jse = (IJavaScriptExecutor)Driver.Instance;

            jse.ExecuteScript("arguments[0].click();", products);

            var dropdown = By.XPath("//*[@class='dropdown-selection-title ng-binding' and contains(text(),'Selected')]");
            var wait     = new WebDriverWait(Driver.Instance, TimeSpan.FromSeconds(10));

            wait.Until(ExpectedConditions.ElementIsVisible(dropdown));
            var actualvalue = GetText(Driver.Instance, dropdown);

            Assert.AreEqual(actualvalue, "Selected");
        }