Skip to content

Commit

Permalink
OCC-238: GitHub Actions Tests fails for Windows (#434)
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahelsaig authored Apr 30, 2024
1 parent 4c2a29b commit 5527e81
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 46 deletions.
6 changes: 3 additions & 3 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
<PackageVersion Include="Lombiq.HelpfulLibraries.Refit" Version="9.1.1-alpha.6.occ-203" />
<PackageVersion Include="Lombiq.NodeJs.Extensions" Version="2.1.0" />
<PackageVersion Include="Lombiq.Tests" Version="3.0.0" />
<PackageVersion Include="Lombiq.Tests.UI" Version="9.0.1-alpha.2.occ-218" />
<PackageVersion Include="Lombiq.Tests.UI.AppExtensions" Version="9.0.1-alpha.2.occ-218" />
<PackageVersion Include="Lombiq.Tests.UI.Shortcuts" Version="9.0.1-alpha.2.occ-218" />
<PackageVersion Include="Lombiq.Tests.UI" Version="9.1.0" />
<PackageVersion Include="Lombiq.Tests.UI.AppExtensions" Version="9.1.0" />
<PackageVersion Include="Lombiq.Tests.UI.Shortcuts" Version="9.1.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="OrchardCore.Application.Cms.Targets" Version="1.8.2" />
Expand Down
18 changes: 0 additions & 18 deletions test/OrchardCore.Commerce.Tests.UI/.htmlvalidate.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<IsPackable>false</IsPackable>
</PropertyGroup>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Lombiq.Tests.UI" />
<PackageReference Include="Lombiq.Tests.UI.AppExtensions" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="xunit.runner.visualstudio">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Lombiq.Tests.UI"/>
<PackageReference Include="Lombiq.Tests.UI.AppExtensions"/>
<PackageReference Include="Microsoft.NET.Test.Sdk"/>
<PackageReference Include="xunit.runner.visualstudio">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\OrchardCore.Commerce.Web\OrchardCore.Commerce.Web.csproj" />
<ProjectReference Include="..\OrchardCore.Commerce.Tests.UI.Shortcuts\OrchardCore.Commerce.Tests.UI.Shortcuts.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\OrchardCore.Commerce.Web\OrchardCore.Commerce.Web.csproj"/>
<ProjectReference Include="..\OrchardCore.Commerce.Tests.UI.Shortcuts\OrchardCore.Commerce.Tests.UI.Shortcuts.csproj"/>
</ItemGroup>

<ItemGroup>
<None Update=".htmlvalidate.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Content Include="orchardcore.htmlvalidate.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PackageCopyToOutput>true</PackageCopyToOutput>
</Content>
</ItemGroup>

</Project>
26 changes: 25 additions & 1 deletion test/OrchardCore.Commerce.Tests.UI/UITestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,26 @@ protected override Task ExecuteTestAfterSetupAsync(
Func<UITestContext, Task> testAsync,
Browser browser,
Func<OrchardCoreUITestExecutorConfiguration, Task> changeConfigurationAsync) =>
ExecuteTestAsync(testAsync, browser, SetupHelpers.RunSetupAsync, changeConfigurationAsync);
ExecuteTestAfterSetupAsync(testAsync, browser, changeConfigurationAsync, timeout: null);

protected async Task ExecuteTestAfterSetupAsync(
Func<UITestContext, Task> testAsync,
Browser browser,
Func<OrchardCoreUITestExecutorConfiguration, Task> changeConfigurationAsync,
TimeSpan? timeout)
{
var timeoutValue = timeout ?? TimeSpan.FromMinutes(10);

var testTask = ExecuteTestAsync(testAsync, browser, SetupHelpers.RunSetupAsync, changeConfigurationAsync);
var timeoutTask = Task.Delay(timeoutValue);

await Task.WhenAny(testTask, timeoutTask);

if (!testTask.IsCompleted)
{
throw new TimeoutException($"The time allotted for the test ({timeoutValue}) was exceeded.");
}
}

protected override Task ExecuteTestAsync(
Func<UITestContext, Task> testAsync,
Expand Down Expand Up @@ -45,6 +64,11 @@ protected override Task ExecuteTestAsync(
OrchardCoreUITestExecutorConfiguration.AssertBrowserLogIsEmpty(messageWithoutJqueryError);
};
configuration.HtmlValidationConfiguration.HtmlValidationOptions =
configuration.HtmlValidationConfiguration.HtmlValidationOptions
.CloneWith(validationOptions => validationOptions.ConfigPath =
Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "orchardcore.htmlvalidate.json")); // #spell-check-ignore-line
if (changeConfigurationAsync != null) await changeConfigurationAsync(configuration);
});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": [
"./.htmlvalidate.json"
],
"rules": {
"form-dup-name": "off"
},
"root": true
}

0 comments on commit 5527e81

Please sign in to comment.