Skip to content

Commit

Permalink
Merge pull request #313 from Lombiq/issue/OSOE-683
Browse files Browse the repository at this point in the history
OSOE-683: Update all NuGet dependencies
  • Loading branch information
sarahelsaig authored Sep 23, 2023
2 parents fdc5079 + c883246 commit bca0879
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 21 deletions.
4 changes: 2 additions & 2 deletions Lombiq.Tests.UI.Samples/Lombiq.Tests.UI.Samples.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ public static async Task UsingScopeAsync(
// Creating a fake HttpContext like in ModularBackgroundService.
httpContextAccessor.HttpContext = shellScope.ShellContext.CreateHttpContext();
var httpContext = httpContextAccessor.HttpContext;

httpContext.Request.PathBase = "/" + shellHost.GetSettings(tenant).RequestUrlPrefix ?? string.Empty;
httpContext.Request.PathBase = "/" + shellHost.GetSettings(tenant).RequestUrlPrefix;
httpContext.Features.Set(new RecipeEnvironmentFeature());

await shellScope.UsingAsync(execute, activateShell);
Expand Down
14 changes: 7 additions & 7 deletions Lombiq.Tests.UI/Lombiq.Tests.UI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Atata" Version="2.8.1" />
<PackageReference Include="Atata" Version="2.9.0" />
<PackageReference Include="Atata.Bootstrap" Version="2.1.0" />
<PackageReference Include="Atata.HtmlValidation" Version="2.3.0" />
<PackageReference Include="Atata.HtmlValidation" Version="2.4.0" />
<PackageReference Include="Atata.WebDriverExtras" Version="2.2.0" />
<PackageReference Include="Atata.WebDriverSetup" Version="2.7.0" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.16.0" />
<PackageReference Include="Atata.WebDriverSetup" Version="2.8.0" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.18.0" />
<PackageReference Include="Ben.Demystifier" Version="0.4.1" />
<PackageReference Include="Codeuctivity.ImageSharpCompare" Version="3.0.156" />
<PackageReference Include="Codeuctivity.ImageSharpCompare" Version="3.0.183" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
<PackageReference Include="Microsoft.SqlServer.DACFx" Version="162.0.52" />
Expand All @@ -68,12 +68,12 @@
<PackageReference Include="OrchardCore.Logging.NLog" Version="1.7.0" />
<PackageReference Include="OrchardCore.Abstractions" Version="1.7.0" />
<PackageReference Include="OrchardCore.Recipes.Core" Version="1.7.0" />
<PackageReference Include="Refit.HttpClientFactory" Version="6.3.2" />
<PackageReference Include="Refit.HttpClientFactory" Version="7.0.0" />
<PackageReference Include="Selenium.Axe" Version="4.0.13" />
<PackageReference Include="Shouldly" Version="4.2.1" />
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
<PackageReference Include="WebDriverManager" Version="2.16.2" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit" Version="2.5.0" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions Lombiq.Tests.UI/Models/SafeWaitAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ public async Task<TResult> UntilAsync<TResult>(Func<T, Task<TResult>> condition)

protected virtual bool DoesConditionResultSatisfy<TResult>(TResult result)
{
if (typeof(TResult) == typeof(bool))
if (result is bool resultBool)
{
if (result is true) return true;
if (resultBool) return true;
}
else if (!Equals(result, default(TResult)) &&
(result is not IEnumerable enumerable || enumerable.Cast<object>().Any()))
Expand Down
3 changes: 3 additions & 0 deletions Lombiq.Tests.UI/OrchardCoreUITestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,10 @@ protected virtual async Task ExecuteTestAsync(
finally
{
_testOutputHelper = originalTestOutputHelper;
// This warning is a false positive as it is not considering the evaluation of the if statement above.
#pragma warning disable S2583 // Conditionally executed code should be reachable
afterTest?.Invoke();
#pragma warning restore S2583 // Conditionally executed code should be reachable
}
}
}
11 changes: 4 additions & 7 deletions Lombiq.Tests.UI/Services/AtataFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@ public static async Task<AtataScope> StartAtataScopeAsync(
var browserConfiguration = configuration.BrowserConfiguration;

var builder = AtataContext.Configure()
// The drivers are disposed when disposing AtataScope.
#pragma warning disable CA2000 // Dispose objects before losing scope
.UseDriver(await CreateDriverAsync(browserConfiguration, timeoutConfiguration, testOutputHelper))
#pragma warning restore CA2000 // Dispose objects before losing scope
.UseBaseUrl(baseUri.ToString())
.UseCulture(browserConfiguration.AcceptLanguage.ToString())
.UseTestName(configuration.AtataConfiguration.TestName)
Expand Down Expand Up @@ -92,14 +89,14 @@ Task<T> FromAsync<T>(Func<BrowserConfiguration, TimeSpan, Task<T>> factory)
}
catch (WebDriverException ex)
{
if (!ex.Message.ContainsOrdinalIgnoreCase("Cannot start the driver service on") || currentTry >= maxTryCount)
currentTry++;
var retryCount = maxTryCount - currentTry;

if (!ex.Message.ContainsOrdinalIgnoreCase("Cannot start the driver service on") || retryCount <= 0)
{
throw;
}

currentTry++;
var retryCount = maxTryCount - currentTry;

// Not using parameters because the exception can throw off the string format.
testOutputHelper.WriteLineTimestampedAndDebug(
"While creating the web driver failed with the following exception, it'll be retried " +
Expand Down
2 changes: 1 addition & 1 deletion Lombiq.Tests.UI/Services/UITestExecutionSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ private Exception PrepareAndLogException(Exception ex)
else if (_context?.Driver is not null)
{
_testOutputHelper.WriteLineTimestampedAndDebug(
$"An exception has occurred while interacting with the page {_context?.GetPageTitleAndAddress()}.");
$"An exception has occurred while interacting with the page {_context.GetPageTitleAndAddress()}.");
}

_testOutputHelper.WriteLineTimestampedAndDebug($"The test failed with the following exception: {ex}");
Expand Down

0 comments on commit bca0879

Please sign in to comment.