diff --git a/.github/workflows/NewsReader.CI.yml b/.github/workflows/NewsReader.CI.yml index e38ed3fd..cad98ea3 100644 --- a/.github/workflows/NewsReader.CI.yml +++ b/.github/workflows/NewsReader.CI.yml @@ -6,6 +6,7 @@ on: - 'src/*' - 'src/NewsReader/**' - '.github/workflows/**' + - '!.github/workflows/System.Waf.CI.yml' jobs: GetVersion: diff --git a/.github/workflows/System.Waf.CI.yml b/.github/workflows/System.Waf.CI.yml index 270e0e33..1fcfeccc 100644 --- a/.github/workflows/System.Waf.CI.yml +++ b/.github/workflows/System.Waf.CI.yml @@ -19,10 +19,10 @@ jobs: run: dotnet build ./src/System.Waf/System.Waf.sln -c Release -p:ContinuousIntegrationBuild=true - name: Test run: dotnet test ./src/System.Waf/System.Waf.sln -c Release --no-build - - name: Upload NuGet packages + - name: Upload NuGet Packages uses: actions/upload-artifact@v4 with: - name: packages + name: Packages if-no-files-found: error path: | src/System.Waf/System.Waf/**/*.nupkg @@ -30,3 +30,12 @@ jobs: - name: UI Test run: dotnet test ./src/Samples.UITest/Samples.UITest.sln --logger "console;verbosity=detailed" + - name: Upload UI Test results + uses: actions/upload-artifact@v4 + if: always() + with: + name: UITestResults + if-no-files-found: ignore + path: | + out/Samples.UITest/ + diff --git a/.gitignore b/.gitignore index 58f9b851..d8a20a08 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,7 @@ [Bb]in/ [Oo]bj/ [Aa]pp[Pp]ackages/ +[Oo]ut/ # Unit test results [Tt]est[Rr]esults diff --git a/src/Samples.UITest/Writer.Test/Tests/WriterTest.cs b/src/Samples.UITest/Writer.Test/Tests/WriterTest.cs index 6114caf7..cb6ae0e4 100644 --- a/src/Samples.UITest/Writer.Test/Tests/WriterTest.cs +++ b/src/Samples.UITest/Writer.Test/Tests/WriterTest.cs @@ -1,4 +1,5 @@ using FlaUI.Core.AutomationElements; +using FlaUI.Core.Capturing; using FlaUI.Core.Definitions; using FlaUI.Core.Tools; using UITest.Writer.Views; @@ -56,7 +57,7 @@ public void NewZoomWritePrintPreviewExitWithoutSave() var fileRibbonMenu = window.FileRibbonMenu; fileRibbonMenu.MenuButton.Click(); fileRibbonMenu.PrintPreviewMenuItem.Invoke(); - + var printPreviewTab = window.PrintPreviewTab; Assert.True(printPreviewTab.IsSelected); printPreviewTab.ZoomOutButton.Click(); @@ -109,7 +110,9 @@ public void NewSaveRestartOpenChangeAskToSave() Log.WriteLine(saveFileDialog.GetTree()); Log.WriteLine("---------"); var fileName = GetTempFileName("rtf"); - saveFileDialog.FileName.EditableText = fileName; + saveFileDialog.FileNameBox.EditableText = fileName; + Capture.Screen().ToFile(GetScreenshotFile("FullSaveScreen.png")); + saveFileDialog.CaptureToFile(GetScreenshotFile("SaveFileDialog.png")); saveFileDialog.SaveButton.Click(); fileRibbonMenu.MenuButton.Click(); diff --git a/src/Samples.UITest/Writer.Test/UITest.cs b/src/Samples.UITest/Writer.Test/UITest.cs index eac11969..77423173 100644 --- a/src/Samples.UITest/Writer.Test/UITest.cs +++ b/src/Samples.UITest/Writer.Test/UITest.cs @@ -14,10 +14,12 @@ namespace UITest.Writer; public class UITest : IDisposable { + private readonly string outPath; private readonly string executable; + private readonly string testOutPath; private readonly List usedFiles = []; private Application? app; - + static UITest() { Mouse.MovePixelsPerMillisecond = 2; @@ -29,14 +31,17 @@ public UITest(ITestOutputHelper log) { Log = log; var assemblyPath = Assembly.GetAssembly(typeof(UITest))!.Location; - executable = Path.GetFullPath(Path.Combine(assemblyPath, "../../../../../../../out/Writer/Release/net8.0-windows/writer.exe")); - + outPath = Path.GetFullPath(Path.Combine(assemblyPath, "../../../../../../../out/")); + executable = Path.Combine(outPath, "Writer/Release/net8.0-windows/writer.exe"); + testOutPath = Path.Combine(outPath, "Samples.UITest/Writer/"); + Directory.CreateDirectory(testOutPath); Log.WriteLine($"OSVersion: {Environment.OSVersion}"); Log.WriteLine($"ProcessorCount: {Environment.ProcessorCount}"); Log.WriteLine($"MachineName: {Environment.MachineName}"); Log.WriteLine($"UserInteractive: {Environment.UserInteractive}"); Log.WriteLine($"AssemblyPath: {assemblyPath}"); Log.WriteLine($"Executable: {executable}"); + Log.WriteLine($"TestOutPath: {testOutPath}"); Automation = new() { ConnectionTimeout = TimeSpan.FromSeconds(5) @@ -67,6 +72,8 @@ public string GetTempFileName(string fileExtension) return file; } + public string GetScreenshotFile(string fileName) => Path.Combine(testOutPath, fileName); + public void Dispose() { if (!SkipAppClose) app?.Close(); diff --git a/src/Samples.UITest/Writer.Test/Views/SaveFileDialog.cs b/src/Samples.UITest/Writer.Test/Views/SaveFileDialog.cs index 7b52bd0c..a23ed3a0 100644 --- a/src/Samples.UITest/Writer.Test/Views/SaveFileDialog.cs +++ b/src/Samples.UITest/Writer.Test/Views/SaveFileDialog.cs @@ -6,7 +6,7 @@ namespace UITest.Writer.Views; public class SaveFileDialog(FrameworkAutomationElementBase element) : Window(element) { - public ComboBox FileName => this.Find("FileNameControlHost").AsComboBox(); + public ComboBox FileNameBox => this.Find("FileNameControlHost").AsComboBox(); public Button SaveButton => this.Find(x => x.ByControlType(ControlType.Button).And(x.ByAutomationId("1"))).AsButton();