test(editor): fix flaky embed iframe e2e test (#11530)

This commit is contained in:
donteatfriedrice
2025-04-08 08:37:12 +00:00
parent ebdeaf3783
commit b8e7ca3214

View File

@@ -19,7 +19,6 @@ const TEST_AFFINE_URL = 'https://affine.pro/';
const EMBED_IFRAME_BLOCK = 'affine-embed-iframe-block';
const EMBED_EDGELESS_IFRAME_BLOCK = 'affine-embed-edgeless-iframe-block';
const IDLE_CARD = 'embed-iframe-idle-card';
const LOADING_CARD = 'embed-iframe-loading-card';
const LINK_INPUT_POPUP = 'embed-iframe-link-input-popup';
test.beforeEach(async ({ page }) => {
@@ -106,8 +105,12 @@ test.describe('embed iframe block', () => {
});
test('add embed iframe url by clicking the idle card', async ({ page }) => {
const { embedIframeIdleCard, embedIframeLinkInputPopup, input } =
await addEmbedIframeBlock(page);
const {
embedIframeBlock,
embedIframeIdleCard,
embedIframeLinkInputPopup,
input,
} = await addEmbedIframeBlock(page);
// click somewhere else to close the link input popup
// click position below the popup
const popupBoundingBox = await embedIframeLinkInputPopup.boundingBox();
@@ -128,9 +131,7 @@ test.describe('embed iframe block', () => {
await expect(embedIframeLinkInputPopup).not.toBeVisible();
await expect(embedIframeIdleCard).not.toBeVisible();
const embedIframeLoadingCard = page.locator(LOADING_CARD);
await expect(embedIframeLoadingCard).toBeVisible();
await expect(embedIframeBlock).toHaveCount(1);
});
test.describe('conversions', () => {