public void ShouldThrowExceptionWhenSearchContextDoesNotWrapDriver(string rawSelector) { var element = new SearchContextBuilder().AsWebElement().Build(); var sut = By.JQuerySelector(rawSelector); ((Action)(() => sut.FindElement(element))).Should().Throw <InvalidCastException>(); }
public void ShouldCreateJQuerySelector(string rawSelector) { var sut = By.JQuerySelector(rawSelector); sut.Should().NotBeNull(); sut.RawSelector.Should().Be(rawSelector); }
public void ShouldThrowExceptionWhenElementIsNotFoundWithJQuerySelector(string rawSelector) { var driver = new WebDriverBuilder().WithJQueryLoaded().WithNoElementLocatedByJQuery(rawSelector) .Build(); var sut = By.JQuerySelector(rawSelector); ((Action)(() => sut.FindElement(driver))).Should().Throw <NoSuchElementException>(); }
public void ShouldCreateJQuerySelectorWithJQueryVariable(string rawSelector, string variable) { var sut = By.JQuerySelector(rawSelector, variable: variable); sut.Should().NotBeNull(); sut.RawSelector.Should().Be(rawSelector); sut.Variable.Should().Be(variable); }
public void ShouldCreateJQuerySelectorWithContext(string contextRawSelector, string rawSelector) { var sut = By.JQuerySelector(rawSelector, By.JQuerySelector(contextRawSelector)); sut.Should().NotBeNull(); sut.RawSelector.Should().Be(rawSelector); sut.Context.RawSelector.Should().Be(contextRawSelector); }
public void ShouldReturnEmptyResultWhenNoElementsAreFoundWithJQuerySelector(string rawSelector) { var driver = new WebDriverBuilder().WithJQueryLoaded().WithNoElementLocatedByJQuery(rawSelector) .Build(); var selector = By.JQuerySelector(rawSelector); var sut = selector.FindElements(driver); sut.Should().NotBeNull().And.HaveCount(0); }
public void ShouldFindElementsByJQuerySelector(string rawSelector) { var driver = new WebDriverBuilder().WithJQueryLoaded().WithElementsLocatedByJQuery(rawSelector) .Build(); var selector = By.JQuerySelector(rawSelector); var sut = selector.FindElements(driver); sut.Should().NotBeNull().And.HaveCount(2); }
public void ShouldThrowExceptionWhenSearchContextIsNotWebElement(string rawSelector) { var driver = new WebDriverBuilder().WithJQueryLoaded().WithElementLocatedByJQuery(rawSelector) .WithElementLocatedByJQuery($"body > {rawSelector}").WithPathToElement(rawSelector) .Build(); var element = new SearchContextBuilder().WithWrappedDriver(driver).Build(); var sut = By.JQuerySelector(rawSelector); ((Action)(() => sut.FindElement(element))).Should().Throw <NotSupportedException>(); }
public void ShouldFindElementWithNestedJQuerySelector(string rawSelector) { var driver = new WebDriverBuilder().WithJQueryLoaded().WithElementLocatedByJQuery(rawSelector) .WithElementLocatedByJQuery($"body > {rawSelector}").WithPathToElement(rawSelector) .Build(); var element = new SearchContextBuilder().AsWebElement().WithWrappedDriver(driver).Build(); var selector = By.JQuerySelector(rawSelector); var sut = selector.FindElement(element); sut.Should().NotBeNull(); }
public void ShouldThrowExceptionWhenCreatingJQuerySelectorWithWhiteSpaceOnlyVariableValue(string rawSelector) => ((Action)(() => By.JQuerySelector(rawSelector, variable: " "))).Should().Throw <ArgumentException>() .And.ParamName.Should().Be("variable");
public void ShouldThrowExceptionWhenCreatingJQuerySelectorWithWhiteSpaceOnlyValue() => ((Action)(() => By.JQuerySelector(" "))).Should().Throw <ArgumentException>().And.ParamName.Should().Be("selector");
public void ShouldThrowExceptionWhenCreatingJQuerySelectorWithNullValue() => ((Action)(() => By.JQuerySelector(null))).Should().Throw <ArgumentNullException>() .And.ParamName.Should().Be("selector");