Employers who do these types of interviews are showing you - right up front - who they are. They're a group who will never value you or your time.
Unfortunately, the only answer is having a lot of experience.
I mean, it doesn't solve the problem of this employer. It simply means you don't have to deal with this employer.
After 20 years in IT and development, when presented with "trial task interviews" like this, I usually reply with "I generally don't do trial work, however I'm absolutely willing to send examples from my portfolio and discuss my extensive experience."
I have a 100% success rate with not getting those jobs (or even an interview.)
I also have a 100% success rate at avoiding abusive companies (since I started this policy :D) and now work for the best company I've ever worked for. One who values both my work time and my personal time.