test(e2e): add CliRunner + ClusterAvailability probe
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
using System.Text.Json;
|
||||
using Xunit;
|
||||
|
||||
namespace ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests.Cluster;
|
||||
|
||||
/// <summary>
|
||||
/// TDD smoke coverage for <see cref="CliRunner"/> and
|
||||
/// <see cref="ClusterAvailability"/>. Confirms the subprocess runner can locate
|
||||
/// the built <c>scadabridge.dll</c>, shell out through <c>dotnet</c>, and parse
|
||||
/// the JSON the CLI prints to stdout. When the dev cluster / MSSQL is unreachable
|
||||
/// the fact reports as Skipped (not Failed), matching the established
|
||||
/// <c>ZB.MOM.WW.ScadaBridge.ConfigurationDatabase.Tests</c> idiom.
|
||||
/// </summary>
|
||||
[Collection("Playwright")]
|
||||
public class CliRunnerSmokeTests
|
||||
{
|
||||
/// <summary>
|
||||
/// <c>scadabridge site list</c> round-trips through the CLI and returns a
|
||||
/// JSON document (the CLI emits a JSON array of sites in <c>--format json</c>).
|
||||
/// </summary>
|
||||
[SkippableFact]
|
||||
public async Task SiteList_ReturnsJson()
|
||||
{
|
||||
Skip.IfNot(await ClusterAvailability.IsAvailableAsync(), ClusterAvailability.SkipReason);
|
||||
using var doc = await CliRunner.RunJsonAsync("site", "list");
|
||||
Assert.True(doc.RootElement.ValueKind is JsonValueKind.Array or JsonValueKind.Object);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user