47 lines
1.8 KiB
C#
47 lines
1.8 KiB
C#
using System.Windows;
|
|
using VideoDownloader.App;
|
|
using VideoDownloader.Core.Config;
|
|
using VideoDownloader.Tests.Infrastructure;
|
|
|
|
namespace VideoDownloader.Tests.E2E;
|
|
|
|
/// <summary>
|
|
/// E2E: 설정창 "앱 업데이트" 섹션(DEPLOYMENT_PLAN §6 자동 업데이트 v1) —
|
|
/// 실제 SettingsWindow 를 띄워 설정값 로드 배선과 잘못된 저장소 형식의 즉시 안내(네트워크 불필요 경로)를 검증.
|
|
/// </summary>
|
|
[Collection("E2E")]
|
|
public class SettingsUpdateUiE2ETests
|
|
{
|
|
[Fact]
|
|
public void 설정창_업데이트_저장소_로드와_형식오류_안내()
|
|
{
|
|
// VD_DATA_DIR 격리: SettingsWindow 가 참조하는 프로필 경로를 실사용자와 분리
|
|
var dataDir = Path.Combine(Path.GetTempPath(), $"vd_set_{Guid.NewGuid():N}");
|
|
Environment.SetEnvironmentVariable("VD_DATA_DIR", dataDir);
|
|
try
|
|
{
|
|
using var sta = StaDispatcher.Start();
|
|
WpfTestApp.Ensure(sta.Dispatcher);
|
|
sta.Invoke(() =>
|
|
{
|
|
var config = new AppConfig { UpdateRepo = "user/videodownloader" };
|
|
var win = new SettingsWindow(config);
|
|
|
|
// 설정 → UI 로드 배선
|
|
Assert.Equal("user/videodownloader", win.UpdateRepoBox.Text);
|
|
|
|
// owner/repo 형식이 아니면 네트워크 호출 없이 즉시 안내
|
|
win.UpdateRepoBox.Text = "invalid-format";
|
|
win.CheckUpdate_Click(null, new RoutedEventArgs());
|
|
Assert.Contains("owner/repo", win.UpdateResultText.Text);
|
|
|
|
win.Close();
|
|
});
|
|
}
|
|
finally
|
|
{
|
|
Environment.SetEnvironmentVariable("VD_DATA_DIR", null);
|
|
try { Directory.Delete(dataDir, recursive: true); } catch (DirectoryNotFoundException) { }
|
|
}
|
|
}
|
|
}
|