diff --git a/Lombiq.Tests.UI.Samples/Tests/JavaScriptTests.cs b/Lombiq.Tests.UI.Samples/Tests/JavaScriptTests.cs index d7084595c..e4cc892bf 100644 --- a/Lombiq.Tests.UI.Samples/Tests/JavaScriptTests.cs +++ b/Lombiq.Tests.UI.Samples/Tests/JavaScriptTests.cs @@ -1,9 +1,14 @@ using Lombiq.Tests.UI.Extensions; +using System; using System.Diagnostics.CodeAnalysis; using System.IO; using System.Threading.Tasks; using Xunit; +// Warning: This feature relies on PNPM and Node.js, and it was designed for projects that use Lombiq.NodeJs.Targets. +// Since the latter is deprecated and PNPM won't be shipped with future versions of Node.js either, this +// feature is no longer supported. + namespace Lombiq.Tests.UI.Samples.Tests; // Let's suppose you want to write UI tests in JavaScript. Why would you want to do that? Unlikely if you are an Orchard @@ -11,6 +16,8 @@ namespace Lombiq.Tests.UI.Samples.Tests; // discussed using a separate frontend server, with mention of technologies using Node.js. In that case the frontend // developers may be more familiar with JavaScript so it makes sense to write and debug the tests in Node.js so they // don't have to learn different tools and tech stacks just to create some UI tests. +[SuppressMessage("Usage", "xUnit1004:Test methods should not be skipped", Justification = "See note at the top of the file.")] +[Obsolete("See note at the top of the file.")] public class JavaScriptTests : UITestBase { public JavaScriptTests(ITestOutputHelper testOutputHelper) @@ -19,7 +26,7 @@ public JavaScriptTests(ITestOutputHelper testOutputHelper) } // Using this approach you only have to write minimal C# boilerplate, which you can see below. - [Fact] + [Fact(Skip = "See note at the top of the file.")] public Task ExampleJavaScriptTestShouldWork() => ExecuteTestAfterSetupAsync(context => { @@ -39,7 +46,6 @@ public Task ExampleJavaScriptTestShouldWork() => // information on how to start up test scripts from your GUI. It's an example of some tooling that can improve the // test developer's workflow. // If you want to try it out yourself, just remove the "Skip" parameter and run this test. - [SuppressMessage("Usage", "xUnit1004:Test methods should not be skipped", Justification = "Only a demo.")] [Fact(Skip = "Use this to test to try out the interactive mode. This is not a real test you can run in CI.")] public Task Sandbox() => OpenSandboxAfterSetupAsync(async context => diff --git a/Lombiq.Tests.UI/Extensions/FrontendUITestContextExtensions.cs b/Lombiq.Tests.UI/Extensions/FrontendUITestContextExtensions.cs index d57e387bb..383c4d71f 100644 --- a/Lombiq.Tests.UI/Extensions/FrontendUITestContextExtensions.cs +++ b/Lombiq.Tests.UI/Extensions/FrontendUITestContextExtensions.cs @@ -65,6 +65,8 @@ public static string GetDriverPath(this UITestContext context) return Path.Join(service.DriverServicePath, service.DriverServiceExecutableName); } + #region Methods related to executing UI tests written in JavaScript. All of this is obsolete. + private static (string WorkingDirectory, string[] Arguments) GetExecuteJavaScriptTestPaths( this UITestContext context, string scriptPath, @@ -101,7 +103,7 @@ static string GetShorterPath(string basePath, string path) } // This uses a different casing of "JavaScript" to avoid breaking backwards compatibility. - [Obsolete($"Use {nameof(ExecuteJavaScriptTestAsync)} instead.")] + [Obsolete("Tests written in JavaScript are no longer supported.")] public static Task ExecuteJavascriptTestAsync( this UITestContext context, string scriptPath, @@ -115,6 +117,7 @@ public static Task ExecuteJavascriptTestAsync( /// Needed to redirect the node output into the test logs. /// The JavaScript source file to execute using node. /// The working directory where node is executed from. + [Obsolete("Tests written in JavaScript are no longer supported.")] public static async Task ExecuteJavaScriptTestAsync( this UITestContext context, ITestOutputHelper testOutputHelper, @@ -155,6 +158,7 @@ await Cli.Wrap(command) /// /// The relative or absolute path pointing to the test script file. /// The path where the test script should be executed, will be converted to absolute. + [Obsolete("Tests written in JavaScript are no longer supported.")] public static Task SwitchToInteractiveWithJavaScriptTestInfoAsync( this UITestContext context, string scriptPath, @@ -178,6 +182,7 @@ public static Task SwitchToInteractiveWithJavaScriptTestInfoAsync( /// relative path based on the temp directory to conserve path length because long paths can be a problem in some /// operating systems. /// + [Obsolete("Tests written in JavaScript are no longer supported.")] public static async Task SetupSeleniumAndExecuteJavaScriptTestAsync( this UITestContext context, ITestOutputHelper testOutputHelper, @@ -193,6 +198,7 @@ public static async Task SetupSeleniumAndExecuteJavaScriptTestAsync( /// Creates a blank Node.js project in the current test session's directory and /// installs the provided NPM using pnpm. /// + [Obsolete("Tests written in JavaScript are no longer supported.")] public static async Task SetupNodeDependenciesAsync( this UITestContext context, ITestOutputHelper helper, @@ -220,6 +226,7 @@ await Cli.Wrap("pnpm") /// Creates a blank Node.js project in the current test session's directory, then /// installs selenium-webdriver and any additional NPM dependencies using pnpm. /// + [Obsolete("Tests written in JavaScript are no longer supported.")] public static Task SetupNodeSeleniumAsync( this UITestContext context, ITestOutputHelper helper, @@ -246,4 +253,6 @@ public static Task SetupNodeSeleniumAsync( workingDirectory, [$"selenium-webdriver@{seleniumWebDriverVersion}", .. otherDependencies]); } + + #endregion } diff --git a/Lombiq.Tests.UI/Lombiq.Tests.UI.csproj b/Lombiq.Tests.UI/Lombiq.Tests.UI.csproj index 2e920a446..a7fc3b201 100644 --- a/Lombiq.Tests.UI/Lombiq.Tests.UI.csproj +++ b/Lombiq.Tests.UI/Lombiq.Tests.UI.csproj @@ -75,6 +75,7 @@ + @@ -102,18 +103,13 @@ - - - - -