Skip to content

Commit 4024e92

Browse files
authored
Merge pull request #645 from Lombiq/issue/OSOE-1185
OSOE-1185: Replace NE with LibMan
2 parents ef8d66c + 1f381b8 commit 4024e92

9 files changed

Lines changed: 52 additions & 83 deletions

File tree

Lombiq.Tests.UI.AppExtensions/Lombiq.Tests.UI.AppExtensions.csproj

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<TargetFramework>net8.0</TargetFramework>
55
<IsPublishable>false</IsPublishable>
6-
<DefaultItemExcludes>$(DefaultItemExcludes);.git*;node_modules\**</DefaultItemExcludes>
6+
<DefaultItemExcludes>$(DefaultItemExcludes);.git*</DefaultItemExcludes>
77
</PropertyGroup>
88

99
<PropertyGroup>
@@ -23,10 +23,6 @@
2323
<None Include="NuGetIcon.png" Pack="true" PackagePath="" />
2424
</ItemGroup>
2525

26-
<ItemGroup>
27-
<None Remove="node_modules\**" />
28-
</ItemGroup>
29-
3026
<ItemGroup>
3127
<FrameworkReference Include="Microsoft.AspNetCore.App" />
3228
</ItemGroup>
@@ -43,6 +39,6 @@
4339

4440

4541
<ItemGroup Condition="'$(NuGetBuild)' == 'true'">
46-
<PackageReference Include="Lombiq.HelpfulLibraries.OrchardCore" Version="12.3.0" />
42+
<PackageReference Include="Lombiq.HelpfulLibraries.OrchardCore" Version="12.4.1-alpha.2.osoe-1185" />
4743
</ItemGroup>
4844
</Project>

Lombiq.Tests.UI.Samples/Tests/JavaScriptTests.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
11
using Lombiq.Tests.UI.Extensions;
2+
using System;
23
using System.Diagnostics.CodeAnalysis;
34
using System.IO;
45
using System.Threading.Tasks;
56
using Xunit;
67

8+
// Warning: This feature relies on PNPM and Node.js, and it was designed for projects that use Lombiq.NodeJs.Targets.
9+
// Since the latter is deprecated and PNPM won't be shipped with future versions of Node.js either, this
10+
// feature is no longer supported.
11+
712
namespace Lombiq.Tests.UI.Samples.Tests;
813

914
// Let's suppose you want to write UI tests in JavaScript. Why would you want to do that? Unlikely if you are an Orchard
1015
// Core developer, but what if the person responsible for writing the tests is not? In the previous training section we
1116
// discussed using a separate frontend server, with mention of technologies using Node.js. In that case the frontend
1217
// developers may be more familiar with JavaScript so it makes sense to write and debug the tests in Node.js so they
1318
// don't have to learn different tools and tech stacks just to create some UI tests.
19+
[SuppressMessage("Usage", "xUnit1004:Test methods should not be skipped", Justification = "See note at the top of the file.")]
20+
[Obsolete("See note at the top of the file.")]
1421
public class JavaScriptTests : UITestBase
1522
{
1623
public JavaScriptTests(ITestOutputHelper testOutputHelper)
@@ -19,7 +26,7 @@ public JavaScriptTests(ITestOutputHelper testOutputHelper)
1926
}
2027

2128
// Using this approach you only have to write minimal C# boilerplate, which you can see below.
22-
[Fact]
29+
[Fact(Skip = "See note at the top of the file.")]
2330
public Task ExampleJavaScriptTestShouldWork() =>
2431
ExecuteTestAfterSetupAsync(context =>
2532
{
@@ -39,7 +46,6 @@ public Task ExampleJavaScriptTestShouldWork() =>
3946
// information on how to start up test scripts from your GUI. It's an example of some tooling that can improve the
4047
// test developer's workflow.
4148
// If you want to try it out yourself, just remove the "Skip" parameter and run this test.
42-
[SuppressMessage("Usage", "xUnit1004:Test methods should not be skipped", Justification = "Only a demo.")]
4349
[Fact(Skip = "Use this to test to try out the interactive mode. This is not a real test you can run in CI.")]
4450
public Task Sandbox() =>
4551
OpenSandboxAfterSetupAsync(async context =>

Lombiq.Tests.UI.Shortcuts/Lombiq.Tests.UI.Shortcuts.csproj

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<TargetFramework>net8.0</TargetFramework>
55
<IsPublishable>false</IsPublishable>
66
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
7-
<DefaultItemExcludes>$(DefaultItemExcludes);.git*;node_modules\**</DefaultItemExcludes>
7+
<DefaultItemExcludes>$(DefaultItemExcludes);.git*</DefaultItemExcludes>
88
</PropertyGroup>
99

1010
<PropertyGroup>
@@ -24,10 +24,6 @@
2424
<None Include="NuGetIcon.png" Pack="true" PackagePath="" />
2525
</ItemGroup>
2626

27-
<ItemGroup>
28-
<None Remove="node_modules\**" />
29-
</ItemGroup>
30-
3127
<ItemGroup>
3228
<FrameworkReference Include="Microsoft.AspNetCore.App" />
3329
</ItemGroup>
@@ -51,7 +47,7 @@
5147
</ItemGroup>
5248

5349
<ItemGroup Condition="'$(NuGetBuild)' == 'true'">
54-
<PackageReference Include="Lombiq.HelpfulLibraries.OrchardCore" Version="12.3.0" />
50+
<PackageReference Include="Lombiq.HelpfulLibraries.OrchardCore" Version="12.4.1-alpha.2.osoe-1185" />
5551
</ItemGroup>
5652

5753
</Project>

Lombiq.Tests.UI/Extensions/FrontendUITestContextExtensions.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ public static string GetDriverPath(this UITestContext context)
6565
return Path.Join(service.DriverServicePath, service.DriverServiceExecutableName);
6666
}
6767

68+
#region Methods related to executing UI tests written in JavaScript. All of this is obsolete.
69+
6870
private static (string WorkingDirectory, string[] Arguments) GetExecuteJavaScriptTestPaths(
6971
this UITestContext context,
7072
string scriptPath,
@@ -101,7 +103,7 @@ static string GetShorterPath(string basePath, string path)
101103
}
102104

103105
// This uses a different casing of "JavaScript" to avoid breaking backwards compatibility.
104-
[Obsolete($"Use {nameof(ExecuteJavaScriptTestAsync)} instead.")]
106+
[Obsolete("Tests written in JavaScript are no longer supported.")]
105107
public static Task ExecuteJavascriptTestAsync(
106108
this UITestContext context,
107109
string scriptPath,
@@ -115,6 +117,7 @@ public static Task ExecuteJavascriptTestAsync(
115117
/// <param name="testOutputHelper">Needed to redirect the <c>node</c> output into the test logs.</param>
116118
/// <param name="scriptPath">The JavaScript source file to execute using <c>node</c>.</param>
117119
/// <param name="workingDirectory">The working directory where <c>node</c> is executed from.</param>
120+
[Obsolete("Tests written in JavaScript are no longer supported.")]
118121
public static async Task ExecuteJavaScriptTestAsync(
119122
this UITestContext context,
120123
ITestOutputHelper testOutputHelper,
@@ -155,6 +158,7 @@ await Cli.Wrap(command)
155158
/// </summary>
156159
/// <param name="scriptPath">The relative or absolute path pointing to the test script file.</param>
157160
/// <param name="workingDirectory">The path where the test script should be executed, will be converted to absolute.</param>
161+
[Obsolete("Tests written in JavaScript are no longer supported.")]
158162
public static Task SwitchToInteractiveWithJavaScriptTestInfoAsync(
159163
this UITestContext context,
160164
string scriptPath,
@@ -178,6 +182,7 @@ public static Task SwitchToInteractiveWithJavaScriptTestInfoAsync(
178182
/// relative path based on the temp directory to conserve path length because long paths can be a problem in some
179183
/// operating systems.
180184
/// </param>
185+
[Obsolete("Tests written in JavaScript are no longer supported.")]
181186
public static async Task SetupSeleniumAndExecuteJavaScriptTestAsync(
182187
this UITestContext context,
183188
ITestOutputHelper testOutputHelper,
@@ -193,6 +198,7 @@ public static async Task SetupSeleniumAndExecuteJavaScriptTestAsync(
193198
/// Creates a blank Node.js project in the current test session's <see cref="DirectoryPaths.Temp"/> directory and
194199
/// installs the provided NPM <paramref name="dependencies"/> using <c>pnpm</c>.
195200
/// </summary>
201+
[Obsolete("Tests written in JavaScript are no longer supported.")]
196202
public static async Task SetupNodeDependenciesAsync(
197203
this UITestContext context,
198204
ITestOutputHelper helper,
@@ -220,6 +226,7 @@ await Cli.Wrap("pnpm")
220226
/// Creates a blank Node.js project in the current test session's <see cref="DirectoryPaths.Temp"/> directory, then
221227
/// installs <c>selenium-webdriver</c> and any additional NPM dependencies using <c>pnpm</c>.
222228
/// </summary>
229+
[Obsolete("Tests written in JavaScript are no longer supported.")]
223230
public static Task SetupNodeSeleniumAsync(
224231
this UITestContext context,
225232
ITestOutputHelper helper,
@@ -246,4 +253,6 @@ public static Task SetupNodeSeleniumAsync(
246253
workingDirectory,
247254
[$"selenium-webdriver@{seleniumWebDriverVersion}", .. otherDependencies]);
248255
}
256+
257+
#endregion
249258
}

Lombiq.Tests.UI/Lombiq.Tests.UI.csproj

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
<PackageReference Include="Deque.AxeCore.Selenium" Version="4.11.0" />
7676
<PackageReference Include="MailKit" Version="4.14.1" />
7777
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0" />
78+
<PackageReference Include="Microsoft.Web.LibraryManager.Build" Version="3.0.71" />
7879
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.1" />
7980
<PackageReference Include="Microsoft.Extensions.Diagnostics.Testing" Version="8.10.0" />
8081
<PackageReference Include="Microsoft.SqlServer.DACFx" Version="170.2.70" />
@@ -102,18 +103,13 @@
102103
<ProjectReference Include="..\..\..\src\Libraries\Lombiq.HelpfulLibraries\Lombiq.HelpfulLibraries.Cli\Lombiq.HelpfulLibraries.Cli.csproj" />
103104
<ProjectReference Include="..\..\..\src\Libraries\Lombiq.HelpfulLibraries\Lombiq.HelpfulLibraries.OrchardCore\Lombiq.HelpfulLibraries.OrchardCore.csproj" />
104105
<ProjectReference Include="..\..\..\src\Libraries\Lombiq.HelpfulLibraries\Lombiq.HelpfulLibraries.Refit\Lombiq.HelpfulLibraries.Refit.csproj" />
105-
<ProjectReference Include="..\..\..\src\Utilities\Lombiq.Npm.Targets\Lombiq.Npm.Targets.csproj" />
106106
</ItemGroup>
107107

108-
<Import Condition="'$(NuGetBuild)' != 'true'" Project="..\..\..\src\Utilities\Lombiq.Npm.Targets\Lombiq.Npm.Targets.props" />
109-
<Import Condition="'$(NuGetBuild)' != 'true'" Project="..\..\..\src\Utilities\Lombiq.Npm.Targets\Lombiq.Npm.Targets.targets" />
110-
111108
<ItemGroup Condition="'$(NuGetBuild)' == 'true'">
112109
<PackageReference Include="Lombiq.Tests" Version="5.0.0" />
113-
<PackageReference Include="Lombiq.HelpfulLibraries.Cli" Version="12.3.0" />
114-
<PackageReference Include="Lombiq.HelpfulLibraries.OrchardCore" Version="12.3.0" />
115-
<PackageReference Include="Lombiq.HelpfulLibraries.Refit" Version="12.3.0" />
116-
<PackageReference Include="Lombiq.Npm.Targets" Version="1.5.0" />
110+
<PackageReference Include="Lombiq.HelpfulLibraries.Cli" Version="12.4.1-alpha.2.osoe-1185" />
111+
<PackageReference Include="Lombiq.HelpfulLibraries.OrchardCore" Version="12.4.1-alpha.2.osoe-1185" />
112+
<PackageReference Include="Lombiq.HelpfulLibraries.Refit" Version="12.4.1-alpha.2.osoe-1185" />
117113
</ItemGroup>
118114

119115
<!-- These are necessary for symbols NuGet packaging, otherwise Shouldly would prevent PDBs to be packaged, see:
@@ -128,7 +124,6 @@
128124
<EmbeddedResource Include="node_modules\gremlins.js\dist\gremlins.min.js">
129125
<Link>Resources\gremlins.min.js</Link>
130126
</EmbeddedResource>
131-
<None Remove="node_modules\**" />
132127
<EmbeddedResource Include="Resources\gremlins-summoning-circle.js" />
133128
</ItemGroup>
134129
<ItemGroup>
Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,29 @@
1-
(function () {
1+
(function gremlinSummoningCircle() {
22
// Disable AMD (RequireJS/Dojo) so UMD scripts attach to window. Try catch is needed because sometimes they cause
33
// errors, but it doesn't matter.
4-
try
5-
{
4+
try {
65
window.define = undefined;
76
}
8-
catch (_)
9-
{
10-
try
11-
{
7+
catch {
8+
try {
129
if (window.define) window.define.amd = undefined;
1310
}
14-
catch (_)
15-
{ }
11+
catch {
12+
// Nothing to do here.
13+
}
1614
}
1715

18-
try
19-
{
16+
try {
2017
window.require = undefined;
2118
}
22-
catch (_)
23-
{ }
19+
catch {
20+
// Nothing to do here.
21+
}
2422

25-
try
26-
{
23+
try {
2724
window.requirejs = undefined;
2825
}
29-
catch (_)
30-
{ }
26+
catch {
27+
// Nothing to do here.
28+
}
3129
})();

Lombiq.Tests.UI/libman.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"version": "3.0",
3+
"defaultProvider": "jsdelivr",
4+
"defaultDestination": "node_modules/[Name]",
5+
"libraries": [
6+
{
7+
"library": "gremlins.js@2.2.0",
8+
"files": [ "dist/gremlins.min.js" ]
9+
}
10+
]
11+
}

Lombiq.Tests.UI/package.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

Lombiq.Tests.UI/pnpm-lock.yaml

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)