Skip to content

Commit

Permalink
UITest: improve SaveFileDialog view to support Win10 as well; add log…
Browse files Browse the repository at this point in the history
…ging in test to get more infos
  • Loading branch information
jbe2277 committed Apr 21, 2024
1 parent 520d973 commit 8d5917c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/Samples.UITest/Writer.Test/Tests/WriterTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ public void NewSaveRestartOpenChangeAskToSave()
saveChangesWindow.YesButton.Click();

var saveFileDialog = window.FirstModalWindow().As<SaveFileDialog>();
Log.WriteLine("---------");
Log.WriteLine(saveFileDialog.GetTree());
Log.WriteLine("---------");
var fileName = GetTempFileName("rtf");
saveFileDialog.FileName.EditableText = fileName;
saveFileDialog.SaveButton.Click();
Expand Down
5 changes: 3 additions & 2 deletions src/Samples.UITest/Writer.Test/Views/SaveFileDialog.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
using FlaUI.Core;
using FlaUI.Core.AutomationElements;
using FlaUI.Core.Definitions;

namespace UITest.Writer.Views;

public class SaveFileDialog(FrameworkAutomationElementBase element) : Window(element)
{
public ComboBox FileName => this.Find("FileNameControlHost").AsComboBox();

public Button SaveButton => this.Find("1").AsButton();
public Button SaveButton => this.Find(x => x.ByControlType(ControlType.Button).And(x.ByAutomationId("1"))).AsButton();

public Button CancelButton => this.Find("2").AsButton();
public Button CancelButton => this.Find(x => x.ByControlType(ControlType.Button).And(x.ByAutomationId("2"))).AsButton();
}

0 comments on commit 8d5917c

Please sign in to comment.