diff --git a/ZB.MOM.WW.Secrets/Directory.Packages.props b/ZB.MOM.WW.Secrets/Directory.Packages.props index 3de714c..5ab76d6 100644 --- a/ZB.MOM.WW.Secrets/Directory.Packages.props +++ b/ZB.MOM.WW.Secrets/Directory.Packages.props @@ -72,7 +72,7 @@ - + diff --git a/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/Components/ConfirmDeleteModal.razor b/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/Components/ConfirmDeleteModal.razor index c4f2631..c8a5741 100644 --- a/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/Components/ConfirmDeleteModal.razor +++ b/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/Components/ConfirmDeleteModal.razor @@ -1,5 +1,7 @@ @namespace ZB.MOM.WW.Secrets.Ui.Components -@implements IDisposable +@implements IAsyncDisposable +@using Microsoft.JSInterop +@inject IJSRuntime JS @inject ISecretStore Store @inject IAuditWriter Audit @inject IServiceProvider Services @@ -16,49 +18,71 @@ every Bootstrap host. Theme tokens with fallbacks keep it legible even without the kit. *@ -
- + } @code { + private readonly string _id = $"secrets-delete-{Guid.NewGuid():N}"; + private string TitleId => $"{_id}-title"; + private string DescriptionId => $"{_id}-description"; + private string CancelId => $"{_id}-cancel"; + private ElementReference _dialog; + private IJSObjectReference? _module; + private DotNetObjectReference? _reference; + private bool _opened; + private bool _activationAttempted; + private readonly SemaphoreSlim _dialogLifecycle = new(1, 1); + private bool _disposed; + private Task? _disposeTask; + private long _generation; + private SecretName? _identity; private readonly CancellationTokenSource _cts = new(); private string? _error; private bool _busy; @@ -69,6 +93,12 @@ /// The secret the modal offers to delete. [Parameter] public SecretName Name { get; set; } + /// Stable focus fallback when the originating row no longer exists. + [Parameter] public string? ReturnFocusId { get; set; } + + /// Notifies a parent while deletion is pending so targets cannot be switched. + [Parameter] public EventCallback OnBusyChanged { get; set; } + /// Raised after the secret has been tombstoned and audited. [Parameter] public EventCallback OnDeleted { get; set; } @@ -78,60 +108,118 @@ /// The cascading authentication state, used as the fallback source of the audit actor. [CascadingParameter] private Task? AuthState { get; set; } - private async Task ConfirmAsync() - { - _error = null; + private bool IsCurrent(long generation) => !_disposed && Visible && generation == _generation; - if (!await SecretsComponentAuthorization.IsAuthorizedAsync(Services, AuthState, SecretsAuthorization.ManagePolicy)) + /// + protected override void OnParametersSet() + { + SecretName? identity = Visible ? Name : null; + if (identity != _identity) { - _error = "You are not authorized to delete secrets."; - return; + _identity = identity; + ++_generation; + _error = null; } - _busy = true; - bool deleted = false; + } + + /// + protected override async Task OnAfterRenderAsync(bool firstRender) + { + // Blazor can start a newer render or disposal while import/open is awaiting JS. + // Serialize those continuations so an old activation cannot close a newer identity, + // and disposal always closes an attempted open before disposing its module/reference. + await _dialogLifecycle.WaitAsync(); try { - string actor = await SecretActorResolver.ResolveAsync(Services, AuthState); + if (_disposed) return; + if (Visible) + { + long generation = _generation; + _module ??= await JS.InvokeAsync("import", "./_content/ZB.MOM.WW.Secrets.Ui/js/secrets-dialog.js"); + if (_disposed || !IsCurrent(generation)) return; + if (!_opened) + { + _reference ??= DotNetObjectReference.Create(this); + _activationAttempted = true; + await _module.InvokeVoidAsync("open", _dialog, CancelId, _reference, ReturnFocusId, _id); + _opened = true; + if (_disposed || !IsCurrent(generation)) + { + await CloseDialogAsync(); + return; + } + } + await _module.InvokeVoidAsync("setBusy", _id, _busy, ReturnFocusId); + } + else await CloseDialogAsync(); + } + finally { _dialogLifecycle.Release(); } + } + private async Task CloseDialogAsync() + { + if (_module is not null && _activationAttempted) + { + await _module.InvokeVoidAsync("close", _id); + _activationAttempted = false; + _opened = false; + } + } + + /// Handles the native dialog's safe Escape/cancel request. + [JSInvokable] + public Task RequestCancelAsync() => CancelAsync(); + + private async Task ConfirmAsync() + { + if (_disposed || _busy || !Visible) return; + long generation = _generation; + SecretName name = Name; + Task? authState = AuthState; + CancellationToken ct = _cts.Token; + EventCallback deletedCallback = OnDeleted; + EventCallback busyCallback = OnBusyChanged; + _error = null; + _busy = true; + try + { + await busyCallback.InvokeAsync(true); + if (!await SecretsComponentAuthorization.IsAuthorizedAsync(Services, authState, SecretsAuthorization.ManagePolicy)) + { + if (IsCurrent(generation)) _error = "You are not authorized to delete secrets."; + return; + } + if (!IsCurrent(generation) || ct.IsCancellationRequested) return; + string actor = await SecretActorResolver.ResolveAsync(Services, authState); + if (!IsCurrent(generation) || ct.IsCancellationRequested) return; + ISecretCacheInvalidator? cache = Services.GetService(); + ILogger? logger = Services.GetService>(); + bool deleted = false; try { - await Store.DeleteAsync(Name, actor, _cts.Token); - - // The tombstone is committed from here on. + await Store.DeleteAsync(name, actor, ct); deleted = true; } catch (Exception) { - // An unexpected store fault must still be audited as a Failure and surfaced to the - // operator instead of tearing down the circuit. - _error = "Unable to delete the secret."; - await WriteFailureAuditAsync(actor); + if (IsCurrent(generation)) _error = "Unable to delete the secret."; + await WriteFailureAuditAsync(actor, name, ct); } - if (deleted) { - // Outside the mutation try (scadaproj#34): a throwing audit sink must not turn a - // committed delete into a reported failure, nor skip the cache eviction below. - await WriteSuccessAuditAsync(actor); + await WriteSuccessAuditAsync(actor, name, ct, logger); + cache?.Invalidate(name); + if (IsCurrent(generation)) await deletedCallback.InvokeAsync(); } } finally { _busy = false; - } - - if (deleted) - { - // Evict any cached plaintext so the ${secret:} / ISecretResolver path does not serve a - // stale value after this delete for the remainder of its TTL. Optional seam — a no-op - // when the host has not registered an invalidator. - Services.GetService()?.Invalidate(Name); - - await OnDeleted.InvokeAsync(); + await busyCallback.InvokeAsync(false); } } - private async Task WriteSuccessAuditAsync(string actor) + private async Task WriteSuccessAuditAsync(string actor, SecretName name, CancellationToken ct, ILogger? logger) { try { @@ -144,22 +232,22 @@ Action = "secret.delete", Outcome = AuditOutcome.Success, Category = "Secrets", - Target = Name.Value, + Target = name.Value, }, - _cts.Token); + ct); } catch (Exception ex) { // Best-effort: the delete itself succeeded. Logged so the audit gap is visible. - Services.GetService>()?.LogWarning( + logger?.LogWarning( ex, "Secret delete of {SecretName} by {Actor} succeeded, but its audit event could not be written.", - Name.Value, + name.Value, actor); } } - private async Task WriteFailureAuditAsync(string actor) + private async Task WriteFailureAuditAsync(string actor, SecretName name, CancellationToken ct) { try { @@ -172,10 +260,10 @@ Action = "secret.delete", Outcome = AuditOutcome.Failure, Category = "Secrets", - Target = Name.Value, + Target = name.Value, DetailsJson = "{\"reason\":\"error\"}", }, - _cts.Token); + ct); } catch { @@ -183,12 +271,34 @@ } } - private Task CancelAsync() => OnCancelled.InvokeAsync(); + private Task CancelAsync() => _busy || _disposed ? Task.CompletedTask : OnCancelled.InvokeAsync(); /// - public void Dispose() + public ValueTask DisposeAsync() => new(_disposeTask ??= DisposeCoreAsync()); + + private async Task DisposeCoreAsync() { + _disposed = true; + ++_generation; _cts.Cancel(); _cts.Dispose(); + await _dialogLifecycle.WaitAsync(); + try + { + if (_module is not null) + { + try + { + await CloseDialogAsync(); + await _module.DisposeAsync(); + } + catch (JSDisconnectedException) { } + } + } + finally + { + _reference?.Dispose(); + _dialogLifecycle.Release(); + } } } diff --git a/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/Components/SecretEditor.razor b/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/Components/SecretEditor.razor index d2fcd81..2531a35 100644 --- a/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/Components/SecretEditor.razor +++ b/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/Components/SecretEditor.razor @@ -9,25 +9,27 @@ The value is entered through a masked input and never rendered back or placed in any audit field. *@ - + @if (IsRotate) { - } else { - } - - + + - - @foreach (SecretContentType ct in Enum.GetValues()) { @@ -35,14 +37,19 @@ - - + @if (_error is not null) { -

@_error

+

@_error

+ } + + @if (!string.IsNullOrEmpty(_nameError)) + { + } @if (_busy) @@ -51,11 +58,11 @@ }
- @(IsRotate ? "Rotate" : "Add") - Cancel @@ -63,6 +70,20 @@ @code { + private readonly string _fieldPrefix = $"secret-editor-{Guid.NewGuid():N}"; + private ElementReference _nameControl; + private bool _focusNameError; + private string NameId => $"{_fieldPrefix}-name"; + private string NameHintId => $"{_fieldPrefix}-name-hint"; + private string NameErrorId => $"{_fieldPrefix}-name-error"; + private string DescriptionId => $"{_fieldPrefix}-description"; + private string DescriptionHintId => $"{_fieldPrefix}-description-hint"; + private string ContentTypeId => $"{_fieldPrefix}-content-type"; + private string ValueId => $"{_fieldPrefix}-value"; + private string ValueHintId => $"{_fieldPrefix}-value-hint"; + private string NameDescriptionIds => string.IsNullOrEmpty(_nameError) ? NameHintId : $"{NameHintId} {NameErrorId}"; + private string NameHint => IsRotate ? "This name is fixed during rotation." : "Required. Up to 450 characters: letters, numbers, dot, underscore, hyphen and slash. No '..', leading/trailing slash or empty path segment. Letters normalize to lowercase."; + private string? _nameError; private readonly CancellationTokenSource _cts = new(); private CancellationTokenSource? _metadataCts; private SecretName? _identityName; @@ -120,6 +141,8 @@ _contentType = SecretContentType.Text; _value = string.Empty; _error = null; + _nameError = null; + _focusNameError = false; _restoreConfirmedFor = null; _metadataLoading = false; _metadataReady = !IsRotate; @@ -171,6 +194,18 @@ } } + /// + protected override async Task OnAfterRenderAsync(bool firstRender) + { + // Wait until finally has unlocked the controls and the DOM reflects it. Focusing a + // disabled input during the submit handler fails in a real host even if markup tests pass. + if (_focusNameError && !_busy && !_disposed) + { + _focusNameError = false; + await _nameControl.FocusAsync(); + } + } + private async Task SubmitAsync() { if (_disposed || _busy || _metadataLoading || !_metadataReady) @@ -193,6 +228,7 @@ EventCallback savedCallback = OnSaved; EventCallback busyCallback = OnBusyChanged; _error = null; + _nameError = null; _busy = true; try { @@ -214,7 +250,11 @@ } catch (ArgumentException ex) { - if (IsCurrent(generation)) _error = ex.Message; + if (IsCurrent(generation)) + { + _nameError = ex.Message; + _focusNameError = true; + } return; } diff --git a/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/Components/SecretsList.razor b/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/Components/SecretsList.razor index e84ef66..2c7532a 100644 --- a/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/Components/SecretsList.razor +++ b/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/Components/SecretsList.razor @@ -7,7 +7,7 @@
- + Add secret
@@ -22,14 +22,27 @@ OnCancelled="() => CloseEditor(editorGeneration)" /> } - - @if (_secrets is null) + +

Secrets

+ + @if (_listError is not null) { -

Loading…

+
+

@_listError

+ Retry refresh +
} - else + @if (_outcome is not null) { -
+

@_outcome

+ } + @if (_loading) + { +

@(_secrets is null ? "Loading secrets…" : "Refreshing secret metadata…")

+ } + @if (_secrets is not null) + { +
@@ -68,12 +81,12 @@ @@ -86,16 +99,30 @@
} + - +@{ var deleteGeneration = _deleteGeneration; } + @code { + private readonly string _id = $"secrets-list-{Guid.NewGuid():N}"; + private string HeadingId => $"{_id}-heading"; + private readonly Dictionary _rowIds = new(); + private long _deleteGeneration; + private bool _deleteBusy; + private bool OperationBusy => _editorBusy || _deleteBusy; private readonly CancellationTokenSource _cts = new(); private IReadOnlyList? _secrets; + private CancellationTokenSource? _listCts; + private long _loadGeneration; + private bool _loading; + private string? _listError; + private string? _outcome; private EditorMode _editorMode = EditorMode.None; private SecretName? _rotateName; @@ -114,12 +141,50 @@ /// protected override async Task OnInitializedAsync() => await ReloadAsync(); - private async Task ReloadAsync() - => _secrets = await Store.ListAsync(includeDeleted: false, _cts.Token); + private Task RetryAsync() => ReloadAsync(); + + private async Task ReloadAsync(bool committed = false) + { + if (_disposed) return; + long generation = ++_loadGeneration; + _listCts?.Cancel(); + _listCts?.Dispose(); + var readCts = CancellationTokenSource.CreateLinkedTokenSource(_cts.Token); + _listCts = readCts; + CancellationToken ct = readCts.Token; + _loading = true; + _listError = null; + if (committed) _outcome = null; + try + { + IReadOnlyList rows = await Store.ListAsync(includeDeleted: false, ct); + if (!_disposed && generation == _loadGeneration) + { + _secrets = rows; + if (committed) _outcome = "Change saved."; + } + } + catch (OperationCanceledException) when (ct.IsCancellationRequested) { } + catch (Exception) + { + if (!_disposed && generation == _loadGeneration) + { + _listError = committed + ? "Change saved; list refresh failed. Retry refresh only; the change will not be repeated." + : "Unable to load secret metadata. Retry refresh."; + } + } + finally + { + if (!_disposed && generation == _loadGeneration) _loading = false; + if (ReferenceEquals(_listCts, readCts)) _listCts = null; + readCts.Dispose(); + } + } private void ShowAdd() { - if (_editorBusy || _disposed || _editorMode == EditorMode.Add) return; + if (OperationBusy || _disposed || _editorMode == EditorMode.Add) return; ++_editorGeneration; _rotateName = null; _editorMode = EditorMode.Add; @@ -127,7 +192,7 @@ private void ShowRotate(SecretName name) { - if (_editorBusy || _disposed || (_editorMode == EditorMode.Rotate && _rotateName == name)) return; + if (OperationBusy || _disposed || (_editorMode == EditorMode.Rotate && _rotateName == name)) return; ++_editorGeneration; _rotateName = name; _editorMode = EditorMode.Rotate; @@ -135,7 +200,7 @@ private void CloseEditor(long generation) { - if (_editorBusy || _disposed || generation != _editorGeneration) return; + if (OperationBusy || _disposed || generation != _editorGeneration) return; ClearEditor(); } @@ -152,32 +217,80 @@ if (!_disposed && generation == _editorGeneration) { _editorBusy = busy; + if (busy) _outcome = null; } } private async Task OnEditorSavedAsync(long generation) { if (_disposed || generation != _editorGeneration) return; - await ReloadAsync(); + await ReloadAsync(committed: true); if (!_disposed && generation == _editorGeneration) { ClearEditor(); - CloseDelete(); + ClearDelete(); } } + private string RowActionId(SecretName name) + { + if (!_rowIds.TryGetValue(name, out string? id)) + { + id = $"{_id}-row-{_rowIds.Count}"; + _rowIds.Add(name, id); + } + return id; + } + + private string DeleteReturnFocusId() + { + if (_secrets is null || _deleteTarget is not { } target) return HeadingId; + var rows = _secrets.ToList(); + int index = rows.FindIndex(row => row.Name == target); + if (index < 0) return HeadingId; + if (index + 1 < rows.Count) return RowActionId(rows[index + 1].Name); + if (index > 0) return RowActionId(rows[index - 1].Name); + return HeadingId; + } + private void ShowDelete(SecretName name) { - if (!_editorBusy && !_disposed) _deleteTarget = name; + if (OperationBusy || _disposed || _deleteTarget == name) return; + ++_deleteGeneration; + _deleteTarget = name; } - private void CloseDelete() => _deleteTarget = null; - - private async Task OnMutatedAsync() + private void OnDeleteBusyChanged(long generation, bool busy) { - CloseEditor(_editorGeneration); - CloseDelete(); - await ReloadAsync(); + if (!_disposed && generation == _deleteGeneration) + { + _deleteBusy = busy; + if (busy) _outcome = null; + } + } + + private void CloseDelete(long generation) + { + if (_deleteBusy || _disposed || generation != _deleteGeneration) return; + ClearDelete(); + } + + private void ClearDelete() + { + ++_deleteGeneration; + _deleteTarget = null; + _deleteBusy = false; + } + + private async Task OnDeleteCommittedAsync(long generation) + { + if (_disposed || generation != _deleteGeneration) return; + await ReloadAsync(committed: true); + if (!_disposed && generation == _deleteGeneration) + { + ClearEditor(); + ClearDelete(); + } } /// @@ -185,6 +298,11 @@ { _disposed = true; ++_editorGeneration; + ++_deleteGeneration; + ++_loadGeneration; + _listCts?.Cancel(); + _listCts?.Dispose(); + _listCts = null; _cts.Cancel(); _cts.Dispose(); } diff --git a/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/wwwroot/js/secrets-dialog.js b/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/wwwroot/js/secrets-dialog.js new file mode 100644 index 0000000..c9ed110 --- /dev/null +++ b/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/wwwroot/js/secrets-dialog.js @@ -0,0 +1,101 @@ +// Native top-layer dialog adapter. Each mounted instance owns its trigger and listeners. +const states = new Map(); +let scrollLocks = 0; +let previousOverflow; +const visible = node => { + if (!node?.isConnected || !node.getClientRects().length) return false; + for (let ancestor = node; ancestor; ancestor = ancestor.parentElement) { + const style = getComputedStyle(ancestor); + if (ancestor.hidden || ancestor.inert || style.display === 'none' || ['hidden', 'collapse'].includes(style.visibility)) return false; + } + return true; +}; +const usable = node => visible(node) && !node.disabled && node.getAttribute('aria-disabled') !== 'true'; +const focusable = dialog => [...dialog.querySelectorAll('button, [href], input, select, textarea, [tabindex]')] + .filter(node => usable(node) && node.tabIndex >= 0); + +export function open(dialog, safeActionId, dotnet, fallbackId, instanceId) { + if (states.has(instanceId)) return; + const state = { dialog, trigger: document.activeElement, busy: false, fallbackId }; + const requestCancel = () => { + if (!state.busy) dotnet.invokeMethodAsync('RequestCancelAsync').catch(error => { + if (states.has(instanceId)) console.error('Unable to dismiss secrets confirmation.', error); + }); + }; + state.keydown = event => { + if (event.key === 'Escape') { + event.preventDefault(); + requestCancel(); + } else if (event.key === 'Tab') { + const items = focusable(dialog); + const first = items[0]; + const last = items.at(-1); + if (!first) { event.preventDefault(); dialog.focus(); } + else if (event.shiftKey && (document.activeElement === first || !items.includes(document.activeElement))) { + event.preventDefault(); last.focus(); + } else if (!event.shiftKey && (document.activeElement === last || !items.includes(document.activeElement))) { + event.preventDefault(); first.focus(); + } + } + }; + state.cancel = event => { event.preventDefault(); requestCancel(); }; + states.set(instanceId, state); + dialog.addEventListener('keydown', state.keydown); + dialog.addEventListener('cancel', state.cancel); + let locked = false; + try { + // showModal provides the top layer and native background inertness without mutating + // an ancestor's existing inert attribute or depending on the host's transform styles. + dialog.showModal(); + if (scrollLocks++ === 0) { + previousOverflow = document.body.style.overflow; + document.body.style.overflow = 'hidden'; + } + locked = true; + document.getElementById(safeActionId)?.focus({ preventScroll: true }); + } catch (error) { + dialog.removeEventListener('keydown', state.keydown); + dialog.removeEventListener('cancel', state.cancel); + states.delete(instanceId); + if (dialog.open) dialog.close(); + if (locked && --scrollLocks === 0) document.body.style.overflow = previousOverflow; + throw error; + } +} + +export function setBusy(instanceId, busy, fallbackId) { + const state = states.get(instanceId); + if (state) { state.busy = busy; state.fallbackId = fallbackId; } +} + +export function close(instanceId) { + const state = states.get(instanceId); + if (!state) return; + const dialog = state.dialog; + states.delete(instanceId); + dialog.removeEventListener('keydown', state.keydown); + dialog.removeEventListener('cancel', state.cancel); + if (dialog.open) dialog.close(); + if (--scrollLocks === 0) document.body.style.overflow = previousOverflow; + // Blazor can dispose a child before its parent render batch removes the old row and + // re-enables adjacent actions. Restore after that actual DOM change, not during disposal. + // A bounded observer also handles a slow circuit round trip without a fixed timing guess. + let timer; + let frame; + const observer = new MutationObserver(restore); + const cleanup = () => { observer.disconnect(); clearTimeout(timer); cancelAnimationFrame(frame); }; + function restore() { + if (states.has(instanceId)) { cleanup(); return; } + for (const target of [state.trigger, document.getElementById(state.fallbackId)]) { + if (!usable(target)) continue; + const modal = document.querySelector('dialog:modal'); + if (modal && !modal.contains(target)) { cleanup(); return; } + target.focus({ preventScroll: true }); + // A connected node can still reject focus. Try the logical fallback too. + if (document.activeElement === target) { cleanup(); return; } + } + } + observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['disabled', 'aria-disabled', 'inert', 'hidden', 'style', 'class', 'tabindex'] }); + timer = setTimeout(cleanup, 3000); + frame = requestAnimationFrame(restore); +} diff --git a/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/AuditFailureAfterCommitTests.cs b/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/AuditFailureAfterCommitTests.cs index 5e3c895..10fb87a 100644 --- a/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/AuditFailureAfterCommitTests.cs +++ b/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/AuditFailureAfterCommitTests.cs @@ -17,6 +17,8 @@ namespace ZB.MOM.WW.Secrets.Ui.Tests; /// public sealed class AuditFailureAfterCommitTests : BunitContext { + public AuditFailureAfterCommitTests() => DialogInterop.Setup(JSInterop); + private (RecordingSecretStore Store, CapturingAuditWriter Audit, RecordingCacheInvalidator Cache) Register() { var store = new RecordingSecretStore(); diff --git a/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/ComponentAuthorizationTests.cs b/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/ComponentAuthorizationTests.cs index a188b8f..ee2080f 100644 --- a/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/ComponentAuthorizationTests.cs +++ b/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/ComponentAuthorizationTests.cs @@ -19,6 +19,8 @@ namespace ZB.MOM.WW.Secrets.Ui.Tests; /// public class ComponentAuthorizationTests : BunitContext { + public ComponentAuthorizationTests() => DialogInterop.Setup(JSInterop); + private const string PlainValue = "the-plaintext-value-42"; private (RecordingSecretStore Store, CapturingAuditWriter Audit, FakeCipher Cipher) Setup(params string[] grantedPolicies) diff --git a/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/ConfirmDeleteModalTests.cs b/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/ConfirmDeleteModalTests.cs index f8b73fe..0a822a0 100644 --- a/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/ConfirmDeleteModalTests.cs +++ b/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/ConfirmDeleteModalTests.cs @@ -1,5 +1,8 @@ using Bunit; using Bunit.TestDoubles; +using Microsoft.AspNetCore.Components.Web; +using Microsoft.JSInterop; +using System.Collections.Concurrent; using Microsoft.Extensions.DependencyInjection; using ZB.MOM.WW.Audit; using ZB.MOM.WW.Secrets.Abstractions; @@ -10,11 +13,30 @@ namespace ZB.MOM.WW.Secrets.Ui.Tests; public class ConfirmDeleteModalTests : BunitContext { + public ConfirmDeleteModalTests() => DialogInterop.Setup(JSInterop); + + [Fact] + public void DeleteDialog_HasANameLinkedToTheExactTarget() + { + Services.AddSingleton(new RecordingSecretStore()); + Services.AddSingleton(new CapturingAuditWriter()); + var cut = Render(p => p + .Add(x => x.Visible, true).Add(x => x.Name, new SecretName("app/a"))); + var dialog = cut.Find("[role=dialog]"); + var titleId = dialog.GetAttribute("aria-labelledby"); + Assert.False(string.IsNullOrWhiteSpace(titleId)); + Assert.Contains("app/a", cut.Find($"[id='{titleId}']").TextContent); + Assert.Equal("true", dialog.GetAttribute("aria-modal")); + var descriptionId = dialog.GetAttribute("aria-describedby"); + Assert.False(string.IsNullOrWhiteSpace(descriptionId)); + Assert.Contains("tombstones", cut.Find($"[id='{descriptionId}']").TextContent); + } + [Fact] public void ConfirmDeleteModal_IsInPageModal_NoJsDialog() { - // Strict JS interop mode: any IJSRuntime call (a JS confirm/alert dialog) would throw, - // proving the confirmation is a rendered in-page modal, not a browser dialog. + // Strict interop permits only the exact DOM-enhancement module configured by the fixture. + // Any browser confirm/alert call remains unhandled and fails the test. JSInterop.Mode = JSRuntimeMode.Strict; var store = new RecordingSecretStore(); @@ -178,6 +200,177 @@ public class ConfirmDeleteModalTests : BunitContext Assert.Contains("display: flex", style.TextContent); } + [Fact] + public async Task PendingDelete_BlocksCancelEscapeAndDuplicateActivation() + { + var store = new RecordingSecretStore(); + Services.AddSingleton(store); + Services.AddSingleton(new CapturingAuditWriter()); + var auth = this.AddAuthorization(); + auth.SetAuthorized("reviewer"); + auth.SetPolicies(SecretsAuthorization.ManagePolicy); + var entered = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + var release = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + store.DeleteOverride = (_, _, _) => { entered.TrySetResult(); return release.Task; }; + bool cancelled = false; + var cut = Render(p => p.Add(x => x.Visible, true) + .Add(x => x.Name, new SecretName("app/a")).Add(x => x.OnCancelled, () => cancelled = true)); + var pending = cut.Find("[data-testid=confirm-delete]").ClickAsync(new MouseEventArgs()); + await entered.Task; + try + { + Assert.True(cut.Find("[data-testid=cancel-delete]").HasAttribute("disabled")); + Assert.Equal("true", cut.Find("[role=dialog]").GetAttribute("aria-busy")); + cut.Find("[data-testid=cancel-delete]").Click(); + await cut.InvokeAsync(() => cut.Instance.RequestCancelAsync()); + cut.Find("[data-testid=confirm-delete]").Click(); + Assert.False(cancelled); + Assert.Empty(store.Deletes); + } + finally { release.TrySetResult(); await pending; } + Assert.Single(store.Deletes); + } + + [Fact] + public async Task ForcedTargetChangeAfterDeleteStarts_KeepsCommittedAuditAndCacheOnCapturedTarget() + { + var store = new RecordingSecretStore(); + var audit = new CapturingAuditWriter(); + var cache = new RecordingCacheInvalidator(); + Services.AddSingleton(store); + Services.AddSingleton(audit); + Services.AddSingleton(cache); + var auth = this.AddAuthorization(); + auth.SetAuthorized("reviewer"); + auth.SetPolicies(SecretsAuthorization.ManagePolicy); + var entered = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + var release = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + store.DeleteOverride = (_, _, _) => { entered.TrySetResult(); return release.Task; }; + bool deleted = false; + var a = new SecretName("app/a"); + var cut = Render(p => p.Add(x => x.Visible, true) + .Add(x => x.Name, a).Add(x => x.OnDeleted, () => deleted = true)); + var pending = cut.Find("[data-testid=confirm-delete]").ClickAsync(new MouseEventArgs()); + await entered.Task; + try { cut.Render(p => p.Add(x => x.Visible, true).Add(x => x.Name, new SecretName("app/b"))); } + finally { release.TrySetResult(); await pending; } + Assert.Equal(a, Assert.Single(store.Deletes).Name); + Assert.Equal(a.Value, Assert.Single(audit.Events).Target); + Assert.Equal(a, Assert.Single(cache.Invalidated)); + Assert.False(deleted); + Assert.Contains("app/b", cut.Find("[role=dialog]").TextContent); + } + + [Fact] + public async Task DisposalDuringDeferredOpen_ClosesBeforeDisposingTheModule() + { + RegisterDialogServices(); + var module = RegisterDeferredModule(); + var cut = Render(p => p.Add(x => x.Visible, true).Add(x => x.Name, new SecretName("app/a"))); + await module.OpenEntered.Task; + var disposal = cut.InvokeAsync(() => cut.Instance.DisposeAsync().AsTask()); + var repeatedDisposal = cut.InvokeAsync(() => cut.Instance.DisposeAsync().AsTask()); + await cut.InvokeAsync(() => Task.CompletedTask); // Let disposal reach the in-flight activation gate. + try + { + Assert.False(disposal.IsCompleted); + Assert.False(repeatedDisposal.IsCompleted); + Assert.DoesNotContain("dispose", module.Events); + } + finally { module.OpenRelease.TrySetResult(); } + await Task.WhenAll(disposal, repeatedDisposal); + Assert.Equal(new[] { "open:start", "open:end", "close", "dispose" }, module.Events); + Assert.False(module.Active); + } + + [Theory] + [InlineData(0)] // target changes while opening + [InlineData(1)] // visibility becomes false while opening + [InlineData(2)] // false then a newer visible identity while opening + public async Task SupersededOpening_CannotCloseANewerVisibleIdentity(int transition) + { + RegisterDialogServices(); + var module = RegisterDeferredModule(); + var cut = Render(p => p.Add(x => x.Visible, true).Add(x => x.Name, new SecretName("app/a"))); + await module.OpenEntered.Task; + if (transition != 0) cut.Render(p => p.Add(x => x.Visible, false).Add(x => x.Name, new SecretName("app/a"))); + if (transition != 1) cut.Render(p => p.Add(x => x.Visible, true).Add(x => x.Name, new SecretName("app/b"))); + module.OpenRelease.SetResult(); + await module.Closed.Task.WaitAsync(TimeSpan.FromSeconds(5)); + if (transition != 1) await module.SecondOpenCompleted.Task.WaitAsync(TimeSpan.FromSeconds(5)); + Assert.Equal(1, module.Events.Count(x => x == "close")); + Assert.Equal(transition == 1 ? 1 : 2, module.Events.Count(x => x == "open:end")); + Assert.Equal(transition != 1, module.Active); + if (transition != 1) Assert.Contains("app/b", cut.Find("[role=dialog]").TextContent); + else Assert.Empty(cut.FindAll("[role=dialog]")); + } + + private void RegisterDialogServices() + { + Services.AddSingleton(new RecordingSecretStore()); + Services.AddSingleton(new CapturingAuditWriter()); + } + + private DeferredDialogModule RegisterDeferredModule() + { + var module = new DeferredDialogModule(); + // Exact import only; all other runtime calls remain strict and unhandled. + Services.AddSingleton(new StrictDialogRuntime(module)); + return module; + } + + private sealed class StrictDialogRuntime(DeferredDialogModule module) : IJSRuntime + { + public ValueTask InvokeAsync(string identifier, object?[]? args) + => InvokeAsync(identifier, CancellationToken.None, args); + public ValueTask InvokeAsync(string identifier, CancellationToken ct, object?[]? args) + { + if (identifier != "import" || args is not ["./_content/ZB.MOM.WW.Secrets.Ui/js/secrets-dialog.js"] || typeof(TValue) != typeof(IJSObjectReference)) + throw new JSException($"Unexpected runtime interop: {identifier}"); + return ValueTask.FromResult((TValue)(object)module); + } + } + + private sealed class DeferredDialogModule : IJSObjectReference + { + private readonly ConcurrentQueue _events = new(); + private bool _disposed; + private int _opens; + public TaskCompletionSource Closed { get; } = new(TaskCreationOptions.RunContinuationsAsynchronously); + public TaskCompletionSource SecondOpenCompleted { get; } = new(TaskCreationOptions.RunContinuationsAsynchronously); + public TaskCompletionSource OpenEntered { get; } = new(TaskCreationOptions.RunContinuationsAsynchronously); + public TaskCompletionSource OpenRelease { get; } = new(TaskCreationOptions.RunContinuationsAsynchronously); + public IReadOnlyList Events => _events.ToArray(); + public bool Active { get; private set; } + public ValueTask InvokeAsync(string identifier, object?[]? args) + => InvokeAsync(identifier, CancellationToken.None, args); + public async ValueTask InvokeAsync(string identifier, CancellationToken ct, object?[]? args) + { + if (_disposed) throw new ObjectDisposedException(nameof(DeferredDialogModule)); + switch (identifier) + { + case "open": + _events.Enqueue("open:start"); + OpenEntered.TrySetResult(); + await OpenRelease.Task; + Active = true; + _events.Enqueue("open:end"); + if (++_opens == 2) SecondOpenCompleted.TrySetResult(); + break; + case "close": Active = false; _events.Enqueue("close"); Closed.TrySetResult(); break; + case "setBusy": _events.Enqueue("setBusy"); break; + default: throw new JSException($"Unexpected dialog interop: {identifier}"); + } + return default!; + } + public ValueTask DisposeAsync() + { + _events.Enqueue("dispose"); + _disposed = true; + return ValueTask.CompletedTask; + } + } + private IRenderedComponent RenderVisibleModal() { Services.AddSingleton(new RecordingSecretStore()); diff --git a/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/Fakes/DialogInterop.cs b/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/Fakes/DialogInterop.cs new file mode 100644 index 0000000..d478b93 --- /dev/null +++ b/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/Fakes/DialogInterop.cs @@ -0,0 +1,14 @@ +using Bunit; + +namespace ZB.MOM.WW.Secrets.Ui.Tests.Fakes; + +internal static class DialogInterop +{ + internal static void Setup(BunitJSInterop js) + { + var module = js.SetupModule("./_content/ZB.MOM.WW.Secrets.Ui/js/secrets-dialog.js"); + module.SetupVoid("open", _ => true).SetVoidResult(); + module.SetupVoid("setBusy", _ => true).SetVoidResult(); + module.SetupVoid("close", _ => true).SetVoidResult(); + } +} diff --git a/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/Fakes/RecordingSecretStore.cs b/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/Fakes/RecordingSecretStore.cs index 24dee90..8249d37 100644 --- a/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/Fakes/RecordingSecretStore.cs +++ b/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/Fakes/RecordingSecretStore.cs @@ -24,6 +24,20 @@ public sealed class RecordingSecretStore : ISecretStore /// Optional hook awaited before the normal recorded upsert commits. public Func? UpsertOverride { get; set; } + private int _listCalls; + + /// Number of metadata-list requests, including failed/retried reads. + public int ListCalls => _listCalls; + + /// Optional metadata listing fault. + public Exception? ListFault { get; set; } + + /// Optional controlled metadata read, including fixtures ignoring cancellation. + public Func>>? ListOverride { get; set; } + + /// Optional controlled delay before the normal delete commits. + public Func? DeleteOverride { get; set; } + /// Rows upserted, in call order. public IReadOnlyList Upserts => _upserts.ToArray(); @@ -66,20 +80,24 @@ public sealed class RecordingSecretStore : ISecretStore } /// - public Task DeleteAsync(SecretName name, string? actor, CancellationToken ct) + public async Task DeleteAsync(SecretName name, string? actor, CancellationToken ct) { + if (DeleteOverride is not null) await DeleteOverride(name, actor, ct); if (DeleteFault is not null) { throw DeleteFault; } _deletes.Enqueue((name, actor)); - return Task.FromResult(_rows.TryRemove(name.Value, out _)); + return _rows.TryRemove(name.Value, out _); } /// public Task> ListAsync(bool includeDeleted, CancellationToken ct) { + Interlocked.Increment(ref _listCalls); + if (ListOverride is not null) return ListOverride(includeDeleted, ct); + if (ListFault is not null) return Task.FromException>(ListFault); IReadOnlyList projection = _rows.Values .Where(r => includeDeleted || !r.IsDeleted) .Select(r => new SecretMetadata diff --git a/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/SecretEditorTests.cs b/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/SecretEditorTests.cs index 16f317d..fca43f3 100644 --- a/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/SecretEditorTests.cs +++ b/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/SecretEditorTests.cs @@ -439,6 +439,70 @@ public class SecretEditorTests : BunitContext Assert.Empty(cut.FindAll("[data-testid=editor-error]")); } + [Fact] + public void IdleEditor_CanBeCancelledWithoutMutation() + { + var (store, _, _) = RegisterServices(); + bool cancelled = false; + var cut = Render(p => p.Add(x => x.OnCancelled, () => cancelled = true)); + Assert.False(cut.Find("[data-testid=editor-cancel]").HasAttribute("disabled")); + cut.Find("[data-testid=editor-cancel]").Click(); + Assert.True(cancelled); + Assert.Empty(store.Upserts); + } + + [Fact] + public void EveryEditorControl_HasAnAssociatedLabel() + { + RegisterServices(); + var cut = Render(); + foreach (var control in cut.FindAll("input:not([type=hidden]),select")) + { + Assert.False(string.IsNullOrWhiteSpace(control.Id)); + Assert.NotNull(cut.Find($"label[for='{control.Id}']")); + } + } + + [Fact] + public void TwoEditors_UseUniqueStableIdsAndExistingDescriptions() + { + RegisterServices(); + var first = Render(); + var second = Render(); + var ids = first.FindAll("input,select").Select(x => x.Id).ToArray(); + Assert.DoesNotContain(ids, id => string.IsNullOrWhiteSpace(id)); + Assert.Empty(ids.Intersect(second.FindAll("input,select").Select(x => x.Id))); + first.Render(); + Assert.Equal(ids, first.FindAll("input,select").Select(x => x.Id)); + foreach (var control in first.FindAll("[aria-describedby]")) + foreach (var id in control.GetAttribute("aria-describedby")!.Split(' ', StringSplitOptions.RemoveEmptyEntries)) + Assert.NotNull(first.Find($"[id='{id}']")); + } + + [Fact] + public void InvalidName_AssociatesFieldErrorAndClearsInvalidStateOnValidSubmit() + { + var (store, _, _) = RegisterServices(); + AuthorizeManager(); + JSInterop.SetupVoid("Blazor._internal.domWrapper.focus", _ => true).SetVoidResult(); + var cut = Render(); + cut.Find("[data-testid=secret-name]").Change("../invalid"); + cut.Find("[data-testid=secret-value]").Change("synthetic value"); + cut.Find("[data-testid=editor-submit]").Click(); + var name = cut.Find("[data-testid=secret-name]"); + Assert.Equal("true", name.GetAttribute("aria-invalid")); + var described = name.GetAttribute("aria-describedby")!.Split(' ', StringSplitOptions.RemoveEmptyEntries); + Assert.Equal(2, described.Length); + Assert.Contains(described, id => cut.Find($"[id='{id}']").ClassList.Contains("field-error")); + Assert.Empty(store.Upserts); + Assert.Equal("password", cut.Find("[data-testid=secret-value]").GetAttribute("type")); + Assert.Equal("new-password", cut.Find("[data-testid=secret-value]").GetAttribute("autocomplete")); + cut.Find("[data-testid=secret-name]").Change("app/valid"); + cut.Find("[data-testid=editor-submit]").Click(); + Assert.Null(cut.Find("[data-testid=secret-name]").GetAttribute("aria-invalid")); + Assert.Single(store.Upserts); + } + private sealed class LateResolutionGuardProvider(IServiceProvider inner) : IServiceProvider { public bool RejectResolutions { get; set; } diff --git a/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/SecretsListTests.cs b/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/SecretsListTests.cs index b6db548..79a2253 100644 --- a/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/SecretsListTests.cs +++ b/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/SecretsListTests.cs @@ -1,3 +1,4 @@ +using Microsoft.AspNetCore.Components; using Bunit; using Bunit.TestDoubles; using Microsoft.Extensions.DependencyInjection; @@ -12,6 +13,8 @@ namespace ZB.MOM.WW.Secrets.Ui.Tests; public class SecretsListTests : BunitContext { + public SecretsListTests() => DialogInterop.Setup(JSInterop); + private static readonly SecretMetadata SecretOne = new() { Name = new SecretName("db/primary"), @@ -200,6 +203,142 @@ public class SecretsListTests : BunitContext Assert.Single(store.Upserts); } + [Fact] + public void DeletionFocusFallback_SelectsAdjacentRowThenStableHeadingForOneRow() + { + RegisterEditableStore(); + var cut = Render(); + var actions = cut.FindAll(".delete-secret"); + var firstName = actions[0].GetAttribute("data-secret-name"); + var nextId = actions[1].Id; + actions[0].Click(); + Assert.Equal(nextId, cut.FindComponent().Instance.ReturnFocusId); + cut.Find("[data-testid=confirm-delete]").Click(); + Assert.Single(cut.FindAll(".delete-secret")); + Assert.DoesNotContain(cut.FindAll(".delete-secret"), action => action.GetAttribute("data-secret-name") == firstName); + cut.Find(".delete-secret").Click(); + Assert.Equal(cut.Find("h2").Id, cut.FindComponent().Instance.ReturnFocusId); + } + + [Fact] + public void InitialListFailure_IsRetryableAndIsNotAnEmptyInventory() + { + var store = RegisterEditableStore(); + store.ListFault = new IOException("synthetic outage"); + var cut = Render(); + Assert.NotNull(cut.Find("[data-testid=list-error]")); + Assert.DoesNotContain("No secrets.", cut.Markup); + store.ListFault = null; + cut.Find("[data-testid=list-retry]").Click(); + Assert.Equal(2, store.ListCalls); + Assert.Empty(cut.FindAll("[data-testid=list-error]")); + Assert.NotEmpty(cut.FindAll("tbody tr")); + Assert.Empty(store.Upserts); + Assert.Empty(store.Deletes); + } + + [Fact] + public void DelayedInitialMetadata_IsLoadingUntilTheReadCompletes() + { + var store = RegisterEditableStore(); + var result = new TaskCompletionSource>(TaskCreationOptions.RunContinuationsAsynchronously); + store.ListOverride = (_, _) => result.Task; + var cut = Render(); + Assert.NotNull(cut.Find("[data-testid=list-loading]")); + Assert.DoesNotContain("No secrets.", cut.Markup); + result.SetResult([SecretOne]); + cut.WaitForAssertion(() => Assert.Single(cut.FindAll("tbody tr"))); + Assert.Empty(cut.FindAll("[data-testid=list-loading]")); + } + + [Fact] + public void CommittedSaveAndFailedRefresh_ClosesEditorAndRetriesOnlyMetadata() + { + var store = RegisterEditableStore(); + var cut = Render(); + cut.Find(".rotate-secret[data-secret-name='db/primary']").Click(); + cut.Find("[data-testid=secret-value]").Change("synthetic replacement"); + store.ListFault = new IOException("synthetic refresh outage"); + cut.Find("[data-testid=editor-submit]").Click(); + Assert.Single(store.Upserts); + Assert.Empty(cut.FindComponents()); + Assert.Contains("Change saved; list refresh failed", cut.Find("[data-testid=list-error]").TextContent); + Assert.Equal(2, cut.FindAll("tbody tr").Count); // Keep previously visible metadata. + store.ListFault = null; + cut.Find("[data-testid=list-retry]").Click(); + Assert.Empty(cut.FindAll("[data-testid=list-error]")); + Assert.Single(store.Upserts); // Retrying a read cannot replay the committed write. + Assert.Empty(store.Deletes); + } + + [Fact] + public void CommittedDeleteAndFailedRefresh_RetryDoesNotDeleteTwice() + { + var store = RegisterEditableStore(); + var cut = Render(); + cut.Find(".delete-secret[data-secret-name='db/primary']").Click(); + store.ListFault = new IOException("synthetic refresh outage"); + cut.Find("[data-testid=confirm-delete]").Click(); + Assert.Single(store.Deletes); + Assert.Empty(cut.FindAll("[role=dialog]")); + Assert.Contains("Change saved; list refresh failed", cut.Find("[data-testid=list-error]").TextContent); + store.ListFault = null; + cut.Find("[data-testid=list-retry]").Click(); + Assert.Single(store.Deletes); + Assert.Empty(store.Upserts); + Assert.Single(cut.FindAll("tbody tr")); + Assert.Empty(cut.FindAll("[data-testid=list-error]")); + } + + [Theory] + [InlineData(false)] + [InlineData(true)] + public void NewFailedMutation_DoesNotRetainThePreviousSavesSuccess(bool delete) + { + var store = RegisterEditableStore(); + var cut = Render(); + cut.Find(".rotate-secret[data-secret-name='db/primary']").Click(); + cut.Find("[data-testid=secret-value]").Change("synthetic first value"); + cut.Find("[data-testid=editor-submit]").Click(); + Assert.Contains("Change saved.", cut.Find("[data-testid=list-outcome]").TextContent); + int reads = store.ListCalls; + if (delete) + { + store.DeleteFault = new IOException("synthetic second mutation failure"); + cut.Find(".delete-secret[data-secret-name='api/token']").Click(); + cut.Find("[data-testid=confirm-delete]").Click(); + Assert.NotNull(cut.Find("[data-testid=delete-error]")); + } + else + { + store.UpsertFault = new IOException("synthetic second mutation failure"); + cut.Find(".rotate-secret[data-secret-name='api/token']").Click(); + cut.Find("[data-testid=secret-value]").Change("synthetic second value"); + cut.Find("[data-testid=editor-submit]").Click(); + Assert.NotNull(cut.Find("[data-testid=editor-error]")); + } + Assert.Empty(cut.FindAll("[data-testid=list-outcome]")); + Assert.Single(store.Upserts); + Assert.Empty(store.Deletes); + Assert.Equal(reads, store.ListCalls); + Assert.Equal(2, cut.FindAll("tbody tr").Count); + } + + [Fact] + public void RemovingList_CancelsReadAndIgnoresItsLateCompletion() + { + var store = RegisterEditableStore(); + var result = new TaskCompletionSource>(TaskCreationOptions.RunContinuationsAsynchronously); + CancellationToken token = default; + store.ListOverride = (_, ct) => { token = ct; return result.Task; }; + RenderFragment list = builder => { builder.OpenComponent(0); builder.CloseComponent(); }; + var cut = Render>(p => p.Add(x => x.Value, true).AddChildContent(list)); + cut.Render(p => p.Add(x => x.Value, true).AddChildContent((RenderFragment)(_ => { }))); + Assert.True(token.IsCancellationRequested); + result.SetResult([SecretOne]); // A non-cooperative read must not recreate the removed UI. + Assert.Empty(cut.FindAll("table")); + } + private RecordingSecretStore RegisterEditableStore() { var store = new RecordingSecretStore(); diff --git a/components/ui-theme/validation/secrets-ui/SEC02-04-after.log b/components/ui-theme/validation/secrets-ui/SEC02-04-after.log new file mode 100644 index 0000000..daf9bc5 --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/SEC02-04-after.log @@ -0,0 +1,11 @@ + Determining projects to restore... + All projects are up-to-date for restore. + ZB.MOM.WW.Secrets.Abstractions -> /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Abstractions/bin/Release/net10.0/ZB.MOM.WW.Secrets.Abstractions.dll + ZB.MOM.WW.Secrets.Ui -> /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/bin/Release/net10.0/ZB.MOM.WW.Secrets.Ui.dll + ZB.MOM.WW.Secrets.Ui.Tests -> /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/bin/Release/net10.0/ZB.MOM.WW.Secrets.Ui.Tests.dll +Test run for /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/bin/Release/net10.0/ZB.MOM.WW.Secrets.Ui.Tests.dll (.NETCoreApp,Version=v10.0) +A total of 1 test files matched the specified pattern. +WARNING: Overwriting results file: /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/components/ui-theme/validation/secrets-ui/SEC02-04-after.trx +Results File: /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/components/ui-theme/validation/secrets-ui/SEC02-04-after.trx + +Passed! - Failed: 0, Passed: 69, Skipped: 0, Total: 69, Duration: 258 ms - ZB.MOM.WW.Secrets.Ui.Tests.dll (net10.0) diff --git a/components/ui-theme/validation/secrets-ui/SEC02-04-after.trx b/components/ui-theme/validation/secrets-ui/SEC02-04-after.trx new file mode 100644 index 0000000..bf18cae --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/SEC02-04-after.trx @@ -0,0 +1,442 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v3.1.4+50e68bbb8b (64-bit .NET 10.0.14) +[xUnit.net 00:00:00.03] Discovering: ZB.MOM.WW.Secrets.Ui.Tests +[xUnit.net 00:00:00.05] Discovered: ZB.MOM.WW.Secrets.Ui.Tests +[xUnit.net 00:00:00.06] Starting: ZB.MOM.WW.Secrets.Ui.Tests +[xUnit.net 00:00:00.33] Finished: ZB.MOM.WW.Secrets.Ui.Tests + + + + \ No newline at end of file diff --git a/components/ui-theme/validation/secrets-ui/SEC02-04-browser-before-focus-fix.json b/components/ui-theme/validation/secrets-ui/SEC02-04-browser-before-focus-fix.json new file mode 100644 index 0000000..581d054 --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/SEC02-04-browser-before-focus-fix.json @@ -0,0 +1,182 @@ +[ + { + "origin": "http://127.0.0.1:53202", + "checks": [ + { + "name": "Label activates Name", + "pass": true + }, + { + "name": "Invalid field receives focus", + "pass": true + }, + { + "name": "Invalid name has existing hint/error associations", + "pass": true + }, + { + "name": "Initial Cancel focus", + "pass": true + }, + { + "name": "Forward Tab wraps", + "pass": true + }, + { + "name": "Reverse Tab wraps", + "pass": true + }, + { + "name": "Native background isolation", + "pass": true + }, + { + "name": "Cancel restores trigger focus", + "pass": true + }, + { + "name": "Cancel does not delete", + "pass": true + }, + { + "name": "Failed deletion retains exact-target dialog", + "pass": true + }, + { + "name": "Busy Escape stays open", + "pass": true + }, + { + "name": "Busy Cancel disabled", + "pass": true + }, + { + "name": "Busy parent target switching disabled", + "pass": true + }, + { + "name": "Removed trigger focuses adjacent row", + "pass": false + }, + { + "name": "Scroll lock restored", + "pass": true + }, + { + "name": "Committed save is distinct from refresh failure", + "pass": true + }, + { + "name": "Retry reads metadata only", + "pass": true + }, + { + "name": "Manage-only principal cannot reveal", + "pass": true + }, + { + "name": "Denied principal rejected at route", + "pass": true + }, + { + "name": "No page errors", + "pass": true + } + ], + "failures": [ + "Removed trigger focuses adjacent row" + ], + "errors": [], + "errorInk": "rgb(180, 33, 33)" + }, + { + "origin": "http://127.0.0.1:53233", + "checks": [ + { + "name": "Label activates Name", + "pass": true + }, + { + "name": "Invalid field receives focus", + "pass": true + }, + { + "name": "Invalid name has existing hint/error associations", + "pass": true + }, + { + "name": "Initial Cancel focus", + "pass": true + }, + { + "name": "Forward Tab wraps", + "pass": true + }, + { + "name": "Reverse Tab wraps", + "pass": true + }, + { + "name": "Native background isolation", + "pass": true + }, + { + "name": "Cancel restores trigger focus", + "pass": true + }, + { + "name": "Cancel does not delete", + "pass": true + }, + { + "name": "Failed deletion retains exact-target dialog", + "pass": true + }, + { + "name": "Busy Escape stays open", + "pass": true + }, + { + "name": "Busy Cancel disabled", + "pass": true + }, + { + "name": "Busy parent target switching disabled", + "pass": true + }, + { + "name": "Removed trigger focuses adjacent row", + "pass": false + }, + { + "name": "Scroll lock restored", + "pass": true + }, + { + "name": "Committed save is distinct from refresh failure", + "pass": true + }, + { + "name": "Retry reads metadata only", + "pass": true + }, + { + "name": "Manage-only principal cannot reveal", + "pass": true + }, + { + "name": "Denied principal rejected at route", + "pass": true + }, + { + "name": "No page errors", + "pass": true + } + ], + "failures": [ + "Removed trigger focuses adjacent row" + ], + "errors": [], + "errorInk": "rgb(180, 33, 33)" + } +] diff --git a/components/ui-theme/validation/secrets-ui/SEC02-04-browser-final.json b/components/ui-theme/validation/secrets-ui/SEC02-04-browser-final.json new file mode 100644 index 0000000..9e940a7 --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/SEC02-04-browser-final.json @@ -0,0 +1,178 @@ +[ + { + "origin": "http://127.0.0.1:53202", + "checks": [ + { + "name": "Label activates Name", + "pass": true + }, + { + "name": "Invalid field receives focus", + "pass": true + }, + { + "name": "Invalid name has existing hint/error associations", + "pass": true + }, + { + "name": "Initial Cancel focus", + "pass": true + }, + { + "name": "Forward Tab wraps", + "pass": true + }, + { + "name": "Reverse Tab wraps", + "pass": true + }, + { + "name": "Native background isolation", + "pass": true + }, + { + "name": "Cancel restores trigger focus", + "pass": true + }, + { + "name": "Cancel does not delete", + "pass": true + }, + { + "name": "Failed deletion retains exact-target dialog", + "pass": true + }, + { + "name": "Busy Escape stays open", + "pass": true + }, + { + "name": "Busy Cancel disabled", + "pass": true + }, + { + "name": "Busy parent target switching disabled", + "pass": true + }, + { + "name": "Removed trigger focuses adjacent row", + "pass": true + }, + { + "name": "Scroll lock restored", + "pass": true + }, + { + "name": "Committed save is distinct from refresh failure", + "pass": true + }, + { + "name": "Retry reads metadata only", + "pass": true + }, + { + "name": "Manage-only principal cannot reveal", + "pass": true + }, + { + "name": "Denied principal rejected at route", + "pass": true + }, + { + "name": "No page errors", + "pass": true + } + ], + "failures": [], + "errors": [], + "errorInk": "rgb(180, 33, 33)" + }, + { + "origin": "http://127.0.0.1:53233", + "checks": [ + { + "name": "Label activates Name", + "pass": true + }, + { + "name": "Invalid field receives focus", + "pass": true + }, + { + "name": "Invalid name has existing hint/error associations", + "pass": true + }, + { + "name": "Initial Cancel focus", + "pass": true + }, + { + "name": "Forward Tab wraps", + "pass": true + }, + { + "name": "Reverse Tab wraps", + "pass": true + }, + { + "name": "Native background isolation", + "pass": true + }, + { + "name": "Cancel restores trigger focus", + "pass": true + }, + { + "name": "Cancel does not delete", + "pass": true + }, + { + "name": "Failed deletion retains exact-target dialog", + "pass": true + }, + { + "name": "Busy Escape stays open", + "pass": true + }, + { + "name": "Busy Cancel disabled", + "pass": true + }, + { + "name": "Busy parent target switching disabled", + "pass": true + }, + { + "name": "Removed trigger focuses adjacent row", + "pass": true + }, + { + "name": "Scroll lock restored", + "pass": true + }, + { + "name": "Committed save is distinct from refresh failure", + "pass": true + }, + { + "name": "Retry reads metadata only", + "pass": true + }, + { + "name": "Manage-only principal cannot reveal", + "pass": true + }, + { + "name": "Denied principal rejected at route", + "pass": true + }, + { + "name": "No page errors", + "pass": true + } + ], + "failures": [], + "errors": [], + "errorInk": "rgb(180, 33, 33)" + } +] diff --git a/components/ui-theme/validation/secrets-ui/SEC02-04-browser-initial-fixture.json b/components/ui-theme/validation/secrets-ui/SEC02-04-browser-initial-fixture.json new file mode 100644 index 0000000..19a9921 --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/SEC02-04-browser-initial-fixture.json @@ -0,0 +1,18 @@ +[ + { + "origin": "http://127.0.0.1:52992", + "checks": [], + "failures": [ + "Error: locator.click: Error: strict mode violation: getByText('Name', { exact: true }) resolved to 2 elements:\n 1) aka locator('label').filter({ hasText: 'Name' })\n 2) Name aka getByRole('columnheader', { name: 'Name' })\n\nCall log:\n - waiting for getByText('Name', { exact: true })\n" + ], + "errors": [] + }, + { + "origin": "http://127.0.0.1:53025", + "checks": [], + "failures": [ + "TimeoutError: locator.waitFor: Timeout 30000ms exceeded.\nCall log:\n - waiting for getByTestId('secret-name') to be visible\n" + ], + "errors": [] + } +] diff --git a/components/ui-theme/validation/secrets-ui/SEC02-04-browser.js b/components/ui-theme/validation/secrets-ui/SEC02-04-browser.js new file mode 100644 index 0000000..6f2dc43 --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/SEC02-04-browser.js @@ -0,0 +1,71 @@ +async (page) => { + const context = await page.context().browser().newContext({ viewport: { width: 1440, height: 1000 } }); + const results = []; + try { + for (const origin of ['http://127.0.0.1:53202', 'http://127.0.0.1:53233']) { + const p = await context.newPage(); p.setDefaultTimeout(7000); + const row = { origin, checks: [], failures: [], errors: [] }; + p.on('pageerror', e => row.errors.push(e.message)); + const check = (name, pass) => { row.checks.push({ name, pass: !!pass }); if (!pass) row.failures.push(name); }; + const faults = async data => { const r = await p.request.post(origin + '/fixture/faults', { data }); if (r.status() !== 204) throw Error('Fixture fault response ' + r.status()); }; + const counts = async () => (await p.request.get(origin + '/fixture/counts')).json(); + const focused = async id => { + try { await p.waitForFunction(id => document.activeElement?.id === id, id, { timeout: 2000 }); return true; } catch { return false; } + }; + try { + await p.goto(origin + '/admin/secrets'); + await p.locator('[data-fixture-ready=true]').waitFor(); + const initialCounts = await counts(); + await p.getByTestId('add-secret').click(); + const name = p.getByTestId('secret-name'); await name.waitFor(); + await p.locator('label').filter({ hasText: /^Name$/ }).click(); + check('Label activates Name', await name.evaluate(n => n === document.activeElement)); + await name.fill('../invalid'); await p.getByTestId('secret-value').fill('synthetic input'); + await p.getByTestId('editor-submit').click(); + await name.locator('xpath=..').locator('.field-error').waitFor(); + check('Invalid field receives focus', await focused(await name.getAttribute('id'))); + check('Invalid name has existing hint/error associations', await name.evaluate(n => n.getAttribute('aria-invalid') === 'true' && n.getAttribute('aria-describedby').split(' ').every(id => document.getElementById(id)))); + row.errorInk = await name.locator('xpath=..').locator('.field-error').evaluate(n => getComputedStyle(n).color); + await p.getByTestId('editor-cancel').click(); await name.waitFor({ state: 'hidden' }); + const trigger = p.locator('.delete-secret').first(); const triggerId = await trigger.getAttribute('id'); const triggerName = await trigger.getAttribute('data-secret-name'); + await trigger.click(); await p.locator('dialog:modal').waitFor(); + check('Initial Cancel focus', await focused(await p.getByTestId('cancel-delete').getAttribute('id'))); + await p.keyboard.press('Tab'); check('Forward Tab wraps', await p.getByTestId('confirm-delete').evaluate(n => n === document.activeElement)); + await p.keyboard.press('Shift+Tab'); check('Reverse Tab wraps', await p.getByTestId('cancel-delete').evaluate(n => n === document.activeElement)); + await p.getByTestId('add-secret').evaluate(n => n.focus()); + check('Native background isolation', await p.locator('dialog').evaluate(n => n.contains(document.activeElement))); + await p.keyboard.press('Escape'); await p.locator('dialog').waitFor({ state: 'hidden' }); + check('Cancel restores trigger focus', await focused(triggerId)); + check('Cancel does not delete', (await counts()).deletes === initialCounts.deletes); + await faults({ write: true }); await p.locator('.delete-secret').first().click(); + await p.getByTestId('confirm-delete').click(); await p.getByTestId('delete-error').waitFor(); + check('Failed deletion retains exact-target dialog', await p.locator('dialog:modal').count() === 1 && (await p.locator('dialog h3').innerText()).includes(triggerName)); + await p.keyboard.press('Escape'); await p.locator('dialog').waitFor({ state: 'hidden' }); + await faults({ delayMs: 800 }); + const nextId = await p.locator('.delete-secret').nth(1).getAttribute('id'); + await p.locator('.delete-secret').first().click(); await p.getByTestId('confirm-delete').click(); + await p.waitForFunction(() => document.querySelector('dialog')?.getAttribute('aria-busy') === 'true'); + await p.keyboard.press('Escape'); + check('Busy Escape stays open', await p.locator('dialog:modal').count() === 1); + check('Busy Cancel disabled', await p.getByTestId('cancel-delete').isDisabled()); + check('Busy parent target switching disabled', await p.getByTestId('add-secret').isDisabled()); + await p.locator('dialog').waitFor({ state: 'hidden' }); + check('Removed trigger focuses adjacent row', await focused(nextId)); + check('Scroll lock restored', await p.evaluate(() => document.body.style.overflow !== 'hidden')); + await faults({}); await p.locator('.rotate-secret').first().click(); + await p.getByTestId('secret-value').fill('synthetic replacement'); await faults({ list: true }); + await p.getByTestId('editor-submit').click(); await p.getByTestId('list-error').waitFor(); + check('Committed save is distinct from refresh failure', (await p.getByTestId('list-error').innerText()).includes('Change saved; list refresh failed')); + const before = await counts(); await faults({}); await p.getByTestId('list-retry').click(); + await p.getByTestId('list-error').waitFor({ state: 'hidden' }); const after = await counts(); + check('Retry reads metadata only', before.upserts === initialCounts.upserts + 1 && after.upserts === before.upserts && after.deletes === initialCounts.deletes + 1 && after.lists > before.lists); + await p.goto(origin + '/admin/secrets?role=manage'); await p.locator('[data-fixture-ready=true]').waitFor(); + check('Manage-only principal cannot reveal', await p.getByTestId('reveal-button').count() === 0); + check('Denied principal rejected at route', (await p.request.get(origin + '/admin/secrets?role=denied')).status() === 403); + check('No page errors', row.errors.length === 0); + } catch (e) { row.failures.push(String(e)); } + results.push(row); await p.close(); + } + } finally { await context.close(); } + return results; +} diff --git a/components/ui-theme/validation/secrets-ui/SEC02-04-fixture-source-hashes.json b/components/ui-theme/validation/secrets-ui/SEC02-04-fixture-source-hashes.json new file mode 100644 index 0000000..0724ca6 --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/SEC02-04-fixture-source-hashes.json @@ -0,0 +1,10 @@ +{ + "OtOpcUaPerPageWrapper": { + "path": "/Users/dohertj2/Desktop/OtOpcUa/src/Server/ZB.MOM.WW.OtOpcUa.AdminUI/Components/Pages/SecretsAdmin.razor", + "sha256": "3443baf0e4500187e9c911b954e1185ef902bd0600802b6edd0b9fb9d098d91c" + }, + "Bootstrap": { + "path": "/Users/dohertj2/Desktop/ScadaBridge/src/ZB.MOM.WW.ScadaBridge.Host/wwwroot/lib/bootstrap/css/bootstrap.min.css", + "sha256": "3c8f27e6009ccfd710a905e6dcf12d0ee3c6f2ac7da05b0572d3e0d12e736fc8" + } +} diff --git a/components/ui-theme/validation/secrets-ui/SEC02-04-host-provenance.json b/components/ui-theme/validation/secrets-ui/SEC02-04-host-provenance.json new file mode 100644 index 0000000..7a6a683 --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/SEC02-04-host-provenance.json @@ -0,0 +1,21 @@ +{ + "browser": "157.0.8103.78", + "hosts": [ + { + "origin": "http://127.0.0.1:53202", + "purpose": "Loopback synthetic Secrets UI acceptance fixture; not a production host", + "theme": "1.0.0.0", + "ui": "0.6.6.0", + "store": "In-memory fake only; no keys, LDAP, SQL, network services or production credentials", + "bootstrap": "/Users/dohertj2/Desktop/ScadaBridge/src/ZB.MOM.WW.ScadaBridge.Host/wwwroot/lib/bootstrap/css" + }, + { + "origin": "http://127.0.0.1:53233", + "purpose": "Loopback synthetic Secrets UI acceptance fixture; not a production host", + "theme": "1.0.0.0", + "ui": "0.6.6.0", + "store": "In-memory fake only; no keys, LDAP, SQL, network services or production credentials", + "bootstrap": "/Users/dohertj2/Desktop/ScadaBridge/src/ZB.MOM.WW.ScadaBridge.Host/wwwroot/lib/bootstrap/css" + } + ] +} diff --git a/components/ui-theme/validation/secrets-ui/SEC02-04-test-identities.json b/components/ui-theme/validation/secrets-ui/SEC02-04-test-identities.json new file mode 100644 index 0000000..8cf9287 --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/SEC02-04-test-identities.json @@ -0,0 +1,27 @@ +{ + "before": 50, + "after": 69, + "added": [ + "ZB.MOM.WW.Secrets.Ui.Tests.ConfirmDeleteModalTests.DeleteDialog_HasANameLinkedToTheExactTarget", + "ZB.MOM.WW.Secrets.Ui.Tests.ConfirmDeleteModalTests.DisposalDuringDeferredOpen_ClosesBeforeDisposingTheModule", + "ZB.MOM.WW.Secrets.Ui.Tests.ConfirmDeleteModalTests.ForcedTargetChangeAfterDeleteStarts_KeepsCommittedAuditAndCacheOnCapturedTarget", + "ZB.MOM.WW.Secrets.Ui.Tests.ConfirmDeleteModalTests.PendingDelete_BlocksCancelEscapeAndDuplicateActivation", + "ZB.MOM.WW.Secrets.Ui.Tests.ConfirmDeleteModalTests.SupersededOpening_CannotCloseANewerVisibleIdentity(transition: 0)", + "ZB.MOM.WW.Secrets.Ui.Tests.ConfirmDeleteModalTests.SupersededOpening_CannotCloseANewerVisibleIdentity(transition: 1)", + "ZB.MOM.WW.Secrets.Ui.Tests.ConfirmDeleteModalTests.SupersededOpening_CannotCloseANewerVisibleIdentity(transition: 2)", + "ZB.MOM.WW.Secrets.Ui.Tests.SecretEditorTests.EveryEditorControl_HasAnAssociatedLabel", + "ZB.MOM.WW.Secrets.Ui.Tests.SecretEditorTests.IdleEditor_CanBeCancelledWithoutMutation", + "ZB.MOM.WW.Secrets.Ui.Tests.SecretEditorTests.InvalidName_AssociatesFieldErrorAndClearsInvalidStateOnValidSubmit", + "ZB.MOM.WW.Secrets.Ui.Tests.SecretEditorTests.TwoEditors_UseUniqueStableIdsAndExistingDescriptions", + "ZB.MOM.WW.Secrets.Ui.Tests.SecretsListTests.CommittedDeleteAndFailedRefresh_RetryDoesNotDeleteTwice", + "ZB.MOM.WW.Secrets.Ui.Tests.SecretsListTests.CommittedSaveAndFailedRefresh_ClosesEditorAndRetriesOnlyMetadata", + "ZB.MOM.WW.Secrets.Ui.Tests.SecretsListTests.DelayedInitialMetadata_IsLoadingUntilTheReadCompletes", + "ZB.MOM.WW.Secrets.Ui.Tests.SecretsListTests.DeletionFocusFallback_SelectsAdjacentRowThenStableHeadingForOneRow", + "ZB.MOM.WW.Secrets.Ui.Tests.SecretsListTests.InitialListFailure_IsRetryableAndIsNotAnEmptyInventory", + "ZB.MOM.WW.Secrets.Ui.Tests.SecretsListTests.NewFailedMutation_DoesNotRetainThePreviousSavesSuccess(delete: False)", + "ZB.MOM.WW.Secrets.Ui.Tests.SecretsListTests.NewFailedMutation_DoesNotRetainThePreviousSavesSuccess(delete: True)", + "ZB.MOM.WW.Secrets.Ui.Tests.SecretsListTests.RemovingList_CancelsReadAndIgnoresItsLateCompletion" + ], + "removed": [], + "changedOutcomes": {} +} diff --git a/components/ui-theme/validation/secrets-ui/SEC02-04.md b/components/ui-theme/validation/secrets-ui/SEC02-04.md new file mode 100644 index 0000000..7d3a029 --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/SEC02-04.md @@ -0,0 +1,33 @@ +# SEC-02–04 review checkpoint + +Managed worktree `codex/scada-ui-consistency`, after SEC-01 `f07bd3c` and accepted G1. No release/version changes beyond exact Theme package adoption; no deployment or real-secret activity. + +## Implemented contracts + +**SEC-02:** central Theme reference `0.2.0` → exact `1.0.0`. Every editor control has a stable per-instance ID and visible associated label. Name and value hints, optional non-credential description guidance, field-local invalid-name error IDs and conditional `aria-invalid`/`aria-describedby` use the Theme API. Password/new-password behavior preserved. Invalid-name focus occurs after the controls have been re-enabled and rendered, verified with real keyboard/browser state. Required-name help documents existing normalization/450-character constraints, without changing validation rules. BusyText and caller-disabled states are separated; idle Cancel remains operable. General errors announce only non-sensitive outcomes. + +**SEC-03:** namespaced native `` with associated exact-target title/description, initial Cancel focus and an RCL DOM module. The top layer prevents a transformed host ancestor from clipping the dialog and supplies native background inertness without altering pre-existing inert attributes. Actual keydown/cancel events synchronously prevent defaults; forward/reverse Tab wrap, safe Escape closes, busy Escape/Cancel cannot imply rollback. Each instance captures its own trigger and stores cleanup by instance handle so Blazor removal does not require resolving an already-removed element reference. Delete captures target/auth/callback/token and cache/logger before mutation waits; forced target changes cannot drift audit/cache target or invoke an obsolete completion. All existing audit-failure/authorization checks are retained. The list chooses adjacent row, then its stable heading, as focus fallback. Activation/close/disposal are serialized behind a private lifecycle gate; attempted activation is tracked before the JS await, and repeated DisposeAsync calls share the same cleanup task. Strict deferred-open tests verify close before module/reference disposal and prevent old target/Visible continuations closing a newer identity. Native `::backdrop` is the single .45 dimming layer; the retained namespaced child is transparent and non-interactive. Dialog/card explicitly use border-box without depending on a host reset. + +A real two-host browser regression caught the child-disposal/parent-render ordering problem: adjacent controls were still disabled when immediate focus restoration ran. The module now restores focus after actual DOM mutation using a bounded observer; it removes native listeners and restores scroll immediately, disconnects the observer after successful focus or a three-second bound, and avoids stealing focus from a newer modal. It excludes hidden/visibility-hidden ancestors, verifies actual focus, then tries the logical fallback if a connected trigger rejects focus; it observes hidden/style/class/disabled/inert changes while waiting for a legitimately disabled adjacent action. Both hosts confirm the corrected behavior. This is supported-modern-browser native dialog behavior, not a promise for IE or engines lacking `showModal`/`:modal`. + +**SEC-04:** initial loading, empty metadata inventory and read failure are distinct. Failures retain prior metadata and expose Retry refresh. Committed save/delete plus failed refresh closes the completed editor/dialog and reports “Change saved; list refresh failed”; Retry reads metadata and never replays a mutation. Listing owns linked read cancellation and generation checks; disposed or superseded reads do not update current UI. No values/ciphertext are included in list projections. A new current-generation mutation clears the previous generic success outcome on busy=true; failed Rotate/Delete cannot retain another operation’s “Change saved.” message. Prior metadata/read-error evidence remains intact. + +## Evidence and limitations + +- SEC-02 red: 3 failures/3 association/unique-ID/invalid-state tests. Initial editor-focused green: 22 passed. Initial full SEC-02: 53 passed; an idle Cancel regression was subsequently added when replacing unmatched component disabled attributes with explicit Razor expressions. +- SEC-03 red: the required associated dialog-name regression failed. Existing strict JS tests now permit only the exact `./_content/ZB.MOM.WW.Secrets.Ui/js/secrets-dialog.js` module and its `open`/`setBusy`/`close` calls; arbitrary confirm/alert remains forbidden. Helper/stub constructors in policy/audit tests are necessary integration changes; no assertions were weakened. +- SEC-04 red: 3 failed/1 passed; original component threw initial/refresh exceptions and lacked explicit loading. Added separate committed-save and committed-delete retry checks, and cancellation of an unmounted delayed read. +- Final whole Release UI suite: **69 passed, 0 failed, 0 skipped** (`SEC02-04-after.trx`, `.log`). All 50 SEC-01 identities/outcomes preserved, 19 additional regressions (`SEC02-04-test-identities.json`). `git diff --check -- ZB.MOM.WW.Secrets` passed. +- Browser Chromium **157.0.8103.78**, 20 checks × 2 hosts = **40 passed**, zero page errors (`SEC02-04-browser-final.json`). Before-fix focus failures are retained separately. First setup attempts are retained as fixture corrections: HTTP synthetic auth registration, label-specific selection, and an explicit OnAfterRender readiness marker to avoid clicks on prerendered nodes. +- Source canary origins: per-page **http://127.0.0.1:53202**, global-interactive Bootstrap **http://127.0.0.1:53233**. They use source UI assembly **0.6.6.0** and published Theme **1.0.0.0**, not a claimed UI1.0.0 package. The per-page fixture links the exact current OtOpcUa `SecretsAdmin.razor` wrapper and intentionally omits Bootstrap as a diagnostic; the other composes the page under a global interactive router with the actual vendored Bootstrap CSS. Source hashes and actual provenance are saved. No RCL assembly routes are registered alongside the wrapper, avoiding the duplicated `/admin/secrets` route. +- Independent review hardening: deferred-open disposal negative probe **1 failed** (`SEC03-lifecycle-red.*`); lifecycle final focused **4 passed** (`SEC03-lifecycle.*`). Recording runtime accepts only the exact import and module methods, rejects disposed-reference invocation, and asserts one close then module disposal. Two repeated disposal callers both await that cleanup. Stale-success negative probe **2 failed** (`SEC04-outcome-red.*`); both final two-operation cases pass. +- Focused JS-module browser probe: **12/12** (hidden trigger/ancestor, disabled trigger, visible nonfocusable trigger, disabled adjacent action becoming enabled, hidden Tab controls) in `SEC03-focus-probe.json`. Focused rebuilt component confirmation (`SEC03-reviewed-component-browser.json`) passed all checks at **http://127.0.0.1:54281** (390px per-page) and **http://127.0.0.1:54288** (1440px Bootstrap), including hidden-origin fallback, three successive deletions ending at heading focus, native overlay cleanup, and no page errors. Computed backdrop rgba(15,18,20,.45), child transparent; card widths358/390 and480/1440 with border-box. Inspected `SEC03-dialog-perpage.png` and `SEC03-dialog-bootstrap.png`; long targets wrap inside the card. These processes supersede the prior source-canary sessions; prior evidence retains its actual origins. No broad screenshot loop. +- These are disposable loopback synthetic hosts, not the complete deployed OtOpcUa/ScadaBridge applications. Fakes contain illustrative strings only, no keys, LDAP, SQL or production network services. Only these own process sessions were restarted; no other worker’s ports were used. +- Keyboard cases include real label activation/error focus, safe focus, Tab/Shift+Tab, attempted background focus, Escape, busy Escape/Cancel/parent switching, failed delete, adjacent focus, scroll unlock, committed refresh recovery, metadata-only retry, manage-only visibility and denied HTTP403 route access. Native dialog suitability is established for this tested browser, including a transformed parent and Bootstrap collision resistance. +- Final desktop/mobile/zoom/contrast/long-name visual checks remain for the completed metadata/filter/reveal surface in SEC-05–07. Packaged two-host acceptance, published Core/replicator compatibility and feed-only restore remain SEC-07. This checkpoint does not claim those gates. + +## Remaining work and release constraints + +SEC-05 metadata filtering/action context, SEC-06 reveal outcome privacy, then SEC-07 packaging. Parent approves the minimal prospective package set **Ui1.0.0 + Abstractions0.6.6**; global/Core/backend version remains0.6.6 source without an incidental release. Before release, demonstrate published Core0.6.2/0.6.3 and replicator binary compatibility with Abstractions0.6.6 (DIM snapshot API and name length delta), immutable clean-source provenance, exact package dependency contents, isolated restore and immediate version-collision check. No wildcard packing/publication. + +Rollback SEC-02–04 source/tests together with Theme package pin when necessary, preserving SEC-01 target isolation. There is no data/schema migration; never replay credential mutations as UI recovery or rollback. Parent accepted the batch after the source review fixes and actual two-host proofs. Commit uses only owned SEC-02–04 paths; SEC-05–06 follow in the next reviewed batch. diff --git a/components/ui-theme/validation/secrets-ui/SEC02-after.log b/components/ui-theme/validation/secrets-ui/SEC02-after.log new file mode 100644 index 0000000..29922e4 --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/SEC02-after.log @@ -0,0 +1,10 @@ + Determining projects to restore... + All projects are up-to-date for restore. + ZB.MOM.WW.Secrets.Abstractions -> /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Abstractions/bin/Release/net10.0/ZB.MOM.WW.Secrets.Abstractions.dll + ZB.MOM.WW.Secrets.Ui -> /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/bin/Release/net10.0/ZB.MOM.WW.Secrets.Ui.dll + ZB.MOM.WW.Secrets.Ui.Tests -> /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/bin/Release/net10.0/ZB.MOM.WW.Secrets.Ui.Tests.dll +Test run for /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/bin/Release/net10.0/ZB.MOM.WW.Secrets.Ui.Tests.dll (.NETCoreApp,Version=v10.0) +A total of 1 test files matched the specified pattern. +Results File: /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/components/ui-theme/validation/secrets-ui/SEC02-after.trx + +Passed! - Failed: 0, Passed: 53, Skipped: 0, Total: 53, Duration: 259 ms - ZB.MOM.WW.Secrets.Ui.Tests.dll (net10.0) diff --git a/components/ui-theme/validation/secrets-ui/SEC02-after.trx b/components/ui-theme/validation/secrets-ui/SEC02-after.trx new file mode 100644 index 0000000..fbc2bab --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/SEC02-after.trx @@ -0,0 +1,346 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v3.1.4+50e68bbb8b (64-bit .NET 10.0.14) +[xUnit.net 00:00:00.04] Discovering: ZB.MOM.WW.Secrets.Ui.Tests +[xUnit.net 00:00:00.06] Discovered: ZB.MOM.WW.Secrets.Ui.Tests +[xUnit.net 00:00:00.07] Starting: ZB.MOM.WW.Secrets.Ui.Tests +[xUnit.net 00:00:00.34] Finished: ZB.MOM.WW.Secrets.Ui.Tests + + + + \ No newline at end of file diff --git a/components/ui-theme/validation/secrets-ui/SEC02-focused.log b/components/ui-theme/validation/secrets-ui/SEC02-focused.log new file mode 100644 index 0000000..004248f --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/SEC02-focused.log @@ -0,0 +1,12 @@ + Determining projects to restore... + Restored /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Abstractions/ZB.MOM.WW.Secrets.Abstractions.csproj (in 41 ms). + Restored /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/ZB.MOM.WW.Secrets.Ui.csproj (in 100 ms). + Restored /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/ZB.MOM.WW.Secrets.Ui.Tests.csproj (in 106 ms). + ZB.MOM.WW.Secrets.Abstractions -> /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Abstractions/bin/Release/net10.0/ZB.MOM.WW.Secrets.Abstractions.dll + ZB.MOM.WW.Secrets.Ui -> /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/bin/Release/net10.0/ZB.MOM.WW.Secrets.Ui.dll + ZB.MOM.WW.Secrets.Ui.Tests -> /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/bin/Release/net10.0/ZB.MOM.WW.Secrets.Ui.Tests.dll +Test run for /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/bin/Release/net10.0/ZB.MOM.WW.Secrets.Ui.Tests.dll (.NETCoreApp,Version=v10.0) +A total of 1 test files matched the specified pattern. +Results File: /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/components/ui-theme/validation/secrets-ui/SEC02-focused.trx + +Passed! - Failed: 0, Passed: 22, Skipped: 0, Total: 22, Duration: 265 ms - ZB.MOM.WW.Secrets.Ui.Tests.dll (net10.0) diff --git a/components/ui-theme/validation/secrets-ui/SEC02-focused.trx b/components/ui-theme/validation/secrets-ui/SEC02-focused.trx new file mode 100644 index 0000000..dd4d8ee --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/SEC02-focused.trx @@ -0,0 +1,160 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v3.1.4+50e68bbb8b (64-bit .NET 10.0.14) +[xUnit.net 00:00:00.03] Discovering: ZB.MOM.WW.Secrets.Ui.Tests +[xUnit.net 00:00:00.05] Discovered: ZB.MOM.WW.Secrets.Ui.Tests +[xUnit.net 00:00:00.06] Starting: ZB.MOM.WW.Secrets.Ui.Tests +[xUnit.net 00:00:00.34] Finished: ZB.MOM.WW.Secrets.Ui.Tests + + + + \ No newline at end of file diff --git a/components/ui-theme/validation/secrets-ui/SEC02-package-audit.json b/components/ui-theme/validation/secrets-ui/SEC02-package-audit.json new file mode 100644 index 0000000..c547db8 --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/SEC02-package-audit.json @@ -0,0 +1,12 @@ +{ + "version": 1, + "parameters": "--vulnerable --include-transitive", + "sources": [ + "https://api.nuget.org/v3/index.json" + ], + "projects": [ + { + "path": "/Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/ZB.MOM.WW.Secrets.Ui.csproj" + } + ] +} diff --git a/components/ui-theme/validation/secrets-ui/SEC02-package-graph.json b/components/ui-theme/validation/secrets-ui/SEC02-package-graph.json new file mode 100644 index 0000000..885cd00 --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/SEC02-package-graph.json @@ -0,0 +1,45 @@ +{ + "version": 1, + "parameters": "--include-transitive", + "projects": [ + { + "path": "/Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/ZB.MOM.WW.Secrets.Ui.csproj", + "frameworks": [ + { + "framework": "net10.0", + "topLevelPackages": [ + { + "id": "ZB.MOM.WW.Audit", + "requestedVersion": "0.1.0", + "resolvedVersion": "0.1.0" + }, + { + "id": "ZB.MOM.WW.Auth.AspNetCore", + "requestedVersion": "0.1.4", + "resolvedVersion": "0.1.4" + }, + { + "id": "ZB.MOM.WW.Theme", + "requestedVersion": "1.0.0", + "resolvedVersion": "1.0.0" + } + ], + "transitivePackages": [ + { + "id": "Novell.Directory.Ldap.NETStandard", + "resolvedVersion": "3.6.0" + }, + { + "id": "ZB.MOM.WW.Auth.Abstractions", + "resolvedVersion": "0.1.4" + }, + { + "id": "ZB.MOM.WW.Auth.Ldap", + "resolvedVersion": "0.1.4" + } + ] + } + ] + } + ] +} diff --git a/components/ui-theme/validation/secrets-ui/SEC02-red.log b/components/ui-theme/validation/secrets-ui/SEC02-red.log new file mode 100644 index 0000000..679c54a --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/SEC02-red.log @@ -0,0 +1,40 @@ + Determining projects to restore... + All projects are up-to-date for restore. + ZB.MOM.WW.Secrets.Abstractions -> /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Abstractions/bin/Release/net10.0/ZB.MOM.WW.Secrets.Abstractions.dll + ZB.MOM.WW.Secrets.Ui -> /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/bin/Release/net10.0/ZB.MOM.WW.Secrets.Ui.dll + ZB.MOM.WW.Secrets.Ui.Tests -> /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/bin/Release/net10.0/ZB.MOM.WW.Secrets.Ui.Tests.dll +Test run for /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/bin/Release/net10.0/ZB.MOM.WW.Secrets.Ui.Tests.dll (.NETCoreApp,Version=v10.0) +A total of 1 test files matched the specified pattern. +[xUnit.net 00:00:00.23] ZB.MOM.WW.Secrets.Ui.Tests.SecretEditorTests.InvalidName_AssociatesFieldErrorAndClearsInvalidStateOnValidSubmit [FAIL] +[xUnit.net 00:00:00.24] ZB.MOM.WW.Secrets.Ui.Tests.SecretEditorTests.TwoEditors_UseUniqueStableIdsAndExistingDescriptions [FAIL] +[xUnit.net 00:00:00.24] ZB.MOM.WW.Secrets.Ui.Tests.SecretEditorTests.EveryEditorControl_HasAnAssociatedLabel [FAIL] + Failed ZB.MOM.WW.Secrets.Ui.Tests.SecretEditorTests.InvalidName_AssociatesFieldErrorAndClearsInvalidStateOnValidSubmit [157 ms] + Error Message: + Assert.Equal() Failure: Strings differ +Expected: "true" +Actual: null + Stack Trace: + at ZB.MOM.WW.Secrets.Ui.Tests.SecretEditorTests.InvalidName_AssociatesFieldErrorAndClearsInvalidStateOnValidSubmit() in /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/SecretEditorTests.cs:line 481 + at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args) + at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) + Failed ZB.MOM.WW.Secrets.Ui.Tests.SecretEditorTests.TwoEditors_UseUniqueStableIdsAndExistingDescriptions [5 ms] + Error Message: + Assert.DoesNotContain() Failure: Filter matched in collection + ↓ (pos 0) +Collection: [null, null, null, null] + Stack Trace: + at ZB.MOM.WW.Secrets.Ui.Tests.SecretEditorTests.TwoEditors_UseUniqueStableIdsAndExistingDescriptions() in /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/SecretEditorTests.cs:line 461 + at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args) + at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) + Failed ZB.MOM.WW.Secrets.Ui.Tests.SecretEditorTests.EveryEditorControl_HasAnAssociatedLabel [2 ms] + Error Message: + Assert.False() Failure +Expected: False +Actual: True + Stack Trace: + at ZB.MOM.WW.Secrets.Ui.Tests.SecretEditorTests.EveryEditorControl_HasAnAssociatedLabel() in /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/SecretEditorTests.cs:line 449 + at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args) + at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) +Results File: /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/components/ui-theme/validation/secrets-ui/SEC02-red.trx + +Failed! - Failed: 3, Passed: 0, Skipped: 0, Total: 3, Duration: 174 ms - ZB.MOM.WW.Secrets.Ui.Tests.dll (net10.0) diff --git a/components/ui-theme/validation/secrets-ui/SEC02-red.trx b/components/ui-theme/validation/secrets-ui/SEC02-red.trx new file mode 100644 index 0000000..4542def --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/SEC02-red.trx @@ -0,0 +1,111 @@ + + + + + + + + + + + Assert.False() Failure +Expected: False +Actual: True + at ZB.MOM.WW.Secrets.Ui.Tests.SecretEditorTests.EveryEditorControl_HasAnAssociatedLabel() in /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/SecretEditorTests.cs:line 449 + at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args) + at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) + + + + + + + Assert.DoesNotContain() Failure: Filter matched in collection + ↓ (pos 0) +Collection: [null, null, null, null] + at ZB.MOM.WW.Secrets.Ui.Tests.SecretEditorTests.TwoEditors_UseUniqueStableIdsAndExistingDescriptions() in /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/SecretEditorTests.cs:line 461 + at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args) + at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) + + + + + + + Assert.Equal() Failure: Strings differ +Expected: "true" +Actual: null + at ZB.MOM.WW.Secrets.Ui.Tests.SecretEditorTests.InvalidName_AssociatesFieldErrorAndClearsInvalidStateOnValidSubmit() in /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/SecretEditorTests.cs:line 481 + at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args) + at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v3.1.4+50e68bbb8b (64-bit .NET 10.0.14) +[xUnit.net 00:00:00.03] Discovering: ZB.MOM.WW.Secrets.Ui.Tests +[xUnit.net 00:00:00.05] Discovered: ZB.MOM.WW.Secrets.Ui.Tests +[xUnit.net 00:00:00.06] Starting: ZB.MOM.WW.Secrets.Ui.Tests +[xUnit.net 00:00:00.23] Assert.Equal() Failure: Strings differ +[xUnit.net 00:00:00.23] Expected: "true" +[xUnit.net 00:00:00.24] Actual: null +[xUnit.net 00:00:00.24] Stack Trace: +[xUnit.net 00:00:00.24] /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/SecretEditorTests.cs(481,0): at ZB.MOM.WW.Secrets.Ui.Tests.SecretEditorTests.InvalidName_AssociatesFieldErrorAndClearsInvalidStateOnValidSubmit() +[xUnit.net 00:00:00.24] at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args) +[xUnit.net 00:00:00.24] at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) +[xUnit.net 00:00:00.24] Assert.DoesNotContain() Failure: Filter matched in collection +[xUnit.net 00:00:00.24] ↓ (pos 0) +[xUnit.net 00:00:00.24] Collection: [null, null, null, null] +[xUnit.net 00:00:00.24] Stack Trace: +[xUnit.net 00:00:00.24] /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/SecretEditorTests.cs(461,0): at ZB.MOM.WW.Secrets.Ui.Tests.SecretEditorTests.TwoEditors_UseUniqueStableIdsAndExistingDescriptions() +[xUnit.net 00:00:00.24] at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args) +[xUnit.net 00:00:00.24] at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) +[xUnit.net 00:00:00.24] Assert.False() Failure +[xUnit.net 00:00:00.24] Expected: False +[xUnit.net 00:00:00.24] Actual: True +[xUnit.net 00:00:00.24] Stack Trace: +[xUnit.net 00:00:00.24] /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/SecretEditorTests.cs(449,0): at ZB.MOM.WW.Secrets.Ui.Tests.SecretEditorTests.EveryEditorControl_HasAnAssociatedLabel() +[xUnit.net 00:00:00.24] at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args) +[xUnit.net 00:00:00.24] at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) +[xUnit.net 00:00:00.25] Finished: ZB.MOM.WW.Secrets.Ui.Tests + + + + + [xUnit.net 00:00:00.23] ZB.MOM.WW.Secrets.Ui.Tests.SecretEditorTests.InvalidName_AssociatesFieldErrorAndClearsInvalidStateOnValidSubmit [FAIL] + + + [xUnit.net 00:00:00.24] ZB.MOM.WW.Secrets.Ui.Tests.SecretEditorTests.TwoEditors_UseUniqueStableIdsAndExistingDescriptions [FAIL] + + + [xUnit.net 00:00:00.24] ZB.MOM.WW.Secrets.Ui.Tests.SecretEditorTests.EveryEditorControl_HasAnAssociatedLabel [FAIL] + + + + \ No newline at end of file diff --git a/components/ui-theme/validation/secrets-ui/SEC03-dialog-bootstrap.png b/components/ui-theme/validation/secrets-ui/SEC03-dialog-bootstrap.png new file mode 100644 index 0000000..f89928b Binary files /dev/null and b/components/ui-theme/validation/secrets-ui/SEC03-dialog-bootstrap.png differ diff --git a/components/ui-theme/validation/secrets-ui/SEC03-dialog-perpage.png b/components/ui-theme/validation/secrets-ui/SEC03-dialog-perpage.png new file mode 100644 index 0000000..ca80d34 Binary files /dev/null and b/components/ui-theme/validation/secrets-ui/SEC03-dialog-perpage.png differ diff --git a/components/ui-theme/validation/secrets-ui/SEC03-focus-probe.js b/components/ui-theme/validation/secrets-ui/SEC03-focus-probe.js new file mode 100644 index 0000000..a0fa975 --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/SEC03-focus-probe.js @@ -0,0 +1,46 @@ +async page => { + const context = await page.context().browser().newContext(); + const results = []; + try { + for (const origin of ['http://127.0.0.1:53202', 'http://127.0.0.1:53233']) { + const p = await context.newPage(); await p.goto(origin + '/admin/secrets'); + await p.locator('[data-fixture-ready=true]').waitFor(); + const facts = { origin, cases: [] }; + for (const scenario of ['hidden-trigger', 'hidden-ancestor', 'disabled-trigger', 'nonfocusable-trigger', 'disabled-adjacent', 'hidden-tab-controls']) { + await p.evaluate(async scenario => { + const mod = await import('/_content/ZB.MOM.WW.Secrets.Ui/js/secrets-dialog.js'); + const id = 'focus-probe-' + scenario; + const root = document.createElement('div'); root.id = id; + const triggerTag = scenario === 'nonfocusable-trigger' ? 'div tabindex="0"' : 'button type="button"'; + root.innerHTML = `
<${triggerTag} id="${id}-trigger">Synthetic trigger
`; + document.body.append(root); + const trigger = document.getElementById(id + '-trigger'); + trigger.focus(); + mod.open(root.querySelector('dialog'), id + '-cancel', { invokeMethodAsync: async () => mod.close(id) }, id + '-fallback', id); + if (scenario === 'hidden-trigger') trigger.hidden = true; + if (scenario === 'hidden-ancestor') trigger.parentElement.style.visibility = 'hidden'; + if (scenario === 'disabled-trigger') trigger.disabled = true; + if (scenario === 'nonfocusable-trigger') trigger.removeAttribute('tabindex'); + if (scenario === 'disabled-adjacent') { trigger.remove(); document.getElementById(id + '-fallback').disabled = true; } + if (scenario !== 'hidden-tab-controls') mod.close(id); + }, scenario); + if (scenario === 'hidden-tab-controls') { + await p.keyboard.press('Tab'); + const forward = await p.evaluate(() => document.activeElement?.id === 'focus-probe-hidden-tab-controls-confirm'); + await p.keyboard.press('Shift+Tab'); + const reverse = await p.evaluate(() => document.activeElement?.id === 'focus-probe-hidden-tab-controls-cancel'); + facts.cases.push({ scenario, pass: forward && reverse }); + await p.keyboard.press('Escape'); + } else { + if (scenario === 'disabled-adjacent') await p.evaluate(() => document.getElementById('focus-probe-disabled-adjacent-fallback').disabled = false); + let pass = true; + try { await p.waitForFunction(scenario => document.activeElement?.id === 'focus-probe-' + scenario + '-fallback', scenario, { timeout: 2000 }); } catch { pass = false; } + facts.cases.push({ scenario, pass }); + } + await p.evaluate(scenario => document.getElementById('focus-probe-' + scenario).remove(), scenario); + } + results.push(facts); await p.close(); + } + } finally { await context.close(); } + return results; +} diff --git a/components/ui-theme/validation/secrets-ui/SEC03-focus-probe.json b/components/ui-theme/validation/secrets-ui/SEC03-focus-probe.json new file mode 100644 index 0000000..4c42998 --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/SEC03-focus-probe.json @@ -0,0 +1,60 @@ +[ + { + "origin": "http://127.0.0.1:53202", + "cases": [ + { + "scenario": "hidden-trigger", + "pass": true + }, + { + "scenario": "hidden-ancestor", + "pass": true + }, + { + "scenario": "disabled-trigger", + "pass": true + }, + { + "scenario": "nonfocusable-trigger", + "pass": true + }, + { + "scenario": "disabled-adjacent", + "pass": true + }, + { + "scenario": "hidden-tab-controls", + "pass": true + } + ] + }, + { + "origin": "http://127.0.0.1:53233", + "cases": [ + { + "scenario": "hidden-trigger", + "pass": true + }, + { + "scenario": "hidden-ancestor", + "pass": true + }, + { + "scenario": "disabled-trigger", + "pass": true + }, + { + "scenario": "nonfocusable-trigger", + "pass": true + }, + { + "scenario": "disabled-adjacent", + "pass": true + }, + { + "scenario": "hidden-tab-controls", + "pass": true + } + ] + } +] diff --git a/components/ui-theme/validation/secrets-ui/SEC03-lifecycle-red.log b/components/ui-theme/validation/secrets-ui/SEC03-lifecycle-red.log new file mode 100644 index 0000000..e948fd5 --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/SEC03-lifecycle-red.log @@ -0,0 +1,19 @@ + Determining projects to restore... + All projects are up-to-date for restore. + ZB.MOM.WW.Secrets.Abstractions -> /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Abstractions/bin/Release/net10.0/ZB.MOM.WW.Secrets.Abstractions.dll + ZB.MOM.WW.Secrets.Ui -> /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/bin/Release/net10.0/ZB.MOM.WW.Secrets.Ui.dll + ZB.MOM.WW.Secrets.Ui.Tests -> /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/bin/Release/net10.0/ZB.MOM.WW.Secrets.Ui.Tests.dll +Test run for /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/bin/Release/net10.0/ZB.MOM.WW.Secrets.Ui.Tests.dll (.NETCoreApp,Version=v10.0) +A total of 1 test files matched the specified pattern. +[xUnit.net 00:00:00.19] ZB.MOM.WW.Secrets.Ui.Tests.ConfirmDeleteModalTests.DisposalDuringDeferredOpen_ClosesBeforeDisposingTheModule [FAIL] + Failed ZB.MOM.WW.Secrets.Ui.Tests.ConfirmDeleteModalTests.DisposalDuringDeferredOpen_ClosesBeforeDisposingTheModule [120 ms] + Error Message: + Assert.False() Failure +Expected: False +Actual: True + Stack Trace: + at ZB.MOM.WW.Secrets.Ui.Tests.ConfirmDeleteModalTests.DisposalDuringDeferredOpen_ClosesBeforeDisposingTheModule() in /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/ConfirmDeleteModalTests.cs:line 275 +--- End of stack trace from previous location --- +Results File: /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/components/ui-theme/validation/secrets-ui/SEC03-lifecycle-red.trx + +Failed! - Failed: 1, Passed: 0, Skipped: 0, Total: 1, Duration: 126 ms - ZB.MOM.WW.Secrets.Ui.Tests.dll (net10.0) diff --git a/components/ui-theme/validation/secrets-ui/SEC03-lifecycle-red.trx b/components/ui-theme/validation/secrets-ui/SEC03-lifecycle-red.trx new file mode 100644 index 0000000..baa0b43 --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/SEC03-lifecycle-red.trx @@ -0,0 +1,55 @@ + + + + + + + + + + + Assert.False() Failure +Expected: False +Actual: True + at ZB.MOM.WW.Secrets.Ui.Tests.ConfirmDeleteModalTests.DisposalDuringDeferredOpen_ClosesBeforeDisposingTheModule() in /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/ConfirmDeleteModalTests.cs:line 275 +--- End of stack trace from previous location --- + + + + + + + + + + + + + + + + + + + + + [xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v3.1.4+50e68bbb8b (64-bit .NET 10.0.14) +[xUnit.net 00:00:00.03] Discovering: ZB.MOM.WW.Secrets.Ui.Tests +[xUnit.net 00:00:00.05] Discovered: ZB.MOM.WW.Secrets.Ui.Tests +[xUnit.net 00:00:00.06] Starting: ZB.MOM.WW.Secrets.Ui.Tests +[xUnit.net 00:00:00.19] Assert.False() Failure +[xUnit.net 00:00:00.19] Expected: False +[xUnit.net 00:00:00.19] Actual: True +[xUnit.net 00:00:00.19] Stack Trace: +[xUnit.net 00:00:00.19] /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/ConfirmDeleteModalTests.cs(275,0): at ZB.MOM.WW.Secrets.Ui.Tests.ConfirmDeleteModalTests.DisposalDuringDeferredOpen_ClosesBeforeDisposingTheModule() +[xUnit.net 00:00:00.19] --- End of stack trace from previous location --- +[xUnit.net 00:00:00.20] Finished: ZB.MOM.WW.Secrets.Ui.Tests + + + + + [xUnit.net 00:00:00.19] ZB.MOM.WW.Secrets.Ui.Tests.ConfirmDeleteModalTests.DisposalDuringDeferredOpen_ClosesBeforeDisposingTheModule [FAIL] + + + + \ No newline at end of file diff --git a/components/ui-theme/validation/secrets-ui/SEC03-lifecycle.log b/components/ui-theme/validation/secrets-ui/SEC03-lifecycle.log new file mode 100644 index 0000000..31f5da0 --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/SEC03-lifecycle.log @@ -0,0 +1,11 @@ + Determining projects to restore... + All projects are up-to-date for restore. + ZB.MOM.WW.Secrets.Abstractions -> /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Abstractions/bin/Release/net10.0/ZB.MOM.WW.Secrets.Abstractions.dll + ZB.MOM.WW.Secrets.Ui -> /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/bin/Release/net10.0/ZB.MOM.WW.Secrets.Ui.dll + ZB.MOM.WW.Secrets.Ui.Tests -> /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/bin/Release/net10.0/ZB.MOM.WW.Secrets.Ui.Tests.dll +Test run for /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/bin/Release/net10.0/ZB.MOM.WW.Secrets.Ui.Tests.dll (.NETCoreApp,Version=v10.0) +A total of 1 test files matched the specified pattern. +WARNING: Overwriting results file: /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/components/ui-theme/validation/secrets-ui/SEC03-lifecycle.trx +Results File: /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/components/ui-theme/validation/secrets-ui/SEC03-lifecycle.trx + +Passed! - Failed: 0, Passed: 4, Skipped: 0, Total: 4, Duration: 207 ms - ZB.MOM.WW.Secrets.Ui.Tests.dll (net10.0) diff --git a/components/ui-theme/validation/secrets-ui/SEC03-lifecycle.trx b/components/ui-theme/validation/secrets-ui/SEC03-lifecycle.trx new file mode 100644 index 0000000..244f992 --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/SEC03-lifecycle.trx @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v3.1.4+50e68bbb8b (64-bit .NET 10.0.14) +[xUnit.net 00:00:00.03] Discovering: ZB.MOM.WW.Secrets.Ui.Tests +[xUnit.net 00:00:00.05] Discovered: ZB.MOM.WW.Secrets.Ui.Tests +[xUnit.net 00:00:00.06] Starting: ZB.MOM.WW.Secrets.Ui.Tests +[xUnit.net 00:00:00.28] Finished: ZB.MOM.WW.Secrets.Ui.Tests + + + + \ No newline at end of file diff --git a/components/ui-theme/validation/secrets-ui/SEC03-red.log b/components/ui-theme/validation/secrets-ui/SEC03-red.log new file mode 100644 index 0000000..38a4c9a --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/SEC03-red.log @@ -0,0 +1,20 @@ + Determining projects to restore... + All projects are up-to-date for restore. + ZB.MOM.WW.Secrets.Abstractions -> /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Abstractions/bin/Release/net10.0/ZB.MOM.WW.Secrets.Abstractions.dll + ZB.MOM.WW.Secrets.Ui -> /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/bin/Release/net10.0/ZB.MOM.WW.Secrets.Ui.dll + ZB.MOM.WW.Secrets.Ui.Tests -> /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/bin/Release/net10.0/ZB.MOM.WW.Secrets.Ui.Tests.dll +Test run for /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/bin/Release/net10.0/ZB.MOM.WW.Secrets.Ui.Tests.dll (.NETCoreApp,Version=v10.0) +A total of 1 test files matched the specified pattern. +[xUnit.net 00:00:00.25] ZB.MOM.WW.Secrets.Ui.Tests.ConfirmDeleteModalTests.DeleteDialog_HasANameLinkedToTheExactTarget [FAIL] + Failed ZB.MOM.WW.Secrets.Ui.Tests.ConfirmDeleteModalTests.DeleteDialog_HasANameLinkedToTheExactTarget [176 ms] + Error Message: + Assert.False() Failure +Expected: False +Actual: True + Stack Trace: + at ZB.MOM.WW.Secrets.Ui.Tests.ConfirmDeleteModalTests.DeleteDialog_HasANameLinkedToTheExactTarget() in /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/ConfirmDeleteModalTests.cs:line 22 + at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args) + at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) +Results File: /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/components/ui-theme/validation/secrets-ui/SEC03-red.trx + +Failed! - Failed: 1, Passed: 0, Skipped: 0, Total: 1, Duration: 182 ms - ZB.MOM.WW.Secrets.Ui.Tests.dll (net10.0) diff --git a/components/ui-theme/validation/secrets-ui/SEC03-red.trx b/components/ui-theme/validation/secrets-ui/SEC03-red.trx new file mode 100644 index 0000000..876b294 --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/SEC03-red.trx @@ -0,0 +1,57 @@ + + + + + + + + + + + Assert.False() Failure +Expected: False +Actual: True + at ZB.MOM.WW.Secrets.Ui.Tests.ConfirmDeleteModalTests.DeleteDialog_HasANameLinkedToTheExactTarget() in /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/ConfirmDeleteModalTests.cs:line 22 + at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args) + at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) + + + + + + + + + + + + + + + + + + + + + [xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v3.1.4+50e68bbb8b (64-bit .NET 10.0.14) +[xUnit.net 00:00:00.03] Discovering: ZB.MOM.WW.Secrets.Ui.Tests +[xUnit.net 00:00:00.05] Discovered: ZB.MOM.WW.Secrets.Ui.Tests +[xUnit.net 00:00:00.06] Starting: ZB.MOM.WW.Secrets.Ui.Tests +[xUnit.net 00:00:00.25] Assert.False() Failure +[xUnit.net 00:00:00.25] Expected: False +[xUnit.net 00:00:00.25] Actual: True +[xUnit.net 00:00:00.25] Stack Trace: +[xUnit.net 00:00:00.25] /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/ConfirmDeleteModalTests.cs(22,0): at ZB.MOM.WW.Secrets.Ui.Tests.ConfirmDeleteModalTests.DeleteDialog_HasANameLinkedToTheExactTarget() +[xUnit.net 00:00:00.25] at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args) +[xUnit.net 00:00:00.25] at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) +[xUnit.net 00:00:00.25] Finished: ZB.MOM.WW.Secrets.Ui.Tests + + + + + [xUnit.net 00:00:00.25] ZB.MOM.WW.Secrets.Ui.Tests.ConfirmDeleteModalTests.DeleteDialog_HasANameLinkedToTheExactTarget [FAIL] + + + + \ No newline at end of file diff --git a/components/ui-theme/validation/secrets-ui/SEC03-reviewed-component-browser.json b/components/ui-theme/validation/secrets-ui/SEC03-reviewed-component-browser.json new file mode 100644 index 0000000..3402b81 --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/SEC03-reviewed-component-browser.json @@ -0,0 +1,110 @@ +[ + { + "mode": "perpage", + "origin": "http://127.0.0.1:54281", + "width": 390, + "errors": [], + "checks": [ + { + "name": "Single intended backdrop", + "pass": true + }, + { + "name": "Card within viewport without relying on Bootstrap reset", + "pass": true + }, + { + "name": "Actual component hidden trigger uses adjacent fallback", + "pass": true + }, + { + "name": "Last deletion restores heading focus", + "pass": true + }, + { + "name": "No orphan native dialog or scroll lock", + "pass": true + }, + { + "name": "No page errors", + "pass": true + } + ], + "styles": { + "nativeBackdrop": "rgba(15, 18, 20, 0.45)", + "childBackdrop": "rgba(0, 0, 0, 0)", + "cardWidth": 358, + "viewport": 390, + "boxSizing": "border-box", + "title": "rgb(27, 29, 33)" + }, + "deletionFocus": [ + { + "expected": "secrets-list-70aee95f8d574aa7855b18ff375e8c97-row-1", + "pass": true + }, + { + "expected": "secrets-list-70aee95f8d574aa7855b18ff375e8c97-row-2", + "pass": true + }, + { + "expected": "secrets-list-70aee95f8d574aa7855b18ff375e8c97-heading", + "pass": true + } + ] + }, + { + "mode": "bootstrap", + "origin": "http://127.0.0.1:54288", + "width": 1440, + "errors": [], + "checks": [ + { + "name": "Single intended backdrop", + "pass": true + }, + { + "name": "Card within viewport without relying on Bootstrap reset", + "pass": true + }, + { + "name": "Actual component hidden trigger uses adjacent fallback", + "pass": true + }, + { + "name": "Last deletion restores heading focus", + "pass": true + }, + { + "name": "No orphan native dialog or scroll lock", + "pass": true + }, + { + "name": "No page errors", + "pass": true + } + ], + "styles": { + "nativeBackdrop": "rgba(15, 18, 20, 0.45)", + "childBackdrop": "rgba(0, 0, 0, 0)", + "cardWidth": 480, + "viewport": 1440, + "boxSizing": "border-box", + "title": "rgb(27, 29, 33)" + }, + "deletionFocus": [ + { + "expected": "secrets-list-87be17432fbd4777aa922f67b869e6c8-row-1", + "pass": true + }, + { + "expected": "secrets-list-87be17432fbd4777aa922f67b869e6c8-row-2", + "pass": true + }, + { + "expected": "secrets-list-87be17432fbd4777aa922f67b869e6c8-heading", + "pass": true + } + ] + } +] diff --git a/components/ui-theme/validation/secrets-ui/SEC03-working.log b/components/ui-theme/validation/secrets-ui/SEC03-working.log new file mode 100644 index 0000000..9e9ef55 --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/SEC03-working.log @@ -0,0 +1,11 @@ + Determining projects to restore... + All projects are up-to-date for restore. + ZB.MOM.WW.Secrets.Abstractions -> /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Abstractions/bin/Release/net10.0/ZB.MOM.WW.Secrets.Abstractions.dll + ZB.MOM.WW.Secrets.Ui -> /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/bin/Release/net10.0/ZB.MOM.WW.Secrets.Ui.dll + ZB.MOM.WW.Secrets.Ui.Tests -> /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/bin/Release/net10.0/ZB.MOM.WW.Secrets.Ui.Tests.dll +Test run for /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/bin/Release/net10.0/ZB.MOM.WW.Secrets.Ui.Tests.dll (.NETCoreApp,Version=v10.0) +A total of 1 test files matched the specified pattern. +WARNING: Overwriting results file: /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/components/ui-theme/validation/secrets-ui/SEC03-working.trx +Results File: /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/components/ui-theme/validation/secrets-ui/SEC03-working.trx + +Passed! - Failed: 0, Passed: 58, Skipped: 0, Total: 58, Duration: 276 ms - ZB.MOM.WW.Secrets.Ui.Tests.dll (net10.0) diff --git a/components/ui-theme/validation/secrets-ui/SEC03-working.trx b/components/ui-theme/validation/secrets-ui/SEC03-working.trx new file mode 100644 index 0000000..5f12628 --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/SEC03-working.trx @@ -0,0 +1,376 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v3.1.4+50e68bbb8b (64-bit .NET 10.0.14) +[xUnit.net 00:00:00.04] Discovering: ZB.MOM.WW.Secrets.Ui.Tests +[xUnit.net 00:00:00.06] Discovered: ZB.MOM.WW.Secrets.Ui.Tests +[xUnit.net 00:00:00.07] Starting: ZB.MOM.WW.Secrets.Ui.Tests +[xUnit.net 00:00:00.36] Finished: ZB.MOM.WW.Secrets.Ui.Tests + + + + \ No newline at end of file diff --git a/components/ui-theme/validation/secrets-ui/SEC04-after.log b/components/ui-theme/validation/secrets-ui/SEC04-after.log new file mode 100644 index 0000000..b590420 --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/SEC04-after.log @@ -0,0 +1,10 @@ + Determining projects to restore... + All projects are up-to-date for restore. + ZB.MOM.WW.Secrets.Abstractions -> /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Abstractions/bin/Release/net10.0/ZB.MOM.WW.Secrets.Abstractions.dll + ZB.MOM.WW.Secrets.Ui -> /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/bin/Release/net10.0/ZB.MOM.WW.Secrets.Ui.dll + ZB.MOM.WW.Secrets.Ui.Tests -> /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/bin/Release/net10.0/ZB.MOM.WW.Secrets.Ui.Tests.dll +Test run for /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/bin/Release/net10.0/ZB.MOM.WW.Secrets.Ui.Tests.dll (.NETCoreApp,Version=v10.0) +A total of 1 test files matched the specified pattern. +Results File: /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/components/ui-theme/validation/secrets-ui/SEC04-after.trx + +Passed! - Failed: 0, Passed: 62, Skipped: 0, Total: 62, Duration: 247 ms - ZB.MOM.WW.Secrets.Ui.Tests.dll (net10.0) diff --git a/components/ui-theme/validation/secrets-ui/SEC04-after.trx b/components/ui-theme/validation/secrets-ui/SEC04-after.trx new file mode 100644 index 0000000..e8d15a5 --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/SEC04-after.trx @@ -0,0 +1,400 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v3.1.4+50e68bbb8b (64-bit .NET 10.0.14) +[xUnit.net 00:00:00.03] Discovering: ZB.MOM.WW.Secrets.Ui.Tests +[xUnit.net 00:00:00.05] Discovered: ZB.MOM.WW.Secrets.Ui.Tests +[xUnit.net 00:00:00.07] Starting: ZB.MOM.WW.Secrets.Ui.Tests +[xUnit.net 00:00:00.32] Finished: ZB.MOM.WW.Secrets.Ui.Tests + + + + \ No newline at end of file diff --git a/components/ui-theme/validation/secrets-ui/SEC04-outcome-red.log b/components/ui-theme/validation/secrets-ui/SEC04-outcome-red.log new file mode 100644 index 0000000..f5699cd --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/SEC04-outcome-red.log @@ -0,0 +1,28 @@ + Determining projects to restore... + All projects are up-to-date for restore. + ZB.MOM.WW.Secrets.Abstractions -> /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Abstractions/bin/Release/net10.0/ZB.MOM.WW.Secrets.Abstractions.dll + ZB.MOM.WW.Secrets.Ui -> /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/bin/Release/net10.0/ZB.MOM.WW.Secrets.Ui.dll + ZB.MOM.WW.Secrets.Ui.Tests -> /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/bin/Release/net10.0/ZB.MOM.WW.Secrets.Ui.Tests.dll +Test run for /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/bin/Release/net10.0/ZB.MOM.WW.Secrets.Ui.Tests.dll (.NETCoreApp,Version=v10.0) +A total of 1 test files matched the specified pattern. +[xUnit.net 00:00:00.29] ZB.MOM.WW.Secrets.Ui.Tests.SecretsListTests.NewFailedMutation_DoesNotRetainThePreviousSavesSuccess(delete: False) [FAIL] +[xUnit.net 00:00:00.32] ZB.MOM.WW.Secrets.Ui.Tests.SecretsListTests.NewFailedMutation_DoesNotRetainThePreviousSavesSuccess(delete: True) [FAIL] + Failed ZB.MOM.WW.Secrets.Ui.Tests.SecretsListTests.NewFailedMutation_DoesNotRetainThePreviousSavesSuccess(delete: False) [212 ms] + Error Message: + Assert.Empty() Failure: Collection was not empty +Collection: [HtmlParagraphElement { AccessKey = "", AccessKeyLabel = "", Align = Left, AssignedSlot = null, BaseUri = "about:blank", ··· }] + Stack Trace: + at ZB.MOM.WW.Secrets.Ui.Tests.SecretsListTests.NewFailedMutation_DoesNotRetainThePreviousSavesSuccess(Boolean delete) in /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/SecretsListTests.cs:line 320 + at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args) + at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr) + Failed ZB.MOM.WW.Secrets.Ui.Tests.SecretsListTests.NewFailedMutation_DoesNotRetainThePreviousSavesSuccess(delete: True) [27 ms] + Error Message: + Assert.Empty() Failure: Collection was not empty +Collection: [HtmlParagraphElement { AccessKey = "", AccessKeyLabel = "", Align = Left, AssignedSlot = null, BaseUri = "about:blank", ··· }] + Stack Trace: + at ZB.MOM.WW.Secrets.Ui.Tests.SecretsListTests.NewFailedMutation_DoesNotRetainThePreviousSavesSuccess(Boolean delete) in /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/SecretsListTests.cs:line 320 + at InvokeStub_SecretsListTests.NewFailedMutation_DoesNotRetainThePreviousSavesSuccess(Object, Span`1) + at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +Results File: /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/components/ui-theme/validation/secrets-ui/SEC04-outcome-red.trx + +Failed! - Failed: 2, Passed: 0, Skipped: 0, Total: 2, Duration: 246 ms - ZB.MOM.WW.Secrets.Ui.Tests.dll (net10.0) diff --git a/components/ui-theme/validation/secrets-ui/SEC04-outcome-red.trx b/components/ui-theme/validation/secrets-ui/SEC04-outcome-red.trx new file mode 100644 index 0000000..17e4821 --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/SEC04-outcome-red.trx @@ -0,0 +1,80 @@ + + + + + + + + + + + Assert.Empty() Failure: Collection was not empty +Collection: [HtmlParagraphElement { AccessKey = "", AccessKeyLabel = "", Align = Left, AssignedSlot = null, BaseUri = "about:blank", ··· }] + at ZB.MOM.WW.Secrets.Ui.Tests.SecretsListTests.NewFailedMutation_DoesNotRetainThePreviousSavesSuccess(Boolean delete) in /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/SecretsListTests.cs:line 320 + at InvokeStub_SecretsListTests.NewFailedMutation_DoesNotRetainThePreviousSavesSuccess(Object, Span`1) + at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) + + + + + + + Assert.Empty() Failure: Collection was not empty +Collection: [HtmlParagraphElement { AccessKey = "", AccessKeyLabel = "", Align = Left, AssignedSlot = null, BaseUri = "about:blank", ··· }] + at ZB.MOM.WW.Secrets.Ui.Tests.SecretsListTests.NewFailedMutation_DoesNotRetainThePreviousSavesSuccess(Boolean delete) in /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/SecretsListTests.cs:line 320 + at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args) + at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr) + + + + + + + + + + + + + + + + + + + + + + + + + + [xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v3.1.4+50e68bbb8b (64-bit .NET 10.0.14) +[xUnit.net 00:00:00.03] Discovering: ZB.MOM.WW.Secrets.Ui.Tests +[xUnit.net 00:00:00.05] Discovered: ZB.MOM.WW.Secrets.Ui.Tests +[xUnit.net 00:00:00.06] Starting: ZB.MOM.WW.Secrets.Ui.Tests +[xUnit.net 00:00:00.29] Assert.Empty() Failure: Collection was not empty +[xUnit.net 00:00:00.29] Collection: [HtmlParagraphElement { AccessKey = "", AccessKeyLabel = "", Align = Left, AssignedSlot = null, BaseUri = "about:blank", ··· }] +[xUnit.net 00:00:00.29] Stack Trace: +[xUnit.net 00:00:00.29] /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/SecretsListTests.cs(320,0): at ZB.MOM.WW.Secrets.Ui.Tests.SecretsListTests.NewFailedMutation_DoesNotRetainThePreviousSavesSuccess(Boolean delete) +[xUnit.net 00:00:00.29] at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args) +[xUnit.net 00:00:00.29] at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr) +[xUnit.net 00:00:00.32] Assert.Empty() Failure: Collection was not empty +[xUnit.net 00:00:00.32] Collection: [HtmlParagraphElement { AccessKey = "", AccessKeyLabel = "", Align = Left, AssignedSlot = null, BaseUri = "about:blank", ··· }] +[xUnit.net 00:00:00.32] Stack Trace: +[xUnit.net 00:00:00.32] /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/SecretsListTests.cs(320,0): at ZB.MOM.WW.Secrets.Ui.Tests.SecretsListTests.NewFailedMutation_DoesNotRetainThePreviousSavesSuccess(Boolean delete) +[xUnit.net 00:00:00.32] at InvokeStub_SecretsListTests.NewFailedMutation_DoesNotRetainThePreviousSavesSuccess(Object, Span`1) +[xUnit.net 00:00:00.32] at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +[xUnit.net 00:00:00.32] Finished: ZB.MOM.WW.Secrets.Ui.Tests + + + + + [xUnit.net 00:00:00.29] ZB.MOM.WW.Secrets.Ui.Tests.SecretsListTests.NewFailedMutation_DoesNotRetainThePreviousSavesSuccess(delete: False) [FAIL] + + + [xUnit.net 00:00:00.32] ZB.MOM.WW.Secrets.Ui.Tests.SecretsListTests.NewFailedMutation_DoesNotRetainThePreviousSavesSuccess(delete: True) [FAIL] + + + + \ No newline at end of file diff --git a/components/ui-theme/validation/secrets-ui/SEC04-red.log b/components/ui-theme/validation/secrets-ui/SEC04-red.log new file mode 100644 index 0000000..9ecc1b9 --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/SEC04-red.log @@ -0,0 +1,65 @@ + Determining projects to restore... + All projects are up-to-date for restore. + ZB.MOM.WW.Secrets.Abstractions -> /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Abstractions/bin/Release/net10.0/ZB.MOM.WW.Secrets.Abstractions.dll + ZB.MOM.WW.Secrets.Ui -> /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/bin/Release/net10.0/ZB.MOM.WW.Secrets.Ui.dll + ZB.MOM.WW.Secrets.Ui.Tests -> /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/bin/Release/net10.0/ZB.MOM.WW.Secrets.Ui.Tests.dll +Test run for /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/bin/Release/net10.0/ZB.MOM.WW.Secrets.Ui.Tests.dll (.NETCoreApp,Version=v10.0) +A total of 1 test files matched the specified pattern. +[xUnit.net 00:00:00.26] ZB.MOM.WW.Secrets.Ui.Tests.SecretsListTests.CommittedSaveAndFailedRefresh_ClosesEditorAndRetriesOnlyMetadata [FAIL] +[xUnit.net 00:00:00.27] ZB.MOM.WW.Secrets.Ui.Tests.SecretsListTests.DelayedInitialMetadata_IsLoadingUntilTheReadCompletes [FAIL] +[xUnit.net 00:00:00.27] ZB.MOM.WW.Secrets.Ui.Tests.SecretsListTests.InitialListFailure_IsRetryableAndIsNotAnEmptyInventory [FAIL] + Failed ZB.MOM.WW.Secrets.Ui.Tests.SecretsListTests.CommittedSaveAndFailedRefresh_ClosesEditorAndRetriesOnlyMetadata [180 ms] + Error Message: + System.IO.IOException : synthetic refresh outage + Stack Trace: + at ZB.MOM.WW.Secrets.Ui.SecretsList.ReloadAsync() in /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/Components/SecretsList.razor:line 129 + at ZB.MOM.WW.Secrets.Ui.SecretsList.OnEditorSavedAsync(Int64 generation) in /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/Components/SecretsList.razor:line 172 + at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task) + at ZB.MOM.WW.Secrets.Ui.Components.SecretEditor.SubmitAsync() in /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/Components/SecretEditor.razor:line 313 + at ZB.MOM.WW.Secrets.Ui.Components.SecretEditor.SubmitAsync() in /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/Components/SecretEditor.razor:line 320 + at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task) + at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState) + at Bunit.Rendering.BunitRenderer.AssertNoUnhandledExceptions() in /_/src/bunit/Rendering/BunitRenderer.cs:line 707 + at Bunit.Rendering.BunitRenderer.DispatchEventAsync(UInt64 eventHandlerId, EventFieldInfo fieldInfo, EventArgs eventArgs, Boolean ignoreUnknownEventHandlers) in /_/src/bunit/Rendering/BunitRenderer.cs:line 201 + at Bunit.TriggerEventDispatchExtensions.GetDispatchEventTasks(BunitRenderer renderer, IElement element, String eventName, EventArgs eventArgs) in /_/src/bunit/EventDispatchExtensions/TriggerEventDispatchExtensions.cs:line 135 + at Bunit.TriggerEventDispatchExtensions.TriggerBubblingEventAsync(BunitRenderer renderer, IElement element, String eventName, EventArgs eventArgs) in /_/src/bunit/EventDispatchExtensions/TriggerEventDispatchExtensions.cs:line 110 + at Bunit.TriggerEventDispatchExtensions.TriggerEventsAsync(BunitRenderer renderer, IElement element, String eventName, EventArgs eventArgs) in /_/src/bunit/EventDispatchExtensions/TriggerEventDispatchExtensions.cs:line 86 + at Bunit.TriggerEventDispatchExtensions.<>c__DisplayClass3_0.b__0() in /_/src/bunit/EventDispatchExtensions/TriggerEventDispatchExtensions.cs:line 73 + at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.<>c.<b__10_0>d.MoveNext() +--- End of stack trace from previous location --- + at Bunit.TriggerEventDispatchExtensions.ThrowIfFailedSynchronously(Task result) in /_/src/bunit/EventDispatchExtensions/TriggerEventDispatchExtensions.cs:line 254 + at Bunit.TriggerEventDispatchExtensions.TriggerEventAsync(IElement element, String eventName, EventArgs eventArgs) in /_/src/bunit/EventDispatchExtensions/TriggerEventDispatchExtensions.cs:line 75 + at Bunit.EventHandlerDispatchExtensions.ClickAsync(IElement element, MouseEventArgs eventArgs) in /_/src/bunit/obj/Release/net10.0/bunit.generators.internal/Bunit.Blazor.EventDispatcherExtensionGenerator/EventHandlerDispatchExtensions.g.cs:line 1209 + at Bunit.EventHandlerDispatchExtensions.Click(IElement element, MouseEventArgs eventArgs) in /_/src/bunit/obj/Release/net10.0/bunit.generators.internal/Bunit.Blazor.EventDispatcherExtensionGenerator/EventHandlerDispatchExtensions.g.cs:line 1200 + at ZB.MOM.WW.Secrets.Ui.Tests.SecretsListTests.CommittedSaveAndFailedRefresh_ClosesEditorAndRetriesOnlyMetadata() in /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/SecretsListTests.cs:line 262 + at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args) + at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) + Failed ZB.MOM.WW.Secrets.Ui.Tests.SecretsListTests.DelayedInitialMetadata_IsLoadingUntilTheReadCompletes [1 ms] + Error Message: + Bunit.ElementNotFoundException : No elements were found that matches the selector '[data-testid=list-loading]' + Stack Trace: + at Bunit.RenderedComponentExtensions.Find[TComponent,TElement](IRenderedComponent`1 renderedComponent, String cssSelector) in /_/src/bunit/Extensions/RenderedComponentExtensions.cs:line 42 + at Bunit.RenderedComponentExtensions.Find[TComponent](IRenderedComponent`1 renderedComponent, String cssSelector) in /_/src/bunit/Extensions/RenderedComponentExtensions.cs:line 21 + at ZB.MOM.WW.Secrets.Ui.Tests.SecretsListTests.DelayedInitialMetadata_IsLoadingUntilTheReadCompletes() in /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/SecretsListTests.cs:line 247 + at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args) + at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) + Failed ZB.MOM.WW.Secrets.Ui.Tests.SecretsListTests.InitialListFailure_IsRetryableAndIsNotAnEmptyInventory [< 1 ms] + Error Message: + System.IO.IOException : synthetic outage + Stack Trace: + at ZB.MOM.WW.Secrets.Ui.SecretsList.ReloadAsync() in /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/Components/SecretsList.razor:line 129 + at ZB.MOM.WW.Secrets.Ui.SecretsList.OnInitializedAsync() in /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/Components/SecretsList.razor:line 126 + at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync() + at Bunit.Rendering.BunitRenderer.AssertNoUnhandledExceptions() in /_/src/bunit/Rendering/BunitRenderer.cs:line 707 + at Bunit.Rendering.BunitRenderer.Render(RenderFragment renderFragment) in /_/src/bunit/Rendering/BunitRenderer.cs:line 597 + at Bunit.Rendering.BunitRenderer.RenderFragment(RenderFragment renderFragment) in /_/src/bunit/Rendering/BunitRenderer.cs:line 137 + at Bunit.BunitContext.RenderInsideRenderTree(RenderFragment renderFragment) in /_/src/bunit/BunitContext.cs:line 230 + at Bunit.BunitContext.RenderInsideRenderTree[TComponent](RenderFragment renderFragment) in /_/src/bunit/BunitContext.cs:line 214 + at Bunit.BunitContext.Render[TComponent](RenderFragment renderFragment) in /_/src/bunit/BunitContext.cs:line 169 + at Bunit.BunitContext.Render[TComponent](Action`1 parameterBuilder) in /_/src/bunit/BunitContext.cs:line 152 + at ZB.MOM.WW.Secrets.Ui.Tests.SecretsListTests.InitialListFailure_IsRetryableAndIsNotAnEmptyInventory() in /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/SecretsListTests.cs:line 228 + at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args) + at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) +Results File: /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/components/ui-theme/validation/secrets-ui/SEC04-red.trx + +Failed! - Failed: 3, Passed: 1, Skipped: 0, Total: 4, Duration: 198 ms - ZB.MOM.WW.Secrets.Ui.Tests.dll (net10.0) diff --git a/components/ui-theme/validation/secrets-ui/SEC04-red.trx b/components/ui-theme/validation/secrets-ui/SEC04-red.trx new file mode 100644 index 0000000..c9b5867 --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/SEC04-red.trx @@ -0,0 +1,167 @@ + + + + + + + + + + + Bunit.ElementNotFoundException : No elements were found that matches the selector '[data-testid=list-loading]' + at Bunit.RenderedComponentExtensions.Find[TComponent,TElement](IRenderedComponent`1 renderedComponent, String cssSelector) in /_/src/bunit/Extensions/RenderedComponentExtensions.cs:line 42 + at Bunit.RenderedComponentExtensions.Find[TComponent](IRenderedComponent`1 renderedComponent, String cssSelector) in /_/src/bunit/Extensions/RenderedComponentExtensions.cs:line 21 + at ZB.MOM.WW.Secrets.Ui.Tests.SecretsListTests.DelayedInitialMetadata_IsLoadingUntilTheReadCompletes() in /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/SecretsListTests.cs:line 247 + at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args) + at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) + + + + + + + System.IO.IOException : synthetic outage + at ZB.MOM.WW.Secrets.Ui.SecretsList.ReloadAsync() in /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/Components/SecretsList.razor:line 129 + at ZB.MOM.WW.Secrets.Ui.SecretsList.OnInitializedAsync() in /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/Components/SecretsList.razor:line 126 + at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync() + at Bunit.Rendering.BunitRenderer.AssertNoUnhandledExceptions() in /_/src/bunit/Rendering/BunitRenderer.cs:line 707 + at Bunit.Rendering.BunitRenderer.Render(RenderFragment renderFragment) in /_/src/bunit/Rendering/BunitRenderer.cs:line 597 + at Bunit.Rendering.BunitRenderer.RenderFragment(RenderFragment renderFragment) in /_/src/bunit/Rendering/BunitRenderer.cs:line 137 + at Bunit.BunitContext.RenderInsideRenderTree(RenderFragment renderFragment) in /_/src/bunit/BunitContext.cs:line 230 + at Bunit.BunitContext.RenderInsideRenderTree[TComponent](RenderFragment renderFragment) in /_/src/bunit/BunitContext.cs:line 214 + at Bunit.BunitContext.Render[TComponent](RenderFragment renderFragment) in /_/src/bunit/BunitContext.cs:line 169 + at Bunit.BunitContext.Render[TComponent](Action`1 parameterBuilder) in /_/src/bunit/BunitContext.cs:line 152 + at ZB.MOM.WW.Secrets.Ui.Tests.SecretsListTests.InitialListFailure_IsRetryableAndIsNotAnEmptyInventory() in /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/SecretsListTests.cs:line 228 + at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args) + at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) + + + + + + + System.IO.IOException : synthetic refresh outage + at ZB.MOM.WW.Secrets.Ui.SecretsList.ReloadAsync() in /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/Components/SecretsList.razor:line 129 + at ZB.MOM.WW.Secrets.Ui.SecretsList.OnEditorSavedAsync(Int64 generation) in /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/Components/SecretsList.razor:line 172 + at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task) + at ZB.MOM.WW.Secrets.Ui.Components.SecretEditor.SubmitAsync() in /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/Components/SecretEditor.razor:line 313 + at ZB.MOM.WW.Secrets.Ui.Components.SecretEditor.SubmitAsync() in /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/Components/SecretEditor.razor:line 320 + at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task) + at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState) + at Bunit.Rendering.BunitRenderer.AssertNoUnhandledExceptions() in /_/src/bunit/Rendering/BunitRenderer.cs:line 707 + at Bunit.Rendering.BunitRenderer.DispatchEventAsync(UInt64 eventHandlerId, EventFieldInfo fieldInfo, EventArgs eventArgs, Boolean ignoreUnknownEventHandlers) in /_/src/bunit/Rendering/BunitRenderer.cs:line 201 + at Bunit.TriggerEventDispatchExtensions.GetDispatchEventTasks(BunitRenderer renderer, IElement element, String eventName, EventArgs eventArgs) in /_/src/bunit/EventDispatchExtensions/TriggerEventDispatchExtensions.cs:line 135 + at Bunit.TriggerEventDispatchExtensions.TriggerBubblingEventAsync(BunitRenderer renderer, IElement element, String eventName, EventArgs eventArgs) in /_/src/bunit/EventDispatchExtensions/TriggerEventDispatchExtensions.cs:line 110 + at Bunit.TriggerEventDispatchExtensions.TriggerEventsAsync(BunitRenderer renderer, IElement element, String eventName, EventArgs eventArgs) in /_/src/bunit/EventDispatchExtensions/TriggerEventDispatchExtensions.cs:line 86 + at Bunit.TriggerEventDispatchExtensions.<>c__DisplayClass3_0.<TriggerEventAsync>b__0() in /_/src/bunit/EventDispatchExtensions/TriggerEventDispatchExtensions.cs:line 73 + at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.<>c.<<InvokeAsync>b__10_0>d.MoveNext() +--- End of stack trace from previous location --- + at Bunit.TriggerEventDispatchExtensions.ThrowIfFailedSynchronously(Task result) in /_/src/bunit/EventDispatchExtensions/TriggerEventDispatchExtensions.cs:line 254 + at Bunit.TriggerEventDispatchExtensions.TriggerEventAsync(IElement element, String eventName, EventArgs eventArgs) in /_/src/bunit/EventDispatchExtensions/TriggerEventDispatchExtensions.cs:line 75 + at Bunit.EventHandlerDispatchExtensions.ClickAsync(IElement element, MouseEventArgs eventArgs) in /_/src/bunit/obj/Release/net10.0/bunit.generators.internal/Bunit.Blazor.EventDispatcherExtensionGenerator/EventHandlerDispatchExtensions.g.cs:line 1209 + at Bunit.EventHandlerDispatchExtensions.Click(IElement element, MouseEventArgs eventArgs) in /_/src/bunit/obj/Release/net10.0/bunit.generators.internal/Bunit.Blazor.EventDispatcherExtensionGenerator/EventHandlerDispatchExtensions.g.cs:line 1200 + at ZB.MOM.WW.Secrets.Ui.Tests.SecretsListTests.CommittedSaveAndFailedRefresh_ClosesEditorAndRetriesOnlyMetadata() in /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/SecretsListTests.cs:line 262 + at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args) + at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v3.1.4+50e68bbb8b (64-bit .NET 10.0.14) +[xUnit.net 00:00:00.03] Discovering: ZB.MOM.WW.Secrets.Ui.Tests +[xUnit.net 00:00:00.05] Discovered: ZB.MOM.WW.Secrets.Ui.Tests +[xUnit.net 00:00:00.06] Starting: ZB.MOM.WW.Secrets.Ui.Tests +[xUnit.net 00:00:00.26] System.IO.IOException : synthetic refresh outage +[xUnit.net 00:00:00.26] Stack Trace: +[xUnit.net 00:00:00.26] /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/Components/SecretsList.razor(129,0): at ZB.MOM.WW.Secrets.Ui.SecretsList.ReloadAsync() +[xUnit.net 00:00:00.26] /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/Components/SecretsList.razor(172,0): at ZB.MOM.WW.Secrets.Ui.SecretsList.OnEditorSavedAsync(Int64 generation) +[xUnit.net 00:00:00.26] at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task) +[xUnit.net 00:00:00.26] /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/Components/SecretEditor.razor(313,0): at ZB.MOM.WW.Secrets.Ui.Components.SecretEditor.SubmitAsync() +[xUnit.net 00:00:00.26] /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/Components/SecretEditor.razor(320,0): at ZB.MOM.WW.Secrets.Ui.Components.SecretEditor.SubmitAsync() +[xUnit.net 00:00:00.26] at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task) +[xUnit.net 00:00:00.26] at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState) +[xUnit.net 00:00:00.26] /_/src/bunit/Rendering/BunitRenderer.cs(707,0): at Bunit.Rendering.BunitRenderer.AssertNoUnhandledExceptions() +[xUnit.net 00:00:00.26] /_/src/bunit/Rendering/BunitRenderer.cs(201,0): at Bunit.Rendering.BunitRenderer.DispatchEventAsync(UInt64 eventHandlerId, EventFieldInfo fieldInfo, EventArgs eventArgs, Boolean ignoreUnknownEventHandlers) +[xUnit.net 00:00:00.26] /_/src/bunit/EventDispatchExtensions/TriggerEventDispatchExtensions.cs(135,0): at Bunit.TriggerEventDispatchExtensions.GetDispatchEventTasks(BunitRenderer renderer, IElement element, String eventName, EventArgs eventArgs) +[xUnit.net 00:00:00.26] /_/src/bunit/EventDispatchExtensions/TriggerEventDispatchExtensions.cs(110,0): at Bunit.TriggerEventDispatchExtensions.TriggerBubblingEventAsync(BunitRenderer renderer, IElement element, String eventName, EventArgs eventArgs) +[xUnit.net 00:00:00.26] /_/src/bunit/EventDispatchExtensions/TriggerEventDispatchExtensions.cs(86,0): at Bunit.TriggerEventDispatchExtensions.TriggerEventsAsync(BunitRenderer renderer, IElement element, String eventName, EventArgs eventArgs) +[xUnit.net 00:00:00.26] /_/src/bunit/EventDispatchExtensions/TriggerEventDispatchExtensions.cs(73,0): at Bunit.TriggerEventDispatchExtensions.<>c__DisplayClass3_0.<TriggerEventAsync>b__0() +[xUnit.net 00:00:00.26] at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.<>c.<<InvokeAsync>b__10_0>d.MoveNext() +[xUnit.net 00:00:00.26] --- End of stack trace from previous location --- +[xUnit.net 00:00:00.26] /_/src/bunit/EventDispatchExtensions/TriggerEventDispatchExtensions.cs(254,0): at Bunit.TriggerEventDispatchExtensions.ThrowIfFailedSynchronously(Task result) +[xUnit.net 00:00:00.26] /_/src/bunit/EventDispatchExtensions/TriggerEventDispatchExtensions.cs(75,0): at Bunit.TriggerEventDispatchExtensions.TriggerEventAsync(IElement element, String eventName, EventArgs eventArgs) +[xUnit.net 00:00:00.26] /_/src/bunit/obj/Release/net10.0/bunit.generators.internal/Bunit.Blazor.EventDispatcherExtensionGenerator/EventHandlerDispatchExtensions.g.cs(1209,0): at Bunit.EventHandlerDispatchExtensions.ClickAsync(IElement element, MouseEventArgs eventArgs) +[xUnit.net 00:00:00.26] /_/src/bunit/obj/Release/net10.0/bunit.generators.internal/Bunit.Blazor.EventDispatcherExtensionGenerator/EventHandlerDispatchExtensions.g.cs(1200,0): at Bunit.EventHandlerDispatchExtensions.Click(IElement element, MouseEventArgs eventArgs) +[xUnit.net 00:00:00.26] /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/SecretsListTests.cs(262,0): at ZB.MOM.WW.Secrets.Ui.Tests.SecretsListTests.CommittedSaveAndFailedRefresh_ClosesEditorAndRetriesOnlyMetadata() +[xUnit.net 00:00:00.26] at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args) +[xUnit.net 00:00:00.26] at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) +[xUnit.net 00:00:00.27] Bunit.ElementNotFoundException : No elements were found that matches the selector '[data-testid=list-loading]' +[xUnit.net 00:00:00.27] Stack Trace: +[xUnit.net 00:00:00.27] /_/src/bunit/Extensions/RenderedComponentExtensions.cs(42,0): at Bunit.RenderedComponentExtensions.Find[TComponent,TElement](IRenderedComponent`1 renderedComponent, String cssSelector) +[xUnit.net 00:00:00.27] /_/src/bunit/Extensions/RenderedComponentExtensions.cs(21,0): at Bunit.RenderedComponentExtensions.Find[TComponent](IRenderedComponent`1 renderedComponent, String cssSelector) +[xUnit.net 00:00:00.27] /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/SecretsListTests.cs(247,0): at ZB.MOM.WW.Secrets.Ui.Tests.SecretsListTests.DelayedInitialMetadata_IsLoadingUntilTheReadCompletes() +[xUnit.net 00:00:00.27] at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args) +[xUnit.net 00:00:00.27] at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) +[xUnit.net 00:00:00.27] System.IO.IOException : synthetic outage +[xUnit.net 00:00:00.27] Stack Trace: +[xUnit.net 00:00:00.27] /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/Components/SecretsList.razor(129,0): at ZB.MOM.WW.Secrets.Ui.SecretsList.ReloadAsync() +[xUnit.net 00:00:00.27] /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/Components/SecretsList.razor(126,0): at ZB.MOM.WW.Secrets.Ui.SecretsList.OnInitializedAsync() +[xUnit.net 00:00:00.27] at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync() +[xUnit.net 00:00:00.27] /_/src/bunit/Rendering/BunitRenderer.cs(707,0): at Bunit.Rendering.BunitRenderer.AssertNoUnhandledExceptions() +[xUnit.net 00:00:00.27] /_/src/bunit/Rendering/BunitRenderer.cs(597,0): at Bunit.Rendering.BunitRenderer.Render(RenderFragment renderFragment) +[xUnit.net 00:00:00.27] /_/src/bunit/Rendering/BunitRenderer.cs(137,0): at Bunit.Rendering.BunitRenderer.RenderFragment(RenderFragment renderFragment) +[xUnit.net 00:00:00.27] /_/src/bunit/BunitContext.cs(230,0): at Bunit.BunitContext.RenderInsideRenderTree(RenderFragment renderFragment) +[xUnit.net 00:00:00.27] /_/src/bunit/BunitContext.cs(214,0): at Bunit.BunitContext.RenderInsideRenderTree[TComponent](RenderFragment renderFragment) +[xUnit.net 00:00:00.27] /_/src/bunit/BunitContext.cs(169,0): at Bunit.BunitContext.Render[TComponent](RenderFragment renderFragment) +[xUnit.net 00:00:00.27] /_/src/bunit/BunitContext.cs(152,0): at Bunit.BunitContext.Render[TComponent](Action`1 parameterBuilder) +[xUnit.net 00:00:00.27] /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/SecretsListTests.cs(228,0): at ZB.MOM.WW.Secrets.Ui.Tests.SecretsListTests.InitialListFailure_IsRetryableAndIsNotAnEmptyInventory() +[xUnit.net 00:00:00.27] at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args) +[xUnit.net 00:00:00.27] at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) +[xUnit.net 00:00:00.27] Finished: ZB.MOM.WW.Secrets.Ui.Tests + + + + + [xUnit.net 00:00:00.26] ZB.MOM.WW.Secrets.Ui.Tests.SecretsListTests.CommittedSaveAndFailedRefresh_ClosesEditorAndRetriesOnlyMetadata [FAIL] + + + [xUnit.net 00:00:00.27] ZB.MOM.WW.Secrets.Ui.Tests.SecretsListTests.DelayedInitialMetadata_IsLoadingUntilTheReadCompletes [FAIL] + + + [xUnit.net 00:00:00.27] ZB.MOM.WW.Secrets.Ui.Tests.SecretsListTests.InitialListFailure_IsRetryableAndIsNotAnEmptyInventory [FAIL] + + + + \ No newline at end of file diff --git a/components/ui-theme/validation/secrets-ui/host-build-bootstrap.log b/components/ui-theme/validation/secrets-ui/host-build-bootstrap.log new file mode 100644 index 0000000..ab5d721 --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/host-build-bootstrap.log @@ -0,0 +1,11 @@ + Determining projects to restore... + All projects are up-to-date for restore. + ZB.MOM.WW.Secrets.Abstractions -> /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Abstractions/bin/Release/net10.0/ZB.MOM.WW.Secrets.Abstractions.dll + ZB.MOM.WW.Secrets.Ui -> /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/bin/Release/net10.0/ZB.MOM.WW.Secrets.Ui.dll + SecretsUiFixture -> /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/components/ui-theme/validation/secrets-ui/hosts/bootstrap/bin/Release/net10.0/SecretsUiFixture.dll + +Build succeeded. + 0 Warning(s) + 0 Error(s) + +Time Elapsed 00:00:00.83 diff --git a/components/ui-theme/validation/secrets-ui/host-build-perpage.log b/components/ui-theme/validation/secrets-ui/host-build-perpage.log new file mode 100644 index 0000000..7b8b638 --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/host-build-perpage.log @@ -0,0 +1,11 @@ + Determining projects to restore... + All projects are up-to-date for restore. + ZB.MOM.WW.Secrets.Abstractions -> /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Abstractions/bin/Release/net10.0/ZB.MOM.WW.Secrets.Abstractions.dll + ZB.MOM.WW.Secrets.Ui -> /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/bin/Release/net10.0/ZB.MOM.WW.Secrets.Ui.dll + SecretsUiFixture -> /Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/components/ui-theme/validation/secrets-ui/hosts/perpage/bin/Release/net10.0/SecretsUiFixture.dll + +Build succeeded. + 0 Warning(s) + 0 Error(s) + +Time Elapsed 00:00:00.84 diff --git a/components/ui-theme/validation/secrets-ui/hosts/bootstrap/Components/App.razor b/components/ui-theme/validation/secrets-ui/hosts/bootstrap/Components/App.razor new file mode 100644 index 0000000..8cfea68 --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/hosts/bootstrap/Components/App.razor @@ -0,0 +1,7 @@ + + + +Secrets synthetic acceptance fixture + +

Synthetic local fixture · bootstrap · No production data or services

+
diff --git a/components/ui-theme/validation/secrets-ui/hosts/bootstrap/Components/PageErrorBoundary.razor b/components/ui-theme/validation/secrets-ui/hosts/bootstrap/Components/PageErrorBoundary.razor new file mode 100644 index 0000000..0478ab7 --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/hosts/bootstrap/Components/PageErrorBoundary.razor @@ -0,0 +1,6 @@ +
@ChildContent
+@code { + [Parameter] public RenderFragment? ChildContent { get; set; } + private bool _ready; + protected override void OnAfterRender(bool firstRender) { if (firstRender) { _ready = true; StateHasChanged(); } } +} diff --git a/components/ui-theme/validation/secrets-ui/hosts/bootstrap/Components/Pages/SecretsAdmin.razor b/components/ui-theme/validation/secrets-ui/hosts/bootstrap/Components/Pages/SecretsAdmin.razor new file mode 100644 index 0000000..34d4edd --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/hosts/bootstrap/Components/Pages/SecretsAdmin.razor @@ -0,0 +1,3 @@ +@page "/admin/secrets" +@attribute [Authorize(Policy = SecretsAuthorization.ManagePolicy)] + diff --git a/components/ui-theme/validation/secrets-ui/hosts/bootstrap/Components/Routes.razor b/components/ui-theme/validation/secrets-ui/hosts/bootstrap/Components/Routes.razor new file mode 100644 index 0000000..5727e62 --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/hosts/bootstrap/Components/Routes.razor @@ -0,0 +1 @@ +

Synthetic principal is not authorized.

Fixture route not found.

diff --git a/components/ui-theme/validation/secrets-ui/hosts/bootstrap/Components/_Imports.razor b/components/ui-theme/validation/secrets-ui/hosts/bootstrap/Components/_Imports.razor new file mode 100644 index 0000000..a164698 --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/hosts/bootstrap/Components/_Imports.razor @@ -0,0 +1,9 @@ +@using Microsoft.AspNetCore.Components +@using Microsoft.AspNetCore.Components.Authorization +@using Microsoft.AspNetCore.Components.Routing +@using Microsoft.AspNetCore.Components.Web +@using Microsoft.AspNetCore.Authorization +@using static Microsoft.AspNetCore.Components.Web.RenderMode +@using ZB.MOM.WW.Theme +@using ZB.MOM.WW.Secrets.Ui +@using SecretsUiFixture.Components diff --git a/components/ui-theme/validation/secrets-ui/hosts/bootstrap/SecretsUiFixture.csproj b/components/ui-theme/validation/secrets-ui/hosts/bootstrap/SecretsUiFixture.csproj new file mode 100644 index 0000000..2a1effe --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/hosts/bootstrap/SecretsUiFixture.csproj @@ -0,0 +1,12 @@ + +net10.0enableenableSecretsUiFixture/Users/dohertj2/Desktop/OtOpcUa + + + + + + + + + + diff --git a/components/ui-theme/validation/secrets-ui/hosts/perpage/Components/App.razor b/components/ui-theme/validation/secrets-ui/hosts/perpage/Components/App.razor new file mode 100644 index 0000000..9f202a6 --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/hosts/perpage/Components/App.razor @@ -0,0 +1,7 @@ + + + +Secrets synthetic acceptance fixture + +

Synthetic local fixture · perpage · No production data or services

+
diff --git a/components/ui-theme/validation/secrets-ui/hosts/perpage/Components/PageErrorBoundary.razor b/components/ui-theme/validation/secrets-ui/hosts/perpage/Components/PageErrorBoundary.razor new file mode 100644 index 0000000..0478ab7 --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/hosts/perpage/Components/PageErrorBoundary.razor @@ -0,0 +1,6 @@ +
@ChildContent
+@code { + [Parameter] public RenderFragment? ChildContent { get; set; } + private bool _ready; + protected override void OnAfterRender(bool firstRender) { if (firstRender) { _ready = true; StateHasChanged(); } } +} diff --git a/components/ui-theme/validation/secrets-ui/hosts/perpage/Components/Routes.razor b/components/ui-theme/validation/secrets-ui/hosts/perpage/Components/Routes.razor new file mode 100644 index 0000000..5727e62 --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/hosts/perpage/Components/Routes.razor @@ -0,0 +1 @@ +

Synthetic principal is not authorized.

Fixture route not found.

diff --git a/components/ui-theme/validation/secrets-ui/hosts/perpage/Components/_Imports.razor b/components/ui-theme/validation/secrets-ui/hosts/perpage/Components/_Imports.razor new file mode 100644 index 0000000..a164698 --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/hosts/perpage/Components/_Imports.razor @@ -0,0 +1,9 @@ +@using Microsoft.AspNetCore.Components +@using Microsoft.AspNetCore.Components.Authorization +@using Microsoft.AspNetCore.Components.Routing +@using Microsoft.AspNetCore.Components.Web +@using Microsoft.AspNetCore.Authorization +@using static Microsoft.AspNetCore.Components.Web.RenderMode +@using ZB.MOM.WW.Theme +@using ZB.MOM.WW.Secrets.Ui +@using SecretsUiFixture.Components diff --git a/components/ui-theme/validation/secrets-ui/hosts/perpage/SecretsUiFixture.csproj b/components/ui-theme/validation/secrets-ui/hosts/perpage/SecretsUiFixture.csproj new file mode 100644 index 0000000..f5cf278 --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/hosts/perpage/SecretsUiFixture.csproj @@ -0,0 +1,13 @@ + +net10.0enableenableSecretsUiFixture/Users/dohertj2/Desktop/OtOpcUa + + + + + + + + + + + diff --git a/components/ui-theme/validation/secrets-ui/hosts/shared/FixtureServices.cs b/components/ui-theme/validation/secrets-ui/hosts/shared/FixtureServices.cs new file mode 100644 index 0000000..80d2cb0 --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/hosts/shared/FixtureServices.cs @@ -0,0 +1,38 @@ +using System.Security.Claims; +using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.Components.Authorization; +using Microsoft.AspNetCore.WebUtilities; +using ZB.MOM.WW.Secrets.Ui; +namespace SecretsUiFixture; +internal sealed class SyntheticAuthentication(NavigationManager navigation) : AuthenticationStateProvider +{ + public override Task GetAuthenticationStateAsync() + { + var query = QueryHelpers.ParseQuery(new Uri(navigation.Uri).Query); + string role = query.TryGetValue("role", out var value) ? value.ToString() : "reveal"; + return Task.FromResult(new AuthenticationState(SyntheticIdentity.ForRole(role))); + } +} +internal sealed record FaultSettings(bool List = false, bool Write = false, bool Audit = false, int DelayMs = 0); + +internal static class SyntheticIdentity +{ + internal static ClaimsPrincipal ForRole(string role) + { + var claims = new List { new(ClaimTypes.Name, "synthetic-reviewer") }; + if (role == "manage") claims.Add(new(ClaimTypes.Role, SecretsAuthorization.ManageRole)); + if (role == "reveal") claims.Add(new(ClaimTypes.Role, SecretsAuthorization.RevealRole)); + return new ClaimsPrincipal(new ClaimsIdentity(claims, "local-synthetic-fixture")); + } +} +internal sealed class SyntheticHandler(Microsoft.Extensions.Options.IOptionsMonitor options, + ILoggerFactory logger, System.Text.Encodings.Web.UrlEncoder encoder) + : Microsoft.AspNetCore.Authentication.AuthenticationHandler(options, logger, encoder) +{ + protected override Task HandleAuthenticateAsync() + { + string role = Request.Query.TryGetValue("role", out var value) ? value.ToString() : "reveal"; + return Task.FromResult(Microsoft.AspNetCore.Authentication.AuthenticateResult.Success( + new Microsoft.AspNetCore.Authentication.AuthenticationTicket(SyntheticIdentity.ForRole(role), Scheme.Name))); + } +} diff --git a/components/ui-theme/validation/secrets-ui/hosts/shared/Program.cs b/components/ui-theme/validation/secrets-ui/hosts/shared/Program.cs new file mode 100644 index 0000000..0e4bf0f --- /dev/null +++ b/components/ui-theme/validation/secrets-ui/hosts/shared/Program.cs @@ -0,0 +1,48 @@ +using Microsoft.AspNetCore.Components.Authorization; +using Microsoft.AspNetCore.DataProtection; +using Microsoft.Extensions.FileProviders; +using SecretsUiFixture; +using SecretsUiFixture.Components; +using ZB.MOM.WW.Audit; +using ZB.MOM.WW.Secrets.Abstractions; +using ZB.MOM.WW.Secrets.Ui; +using ZB.MOM.WW.Secrets.Ui.Tests.Fakes; +using ZB.MOM.WW.Theme; +var builder = WebApplication.CreateBuilder(args); +builder.WebHost.UseStaticWebAssets(); +builder.Services.AddRazorComponents().AddInteractiveServerComponents(); +builder.Services.AddDataProtection().UseEphemeralDataProtectionProvider(); +builder.Services.AddAuthentication("synthetic").AddScheme("synthetic", _ => { }); +builder.Services.AddAuthorization(options => options.AddSecretsAuthorization()); +builder.Services.AddCascadingAuthenticationState(); +builder.Services.AddScoped(); +var store = new RecordingSecretStore(); +var cipher = new FakeCipher(); +var audit = new CapturingAuditWriter(); +foreach (string name in new[] { "app/alpha", "app/bravo", "app/" + new string('x', 160) }) + store.Seed(cipher.Encrypt(new SecretName(name), "synthetic-fixture-value", SecretContentType.Text) with + { Description = "Illustrative local metadata", UpdatedBy = "synthetic-reviewer", UpdatedUtc = DateTimeOffset.Parse("2026-11-13T12:00:00Z") }); +builder.Services.AddSingleton(store); +builder.Services.AddSingleton(cipher); +builder.Services.AddSingleton(audit); +builder.Services.AddSingleton(new RecordingCacheInvalidator()); +var app = builder.Build(); +string bootstrap = builder.Configuration["Fixture:BootstrapRoot"] ?? "/Users/dohertj2/Desktop/ScadaBridge/src/ZB.MOM.WW.ScadaBridge.Host/wwwroot/lib/bootstrap/css"; +if (Directory.Exists(bootstrap)) app.UseStaticFiles(new StaticFileOptions { FileProvider = new PhysicalFileProvider(bootstrap), RequestPath = "/fixture-bootstrap" }); +app.UseStaticFiles(); +app.UseAntiforgery(); +app.MapGet("/fixture/provenance", () => new { purpose = "Loopback synthetic Secrets UI acceptance fixture; not a production host", theme = typeof(ThemeHead).Assembly.GetName().Version?.ToString(), ui = typeof(SecretsPage).Assembly.GetName().Version?.ToString(), store = "In-memory fake only; no keys, LDAP, SQL, network services or production credentials", bootstrap }); +app.MapPost("/fixture/faults", (FaultSettings faults) => +{ + store.ListFault = faults.List ? new IOException("synthetic metadata outage") : null; + store.UpsertFault = faults.Write ? new IOException("synthetic write outage") : null; + store.DeleteFault = faults.Write ? new IOException("synthetic delete outage") : null; + audit.SuccessFault = faults.Audit ? new IOException("synthetic audit outage") : null; + int delay = Math.Clamp(faults.DelayMs, 0, 10000); + store.UpsertOverride = (_, ct) => Task.Delay(delay, ct); + store.DeleteOverride = (_, _, ct) => Task.Delay(delay, ct); + return Results.NoContent(); +}); +app.MapGet("/fixture/counts", () => new { lists = store.ListCalls, upserts = store.Upserts.Count, deletes = store.Deletes.Count, audits = audit.Events.Select(e => new { e.Action, e.Target, e.DetailsJson, e.Outcome }) }); +app.MapRazorComponents().AddInteractiveServerRenderMode(); +app.Run();