This is a huge red flag in my opinion and I would recommend people not agree to this. Why? Because it shows complete disregard for the candidate. "Pass a test and you can speak to an actual human being." Its demeaning. It also shows just how useless many recruiters have become. Part of the job of a recruiter's job and good ones do this, is to get a candidate excited about interviewing with the company and get the preliminary deal breaker questions out of the way to see if it even makes sense to proceed.
Nowadays I just point them at my github. If a body of open source isn't enough to get an interview I'm not interested in working there.
I have no problem with competency testing provided I have already spoken to someone on the team and established contact and registered interest with someone besides a recruiter.
Initially it was a Hackerrank challenge, now its a (100% Javascript) "Full Stack" take home exercise before you even get to speak to anyone technical.
I guess the lesson learned is to ask what the interview process looks like before getting involved.
However for this company, I applied online, they sent me a InterviewStreet/HackerRank coding test, and only after I passed that did a recruiter call me, and tell me they wanted me onsite for a week.