Skip to content

Commit

Permalink
Merge pull request #699 from Lombiq/issue/OSOE-771
Browse files Browse the repository at this point in the history
OSOE-771: Create full UI test suite in Lombiq.Walkthroughs
  • Loading branch information
DemeSzabolcs authored Feb 13, 2024
2 parents 27f1dfc + aa65673 commit ffc0cea
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 24 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/build-and-test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ jobs:
uses: Lombiq/GitHub-Actions/.github/workflows/build-and-test-orchard-core.yml@dev
with:
parent-job-name: "root-solution-larger-runners"
# Should be windows-2022-8core but temporarily isn't due to this bug: https://github.com/Lombiq/GitHub-Actions/issues/320.
# Once this is reverted, timeout-minutes below should also be reverted to 30 and dotnet-test-process-timeout to 360000.
# Should be windows-2022-8core but temporarily isn't due to this bug:
# https://github.com/Lombiq/GitHub-Actions/issues/320. Once this is reverted, timeout-minutes below should also be
# reverted to 30 and dotnet-test-process-timeout to 540000.
machine-types: "['windows-2022']"
timeout-minutes: 60
set-up-sql-server: "true"
Expand Down Expand Up @@ -76,8 +77,8 @@ jobs:
parent-job-name: "nuget-solution"
machine-types: "['windows-2022']"
build-directory: NuGetTest
timeout-minutes: 25
dotnet-test-process-timeout: 360000
timeout-minutes: 30
dotnet-test-process-timeout: 420000
# Running ZAP for security scans in Docker under GHA Windows runners won't work since such virtualization is not
# supported by GHA.
test-filter: "FullyQualifiedName!~SecurityScanningTests"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ jobs:
with:
parent-job-name: "root-solution-larger-runners"
machine-types: "['buildjet-4vcpu-ubuntu-2204']"
timeout-minutes: 20
timeout-minutes: 30
set-up-sql-server: "true"
set-up-azurite: "true"
ui-test-parallelism: 0
build-create-binary-log: "true"
dotnet-test-process-timeout: 360000
dotnet-test-process-timeout: 540000
build-enable-nuget-caching: "true"
build-enable-npm-caching: "true"

Expand All @@ -43,8 +43,8 @@ jobs:
with:
parent-job-name: nuget-solution
build-directory: NuGetTest
timeout-minutes: 15
dotnet-test-process-timeout: 360000
timeout-minutes: 20
dotnet-test-process-timeout: 420000

spelling:
name: Spelling
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@
<PackageReference Include="Lombiq.Privacy" Version="7.0.2-alpha.2.osoe-638" />
<PackageReference Include="Lombiq.Privacy.Samples" Version="7.0.2-alpha.2.osoe-638" />
<PackageReference Include="Lombiq.SetupExtensions" Version="5.0.0" />
<PackageReference Include="Lombiq.Tests.UI.AppExtensions" Version="8.2.1-alpha.14.osoe-767" />
<PackageReference Include="Lombiq.Tests.UI.Shortcuts" Version="8.2.1-alpha.14.osoe-767" />
<PackageReference Include="Lombiq.Tests.UI.AppExtensions" Version="8.2.1-alpha.16.osoe-771" />
<PackageReference Include="Lombiq.Tests.UI.Shortcuts" Version="8.2.1-alpha.16.osoe-771" />
<PackageReference Include="Lombiq.UIKit" Version="6.0.1-alpha.0.osoe-638" />
<PackageReference Include="Lombiq.VueJs" Version="3.0.1-alpha.0.osoe-638" />
<PackageReference Include="Lombiq.VueJs.Samples" Version="3.0.1-alpha.0.osoe-638" />
<PackageReference Include="Lombiq.Walkthroughs" Version="1.0.0-alpha.2.nest-522" />
<PackageReference Include="Lombiq.Walkthroughs" Version="1.0.0-alpha.4.osoe-771" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="1.2.2" Condition="'$(RazorRuntimeCompilation)' == 'true'" />
<PackageReference Include="SixLabors.ImageSharp.Web" Version="3.0.1" />
</ItemGroup>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
<PackageReference Include="Lombiq.OrchardCoreApiClient.Tests.UI" Version="4.0.1-alpha.0.osoe-638" />
<PackageReference Include="Lombiq.Privacy.Tests.UI" Version="7.0.2-alpha.2.osoe-638" />
<PackageReference Include="Lombiq.HelpfulExtensions.Tests.UI" Version="7.0.2-alpha.2.osoe-683" />
<PackageReference Include="Lombiq.Tests.UI" Version="8.2.1-alpha.14.osoe-767" />
<PackageReference Include="Lombiq.Tests.UI" Version="8.2.1-alpha.16.osoe-771" />
<PackageReference Include="Lombiq.VueJs.Tests.UI" Version="3.0.1-alpha.0.osoe-638" />
<PackageReference Include="Lombiq.Walkthroughs.Tests.UI" Version="1.0.0-alpha.2.nest-522" />
<PackageReference Include="Lombiq.Walkthroughs.Tests.UI" Version="1.0.0-alpha.4.osoe-771" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
using Lombiq.Tests.UI.Extensions;
using Lombiq.Tests.UI.Services;
using Lombiq.Walkthroughs.Tests.UI.Extensions;
using OpenQA.Selenium;
using Shouldly;
using System;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Xunit;
using Xunit.Abstractions;
Expand All @@ -18,9 +23,26 @@ public BehaviorWalkthroughsTests(ITestOutputHelper testOutputHelper)
public Task WalkthroughsShouldWorkCorrectly() =>
ExecuteTestAsync(
context => context.RunSetupAndTestWalkthroughsBehaviorAsync(),
// Could be removed if https://github.com/shepherd-pro/shepherd/issues/2555 is fixed.
changeConfiguration: configuration => configuration.HtmlValidationConfiguration.HtmlValidationOptions =
configuration.HtmlValidationConfiguration.HtmlValidationOptions
.CloneWith(validationOptions => validationOptions.ConfigPath =
Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "BehaviorWalkthroughsTests.htmlvalidate.json")));
changeConfiguration: configuration =>
{
// Could be removed if https://github.com/shepherd-pro/shepherd/issues/2555 is fixed.
configuration.HtmlValidationConfiguration.HtmlValidationOptions =
configuration.HtmlValidationConfiguration.HtmlValidationOptions
.CloneWith(validationOptions => validationOptions.ConfigPath =
Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "BehaviorWalkthroughsTests.htmlvalidate.json"));

// Once the linked issues are fixed, the custom browser log assertion can be removed completely.
configuration.AssertBrowserLog = logEntries => logEntries.ShouldNotContain(
logEntry => IsValidLogEntry(logEntry),
logEntries.Where(IsValidLogEntry).ToFormattedString());
});

private static bool IsValidLogEntry(LogEntry logEntry) =>
OrchardCoreUITestExecutorConfiguration.IsValidBrowserLogEntry(logEntry) &&
// See https://github.com/OrchardCMS/OrchardCore/issues/15301.
!(logEntry.Message.ContainsOrdinalIgnoreCase("/OrchardCore.Resources/Scripts/jquery.js?v=") &&
logEntry.Message.ContainsOrdinalIgnoreCase("3128:6 Uncaught")) &&
// See https://github.com/OrchardCMS/OrchardCore/issues/14598. This error has multiple variations, so targeting
// the lowest common denominator with the file name.
!logEntry.Message.ContainsOrdinalIgnoreCase("/monaco/IStandaloneEditorConstructionOptions.json");
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
using Lombiq.Tests.UI.Extensions;
using Lombiq.Tests.UI.Services;
using Lombiq.Walkthroughs.Tests.UI.Extensions;
using OpenQA.Selenium;
using Shouldly;
using System;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Xunit;
using Xunit.Abstractions;
Expand All @@ -19,8 +24,26 @@ public Task WalkthroughsShouldWorkCorrectly() =>
ExecuteTestAsync(
context => context.RunSetupAndTestWalkthroughsBehaviorAsync(),
// Could be removed if https://github.com/shepherd-pro/shepherd/issues/2555 is fixed.
changeConfiguration: configuration => configuration.HtmlValidationConfiguration.HtmlValidationOptions =
configuration.HtmlValidationConfiguration.HtmlValidationOptions
.CloneWith(validationOptions => validationOptions.ConfigPath =
Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "BehaviorWalkthroughsTests.htmlvalidate.json")));
changeConfiguration: configuration =>
{
// Could be removed if https://github.com/shepherd-pro/shepherd/issues/2555 is fixed.
configuration.HtmlValidationConfiguration.HtmlValidationOptions =
configuration.HtmlValidationConfiguration.HtmlValidationOptions
.CloneWith(validationOptions => validationOptions.ConfigPath =
Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "BehaviorWalkthroughsTests.htmlvalidate.json"));

// Once the linked issues are fixed, the custom browser log assertion can be removed completely.
configuration.AssertBrowserLog = logEntries => logEntries.ShouldNotContain(
logEntry => IsValidLogEntry(logEntry),
logEntries.Where(IsValidLogEntry).ToFormattedString());
});

private static bool IsValidLogEntry(LogEntry logEntry) =>
OrchardCoreUITestExecutorConfiguration.IsValidBrowserLogEntry(logEntry) &&
// See https://github.com/OrchardCMS/OrchardCore/issues/15301.
!(logEntry.Message.ContainsOrdinalIgnoreCase("/OrchardCore.Resources/Scripts/jquery.js?v=") &&
logEntry.Message.ContainsOrdinalIgnoreCase("3128:6 Uncaught")) &&
// See https://github.com/OrchardCMS/OrchardCore/issues/14598. This error has multiple variations, so targeting
// the lowest common denominator with the file name.
!logEntry.Message.ContainsOrdinalIgnoreCase("/monaco/IStandaloneEditorConstructionOptions.json");
}

0 comments on commit ffc0cea

Please sign in to comment.