public void ShouldWaitForElementToBecomeVisible() { var elStatusPage = Browser.Open <ElementStatusPage>(); var disablingElement = WebElement.Create(null, ElementLocator.Create(By.Id, "willBeDisplayed")); using (var benchmark = new BenchmarkScope("Time Until Display")) { Wait.NoMoreThan(TimeSpan.FromSeconds(3)).Until(() => disablingElement.IsDisplayed); benchmark.Elapsed.Should().BeCloseTo(TimeSpan.FromSeconds(2), 300); } }
public void Issue_11_ShouldNoBlockForLongerThanSpecifiedWhenCallingWaitForNoMoreThan() { var gatewayPage = Browser.Open<Test000GatewayPage>(); var nonExistingElement = WebElement.Create(null, ElementLocator.Create(SpecDrill.SecondaryPorts.AutomationFramework.By.CssSelector, ".abc-xyz")); using (var wait = Browser.ImplicitTimeout(TimeSpan.FromSeconds(3))) using (var benchmark = new BenchmarkScope("timing Wait.NoMoreThan(...)")) { var twoSeconds = TimeSpan.FromSeconds(1); Wait.NoMoreThan(twoSeconds).Until(() => nonExistingElement.IsAvailable, throwException: false); benchmark.Elapsed.Should().BeCloseTo(twoSeconds, 300); } }
private async Task <IReadOnlyCollection <MatchedTerm> > SearchCoreAsync(string query) { using (var benchmarkScope = new BenchmarkScope(_logger, $"Trace ID: {HttpContext.TraceIdentifier} | searching text")) { _logger.LogInformation($"Trace ID: {HttpContext.TraceIdentifier} | Query: {query}"); var matchedTerms = await _searchProvider.SearchAsync(query); _logger.LogInformation($"Trace ID: {HttpContext.TraceIdentifier} | Count of matched terms: {matchedTerms.Count}"); return(matchedTerms); } }
public void Issue_11_ShouldNoBlockForLongerThanSpecifiedWhenCallingWaitForNoMoreThan() { var gatewayPage = Browser.Open <Test000GatewayPage>(); var nonExistingElement = WebElement.Create(null, ElementLocator.Create(SpecDrill.SecondaryPorts.AutomationFramework.By.CssSelector, ".abc-xyz")); using (var wait = Browser.ImplicitTimeout(TimeSpan.FromSeconds(3))) using (var benchmark = new BenchmarkScope("timing Wait.NoMoreThan(...)")) { var timeLimit = TimeSpan.FromSeconds(1); Action waitForNonExistingElement = () => Wait.NoMoreThan(timeLimit).Until(() => nonExistingElement.IsAvailable); waitForNonExistingElement.Should().Throw <TimeoutException>(); benchmark.Elapsed.Should().BeCloseTo(timeLimit, 300); } }