Skip to content

Cypress: api call not made #239

@DiegoMcDipster

Description

@DiegoMcDipster

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions