test(e2e): add ListAreaIdsByNamePrefixAsync CLI helper for UI-created area teardown

Adds CliRunner.ListAreaIdsByNamePrefixAsync so Playwright tests can locate
and delete areas they created through the UI without needing the id returned
from a CLI create call. Mirrors ListTemplateIdsByNamePrefixAsync. Round-trip
test verifies create → list-by-prefix → delete against the live cluster.
This commit is contained in:
Joseph Doherty
2026-06-06 13:20:11 -04:00
parent b4b38fe52a
commit 1afb3670c5
2 changed files with 73 additions and 0 deletions
@@ -84,4 +84,31 @@ public class CliRunnerHelpersTests
await CliRunner.DeleteApiMethodAsync(id);
}
}
/// <summary>
/// A freshly created area is discoverable by name prefix via
/// <see cref="CliRunner.ListAreaIdsByNamePrefixAsync"/>, confirming the round-trip
/// used by UI tests that need to tear down areas whose ids are never surfaced.
/// Exercises <see cref="CliRunner.CreateAreaAsync"/>,
/// <see cref="CliRunner.ListAreaIdsByNamePrefixAsync"/>, and
/// <see cref="CliRunner.DeleteAreaAsync"/>.
/// </summary>
[SkippableFact]
public async Task ListAreaIdsByNamePrefix_FindsCreatedArea()
{
Skip.IfNot(await ClusterAvailability.IsAvailableAsync(), ClusterAvailability.SkipReason);
var siteId = await CliRunner.ResolveSiteIdAsync("site-a");
var name = CliRunner.UniqueName("listarea");
var areaId = await CliRunner.CreateAreaAsync(siteId, name);
try
{
var ids = await CliRunner.ListAreaIdsByNamePrefixAsync(siteId, name);
Assert.Contains(areaId, ids);
}
finally
{
await CliRunner.DeleteAreaAsync(areaId);
}
}
}