513fa1aa16
Comment/XML-doc changes only: - add summaries to ~10k test methods, fixtures, fakes and helpers (+ <param> on theories, <returns> on async Task methods, <inheritdoc/> on interface implementations the checker can resolve) - strip ~2.6k project-tracking references (WP*, P*-*, row-NN, Task N, #NN, Component-0NN) from comments, keeping the explanatory text; reword false positives in comments only - real docs on fakes implementing BCL/library interfaces (IDisposable, ILogger, IOptionsMonitor, IAsyncLifetime) - reword the last 5 src/ false positives (CWE-1236, failures-1, year-0001, M365) Only non-comment edits: four one-line nested classes split across lines so members can carry docs. Build 0 errors / 0 warnings.
51 lines
3.1 KiB
C#
51 lines
3.1 KiB
C#
using System.Collections.Concurrent;
|
|
using Microsoft.Playwright;
|
|
|
|
namespace ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests;
|
|
|
|
/// <summary>Read-only deployed smoke for CSRF login, bounded lazy topology, and debugger navigation.</summary>
|
|
[Collection("Playwright")]
|
|
public class LowReviewSmokeTests(PlaywrightFixture fixture)
|
|
{
|
|
/// <summary>Verifies that CSRF login, lazy topology loading and Flow Debugger navigation work in the browser.</summary>
|
|
/// <returns>A task that represents the asynchronous operation.</returns>
|
|
[Fact]
|
|
public async Task LowReview_CsrfLogin_LazyTopology_AndFlowDebuggerNavigation()
|
|
{
|
|
var page = await fixture.NewAuthenticatedPageAsync();
|
|
var errors = new ConcurrentQueue<string>();
|
|
page.PageError += (_, error) => errors.Enqueue(error);
|
|
try
|
|
{
|
|
// Fixture fetch posts the real login form's antiforgery token with its cookie.
|
|
Assert.DoesNotContain("/login", page.Url);
|
|
await page.GotoAsync($"{PlaywrightFixture.BaseUrl}/deployment/topology");
|
|
await Assertions.Expect(page.GetByRole(AriaRole.Heading, new() { Name = "Topology", Exact = true })).ToBeVisibleAsync();
|
|
var live = page.Locator("#live-updates");
|
|
if (await live.IsCheckedAsync()) await live.UncheckAsync();
|
|
await Assertions.Expect(page.Locator("i.bi-box")).ToHaveCountAsync(0);
|
|
await Assertions.Expect(page.GetByText("0 loaded instance(s)", new() { Exact = false })).ToBeVisibleAsync();
|
|
|
|
var site = page.Locator("li[role='treeitem'][aria-level='1']").First;
|
|
await Assertions.Expect(site).ToBeVisibleAsync();
|
|
var toggle = site.Locator(":scope > .tv-row .tv-toggle").First;
|
|
if (await toggle.GetAttributeAsync("aria-expanded") == "false") await toggle.ClickAsync();
|
|
await site.GetByRole(AriaRole.Button, new() { Name = "Load instances", Exact = true }).First.ClickAsync();
|
|
await Assertions.Expect(site.GetByText("Page 1", new() { Exact = true })).ToBeVisibleAsync();
|
|
await Assertions.Expect(site.GetByRole(AriaRole.Button, new() { Name = "Previous", Exact = true })).ToBeDisabledAsync();
|
|
await Assertions.Expect(site.GetByRole(AriaRole.Button, new() { Name = "Next", Exact = true })).ToBeVisibleAsync();
|
|
Assert.InRange(await site.Locator("i.bi-box").CountAsync(), 0, 50);
|
|
await Assertions.Expect(page.Locator("#blazor-error-ui")).ToBeHiddenAsync();
|
|
await Assertions.Expect(page.Locator(".alert-danger")).ToHaveCountAsync(0);
|
|
|
|
await PlaywrightFixture.ExpandAllNavSectionsAsync(page);
|
|
await page.GetByRole(AriaRole.Link, new() { Name = "Flow Debugger", Exact = true }).ClickAsync();
|
|
await PlaywrightFixture.WaitForPathAsync(page, "/deployment/flow-debugger");
|
|
await Assertions.Expect(page.GetByRole(AriaRole.Heading, new() { Name = "Flow Debugger", Exact = true })).ToBeVisibleAsync();
|
|
await Assertions.Expect(page.Locator("#blazor-error-ui")).ToBeHiddenAsync();
|
|
Assert.Empty(errors);
|
|
}
|
|
finally { await page.Context.CloseAsync(); }
|
|
}
|
|
}
|