I know of the method to calculate $g^k$ for every $k < p$ and check if it ever is congruent to $1$.
But can I prove the same property with less work by taking the factors of $(p-1)$ and only raising g to those powers?
For Example: $g = 2$, $p = 7$ we can find $p-1 = 6$ and the factors of 6 are $1,2,3,6$ and can we only check these factors. $2^1 = 2$, $2^2 = 4$, $2^3 = 1$, $2^6 = 1$. Here shows that $2$ is not a primitive root of $7$ since it should have an order = $6$ but has an order = $3$.