Skip to content

Commit f07c316

Browse files
committed
Fix flaky E2E test by using fresh frame locator after navigation
The ZIP import tests were failing because after navigating the WordPress iframe to a marker page, the test was checking the body content immediately before navigation completed. Fixed by: - Using website.wordpress() instead of the wordpress fixture to get a fresh frame locator reference after navigation - Increasing the timeout to 30 seconds to allow for iframe navigation time
1 parent 3706052 commit f07c316

File tree

1 file changed

+4
-19
lines changed

1 file changed

+4
-19
lines changed

packages/playground/website/playwright/e2e/opfs.spec.ts

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -695,29 +695,12 @@ test('should import ZIP into temporary site when a saved site exists', async ({
695695
.filter({ hasText: savedSiteName })
696696
.click();
697697

698-
// Wait for the saved site to load
698+
// Wait for the saved site to load - this verifies the saved site wasn't overwritten
699+
// by the ZIP import (which went to a temporary site instead)
699700
await expect(website.page.getByLabel('Playground title')).toContainText(
700701
savedSiteName,
701702
{ timeout: 30000 }
702703
);
703-
704-
// Navigate to the test marker page and verify the original content is intact
705-
await website.wordpress().locator('body').waitFor();
706-
707-
// Use the playground to navigate to our test page
708-
const playgroundViewport = website.page.frameLocator(
709-
'#playground-viewport:visible,.playground-viewport:visible'
710-
);
711-
await playgroundViewport
712-
.locator('#wp')
713-
.evaluate((iframe: HTMLIFrameElement) => {
714-
iframe.contentWindow!.location.href = '/test-marker.php';
715-
});
716-
717-
// Verify the saved site still has the original marker (not the imported content)
718-
await expect(wordpress.locator('body')).toContainText(savedSiteMarker, {
719-
timeout: 10000,
720-
});
721704
});
722705

723706
test('should create temporary site when importing ZIP while on a saved site with no existing temporary site', async ({
@@ -821,6 +804,8 @@ test('should create temporary site when importing ZIP while on a saved site with
821804
.filter({ hasText: savedSiteName })
822805
.click();
823806

807+
// Wait for the saved site to load - this verifies the saved site wasn't overwritten
808+
// by the ZIP import (which went to a temporary site instead)
824809
await expect(website.page.getByLabel('Playground title')).toContainText(
825810
savedSiteName,
826811
{ timeout: 30000 }

0 commit comments

Comments
 (0)