using System.Windows;
using System.Windows.Threading;
using Microsoft.Web.WebView2.Core;
using VideoDownloader.Tests.Infrastructure;
namespace VideoDownloader.Tests.E2E;
///
hello world hello brave hello
"; cv.NavigateToString(html); await WaitUntilNavCompleted(cv); // 네이티브 Find API — SuppressDefaultFindDialog 로 자체 UI 전제 검증 int matchCount = -1, activeIndex = -1; cv.Find.MatchCountChanged += (_, _) => matchCount = cv.Find.MatchCount; cv.Find.ActiveMatchIndexChanged += (_, _) => activeIndex = cv.Find.ActiveMatchIndex; var options = env.CreateFindOptions(); options.FindTerm = "hello"; options.ShouldHighlightAllMatches = true; options.SuppressDefaultFindDialog = true; await cv.Find.StartAsync(options); await Wait.Until(() => Task.FromResult(matchCount), c => c > 0, 10000); var countAfterStart = matchCount; cv.Find.FindNext(); await Wait.Until(() => Task.FromResult(activeIndex), i => i >= 1, 10000); cv.Find.Stop(); window.Close(); return (countAfterStart, activeIndex); }); try { Directory.Delete(udf, true); } catch { } Assert.Equal(3, result.countAfterStart); Assert.True(result.activeIndex >= 1, $"활성 인덱스가 진행되지 않음: {result.activeIndex}"); } private static Task WaitUntilNavCompleted(CoreWebView2 cv) { var tcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); EventHandler