using System.Text.Json; using Newtonsoft.Json.Linq; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Windows.Foundation; using XFEExtension.NetCore.WinUIHelper.Interface.Services; using XFEExtension.NetCore.WinUIHelper.Utilities; using XFEExtension.NetCore.WinUIHelper.Utilities.Helper; using XFEWarframe.Admin.Profiles.CrossVersionProfiles; using XFEWarframe.Admin.ViewModels; using XFEWarframe.Admin.Views; using XFEWarframe.Desktop.Editing; namespace XFEWarframe.Admin.Utilities.Diagnostics; // Opt-in isolated integration check. --verify-dialogs activates native modal interactions; no game is installed or launched. internal static class DesktopVerification { public static List BindingErrors { get; } = []; public static async Task RunAsync(string reportPath) { if (AppPath.Argument("verify-ability-controls") == "true") { await AbilityEditorVerification.RunAsync(App.MainWindow, reportPath); return; } var checks = new List(); string? error = null; try { if (AppPath.Argument("profile-root") is null) throw new InvalidOperationException("UI verification requires an isolated --profile-root."); if (!App.MainWindow.ExtendsContentIntoTitleBar || App.MainWindow.Content is not AppShellPage) throw new InvalidOperationException("Native window shell was not initialized."); checks.Add("native-titlebar-and-app-shell"); var navigation = ServiceManager.GetGlobalService()!; foreach (var type in PageManager.PageDefinitions.Values.Where(x => x != typeof(AppShellPage)).ToArray()) { AppPath.TraceVerification("Verify page " + type.Name); navigation.NavigateTo(type); var page = (Page)navigation.NavigationService.Frame!.Content; var vm = (ViewModelBase)page.DataContext; if (vm.LoadCommand.ExecutionTask is Task loading) await loading; if (vm.LastError is not null) throw new InvalidOperationException(type.Name + ": " + vm.LastError); if (vm.NavigationParameters.CurrentPage != page) throw new InvalidOperationException("Navigation parameter service lost its page."); if (AppPath.Argument("verify-dialogs") != "true") foreach (var width in new[] { 1400d, 1024d, 800d }) { page.Measure(new Size(width, 900)); page.Arrange(new Rect(0, 0, width, 900)); page.UpdateLayout(); } if (AppPath.Argument("verify-dialogs") == "true") { await Task.Delay(80); page.UpdateLayout(); } checks.Add(type.Name + ": navigation, view-model load, XAML layout"); AppPath.TraceVerification("Page passed " + type.Name); if (AppPath.Argument("verify-dialogs") == "true") foreach (var launcher in DialogVerification.Children(page).Where(x => x.Ready && x.Visibility == Visibility.Visible).ToArray()) await DialogVerification.RunAsync(launcher); } if (!App.Service.State.Connected) throw new InvalidOperationException("Admin API connection was not exercised."); var verifyApi = AppPath.Argument("verify-api"); if (!Uri.TryCreate(verifyApi, UriKind.Absolute, out var endpoint) || !endpoint.IsLoopback || App.Service.State.Address.TrimEnd('/') != verifyApi!.TrimEnd('/')) throw new InvalidOperationException("Administrative verification requires its isolated loopback API."); await App.Service.PostAsync("config", new { allowPlayerCurrencyGrant = false, allowPlayerItemGrant = true }); var permissions = await App.Service.GetAsync("config"); if (permissions.Value("allowPlayerCurrencyGrant") || !permissions.Value("allowPlayerItemGrant")) throw new InvalidOperationException("Independent permissions were not saved."); await App.Service.PostAsync("config", new { allowPlayerCurrencyGrant = true, allowPlayerItemGrant = true }); await App.Service.PostAsync("news/save", new { title = "Desktop verification", englishTitle = "", url = "", imageUrl = "", priority = false, published = true }); var players = (JArray)await App.Service.GetAsync("accounts"); navigation.NavigateTo(); var playersModel = ((PlayersPage)navigation.NavigationService.Frame!.Content).ViewModel; if (playersModel.LoadCommand.ExecutionTask is Task playersLoad) await playersLoad; foreach (var skip in new[] { true, false }) { playersModel.SkipTutorial = skip; await playersModel.SaveTutorialCommand.ExecuteAsync(null); if (playersModel.LastError is not null || playersModel.SelectedAccount?.SkipTutorial != skip) throw new InvalidOperationException("Tutorial option did not round-trip through the player management view-model: " + playersModel.LastError); } checks.Add("administrator-per-player-tutorial-option-persists"); await App.Service.PostAsync("messages/publish", new { requestId = Guid.NewGuid().ToString("D"), audience = "selected", targetIds = new[] { players[0]!.Value("id")! }, sender = "Verification", subject = "Desktop verification", body = "Isolated test mail" }); if (!((JArray)await App.Service.GetAsync("news")).Any() || !((JArray)await App.Service.GetAsync("messages")).Any()) throw new InvalidOperationException("Publication records were not saved."); foreach (var pageType in new[] { typeof(NewsPage), typeof(MailPage) }) { navigation.NavigateTo(pageType); var page = (Page)navigation.NavigationService.Frame!.Content; var vm = (ViewModelBase)page.DataContext; if (vm.LoadCommand.ExecutionTask is Task load) await load; if (vm.LastError is not null) throw new InvalidOperationException(vm.LastError); if (AppPath.Argument("verify-dialogs") != "true") foreach (var width in new[] { 1400d, 1024d, 800d }) { page.Measure(new Size(width, 900)); page.Arrange(new Rect(0, 0, width, 900)); page.UpdateLayout(); } } checks.Add("independent-permissions-and-mail-news-publishing"); AppPath.TraceVerification("Verify settings cards"); await VerifySettingsCardsAsync(navigation, checks); AppPath.TraceVerification("Verify editor synchronization"); await VerifyEditorSynchronizationAsync(navigation, players, checks); if (AppPath.Argument("verify-dialogs") == "true") { await SuggestionVerification.VerifyAsync((FrameworkElement)App.MainWindow.Content, new CatalogPageViewModel().Suggestions); checks.Add("native-AutoSuggestBox: nullable/invalid/ambiguous choices, exact paths, stale-response protection, context changes, failures, real catalog API"); } AppPath.TraceVerification("Verify unified inventory"); await VerifyUnifiedInventoryAsync(navigation, checks); if (AppPath.Argument("verify-dialogs") == "true") await VerifyQuestCreationAsync(navigation, checks); AppPath.TraceVerification("Verify overview actions"); await VerifyOverviewActionsAsync(navigation, checks); var largeId = players[0]!.Value("id")!; var largeInventory = await Task.Run(() => new JObject { ["Settings"] = new JObject { ["VerificationPayload"] = new string('界', 2_000_000) } }); await App.Service.PostAsync($"accounts/{largeId}/import", new { inventory = largeInventory }); navigation.NavigateTo(typeof(InventoryPage)); var inventoryPage = (InventoryPage)navigation.NavigationService.Frame!.Content; var inventoryVm = inventoryPage.ViewModel; if (inventoryVm.LoadCommand.ExecutionTask is Task firstLoad) await firstLoad; if (inventoryVm.LastError is not null) throw new InvalidOperationException(inventoryVm.LastError); var beats = 0; var clock = System.Diagnostics.Stopwatch.StartNew(); var lastBeat = clock.Elapsed; var maximumGap = TimeSpan.Zero; // DispatcherQueue timers also run before a test window is activated; // XAML DispatcherTimer ticks can be suspended on a hidden window. var heartbeat = App.MainWindow.DispatcherQueue.CreateTimer(); heartbeat.Interval = TimeSpan.FromMilliseconds(16); heartbeat.IsRepeating = true; heartbeat.Tick += (_, _) => { beats++; var now = clock.Elapsed; if (now - lastBeat > maximumGap) maximumGap = now - lastBeat; lastBeat = now; }; heartbeat.Start(); try { var load = inventoryVm.RefreshCommand.ExecuteAsync(null); if (inventoryVm.LoadingVisibility != Visibility.Visible) throw new InvalidOperationException("Inventory loading indicator was not shown."); await load; inventoryPage.Measure(new Size(1024, 900)); inventoryPage.Arrange(new Rect(0, 0, 1024, 900)); inventoryPage.UpdateLayout(); await Task.Delay(50); if (inventoryVm.LastError is not null || inventoryVm.InventoryJson.Length > Models.InventoryPreview.PageSize + 1 || !inventoryVm.CanNext || beats == 0 || maximumGap > TimeSpan.FromSeconds(1)) throw new InvalidOperationException($"Large inventory failed: {inventoryVm.LastError}; ticks={beats}, maximum gap={maximumGap.TotalMilliseconds:0}ms."); inventoryVm.NextPageCommand.Execute(null); if (!inventoryVm.CanPrevious) throw new InvalidOperationException("Inventory pagination failed."); checks.Add($"6MB-inventory-responsive-loading: {beats} UI ticks, max gap {maximumGap.TotalMilliseconds:0}ms, bounded JSON pages"); } finally { heartbeat.Stop(); } _ = new Views.Dialogs.NewAccountDialog(); _ = new Views.Dialogs.GiveItemDialog("Verification", [new Models.AccountRow("test", "Test", "test@example.invalid", false, false, 0, 0)]); checks.Add("admin-API-and-dialog-construction"); var previous = SystemProfile.Theme; foreach (var theme in new[] { ElementTheme.Light, ElementTheme.Dark, ElementTheme.Default }) AppThemeHelper.ChangeTheme(theme); AppThemeHelper.ChangeTheme(previous); SystemProfile.SaveProfile(); if (BindingErrors.Count > 0) throw new InvalidOperationException(string.Join("\n", BindingErrors)); checks.Add("theme-and-isolated-XFEProfile-save"); if (AppPath.Argument("verify-dialogs") == "true") checks.Add($"native-form-dialogs: {DialogVerification.CompletedCount} opens, button actions and detachments; shared button styling"); } catch (Exception ex) { error = ex.ToString(); AppPath.LogException(ex); } Directory.CreateDirectory(Path.GetDirectoryName(Path.GetFullPath(reportPath))!); await File.WriteAllTextAsync(reportPath, JsonSerializer.Serialize(new { application = "Admin", passed = error is null, checks, error, scope = AppPath.Argument("verify-dialogs") == "true" ? "Isolated real API, native WinUI modal open/save/cancel, persistence, navigation, bindings, styles and layout." : "Hidden XAML construction, navigation, bindings and layout; not visual acceptance." }, new JsonSerializerOptions { WriteIndented = true })); } private static async Task VerifyEditorSynchronizationAsync(INavigationViewService navigation, JArray players, List checks) { navigation.NavigateTo(); var settings = ((ServerSettingsPage)navigation.NavigationService.Frame!.Content).ViewModel; if (settings.LoadCommand.ExecutionTask is Task loading) await loading; var field = settings.Fields.First(x => x.Key == "worldState.baroAlwaysAvailable"); var before = field.Value.Value(); field.Value = new JValue(!before); var current = (JObject)await App.Service.GetAsync("editor/server"); await App.Service.PostAsync("editor/server", new { version = current.Value("version"), values = new JObject { ["worldState.creditBoostMultiplier"] = 2 } }); await settings.CheckChangesAsync(); if (!settings.HasChangeNotice || field.Value.Value() != !before || !ReferenceEquals(field, settings.Fields.First(x => x.Key == field.Key))) throw new InvalidOperationException("World setting change discarded the administrator's unsaved input."); await settings.RefreshCommand.ExecuteAsync(null); if (settings.LastError is not null || settings.HasChangeNotice || settings.Fields.First(x => x.Key == "worldState.creditBoostMultiplier").Value.Value() != 2) throw new InvalidOperationException("Server settings failed to refresh after a conflict."); current = (JObject)await App.Service.GetAsync("editor/server"); await App.Service.PostAsync("editor/server", new { version = current.Value("version"), values = new JObject { ["worldState.creditBoostMultiplier"] = 3 } }); await settings.CheckChangesAsync(); if (settings.Fields.First(x => x.Key == "worldState.creditBoostMultiplier").Value.Value() != 3) throw new InvalidOperationException("Clean server settings did not follow a remote change."); navigation.NavigateTo(); var vm = ((EditorPage)navigation.NavigationService.Frame!.Content).ViewModel; if (vm.LoadCommand.ExecutionTask is Task editorLoad) await editorLoad; vm.Category = vm.Categories.First(x => x.Key == "settings"); await vm.RefreshCommand.ExecuteAsync(null); var rule = vm.Fields.First(x => x.Key == "skipAllDialogue"); rule.Value = new JValue(!rule.Value.Value()); await App.Service.PostAsync($"accounts/{vm.SelectedAccount!.Id}/currency", new { currency = "RegularCredits", delta = 1 }); await vm.CheckChangesAsync(); if (!vm.HasExternalChanges || vm.CanSave || !rule.Changed || !ReferenceEquals(rule, vm.Fields.First(x => x.Key == rule.Key))) throw new InvalidOperationException("Administrator account editor failed to protect a modified form."); await vm.RefreshCommand.ExecuteAsync(null); if (vm.LastError is not null || vm.HasExternalChanges || vm.Fields.Any(x => x.Changed)) throw new InvalidOperationException("Administrator editor did not clear the conflict on refresh."); checks.Add("administrator-editor-and-world-settings-external-change-detection-with-input-preservation"); } private static async Task VerifySettingsCardsAsync(INavigationViewService navigation, List checks) { navigation.NavigateTo(); var page = (ServerSettingsPage)navigation.NavigationService.Frame!.Content; var settings = page.ViewModel; if (settings.LoadCommand.ExecutionTask is Task load) await load; page.UpdateLayout(); var form = DialogVerification.Children(page).Single(); var groups = form.Children.OfType().ToArray(); var cards = groups.SelectMany(x => x.Items).Cast().ToArray(); if (cards.Length != settings.Fields.Count || cards.Length < 50 || DialogVerification.Children(page).Any()) throw new InvalidOperationException("Server settings must be directly editable community SettingsCards."); if (groups.Length < 5 || groups.Any(x => (string)x.Tag == "other") || cards.Select(x => (string)x.Tag).Distinct().Count() != cards.Length) throw new InvalidOperationException("Server settings grouping lost, duplicated or failed to categorize a field."); var field = settings.Fields.First(x => x.Key == "worldState.baroAlwaysAvailable"); var before = field.Value.Value(); var vendors = groups.Single(x => (string)x.Tag == "vendors"); vendors.IsExpanded = true; page.UpdateLayout(); ((ToggleSwitch)cards.Single(x => (string)x.Tag == field.Key).Content).IsOn = !before; if (field.Value.Value() == before) throw new InvalidOperationException("The SettingsCard toggle did not update its field."); settings.Query = "creditBoostMultiplier"; page.UpdateLayout(); var matches = groups.Where(x => x.Visibility == Visibility.Visible).ToArray(); if (matches.Length != 1 || (string)matches[0].Tag != "boosters" || !matches[0].IsExpanded || cards.Single(x => (string)x.Tag == field.Key).Visibility != Visibility.Collapsed) throw new InvalidOperationException("Settings search failed to reveal only the matching section and field."); settings.Query = ""; page.UpdateLayout(); if (!vendors.IsExpanded || groups.Single(x => (string)x.Tag == "boosters").IsExpanded || field.Value.Value() == before) throw new InvalidOperationException("Clearing search lost the section expansion state or pending input."); settings.Query = UiText.Translate("虚空腐蚀 · 2025"); page.UpdateLayout(); matches = groups.Where(x => x.Visibility == Visibility.Visible).ToArray(); if (matches.Length != 1 || (string)matches[0].Tag != "void-2025" || matches[0].Items.Count != 4 || !matches[0].IsExpanded) throw new InvalidOperationException("Weekly event settings cannot be found by their event group name."); settings.Query = "no-such-setting-" + Guid.NewGuid().ToString("N"); page.UpdateLayout(); if (groups.Any(x => x.Visibility == Visibility.Visible)) throw new InvalidOperationException("Unmatched settings search left unrelated groups visible."); await settings.SaveCommand.ExecuteAsync(null); var saved = (JObject)await App.Service.GetAsync("editor/server"); if (settings.LastError is not null || saved["fields"]!.First(x => x.Value("key") == field.Key).Value("value") == before) throw new InvalidOperationException("An edited setting was lost when filtered out before saving."); settings.Query = ""; navigation.NavigateTo(); var permissionsPage = (PermissionsPage)navigation.NavigationService.Frame.Content; var permissions = permissionsPage.ViewModel; if (permissions.LoadCommand.ExecutionTask is Task permissionsLoad) await permissionsLoad; permissionsPage.UpdateLayout(); var permissionForm = DialogVerification.Children(permissionsPage).Single(); var permissionGroups = permissionForm.Children.OfType().ToArray(); var permissionCards = permissionGroups.SelectMany(x => x.Items).Cast().ToArray(); if (permissionCards.Length != permissions.Fields.Count || permissionGroups.Any(x => ((string)x.Tag).EndsWith("other", StringComparison.Ordinal))) throw new InvalidOperationException("Permission groups omitted or failed to categorize an authorized field."); var permission = permissions.Fields.First(x => x.Key == "experience"); var permissionBefore = permission.Value.Value(); ((ToggleSwitch)permissionCards.Single(x => (string)x.Tag == permission.Key).Content).IsOn = !permissionBefore; await permissions.SaveCommand.ExecuteAsync(null); if (permissions.LastError is not null || permissions.Fields.First(x => x.Key == permission.Key).Value.Value() == permissionBefore) throw new InvalidOperationException("Permission SettingsCard save did not round-trip."); permissions.Fields.First(x => x.Key == permission.Key).Value = new JValue(permissionBefore); await permissions.SaveCommand.ExecuteAsync(null); permissionsPage.UpdateLayout(); var editingToggle = DialogVerification.Children(permissionsPage).Single(x => Microsoft.UI.Xaml.Automation.AutomationProperties.GetAutomationId(x) == "AllowItemEditing"); editingToggle.IsOn = false; await permissions.SaveCommand.ExecuteAsync(null); if (permissions.AllowItemEditing) throw new InvalidOperationException("Item editing switch failed to revoke item operations."); editingToggle.IsOn = true; await permissions.SaveCommand.ExecuteAsync(null); if (!permissions.AllowItemEditing || !permissions.Fields.First(x => x.Key == "ability").Value.Value() || !permissions.Fields.First(x => x.Key == "shards").Value.Value()) throw new InvalidOperationException("Item editing switch failed to enable full equipment editing."); permissions.Fields.First(x => x.Key == "ability").Value = new JValue(false); await permissions.SaveCommand.ExecuteAsync(null); permissionsPage.UpdateLayout(); var completeButton = (Button)permissionsPage.FindName("CompleteItemEditingButton"); if (permissions.CompleteItemEditingVisibility != Visibility.Visible || completeButton.Visibility != Visibility.Visible || !permissions.ItemEditingDescription.Contains("16 / 17", StringComparison.Ordinal)) throw new InvalidOperationException("Partial equipment permissions have no visible completion control or enabled count."); ((Microsoft.UI.Xaml.Automation.Provider.IInvokeProvider)new Microsoft.UI.Xaml.Automation.Peers.ButtonAutomationPeer(completeButton) .GetPattern(Microsoft.UI.Xaml.Automation.Peers.PatternInterface.Invoke)).Invoke(); await permissions.SaveCommand.ExecuteAsync(null); if (permissions.LastError is not null || permissions.CompleteItemEditingVisibility != Visibility.Collapsed || !permissions.Fields.First(x => x.Key == "ability").Value.Value()) throw new InvalidOperationException("Completing partial equipment permissions did not save all operations."); var independent = await App.Service.GetAsync("config"); if (!independent.Value("allowPlayerItemGrant") || !independent.Value("allowPlayerCurrencyGrant")) throw new InvalidOperationException("Item editing changed independent item/currency grant switches."); checks.Add("allow-item-editing: native SettingsCard enables/revokes operations, reports partial grants and completes them with a native button independently of item/currency grants"); checks.Add($"community-settings-expanders: {cards.Length} server controls in {groups.Length} groups, inline toggle/save, name/key/group search, expansion and drafts retained, {permissionCards.Length} grouped permissions save/restore"); } private static async Task VerifyOverviewActionsAsync(INavigationViewService navigation, List checks) { navigation.NavigateTo(); var page = (InventoryPage)navigation.NavigationService.Frame!.Content; if (page.ViewModel.LoadCommand.ExecutionTask is Task load) await load; var id = page.ViewModel.SelectedAccount!.Id; await OverviewActionsVerification.VerifyAsync((OverviewActionsView)page.FindName("OverviewActions"), page.ViewModel.OverviewActions, async () => (JObject)(await App.Service.GetAsync($"accounts/{id}/archive"))["inventory"]!, AppPath.Argument("verify-dialogs") == "true"); if (page.ViewModel.RefreshCommand.ExecutionTask is Task refresh) await refresh; if (InventoryNavigation.All.Any(x => x.Key == "progress")) throw new InvalidOperationException("The old progress item-list navigation remains."); checks.Add("overview-actions: 16 dedicated buttons, grouped cards, native cancel and execute, syndicate suggestion, API readback, account-switch guard"); } private static async Task VerifyQuestCreationAsync(INavigationViewService navigation, List checks) { navigation.NavigateTo(InventoryNavigation.Route("QuestKeys")); var page = (EditorPage)navigation.NavigationService.Frame!.Content; var vm = page.ViewModel; if (vm.LoadCommand.ExecutionTask is Task load) await load; await QuestEditorVerification.VerifyAsync(page, (FormDialogButton)page.FindName("AddQuestButton"), (AutoSuggestBox)page.FindName("OwnedSearch"), () => vm.QuestFields, () => vm.Items, () => vm.IsIdle, () => vm.LastError, async () => (JObject)(await App.Service.GetAsync($"accounts/{vm.SelectedAccount!.Id}/archive"))["inventory"]!); checks.Add("missing-quest: native suggestion and add dialog, API persistence preserves progress; live name/path/no-match/clear list search"); } private static async Task VerifyUnifiedInventoryAsync(INavigationViewService navigation, List checks) { var shell = (AppShellPage)App.MainWindow.Content; var tree = (NavigationViewItem)shell.FindName("InventoryRoot"); if (tree.MenuItems.Count != InventoryNavigation.Sections.Count + 1) throw new InvalidOperationException("Inventory tree is incomplete."); var original = App.Service.State.SelectedAccountId; var secondary = await App.Service.PostAsync("accounts", new { displayName = "Navigation fixture", email = Guid.NewGuid().ToString("N") + "@example.invalid", password = Guid.NewGuid().ToString("N") }); var accounts = (JArray)await App.Service.GetAsync("accounts"); var target = accounts.First(x => x.Value("DisplayName") == "Navigation fixture").Value("id")!; App.Service.State.SelectedAccountId = target; foreach (var section in InventoryNavigation.All.Where(x => x.Key is not ("riven" or "catalog"))) { navigation.NavigateTo(InventoryNavigation.Route(section.Key)); var vm = ((EditorPage)navigation.NavigationService.Frame!.Content).ViewModel; if (vm.LoadCommand.ExecutionTask is Task load) await load; if (vm.LastError is not null || vm.Category?.Key != section.Key || vm.SelectedAccount?.Id != target) throw new InvalidOperationException("Inventory category failed: " + section.Key + ": " + vm.LastError); } navigation.NavigateTo(InventoryNavigation.Route("Suits")); var editor = ((EditorPage)navigation.NavigationService.Frame!.Content).ViewModel; if (editor.LoadCommand.ExecutionTask is Task loaded) await loaded; await editor.ShowCatalogCommand.ExecuteAsync(null); editor.Catalog.Query = "/Lotus/Powersuits/Excalibur/Excalibur"; await editor.Catalog.SearchCommand.ExecuteAsync(null); editor.Catalog.SelectedItem = editor.Catalog.Items.First(x => x.Type == editor.Catalog.Query); await editor.Catalog.GiveCommand.ExecuteAsync(null); await editor.ShowOwnedCommand.ExecuteAsync(null); if (editor.LastError is not null || editor.IsCatalogMode || !editor.Items.Any() || editor.SelectedAccount?.Id != target) throw new InvalidOperationException("Integrated administrator item creation did not return to the same inventory: " + editor.LastError); editor.SelectedItem = editor.Items.First(); await editor.OpenItemCommand.ExecuteAsync(null); if (editor.Actions.Count == 0) throw new InvalidOperationException("The added Warframe has no editor actions."); editor.Query = "Excalibur"; await editor.RefreshCommand.ExecuteAsync(null); editor.SelectedItem = editor.Items.First(); var selectedKey = editor.SelectedItem.Key; editor.EditItemCommand.Execute(null); if (navigation.NavigationService.Frame!.Content is not EquipmentPage details) throw new InvalidOperationException("Editing did not navigate to the dedicated page."); if (details.ViewModel.LoadCommand.ExecutionTask is Task detailLoad) await detailLoad; if (details.ViewModel.LastError is not null) throw new InvalidOperationException(details.ViewModel.LastError); var liveInput = AppPath.Argument("verify-dialogs") == "true"; AppPath.TraceVerification("Verify equipment sections"); await EquipmentEditorVerification.VerifyAsync(details, (EquipmentEditorView)details.FindName("EditorView"), 3141, liveInput); checks.Add(liveInput ? "ability-AutoSuggestBox: loaded input, name/path candidates, invalid input rejected, native query and save, API readback" : "ability-AutoSuggestBox: construction only; live input requires --verify-dialogs"); checks.Add(liveInput ? "multiple-abilities: four native suggestions, save/reload, independent configurations, restore original skills" : "multiple-abilities: four searchable slots constructed"); AppPath.TraceVerification("Verify equipment synchronization"); await EquipmentEditorVerification.VerifySynchronizationAsync(details.ViewModel.Editor, async () => { await App.Service.PostAsync($"accounts/{target}/currency", new { currency = "RegularCredits", delta = 1 }); }); AppPath.TraceVerification("Verify exalted mod board"); await EquipmentEditorVerification.VerifyExaltedAsync(details, (EquipmentEditorView)details.FindName("EditorView"), async () => { foreach (var type in new[] { "/Lotus/Upgrades/Mods/Pistol/WeaponDamageAmountMod", "/Lotus/Upgrades/Mods/Warframe/AvatarHealthMaxMod", "/Lotus/Upgrades/Mods/Warframe/AvatarArmourMod", "/Lotus/Upgrades/Mods/Pistol/WeaponFreezeDamageMod", "/Lotus/Upgrades/Mods/Pistol/WeaponToxinDamageMod", "/Lotus/Upgrades/Mods/Pistol/WeaponFireRateMod", "/Lotus/Upgrades/Mods/Pistol/WeaponCritChanceMod" }) await App.Service.PostAsync($"accounts/{target}/item", new { type, count = 1 }); }, async () => { var current = (EquipmentPage)navigation.NavigationService.Frame!.Content; if (current.ViewModel.LoadCommand.ExecutionTask is Task load) await load; return (current, (EquipmentEditorView)current.FindName("EditorView")); }, () => navigation.NavigationService.GoBack(), liveInput); checks.Add("exalted-equipment: host-to-Glory shared card board, Warframe/Glory install/swap/uninstall, raw-to-instance conversion, C save, independent B, back retains host"); checks.Add("image-loading: native WinUI PNG decode, cache miss/hit, resource icon, stale request protection, no wrong-thread dependency-property reads"); checks.Add("mod-search: original descriptions, Viral includes Cold/Toxin, matching suggestions, AND keywords, cancelled stale request cannot replace results"); navigation.NavigationService.GoBack(); if (navigation.NavigationService.Frame.Content is not EditorPage returned) throw new InvalidOperationException("Native Back did not return to the inventory list."); if (returned.ViewModel.ResumeListCommand.ExecutionTask is Task resumed) await resumed; if (returned.ViewModel.Query != "Excalibur" || returned.ViewModel.SelectedItem?.Key != selectedKey) throw new InvalidOperationException("Back lost the inventory query or selected item."); checks.Add("equipment-SelectorBar: dedicated page, native save/reset, cross-section drafts, API persistence, external conflict protection, back retains list context"); foreach (var type in new[] { EquipmentEditorVerification.FetchPetFixture, XFEWarframe.Mods.PetFetchMod.Type }) await App.Service.PostAsync($"accounts/{target}/item", new { type, count = 1 }); navigation.NavigateTo(InventoryNavigation.Route("KubrowPets")); var pets = ((EditorPage)navigation.NavigationService.Frame.Content).ViewModel; if (pets.LoadCommand.ExecutionTask is Task petLoad) await petLoad; pets.SelectedItem = pets.Items.First(); pets.EditItemCommand.Execute(null); if (navigation.NavigationService.Frame.Content is not EquipmentPage petDetails) throw new InvalidOperationException("Pet editing did not open the shared equipment page."); if (petDetails.ViewModel.LoadCommand.ExecutionTask is Task petDetailLoad) await petDetailLoad; await EquipmentEditorVerification.VerifyPetAsync(petDetails, (EquipmentEditorView)petDetails.FindName("EditorView")); navigation.NavigationService.GoBack(); checks.Add("pet-fetch: shared ten-slot board at three widths, 300m keyword suggestions, full-rank owned card, install/move/uninstall/save, independent configs"); navigation.NavigateTo(); var riven = ((RivenPage)navigation.NavigationService.Frame!.Content).ViewModel; if (riven.LoadCommand.ExecutionTask is Task rivenLoad) await rivenLoad; if (riven.SelectedAccount?.Id != target) throw new InvalidOperationException("Riven navigation changed the selected player."); await RivenVerification.VerifyAsync((RivenPage)navigation.NavigationService.Frame.Content, riven.Rows, () => riven.CalculateCommand.ExecuteAsync(null), () => riven.Name, AppPath.Argument("verify-dialogs") == "true"); checks.Add("riven-instance-name-colored-stats-numeric-suggestions-and-live-preview"); App.Service.State.SelectedAccountId = original; checks.Add($"unified-inventory: {InventoryNavigation.All.Count() - 2} categories, retained player, category-scoped add and edit, riven target"); } }