I am writing a JavaScript application and using Playwright to test my application.
I found a bug in my code such that on selecting an item in a list, my app got stuck in an infinite loop calling a server API.
How can you write a playwright tests to ensure an action only causes a single server call.
Sample Code
I wait for the item to be visible using something like the following
await page.locator('list1','file1').waitFor();
Then I select and wait for the server request with code similar to beloe
const responsePromise = page.waitForResponse(resp =>
resp.url().includes('/myServerURL') && resp.status() === 200);
await page.locator('list1','file1').click();
const response = await responsePromise;
But i want to make sure that I only get one request to ‘/myServerURL’ on selecting the item, and not more than one.
Is this possible in Playwright