For a group $(G,\star)$, an element $x\in G$ is said to be *square* if there is $y\in G$ such that $x=y\star y$.

My question is: For which kinds of group $G$, can we decide whether $x\in G$ is a square or not?

As for the multiplicative group $(\mathbb Z/n\mathbb Z)^*$ (where $n$ is a prime or the production of some primes), we know that this problem is equivalent to the so-called quadratic residue problem, and we have methods for dealing with this problem. More specifically, if and only if the factorization of $n$ is known, we can identify a sqaure element efficiently.

How about for other groups? If we cannot hope for a general answer, can we answer this question for certain special groups?