'What is a proper way to disable captcha in Auth0 when run tests with Cypress
there is an app with Auth0 authentication. I am working on Cypress test suite. Today, after many test runs locally, Auth0 started to show captcha on a login page. This is something that is hard to automate and I don't want to do this.
Is there any way to disable captcha in Auth0 for Cypress tests? Are there any workarounds for this? I found a few articles how to generate authentication token with api call, but I personally don't support this. This is e2e testing and we should work with an app like with a black box.
Please advise. Thank you.
Solution 1:[1]
If You getting re like this,
You can try with,
/**
* This method use to submit the the reCaptcha.
*/
Cypress.Commands.add ("authenticateWithReCaptcha",()=>{
cy.window().then(currentWindow => {
const params = new URLSearchParams(currentWindow.location.search);
if (params.has("reCaptcha") &&
currentWindow.document
.querySelector("iframe[src*='recaptcha']") &&
getComputedStyle(currentWindow.document
.querySelector("iframe[src*='recaptcha']")).visibility === "visible") {
cy.window().invoke("submitForm");
}
});
});
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Niluka Monnankulama |

