Sometimes it happens that girls shit test guys, i.e. flirt with other guys in front of BF, leave deprecating comments, etc.

Well, the actions look very similar to TRP's description of dread game. That is, you should give a girl a feeling that she is not as good as you and that you have a plenty of alternatives to her. Hence, she just tries to be nice due to a feeling of competition. However, I believe that only works for already "top" men.

So, a girl who thinks she is superior to other girls (well-looking, good sex, etc.) and hardly replaceable, will play dread game as well. Potentially, the guy will make her gifts, will care about her and so on. The guy still can be very "alpha" and she might want to have sex with him, but dread game is a thing. If it doesn't work (the guy passes shit test) she loses nothing.

But where do women even learn that stuff? Is it ingrained in them? When and why do they play?