Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OCC-238: GitHub Actions Tests fails for Windows #434

Merged
merged 11 commits into from
Apr 30, 2024
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.0.1-alpha.7.osoe-840" />
<PackageVersion Include="Lombiq.Tests.UI.AppExtensions" Version="9.0.1-alpha.7.osoe-840" />
<PackageVersion Include="Lombiq.Tests.UI.Shortcuts" Version="9.0.1-alpha.7.osoe-840" />
sarahelsaig marked this conversation as resolved.
Show resolved Hide resolved
<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
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,25 @@
</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>
<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" />
<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>
<Content Include="orchardcore.htmlvalidate.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PackageCopyToOutput>true</PackageCopyToOutput>
</Content>
</ItemGroup>
Piedone marked this conversation as resolved.
Show resolved Hide resolved

</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.");
}
}
Piedone marked this conversation as resolved.
Show resolved Hide resolved

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
Piedone marked this conversation as resolved.
Show resolved Hide resolved

if (changeConfigurationAsync != null) await changeConfigurationAsync(configuration);
});
}
Piedone marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
"wcag/h67": "off",
"wcag/h71": "off",
"form-dup-name": "off"
}
},
"root": true
}
Loading