diff --git a/core/src/components/searchbar/test/basic/searchbar.e2e.ts b/core/src/components/searchbar/test/basic/searchbar.e2e.ts index 3b0975b08a..0d8ec153d0 100644 --- a/core/src/components/searchbar/test/basic/searchbar.e2e.ts +++ b/core/src/components/searchbar/test/basic/searchbar.e2e.ts @@ -8,6 +8,16 @@ test.describe('searchbar: basic', () => { test('should not have visual regressions', async ({ page }) => { await page.setIonViewport(); + /** + * The searchbar test template is rendering an ion-searchbar + * that is animated. This requires the searchbar to render, + * before the cancel button can be positioned correctly. + * + * We wait for changes to ensure the searchbar has rendered + * correctly before capturing the screenshot. + */ + await page.waitForChanges(); + expect(await page.screenshot({ animations: 'disabled' })).toMatchSnapshot( `searchbar-diff-${page.getSnapshotSettings()}.png` );