How to bypass recaptcha human check in nightwatch

2019-06-18 15:14发布

问题:

I'm writing a nightwatch test for a Backbone View that includes Google's "recaptcha" human check. Obviously, the test is a bot, and so it can't pass the test. So I'm trying to figure out a way to bypass the human check in the test. Can anyone suggest a way to do this that is elegant?

At the moment, the only possibility I can see is setting a query parameter on the url that nightwatch uses to load the page, and then checking for that query parameter within the logic of the Backbone view, but this seems bad. I don't want to have to include logic about testing in the code itself. It's just messy.

Thoughts?