test(e2e): add CliRunner typed fixture helpers
This commit is contained in:
+46
@@ -0,0 +1,46 @@
|
||||
using Xunit;
|
||||
|
||||
namespace ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests.Cluster;
|
||||
|
||||
/// <summary>
|
||||
/// TDD coverage for the typed <see cref="CliRunner"/> fixture helpers used by
|
||||
/// state-changing Central UI Playwright E2E tests to provision and tear down
|
||||
/// templates, attributes, areas, and instances against the running dev cluster.
|
||||
/// When the cluster / MSSQL is unreachable the facts report as Skipped (not
|
||||
/// Failed), matching the established suite idiom.
|
||||
/// </summary>
|
||||
[Collection("Playwright")]
|
||||
public class CliRunnerHelpersTests
|
||||
{
|
||||
/// <summary>
|
||||
/// A freshly created template is discoverable by name prefix and can be
|
||||
/// deleted, exercising <see cref="CliRunner.CreateTemplateAsync"/>,
|
||||
/// <see cref="CliRunner.ListTemplateIdsByNamePrefixAsync"/>, and
|
||||
/// <see cref="CliRunner.DeleteTemplateAsync"/> as a round-trip.
|
||||
/// </summary>
|
||||
[SkippableFact]
|
||||
public async Task CreateThenDeleteTemplate_RoundTrips()
|
||||
{
|
||||
Skip.IfNot(await ClusterAvailability.IsAvailableAsync(), ClusterAvailability.SkipReason);
|
||||
var name = CliRunner.UniqueName("tmpl");
|
||||
int id = await CliRunner.CreateTemplateAsync(name);
|
||||
try
|
||||
{
|
||||
var ids = await CliRunner.ListTemplateIdsByNamePrefixAsync(name);
|
||||
Assert.Contains(id, ids);
|
||||
}
|
||||
finally { await CliRunner.DeleteTemplateAsync(id); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="CliRunner.ResolveSiteIdAsync"/> finds the well-known
|
||||
/// <c>site-a</c> seed site by its <c>siteIdentifier</c> and returns a
|
||||
/// positive id.
|
||||
/// </summary>
|
||||
[SkippableFact]
|
||||
public async Task ResolveSiteA_ReturnsId()
|
||||
{
|
||||
Skip.IfNot(await ClusterAvailability.IsAvailableAsync(), ClusterAvailability.SkipReason);
|
||||
Assert.True(await CliRunner.ResolveSiteIdAsync("site-a") > 0);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user