Testing with puppeteer an AWS amplify react app

I would like to test a react application with AWS amplify authentication ( using cognito).

The first step is log in to the app filling the input fileds (email and password) and submit the login form

await page.waitForSelector(“#email”);
await page.type(“#email”, “email@example.com”, {delay: 500});

await page.waitForSelector(“#pass”);
await page.type(“#pass”, “secret”, {delay: 500});

then the submit event

But with amplify it didn’t works – the input elements are not finded

The form is the following

form login amplify

As you can see the html element form username is just input#username , but if I try to select sthe elemtns with plain JS , it doesnt work

i cant find the input elements

How could I set the value to the form fields and submit the form for puppeter

58 thoughts on “Testing with puppeteer an AWS amplify react app”

Leave a Comment