Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

439
Vistas
react-datepicker - cannot open date popup using Testcafe

I'm using the react-datepicker package as a custom Date Picker component for my app. I wrap it in my own component like so:

const MyCustomDatePicker = ({ onChange, value, error, disabled, placeholder, dateFormat }) => {
  return (
    <div className='date-input' data-test-id='date-picker'>
      <div className='date-input__field'>
        <DatePicker
          selected={value}
          disabled={disabled}
          onChange={onChange}
          dateFormat={dateFormat}
          placeholderText={placeholder}
          className='date-input__input'
        />
      </div>
    </div>
  );
};

Which works fine in the UI, I can select a date from the popup:

Popup

However, when I try replicating this in Testcafe, I can't seem to get the popup to appear. I've tried a different combination of my own class names and those generated by the react-datepicker package:

import { Selector } from 'testcafe';

fixture`Getting Started`
  .page`https://my-page`;

test('My first test', async t => {
  await t.click(Selector('date-input__input'))
  await t.click(Selector('react-datepicker__input-container'))
  await t.click(Selector('react-datepicker-wrapper'))
  await t.wait(5000)
});

But none of these open the date picker popup. Is it possible to do this in testcafe?

about 4 years ago · Santiago Gelvez
1 Respuestas
Responde la pregunta

0

In the snippet you provided, I see an error: you are trying to take a selector by class, but you are not using a dot. Try, for example, running this test:

import { Selector } from 'testcafe';

fixture `New Fixture`
    .page `https://reactdatepicker.com/`;
    
test(`New Test`, async t => {
    const anyPicker = Selector('.react-datepicker__input-container').nth(1);
    const input     = anyPicker.find('input');
    const dateCell  = Selector('.react-datepicker__day').withText('16');

    await t
        .click(input)
        .click(dateCell)
        .expect(input.value).eql('07/16/2022');
});
about 4 years ago · Santiago Gelvez Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda