Example #1
0
        public void TestElementEnabledCheckWhenStaleElementReferenceReturnsFalse()
        {
            var element = new Mock <IWebElement>(MockBehavior.Strict);

            element.SetupGet(e => e.Displayed).Throws <StaleElementReferenceException>();

            var nativePage = new NativePage();
            var page       = new SeleniumPage(nativePage, null);

            var result = page.ElementEnabledCheck(element.Object);

            Assert.IsFalse(result);
            element.VerifyAll();
        }
Example #2
0
        public void TestElementEnabledCheckWhenElementNotVisibleExceptionReturnsFalse()
        {
            var element = new Mock <IWebElement>(MockBehavior.Strict);

            element.SetupGet(e => e.Displayed).Throws <ElementNotVisibleException>();

            var nativePage = new NativePage();
            var page       = new SeleniumPage(nativePage, null);

            var result = page.ElementEnabledCheck(element.Object);

            Assert.AreEqual(false, result);
            element.VerifyAll();
        }
        public void TestElementEnabledCheckWhenNotDisplayedReturnsFalse()
        {
            var element = new Mock <IWebElement>(MockBehavior.Strict);

            element.SetupGet(e => e.Displayed).Returns(false);

            var nativePage = new NativePage();
            var page       = new SeleniumPage(nativePage);

            var result = page.ElementEnabledCheck(element.Object);

            Assert.AreEqual(false, result);
            element.VerifyAll();
        }
Example #4
0
        public void TestElementEnabledCheckWhenStaleElementReferenceReturnsFalse()
        {
            var element = new Mock<IWebElement>(MockBehavior.Strict);
            element.SetupGet(e => e.Displayed).Throws<StaleElementReferenceException>();

            var nativePage = new NativePage();
            var page = new SeleniumPage(nativePage);

            var result = page.ElementEnabledCheck(element.Object);

            Assert.IsFalse(result);
            element.VerifyAll();
        }
Example #5
0
        public void TestElementEnabledCheckWhenElementNotVisibleExceptionReturnsFalse()
        {
            var element = new Mock<IWebElement>(MockBehavior.Strict);
            element.SetupGet(e => e.Displayed).Throws<ElementNotVisibleException>();

            var nativePage = new NativePage();
            var page = new SeleniumPage(nativePage);

            var result = page.ElementEnabledCheck(element.Object);

            Assert.AreEqual(false, result);
            element.VerifyAll();
        }
Example #6
0
        public void TestElementEnabledCheckWhenDisplayedAndEnabledReturnsTrue()
        {
            var element = new Mock<IWebElement>(MockBehavior.Strict);
            element.SetupGet(e => e.Displayed).Returns(true);
            element.SetupGet(e => e.Enabled).Returns(true);

            var nativePage = new NativePage();
            var page = new SeleniumPage(nativePage);

            var result = page.ElementEnabledCheck(element.Object);

            Assert.AreEqual(true, result);
            element.VerifyAll();
        }