VividCortex / angular-recaptcha

AngularJS directive to add a reCaptcha widget to your form
http://vividcortex.github.io/angular-recaptcha/
MIT License
496 stars 257 forks source link

Automated e2e-test with protractor #164

Open jlgonzalezpisa opened 8 years ago

jlgonzalezpisa commented 8 years ago

Hi,

I would like to know if there is any way to integrate angular-recaptcha with protractor. I mean, Is there a way to tell angular-recaptcha "I am testing, so let me pass allways until I finish"?

Thank you very much.

TheSharpieOne commented 8 years ago

https://developers.google.com/recaptcha/docs/faq#id-like-to-run-automated-tests-with-recaptcha-v2-what-should-i-do

With the following test keys, you will always get No CAPTCHA and all verification requests will pass.

Site key: 6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI Secret key: 6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe The reCAPTCHA widget will show a warning message to claim that it's only for testing purpose. Please do not use these keys for your production traffic. image

Essentially, change your keys to the test keys provide by Google reCaptcha when testing.

rtm commented 7 years ago

@TheSharpieOne How do I change my keys to the test keys provided by Google when testing?

TheSharpieOne commented 7 years ago

I keep my key and other configurations in a const which is injected using angulars dependency injection. For test and non prod environments, it injects different values. The tests reference the test configurations file and pull it in. The prod build references the prod configuration file. Both are the same and register the same service, just with different values.