Issue #3484247 by mstrelan, smustgrave: Add NodeElement return typehints to protected test helper methods
(cherry picked from commit 8925a129)
Closes #3511374