I wrote this test using the vscode extension. it passed the test, but no data has been posted, which i would expect to be the result. I'm confused at what I'm doing wrong here.
import { test, expect } from '@playwright/test';
test('test', async ({ page }) => {
await page.goto('http://localhost:8080/');
await page.getByRole('button', { name: '+ Create New' }).click();
await page.getByPlaceholder('“Enter the street name”').click();
await page.getByPlaceholder('“Enter the street name”').fill('Testing');
await page.getByPlaceholder('“Enter description”').click();
await page.getByPlaceholder('“Enter description”').fill('Lorem Ipsum.');
await page.getByRole('button', { name: 'Post' }).click();
});
This thread is trying to answer question "Why is no new data created even though the form fill test passed?"
in headed mode you see that PW enters all the Input and click on the "Post" button but after the test the data should appear in UI but it isnt? The your wrote seems legit. It does not have any expectation that means if Playwright finds all the Inputs Buttons etc it will passed. You can add validation like if you click on the Post the new data will posted .
yes, i just found out i had to let the page process before closing the test to actually make the form submit. with the following line, i listen to a class to be rendered in the DOM.
await page.waitForSelector('.mild-notice');
the form submission actually gets processed now before it closes the test.
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].