diff --git a/Directory.Packages.props b/Directory.Packages.props index e9f4705bb..be02d2929 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -9,9 +9,9 @@ - - - + + + diff --git a/test/OrchardCore.Commerce.Tests.UI/.htmlvalidate.json b/test/OrchardCore.Commerce.Tests.UI/.htmlvalidate.json deleted file mode 100644 index 424297cef..000000000 --- a/test/OrchardCore.Commerce.Tests.UI/.htmlvalidate.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "extends": [ - "html-validate:recommended" - ], - - "rules": { - "attribute-boolean-style": "off", - "no-trailing-whitespace": "off", - "no-inline-style": "off", - "wcag/h30": "off", - "wcag/h32": "off", - "wcag/h36": "off", - "wcag/h37": "off", - "wcag/h67": "off", - "wcag/h71": "off", - "form-dup-name": "off" - } -} diff --git a/test/OrchardCore.Commerce.Tests.UI/OrchardCore.Commerce.Tests.UI.csproj b/test/OrchardCore.Commerce.Tests.UI/OrchardCore.Commerce.Tests.UI.csproj index 93f79a12d..be393bd5a 100644 --- a/test/OrchardCore.Commerce.Tests.UI/OrchardCore.Commerce.Tests.UI.csproj +++ b/test/OrchardCore.Commerce.Tests.UI/OrchardCore.Commerce.Tests.UI.csproj @@ -1,31 +1,32 @@ - - Exe - net8.0 - enable - false - + + Exe + net8.0 + enable + false + - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + - - - - + + + + - - - PreserveNewest - - + + + PreserveNewest + true + + diff --git a/test/OrchardCore.Commerce.Tests.UI/UITestBase.cs b/test/OrchardCore.Commerce.Tests.UI/UITestBase.cs index 35cfe6d84..53868e680 100644 --- a/test/OrchardCore.Commerce.Tests.UI/UITestBase.cs +++ b/test/OrchardCore.Commerce.Tests.UI/UITestBase.cs @@ -16,7 +16,26 @@ protected override Task ExecuteTestAfterSetupAsync( Func testAsync, Browser browser, Func changeConfigurationAsync) => - ExecuteTestAsync(testAsync, browser, SetupHelpers.RunSetupAsync, changeConfigurationAsync); + ExecuteTestAfterSetupAsync(testAsync, browser, changeConfigurationAsync, timeout: null); + + protected async Task ExecuteTestAfterSetupAsync( + Func testAsync, + Browser browser, + Func 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 testAsync, @@ -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); }); } diff --git a/test/OrchardCore.Commerce.Tests.UI/orchardcore.htmlvalidate.json b/test/OrchardCore.Commerce.Tests.UI/orchardcore.htmlvalidate.json new file mode 100644 index 000000000..e11bb8c64 --- /dev/null +++ b/test/OrchardCore.Commerce.Tests.UI/orchardcore.htmlvalidate.json @@ -0,0 +1,9 @@ +{ + "extends": [ + "./.htmlvalidate.json" + ], + "rules": { + "form-dup-name": "off" + }, + "root": true +}