diff --git a/RepoM.sln b/RepoM.sln index a7a2738c..4414363e 100644 --- a/RepoM.sln +++ b/RepoM.sln @@ -67,6 +67,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RepoM.ActionMenu.Core.TestL EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RepoM.ActionMenu.CodeGenDummyLibrary", "tests\RepoM.ActionMenu.CodeGenDummyLibrary\RepoM.ActionMenu.CodeGenDummyLibrary.csproj", "{998B5CA0-158D-4B01-A343-07ED534D02B0}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UiTests", "tests\UiTests\UiTests.csproj", "{B537DF84-37BC-411F-ABBD-9CBBCE66F0E1}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -681,6 +683,26 @@ Global {998B5CA0-158D-4B01-A343-07ED534D02B0}.Release|x64.Build.0 = Release|Any CPU {998B5CA0-158D-4B01-A343-07ED534D02B0}.Release|x86.ActiveCfg = Release|Any CPU {998B5CA0-158D-4B01-A343-07ED534D02B0}.Release|x86.Build.0 = Release|Any CPU + {B537DF84-37BC-411F-ABBD-9CBBCE66F0E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B537DF84-37BC-411F-ABBD-9CBBCE66F0E1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B537DF84-37BC-411F-ABBD-9CBBCE66F0E1}.Debug|ARM.ActiveCfg = Debug|Any CPU + {B537DF84-37BC-411F-ABBD-9CBBCE66F0E1}.Debug|ARM.Build.0 = Debug|Any CPU + {B537DF84-37BC-411F-ABBD-9CBBCE66F0E1}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {B537DF84-37BC-411F-ABBD-9CBBCE66F0E1}.Debug|ARM64.Build.0 = Debug|Any CPU + {B537DF84-37BC-411F-ABBD-9CBBCE66F0E1}.Debug|x64.ActiveCfg = Debug|Any CPU + {B537DF84-37BC-411F-ABBD-9CBBCE66F0E1}.Debug|x64.Build.0 = Debug|Any CPU + {B537DF84-37BC-411F-ABBD-9CBBCE66F0E1}.Debug|x86.ActiveCfg = Debug|Any CPU + {B537DF84-37BC-411F-ABBD-9CBBCE66F0E1}.Debug|x86.Build.0 = Debug|Any CPU + {B537DF84-37BC-411F-ABBD-9CBBCE66F0E1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B537DF84-37BC-411F-ABBD-9CBBCE66F0E1}.Release|Any CPU.Build.0 = Release|Any CPU + {B537DF84-37BC-411F-ABBD-9CBBCE66F0E1}.Release|ARM.ActiveCfg = Release|Any CPU + {B537DF84-37BC-411F-ABBD-9CBBCE66F0E1}.Release|ARM.Build.0 = Release|Any CPU + {B537DF84-37BC-411F-ABBD-9CBBCE66F0E1}.Release|ARM64.ActiveCfg = Release|Any CPU + {B537DF84-37BC-411F-ABBD-9CBBCE66F0E1}.Release|ARM64.Build.0 = Release|Any CPU + {B537DF84-37BC-411F-ABBD-9CBBCE66F0E1}.Release|x64.ActiveCfg = Release|Any CPU + {B537DF84-37BC-411F-ABBD-9CBBCE66F0E1}.Release|x64.Build.0 = Release|Any CPU + {B537DF84-37BC-411F-ABBD-9CBBCE66F0E1}.Release|x86.ActiveCfg = Release|Any CPU + {B537DF84-37BC-411F-ABBD-9CBBCE66F0E1}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/RepoM.App/App.xaml.cs b/src/RepoM.App/App.xaml.cs index e0b71248..67e8da09 100644 --- a/src/RepoM.App/App.xaml.cs +++ b/src/RepoM.App/App.xaml.cs @@ -176,6 +176,7 @@ private static bool IsAlreadyRunning() return false; } +#pragma warning disable CS0162 // Unreachable code detected try { _mutex = new Mutex(true, "Local\\github.com/coenm/RepoM", out var createdNew); @@ -193,6 +194,7 @@ private static bool IsAlreadyRunning() _mutex.Dispose(); _mutex = null; return true; +#pragma warning restore CS0162 // Unreachable code detected } private static void ReleaseAndDisposeMutex() diff --git a/src/RepoM.App/MainWindow.xaml b/src/RepoM.App/MainWindow.xaml index d4b574cd..08a9136d 100644 --- a/src/RepoM.App/MainWindow.xaml +++ b/src/RepoM.App/MainWindow.xaml @@ -33,7 +33,7 @@ Focusable="False"> - - - + + + + + + + + + + + + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + + + diff --git a/tests/UiTests/Utils/ApplicationFactory.cs b/tests/UiTests/Utils/ApplicationFactory.cs new file mode 100644 index 00000000..27ea464c --- /dev/null +++ b/tests/UiTests/Utils/ApplicationFactory.cs @@ -0,0 +1,27 @@ +namespace UiTests.Utils; + +using FlaUI.Core; + +public static class ApplicationFactory +{ + public static Application LaunchVsCode(string? filename) + { + if (string.IsNullOrWhiteSpace(filename)) + { + filename = string.Empty; + } + else + { + filename = @" """ + filename + @""""; + } + + return Application.Launch( + @"""C:\Users\Munckhof CJJ\AppData\Local\Programs\Microsoft VS Code\Code.exe""", + "--new-window --disable-extensions" + filename); + } + + public static Application LaunchRepoM() + { + return Application.Launch(@"C:\Projects\Private\git\RepoM\src\RepoM.App\bin\Release\net8.0-windows\RepoM.exe"); + } +} \ No newline at end of file diff --git a/tests/UiTests/Utils/Delays.cs b/tests/UiTests/Utils/Delays.cs new file mode 100644 index 00000000..20056a0b --- /dev/null +++ b/tests/UiTests/Utils/Delays.cs @@ -0,0 +1,20 @@ +namespace UiTests.Utils; + +using System; +using System.Threading.Tasks; + +public static class Delays +{ + public static TimeSpan DefaultKeyPressDelay { get; } = TimeSpan.FromMilliseconds(100); + public static TimeSpan DefaultWaitUntilClick { get; } = TimeSpan.FromMilliseconds(1000); + + public static Task DelaySmallAsync() + { + return Task.Delay(100); + } + + public static Task DelayMediumAsync() + { + return Task.Delay(1000); + } +} \ No newline at end of file diff --git a/tests/UiTests/VideoRecordingMode.cs b/tests/UiTests/VideoRecordingMode.cs new file mode 100644 index 00000000..6be5a02c --- /dev/null +++ b/tests/UiTests/VideoRecordingMode.cs @@ -0,0 +1,22 @@ +namespace UiTests; + +/// +/// Defines how videos should be recorded for the tests. +/// +public enum VideoRecordingMode +{ + /// + /// Do not record any video. + /// + NoVideo, + + /// + /// Record one separate video per test. + /// + OnePerTest, + + /// + /// Report one video for the whole test fixture. + /// + OnePerFixture, +} \ No newline at end of file