Files
scadalink-design/tests/ScadaLink.CentralUI.PlaywrightTests/NavigationTests.cs
Joseph Doherty da5fdf0e63 feat(ui/admin): Topology-style refresh of Data Connections page
Brings the Data Connections admin page up to the same UX standard as the
Topology page:
- Search box with dim non-matches (opacity 0.4, shape preserved)
- Toolbar: + Connection (disabled until a site is selected), Refresh,
  Expand, Collapse
- Site context menu gains "Add Connection here" that navigates with
  ?siteId= so the form preselects + locks the Site field
- Form gains "Primary Endpoint" / "Backup Endpoint" h6 subsection
  headers matching the SiteForm convention; Failover Retry Count moved
  inside the Backup subsection
- URL renamed: /admin/connections (primary) + /admin/data-connections
  (legacy secondary @page). Same dual-route treatment on the form
- Nav label: "Data Connections" -> "Connections"
- Adds DataConnectionsPageTests bUnit suite (6 tests)
2026-05-11 22:42:48 -04:00

77 lines
2.8 KiB
C#

using Microsoft.Playwright;
namespace ScadaLink.CentralUI.PlaywrightTests;
[Collection("Playwright")]
public class NavigationTests
{
private readonly PlaywrightFixture _fixture;
public NavigationTests(PlaywrightFixture fixture)
{
_fixture = fixture;
}
[Fact]
public async Task Dashboard_IsVisibleAfterLogin()
{
var page = await _fixture.NewAuthenticatedPageAsync();
// The nav sidebar should be visible with the brand
await Expect(page.Locator(".brand")).ToHaveTextAsync("ScadaLink");
// The nav should contain "Dashboard" link (exact match to avoid "Health Dashboard")
await Expect(page.GetByRole(AriaRole.Link, new() { Name = "Dashboard", Exact = true })).ToBeVisibleAsync();
}
[Theory]
[InlineData("Sites", "/admin/sites")]
[InlineData("Connections", "/admin/connections")]
[InlineData("API Keys", "/admin/api-keys")]
[InlineData("LDAP Mappings", "/admin/ldap-mappings")]
public async Task AdminNavLinks_NavigateCorrectly(string linkText, string expectedPath)
{
var page = await _fixture.NewAuthenticatedPageAsync();
await ClickNavAndWait(page, linkText, expectedPath);
}
[Theory]
[InlineData("Templates", "/design/templates")]
[InlineData("Shared Scripts", "/design/shared-scripts")]
[InlineData("External Systems", "/design/external-systems")]
public async Task DesignNavLinks_NavigateCorrectly(string linkText, string expectedPath)
{
var page = await _fixture.NewAuthenticatedPageAsync();
await ClickNavAndWait(page, linkText, expectedPath);
}
[Theory]
[InlineData("Topology", "/deployment/topology")]
[InlineData("Deployments", "/deployment/deployments")]
public async Task DeploymentNavLinks_NavigateCorrectly(string linkText, string expectedPath)
{
var page = await _fixture.NewAuthenticatedPageAsync();
await ClickNavAndWait(page, linkText, expectedPath);
}
[Theory]
[InlineData("Health Dashboard", "/monitoring/health")]
[InlineData("Event Logs", "/monitoring/event-logs")]
[InlineData("Parked Messages", "/monitoring/parked-messages")]
[InlineData("Audit Log", "/monitoring/audit-log")]
public async Task MonitoringNavLinks_NavigateCorrectly(string linkText, string expectedPath)
{
var page = await _fixture.NewAuthenticatedPageAsync();
await ClickNavAndWait(page, linkText, expectedPath);
}
private static async Task ClickNavAndWait(IPage page, string linkText, string expectedPath)
{
await page.Locator($"nav a:has-text('{linkText}')").ClickAsync();
await PlaywrightFixture.WaitForPathAsync(page, expectedPath);
Assert.Contains(expectedPath, page.Url);
}
private static ILocatorAssertions Expect(ILocator locator) =>
Assertions.Expect(locator);
}