Testing UI behaviour is not an easy task. But there are multiple ways to do some useful tests without much effort.
Usually as simple as finding references to UI. Might be harder at times. But usually finding by name should be enough. And if your project is big enough that finding by name is not an option or if the naming is bound to change. Fetch the references from any other type that you hold in the scene or use tags.
Once you have the reference to your UI item. You can execute Button.onClick.Invoke() and equivalent for sliders/inputfields.
Rect child = rectTransform.GetRectRelativeToScreen();
return Fits(parent, child);
Now going to the test…. We can’t change the resolution of game view by script so it should exclude editor. Then we provide resolution list from a static function. Fetch all canvases and go through all items. And done!