vendredi 8 juin 2018

Puppeteer adds 0 to date input

I'm currently working on an end-to-end test for filling in a form and I've found a very unusual fault. When I reach a date-input field I the value should be set to 11-11-2018, but I receive the error "Date cannot be in the past", I have found out by setting headless: false that puppeteer automatically adds a 0 in front of my date. At first I thought that it switched the order of the date (and thus putting the 0 in front at 2018). But even when I change the date to 11-11-8888 a 0 gets added in front of the date.

The code:

test("Filling in fields", async () => {
    const date = "11-11-8888";

    //getting all fields
    const dateInput = await thePage.waitFor('input[type=date');

    //checking all fields
    expect(dateInput).toBeDefined();

    //setting all fields
    await dateInput.type(date);

})

Aucun commentaire:

Enregistrer un commentaire