mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-12-01 21:05:42 +09:00
perf: balance Builder E2E shard runtimes
This commit is contained in:
1 parent
07c7162c0e
commit
5a319f96af
8 files changed
+42
-44
No files matched your search
@@ -14,11 +14,13 @@ export const createBuilderEditingProject = ({
|
||||
context,
|
||||
page,
|
||||
name,
|
||||
devPlan,
|
||||
includePageTemplate = false,
|
||||
}: {
|
||||
context: BrowserContext;
|
||||
page?: Page;
|
||||
name: string;
|
||||
devPlan?: string;
|
||||
includePageTemplate?: boolean;
|
||||
}) =>
|
||||
createSeededBuilderProject({
|
||||
@@ -26,6 +28,7 @@ export const createBuilderEditingProject = ({
|
||||
page,
|
||||
email: `${name}@webstudio.test`,
|
||||
title: name,
|
||||
devPlan,
|
||||
builderToken: `${name}-${randomUUID()}-builder-token`,
|
||||
createBuildUpdate: (build) => {
|
||||
const pages = migratePages(JSON.parse(build.pages));
|
||||
|
||||
@@ -10,6 +10,7 @@ export const createSeededBuilderProject = async ({
|
||||
page,
|
||||
email,
|
||||
title,
|
||||
devPlan,
|
||||
builderToken,
|
||||
createBuildUpdate,
|
||||
}: {
|
||||
@@ -17,6 +18,7 @@ export const createSeededBuilderProject = async ({
|
||||
page?: Page;
|
||||
email: string;
|
||||
title: string;
|
||||
devPlan?: string;
|
||||
builderToken: string;
|
||||
createBuildUpdate: (build: Build) => BuildUpdate | Promise<BuildUpdate>;
|
||||
}) => {
|
||||
@@ -25,6 +27,7 @@ export const createSeededBuilderProject = async ({
|
||||
page,
|
||||
email,
|
||||
title,
|
||||
devPlan,
|
||||
});
|
||||
const build = await loadDevBuild({ projectId });
|
||||
await updateBuild(build.id, {
|
||||
|
||||
File renamed without changes.
@@ -20,10 +20,7 @@ import {
|
||||
replaceCanvasText,
|
||||
replaceCanvasTextAndApplyInlineFormats,
|
||||
} from "../flows/content-editing";
|
||||
import {
|
||||
fillSelectedStringProperty,
|
||||
waitForSelectedStringPropertyValue,
|
||||
} from "../flows/props-panel";
|
||||
import { waitForSelectedStringPropertyValue } from "../flows/props-panel";
|
||||
import {
|
||||
expectContentModeTemplateActionsUnavailable,
|
||||
openPagesPanel,
|
||||
@@ -303,12 +300,18 @@ test("Editor can paste, format and delete text while protected content remains",
|
||||
text: formattedText,
|
||||
propertyLabel: "Href",
|
||||
});
|
||||
await fillSelectedStringProperty({
|
||||
page,
|
||||
label: "Href",
|
||||
control: "url",
|
||||
value: editedHref,
|
||||
});
|
||||
const urlInput = page.getByPlaceholder("https://www.url.com").first();
|
||||
await urlInput.fill(editedHref);
|
||||
await urlInput.blur();
|
||||
|
||||
const canvas = await waitForCanvasFrame({ page });
|
||||
await expect(
|
||||
canvas.getByRole("link", { name: existingLinkText })
|
||||
).toBeVisible();
|
||||
// Save both link edits before checking the stored build and reloading.
|
||||
await removeCanvasInlineLink({ page, text: existingLinkText });
|
||||
await waitForSyncComplete({ page });
|
||||
|
||||
const savedHref = await getElementHrefWithText({
|
||||
projectId: fixture.projectId,
|
||||
text: formattedText,
|
||||
@@ -319,11 +322,6 @@ 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",
|
||||
|
||||
File renamed without changes.
@@ -1,7 +1,7 @@
|
||||
import { createServer } from "node:http";
|
||||
import { expect } from "@playwright/test";
|
||||
import { loadDevBuild } from "../db";
|
||||
import { createContentModeProject } from "../fixtures/content-mode-suite";
|
||||
import { createBuilderEditingProject } from "../fixtures/builder-editing-project";
|
||||
import { startFormDeliveryReceiver } from "../flows/generated-form-delivery";
|
||||
import { withMcpEmailHttpPreview } from "../flows/mcp-email-http-preview";
|
||||
import { startLocalEmailReceiver } from "../flows/mcp-email-preview";
|
||||
@@ -25,13 +25,10 @@ test("Project redirects and MCP-authored Forms run in the same generated product
|
||||
test.setTimeout(240_000);
|
||||
|
||||
await startPreviewFormMcpClient();
|
||||
const fixture = await createContentModeProject({
|
||||
const fixture = await createBuilderEditingProject({
|
||||
context,
|
||||
email: "mcp-email-attachments@webstudio.test",
|
||||
title: "MCP Form delivery and project settings",
|
||||
name: "mcp-email-attachments",
|
||||
devPlan: e2eEmailPlanName,
|
||||
assetNamePrefix: "mcp-email-attachments-",
|
||||
builderToken: "mcp-email-attachments-builder-token",
|
||||
});
|
||||
const requests: Array<{ method: string; url: string }> = [];
|
||||
const server = createServer((request, response) => {
|
||||
|
||||
+20
-23
@@ -1,4 +1,4 @@
|
||||
import type { Page as PlaywrightPage } from "@playwright/test";
|
||||
import { expect, type Page as PlaywrightPage } from "@playwright/test";
|
||||
import { parseProjectAuthRoutes } from "@webstudio-is/project-build/contracts";
|
||||
import { updateProject } from "../db";
|
||||
import { openProjectBuilder, waitForCanvasText } from "../flows/builder";
|
||||
@@ -12,7 +12,10 @@ import {
|
||||
getPersistedProjectSettings,
|
||||
openProjectSettings,
|
||||
} from "../flows/project-settings-runtime";
|
||||
import { waitForChangeToBeSaved } from "../flows/sync-status";
|
||||
import {
|
||||
waitForChangeToBeSaved,
|
||||
waitForSyncComplete,
|
||||
} from "../flows/sync-status";
|
||||
import { createContentModeProject } from "../fixtures/content-mode-suite";
|
||||
import { test } from "../test";
|
||||
import { measure } from "../perf";
|
||||
@@ -147,32 +150,26 @@ test("Marketplace page settings and project authentication routes persist after
|
||||
"marketplace page settings update marketplace fields",
|
||||
async () => {
|
||||
await openPageSettings({ page, pageName });
|
||||
const includeSave = waitForChangeToBeSaved({ page });
|
||||
await page.getByLabel("Include in the marketplace").click();
|
||||
await includeSave;
|
||||
|
||||
const categorySave = waitForChangeToBeSaved({ page });
|
||||
await page.getByLabel("Category").fill(category);
|
||||
await page.getByLabel("Category").blur();
|
||||
await categorySave;
|
||||
|
||||
await expect
|
||||
.poll(
|
||||
async () => {
|
||||
const persistedPage = await getPersistedPageByName({
|
||||
projectId: fixture.projectId,
|
||||
name: pageName,
|
||||
});
|
||||
return persistedPage.marketplace;
|
||||
},
|
||||
{ message: "Marketplace settings persist before reload" }
|
||||
)
|
||||
.toMatchObject({ include: true, category });
|
||||
await waitForSyncComplete({ page });
|
||||
}
|
||||
);
|
||||
|
||||
let persistedPage = await getPersistedPageByName({
|
||||
projectId: fixture.projectId,
|
||||
name: pageName,
|
||||
});
|
||||
if (
|
||||
persistedPage.marketplace?.include !== true ||
|
||||
persistedPage.marketplace.category !== category
|
||||
) {
|
||||
throw new Error(
|
||||
`Expected marketplace settings to persist. Received ${JSON.stringify(
|
||||
persistedPage.marketplace
|
||||
)}`
|
||||
);
|
||||
}
|
||||
|
||||
await measure("marketplace page settings reload builder", async () => {
|
||||
await openProjectBuilder({
|
||||
page,
|
||||
@@ -197,7 +194,7 @@ test("Marketplace page settings and project authentication routes persist after
|
||||
`Expected marketplace category "${category}", received "${categoryValue}"`
|
||||
);
|
||||
}
|
||||
persistedPage = await getPersistedPageByName({
|
||||
const persistedPage = await getPersistedPageByName({
|
||||
projectId: fixture.projectId,
|
||||
name: pageName,
|
||||
});
|
||||
Reference in new issue
Block a user