fix(app): announce job and transfer states, not progress ticks; smoke tests for the screens
- Jobs and sync rows announce a new state with their job or sequence; the update check announces each state, not each download percent. Live regions stay quiet when a recycled row shows another item or a language switch relabels them. - The first-run dialog keeps its chosen card as the window's focused element, so focus starts inside it even before the window is active. - Known-server addresses read left to right in the menu. - Smoke tests: row names and states, row buttons, radio chips, header and cell columns, Workers readout, badge and strip counts, Settings values set elsewhere, German labels never cut, the cache row at 1200 px, no Reset on Advanced, Forget asks first, first-run focus and the RTL window direction. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
18 files changed
+398
-8
No files matched your search
@@ -1,3 +1,5 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Automation;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using Titano.App.Infrastructure;
|
||||
@@ -82,6 +84,36 @@ public sealed class ServerScreenSmokeTests
|
||||
Assert.True(rowButtons.Select(b => b.DataContext).OfType<SyncRowAction>().Count() > 3, "buttons of several rows are on screen");
|
||||
Assert.True(rowButtons.All(b => b.Focusable && b.IsTabStop), "every row button is a tab stop");
|
||||
|
||||
// Screen readers: a row reads as its sequence and state, each of the many "Upload" buttons names its sequence.
|
||||
foreach (var item in app.FindAll<ListBoxItem>().Where(i => i.DataContext is SyncRow && i.IsVisible))
|
||||
{
|
||||
var row = (SyncRow)item.DataContext;
|
||||
Assert.Equal(row.Title, AutomationProperties.GetName(item));
|
||||
Assert.Equal(row.StateText, AutomationProperties.GetItemStatus(item));
|
||||
}
|
||||
Assert.True(rowButtons.All(b => AutomationProperties.GetName(b) == ((SyncRowAction)b.DataContext).AccessibleName), "row buttons carry their row's name");
|
||||
Assert.Equal(Loc.L("Server.Sync.ActionFor", Loc.L("Server.Sync.Action.Upload"), "Clouds over the Langhe"),
|
||||
Row(table, "Clouds over the Langhe").Actions.Single().AccessibleName);
|
||||
|
||||
// The filters are a radio group: the chosen one is checked, so its state reaches screen readers.
|
||||
var chips = app.FindAll<RadioButton>().Where(r => r.DataContext is SyncFilterChip).ToList();
|
||||
Assert.Count(Enum.GetValues<SyncFilter>().Length, chips);
|
||||
Assert.True(chips.All(c => c.IsChecked == ((SyncFilterChip)c.DataContext).IsSelected), "the checked chip is the chosen filter");
|
||||
|
||||
// While connected the address is read-only text (selectable, not dimmed), kept left to right; status changes are announced.
|
||||
var address = app.FindAll<TextBox>().Single(t => t.Name == "AddressBox");
|
||||
Assert.True(address.IsEnabled && address.IsReadOnly, "the connected address is read-only, not disabled");
|
||||
Assert.Equal(FlowDirection.LeftToRight, address.FlowDirection);
|
||||
var known = app.FindAll<Button>().Single(b => b.Name == "KnownButton");
|
||||
Assert.False(string.IsNullOrEmpty(AutomationProperties.GetName(known)), "the icon-only button has a name");
|
||||
Assert.True(ToolTipService.GetShowOnDisabled(known), "a disabled ▾ still says why");
|
||||
Assert.Equal(AutomationLiveSetting.Polite, AutomationProperties.GetLiveSetting(
|
||||
app.FindAll<StatusGlyph>().First(g => g.IsVisible && g.Text == shell.Server.StatusText)));
|
||||
|
||||
// The web admin admits administrators only: the sample user is an editor.
|
||||
Assert.False(table.CanOpenAdmin);
|
||||
Assert.False(app.FindAll<Button>().Any(b => b.Content as string == Loc.L("Server.Sync.OpenAdmin") && b.IsVisible), "no admin link for an editor");
|
||||
|
||||
// Transfers in every state: the rows show what moves and offer Pause or Resume.
|
||||
await app.Sample.FillSyncAsync();
|
||||
await table.ReloadAsync();
|
||||
@@ -104,9 +136,22 @@ public sealed class ServerScreenSmokeTests
|
||||
Assert.Equal("Holy grail · Monviso", Assert.Contains(table.Rows, _ => true).Title);
|
||||
Assert.Count(1, table.Rows);
|
||||
await app.ExpectAsync<ServerView>("server-conflict");
|
||||
|
||||
// One row, no scrolling: the header still lines up with the cells (same padding, constant scroll-bar gutter).
|
||||
var only = table.Rows[0];
|
||||
Assert.Approximately(Left(Text(app, Loc.L("Server.Sync.Column.Local"))), Left(Text(app, only.LocalText)), 1.5, "This PC column");
|
||||
Assert.Approximately(Left(Text(app, Loc.L("Server.Sync.Column.State"))),
|
||||
Left(app.FindAll<StatusGlyph>().First(g => g.DataContext == only && g.IsVisible)), 1.5, "State column");
|
||||
|
||||
// No match: one sentence and its one action, which shows every sequence again.
|
||||
table.SearchText = "nothing like this";
|
||||
Assert.False(table.HasRows);
|
||||
Assert.NotNull(table.EmptyText);
|
||||
Assert.Equal(SyncEmpty.NoMatch, table.Empty);
|
||||
table.ClearFiltersCommand.Execute(null);
|
||||
Assert.Equal(string.Empty, table.SearchText);
|
||||
Assert.True(Chip(table, SyncFilter.All).IsSelected);
|
||||
Assert.Equal(Chip(table, SyncFilter.All).Count, table.Rows.Count);
|
||||
|
||||
// Another language relabels chips and rows at once.
|
||||
UiLanguage.Apply("it");
|
||||
@@ -137,12 +182,23 @@ public sealed class ServerScreenSmokeTests
|
||||
|
||||
Assert.False(shell.Server.Sync.IsActive);
|
||||
Assert.False(shell.Server.Sync.HasRows);
|
||||
Assert.Equal(SyncEmpty.SignedOut, shell.Server.Sync.Empty);
|
||||
Assert.False(shell.Server.Sync.UploadAllCommand.CanExecute(null));
|
||||
Assert.Equal(Loc.L("Tooltips.Server.Sync.UploadAll.NotConnected"), shell.Server.Sync.UploadAllToolTip);
|
||||
shell.Navigate(SectionKey.Server);
|
||||
await app.ExpectAsync<ServerView>("server-signedout-table");
|
||||
|
||||
// Nothing to filter while signed out: chips and search give way to the one action, Connect.
|
||||
Assert.False(app.FindAll<RadioButton>().Any(r => r.DataContext is SyncFilterChip && r.IsVisible), "no filter chips while signed out");
|
||||
Assert.False(app.FindAll<TextBox>().Any(t => AutomationProperties.GetName(t) == Loc.L("Server.Sync.Search") && t.IsVisible), "no search while signed out");
|
||||
Assert.True(app.FindAll<Button>().Any(b => b.Content as string == Loc.L("Server.Connect") && b.IsVisible), "the empty table offers Connect");
|
||||
});
|
||||
|
||||
private static TextBlock Text(ScreenSmokeTests.SampleApp app, string text) => app.FindAll<TextBlock>().First(t => t.Text == text && t.IsVisible);
|
||||
|
||||
/// <summary>The left edge of an element in window coordinates.</summary>
|
||||
private static double Left(FrameworkElement element) => element.TranslatePoint(new Point(0, 0), Window.GetWindow(element)).X;
|
||||
|
||||
private static SyncFilterChip Chip(SyncTableViewModel table, SyncFilter filter) => table.Chips.Single(c => c.Filter == filter);
|
||||
|
||||
private static SyncRow Row(SyncTableViewModel table, string title) => table.Rows.Single(r => r.Title == title);
|
||||
|
||||
Reference in new issue
Block a user