public void TestGetElementTextWhenControlIsNotSpecialReturnsTheElementText() { var element = new Mock <IWebElement>(MockBehavior.Strict); element.SetupGet(e => e.TagName).Returns("DIV"); element.SetupGet(e => e.Text).Returns("Normal Text"); var nativePage = new NativePage(); var page = new SeleniumPage(nativePage, null); var result = page.GetElementText(element.Object); Assert.AreEqual("Normal Text", result); element.VerifyAll(); }
public void TestGetElementTextWhenControlIsCheckBoxInputControl() { var element = new Mock <IWebElement>(MockBehavior.Strict); element.SetupGet(e => e.TagName).Returns("input "); element.Setup(e => e.GetAttribute("type")).Returns("checkBox"); element.SetupGet(e => e.Selected).Returns(true); var nativePage = new NativePage(); var page = new SeleniumPage(nativePage, null); var result = page.GetElementText(element.Object); Assert.AreEqual("True", result); element.VerifyAll(); }
public void TestGetElementTextWhenControlIsTextAreaControl() { var element = new Mock <IWebElement>(MockBehavior.Strict); element.SetupGet(e => e.TagName).Returns("textarea"); element.Setup(e => e.GetAttribute("type")).Returns("textarea"); element.Setup(e => e.GetAttribute("value")).Returns("Input Text Area"); var nativePage = new NativePage(); var page = new SeleniumPage(nativePage, null); var result = page.GetElementText(element.Object); Assert.AreEqual("Input Text Area", result); element.VerifyAll(); }
public void TestGetElementTextWhenControlASelectControlReturnsTheSelectedItemText() { var option = new Mock <IWebElement>(MockBehavior.Strict); option.SetupGet(o => o.Selected).Returns(true); option.SetupGet(o => o.Text).Returns("Selected Item"); var element = new Mock <IWebElement>(MockBehavior.Strict); element.SetupGet(e => e.TagName).Returns("select"); element.Setup(e => e.GetAttribute("multiple")).Returns("false"); element.Setup(e => e.FindElements(By.TagName("option"))) .Returns(new ReadOnlyCollection <IWebElement>(new[] { option.Object })); var nativePage = new NativePage(); var page = new SeleniumPage(nativePage, null); var result = page.GetElementText(element.Object); Assert.AreEqual("Selected Item", result); element.VerifyAll(); }
public void TestGetElementTextWhenControlIsCheckBoxInputControl() { var element = new Mock<IWebElement>(MockBehavior.Strict); element.SetupGet(e => e.TagName).Returns("input "); element.Setup(e => e.GetAttribute("type")).Returns("checkBox"); element.SetupGet(e => e.Selected).Returns(true); var nativePage = new NativePage(); var page = new SeleniumPage(nativePage); var result = page.GetElementText(element.Object); Assert.AreEqual("True", result); element.VerifyAll(); }
public void TestGetElementTextWhenControlIsTextAreaControl() { var element = new Mock<IWebElement>(MockBehavior.Strict); element.SetupGet(e => e.TagName).Returns("textarea"); element.Setup(e => e.GetAttribute("type")).Returns("textarea"); element.Setup(e => e.GetAttribute("value")).Returns("Input Text Area"); var nativePage = new NativePage(); var page = new SeleniumPage(nativePage); var result = page.GetElementText(element.Object); Assert.AreEqual("Input Text Area", result); element.VerifyAll(); }
public void TestGetElementTextWhenControlASelectControlReturnsTheSelectedItemText() { var option = new Mock<IWebElement>(MockBehavior.Strict); option.SetupGet(o => o.Selected).Returns(true); option.SetupGet(o => o.Text).Returns("Selected Item"); var element = new Mock<IWebElement>(MockBehavior.Strict); element.SetupGet(e => e.TagName).Returns("select"); element.Setup(e => e.GetAttribute("multiple")).Returns("false"); element.Setup(e => e.FindElements(By.TagName("option"))) .Returns(new ReadOnlyCollection<IWebElement>(new[] { option.Object })); var nativePage = new NativePage(); var page = new SeleniumPage(nativePage); var result = page.GetElementText(element.Object); Assert.AreEqual("Selected Item", result); element.VerifyAll(); }
public void TestGetElementTextWhenControlIsNotSpecialReturnsTheElementText() { var element = new Mock<IWebElement>(MockBehavior.Strict); element.SetupGet(e => e.TagName).Returns("DIV"); element.SetupGet(e => e.Text).Returns("Normal Text"); var nativePage = new NativePage(); var page = new SeleniumPage(nativePage); var result = page.GetElementText(element.Object); Assert.AreEqual("Normal Text", result); element.VerifyAll(); }