Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cypress: api call not made #239

Open
DiegoMcDipster opened this issue Oct 27, 2023 · 0 comments
Open

Cypress: api call not made #239

DiegoMcDipster opened this issue Oct 27, 2023 · 0 comments

Comments

@DiegoMcDipster
Copy link

I'm using Nextjs & cypress.

I have a contact form with captcha startMode: "focus". When all fields are filled in and the user is verfied as not being a robot, the submit button is enabled. I want to make sure this works with my cypress tests.

In a browser, if any of the input fields get focus, the captcha check is kicked off. Works great!

However, in Cypress, I set up an intercept to always return 'success'. But, the captcha api call is never kicked off.

I've seen the issue #189

The solution to force the button to be enabled does not allow me to check that the form is working correctly. What I want to do is two tests:

  1. make sure the button is enabled when all fields are correctly filled in and the intercept returns 'success'
  2. make sure the button remains disabled when all fields are correctly filled in and the intercept returns 'fail'

Forcing the button to be enabled/disabled is not really testing the validation functionality nor response from the api.

Is there a better solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant