user2463014
user2463014

Reputation: 23

ObservableCollection Clear makes FlaUI cannot read DataItem

I have an WPF application using CommunityToolkit.Mvvm, which is working and now I want to use FlaUI to create automated UI testing. When I start application, I have window like thisstarting window

and in FlaUInspect I have FlaUInspect after start

But now user can change value on input fields, and after user change it I invoke recreate method for my ObservableCollection. Like this:

[ObservableProperty]
private ObservableCollection<PhaseMaterialsPresenter> _myCollection;

public void Recreate()
{
   MyCollection.Clear();
   foreach (var data in _newData)
   {
      MyCollecion.Add(data);
   }
}

And UI still works fine, but after this Recreation, when I refresh list in FlaUInspect I have this list where each DataItem seems to be empty: FlaUInspect after Recreate

It seems that invoking Clear on an ObservableCollection makes this issue, where FlaUI can't recognize UI elements anymore. I also tried to create new collection and then simply assign my new collection to my old collection, but it also has the same result. Anyone know how to make FlaUI to "see" the same thing that I have in my app UI?

Upvotes: 0

Views: 48

Answers (1)

user2463014
user2463014

Reputation: 23

I have found solution here https://github-wiki-see.page/m/FlaUI/FlaUI/wiki/Common-Issues

So my problem occured because I am using DevExpress controls, so all I had to do was to disable this static property:

ClearAutomationEventsHelper.IsEnabled = false;

I am leaving the comment here if someone else has similar problem.

Upvotes: 0

Related Questions