I have a test where I compare a price after a request is made. The test passes on Mobile Chrome, but on Mobile Safari the comparison is done before the view is getting updated.
const productCardPriceDescending = await getFirstProductPrice(); //getting first value
await openFacetsButton.click();
await facetListItemSort.click();
await page.getByTestId('facetSortItem_PRICE_ASCENDING').click(); //results in a request to grapqhl
await facetCloseButton.click();
await expect(facetWrapperClosed).toBeVisible(); //these is to wait and confirm that facet is closed
const productCardPriceAscending = await getFirstProductPrice(); //getting updated value
console.log(productCardPriceDescending, productCardPriceAscending); // gives me same value, should be different
expect(productCardPriceAscending).not.toBe(productCardPriceDescending); //fails saying its the same value
I’ve tried using await page.waitForResponse to wait for the response, but does not work. I even manually satt in a wait page.waitForTimeout(5000);, which with –headed flag I could see the new updated value, but the tests still is stuck on the old. With tracing I can also see that the value is not updated even though in the tests it clearly was. Is this maybe a known issue with Playwright and safari?
We use NextJS + Apollo graphql