angular-recaptcha icon indicating copy to clipboard operation
angular-recaptcha copied to clipboard

Automated e2e-test with protractor

Open jlgonzalezpisa opened this issue 8 years ago • 3 comments

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.

jlgonzalezpisa avatar Oct 25 '16 14:10 jlgonzalezpisa

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.

TheSharpieOne avatar Oct 25 '16 14:10 TheSharpieOne

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

rtm avatar Sep 26 '17 07:09 rtm

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.

TheSharpieOne avatar Sep 26 '17 12:09 TheSharpieOne