This thread is trying to answer question "Why is the getByPlaceholder method resulting in a timeout error even when the input is found and the existing value is retrieved?"
I tried without await same result. Yes, the test should have failed but instead got timeout error.
This was a form field within a modal, this happened after modal was reponed after closing. The modal component was not removed from DOM which is why it might have happened. I have moved the model under conditional rendering and have fixed this.
But still wondering about the error message. It was able to resolve the locator. May be it was attached to the DOM but not visible?
// reopen the form and check if form fields are empty
await page.getByRole('button', { name: 'Add Building' }).click();
await expect(page.getByPlaceholder('Name')).toBeHidden();
await expect(page.getByPlaceholder('Name')).toHaveValue('');
await expect(page.getByPlaceholder('Address')).toHaveValue('');
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].