diff --git a/apps/builder/e2e/tests/animation-runtime.[shard-10].e2e.ts b/apps/builder/e2e/tests/animation-runtime.[shard-10].e2e.ts index 853077c765..29d14925f9 100644 --- a/apps/builder/e2e/tests/animation-runtime.[shard-10].e2e.ts +++ b/apps/builder/e2e/tests/animation-runtime.[shard-10].e2e.ts @@ -5,7 +5,7 @@ import { selectCanvasTextInstance } from "../flows/canvas-selection"; import { expectGeneratedAppBuild } from "../flows/generated-app"; import { openNavigatorPanel } from "../flows/navigator"; import { waitForSyncComplete } from "../flows/sync-status"; -import { createContentModeProject } from "../fixtures/content-mode-suite"; +import { createBuilderEditingProject } from "../fixtures/builder-editing-project"; import { test } from "../test"; import { measure } from "../perf"; @@ -144,14 +144,10 @@ test("Builder animation UI creates supported animation props that persist and bu // Includes two Builder loads and a generated app build on shared CI CPUs. test.setTimeout(180_000); - const email = "animation-runtime@webstudio.test"; - const fixture = await createContentModeProject({ - context: context, - email, - title: "Animation Runtime", - assetNamePrefix: "animation-runtime-", - editorToken: "animation-runtime-editor-token", - builderToken: "animation-runtime-builder-token", + const fixture = await createBuilderEditingProject({ + context, + page, + name: "animation-runtime", }); const text = "Initial content"; const wrapperName = "Animation Group"; diff --git a/apps/builder/e2e/tests/content-mode-content-editing.[shard-10].e2e.ts b/apps/builder/e2e/tests/content-mode-content-editing.[shard-10].e2e.ts index f7a178ba7d..9042de1fbc 100644 --- a/apps/builder/e2e/tests/content-mode-content-editing.[shard-10].e2e.ts +++ b/apps/builder/e2e/tests/content-mode-content-editing.[shard-10].e2e.ts @@ -1,4 +1,5 @@ import { expect } from "@playwright/test"; +import type { Instance, Prop } from "@webstudio-is/sdk"; import { openProjectBuilder, waitForCanvasFrame, @@ -38,7 +39,7 @@ import type { SeededContentModeProject } from "../fixtures/content-mode-project" import { test, withBrowserContext } from "../test"; import { measure } from "../perf"; import { e2ePaidPlanName } from "../plans"; -import { loadDevBuild } from "../db"; +import { loadDevBuild, updateBuild } from "../db"; const getElementTagWithTextCount = async ({ projectId, @@ -157,6 +158,50 @@ test("Editor can paste, format and delete text while protected content remains", }) => { const formattedText = "Rich editor formatted copy"; const editedHref = "/rich-text-editor-link"; + const existingLinkText = "Preexisting inline link"; + const build = await loadDevBuild({ projectId: fixture.projectId }); + const instances: Instance[] = JSON.parse(build.instances); + const props: Prop[] = JSON.parse(build.props); + const contentBlock = instances.find(({ id }) => id === "content-block"); + if (contentBlock === undefined) { + throw new Error("Expected the fixture Content Block"); + } + // Keep a second link so adding and removing links can share one reload. + contentBlock.children.push({ type: "id", value: "existing-link-paragraph" }); + instances.push( + { + type: "instance", + id: "existing-link-paragraph", + component: "ws:element", + tag: "p", + children: [{ type: "id", value: "existing-inline-link" }], + }, + { + type: "instance", + id: "existing-inline-link", + component: "ws:element", + tag: "a", + children: [{ type: "id", value: "existing-inline-link-text" }], + }, + { + type: "instance", + id: "existing-inline-link-text", + component: "ws:element", + tag: "b", + children: [{ type: "text", value: existingLinkText }], + } + ); + props.push({ + id: "existing-inline-link-href", + instanceId: "existing-inline-link", + name: "href", + type: "string", + value: "/existing-inline-link", + }); + await updateBuild(build.id, { + instances: JSON.stringify(instances), + props: JSON.stringify(props), + }); await measure("content mode open editor for text changes", async () => { await openProjectBuilder({ @@ -274,6 +319,18 @@ test("Editor can paste, format and delete text while protected content remains", ); } + const canvas = await waitForCanvasFrame({ page }); + await expect( + canvas.getByRole("link", { name: existingLinkText }) + ).toBeVisible(); + await removeCanvasInlineLink({ page, text: existingLinkText }); + const removedLinkCount = await getElementTagWithTextCount({ + projectId: fixture.projectId, + tag: "a", + text: existingLinkText, + }); + expect(removedLinkCount).toBe(0); + await measure("content mode reload text changes", async () => { await openProjectBuilder({ page, @@ -329,37 +386,20 @@ test("Editor can paste, format and delete text while protected content remains", ); } - await removeCanvasInlineLink({ page, text: formattedText }); - const removedLinkCount = await getElementTagWithTextCount({ - projectId: fixture.projectId, - tag: "a", - text: formattedText, - }); - if (removedLinkCount !== 0) { - throw new Error( - `Expected rich-text link removal to delete the inline link subtree, received ${removedLinkCount} link instances` - ); - } - - await measure("content mode reload rich text link removal", async () => { - await openProjectBuilder({ - page, - projectId: fixture.projectId, - authToken: fixture.editorToken, - mode: "content", - }); - }); - await waitForCanvasText({ page, text: formattedText }); + const reloadedCanvas = await waitForCanvasFrame({ page }); + await expect( + reloadedCanvas.getByRole("link", { name: formattedText }) + ).toHaveAttribute("href", editedHref); + await expect(reloadedCanvas.getByText(existingLinkText)).toBeVisible(); + await expect( + reloadedCanvas.getByRole("link", { name: existingLinkText }) + ).toHaveCount(0); const reloadedRemovedLinkCount = await getElementTagWithTextCount({ projectId: fixture.projectId, tag: "a", - text: formattedText, + text: existingLinkText, }); - if (reloadedRemovedLinkCount !== 0) { - throw new Error( - `Expected rich-text link removal to persist after reload, received ${reloadedRemovedLinkCount} link instances` - ); - } + expect(reloadedRemovedLinkCount).toBe(0); await measure("content mode insert nested template", async () => { await insertTemplateAfterCanvasText({ diff --git a/apps/builder/e2e/tests/mcp-email-resource-inspector.[shard-10].e2e.ts b/apps/builder/e2e/tests/mcp-email-resource-inspector.[shard-10].e2e.ts index cf8b4028ca..ba1fb36376 100644 --- a/apps/builder/e2e/tests/mcp-email-resource-inspector.[shard-10].e2e.ts +++ b/apps/builder/e2e/tests/mcp-email-resource-inspector.[shard-10].e2e.ts @@ -22,6 +22,7 @@ test("MCP Email inspector loads Request without sending and shows the captured s }) => { const fixture = await createContentModeProject({ context, + page, email: "mcp-email-inspector@webstudio.test", title: "MCP Email inspector", assetNamePrefix: "mcp-email-inspector-",