Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

219
Views
La prueba de Formik devuelve "Parece que tiene llamadas act () superpuestas, esto no es compatible"

Tengo un formulario simple que estoy tratando de probar:

Forma:

 <Formik enableReinitialize onSubmit={(values, actions) => { console.log('---DEBUG---'); onSubmit(values, actions); }} validationSchema={ValidationSchema} > {(formik) => { const { errors } = formik; return ( <Form noValidate autoComplete="off"> {/* USER PICKER */} <FastField id="name" name="name" type="text" onChange={({ event, value }) => { handleChange(event); setUserIdOrName(value); }} value={values.name} errorMessage={ !!errors.name && !!touched.name ? errors.name : '' } as={TextField} /> {/* SUBMIT BUTTON */} <Button color="red" type="submit" onClick={() => { console.log('-----CLICKED----'); }} /> </Form> ); }} </Formik>

Prueba:

 it.only('shows required error messages', async () => { render(<MyForm />); const button = screen.getByRole('button'); userEvent.click(button); // Formik and Yup validation are async methods const required = await screen.findByText(/required/i); expect(required).toBeInTheDocument(); });

Error:

console.error Advertencia: Parece que tiene llamadas act() superpuestas, esto no es compatible. Asegúrese de esperar las llamadas act() anteriores antes de hacer una nueva.

 TestingLibraryElementError: Unable to find an element with the text: /required/i. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Prueba con:

 it.only('shows required error messages', async () => { render(<MyForm />); const button = screen.getByRole('button'); await userEvent.click(button); // Formik and Yup validation are async methods const required = await screen.findByText(/required/i); expect(required).toBeInTheDocument(); });
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!