using System.Text.Json;
using Xunit;
namespace ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests.Cluster;
///
/// TDD smoke coverage for and
/// . Confirms the subprocess runner can locate
/// the built scadabridge.dll, shell out through dotnet, 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
/// ZB.MOM.WW.ScadaBridge.ConfigurationDatabase.Tests idiom.
///
[Collection("Playwright")]
public class CliRunnerSmokeTests
{
///
/// scadabridge site list round-trips through the CLI and returns a
/// JSON document (the CLI emits a JSON array of sites in --format json).
///
[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);
}
}