From 66fe3b763ac147d30e5348d388a5ebde91ac872c Mon Sep 17 00:00:00 2001 From: suyx Date: Tue, 28 Jul 2026 17:17:03 +0800 Subject: [PATCH] fix: center TASK-WP1-03 registration layout --- apps/web/src/user-auth.css | 4 ++-- tests/e2e/user-registration.spec.ts | 37 +++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/apps/web/src/user-auth.css b/apps/web/src/user-auth.css index 8207328..05c3f29 100644 --- a/apps/web/src/user-auth.css +++ b/apps/web/src/user-auth.css @@ -121,7 +121,7 @@ button { .auth-panel { width: min(480px, 100%); - margin-left: 84px; + margin-inline: auto; } .auth-tabs { @@ -472,7 +472,7 @@ button { } .auth-panel { - margin-left: 0; + margin-inline: 0; } .auth-registration-status { diff --git a/tests/e2e/user-registration.spec.ts b/tests/e2e/user-registration.spec.ts index e52c8f9..5ff7195 100644 --- a/tests/e2e/user-registration.spec.ts +++ b/tests/e2e/user-registration.spec.ts @@ -50,6 +50,12 @@ test("TDD-WP1-NOTICE-001 expands DVPM8 only after successful code delivery", asy await expect(page.getByRole("checkbox", { name: /同意/ })).not.toBeChecked(); await expect(page.getByRole("button", { name: "注册并进入 Dada" })).toBeDisabled(); + const panelBounds = await page.locator(".auth-panel").boundingBox(); + const viewport = page.viewportSize(); + expect(panelBounds).not.toBeNull(); + expect(viewport).not.toBeNull(); + expect(Math.abs((panelBounds!.x + panelBounds!.width / 2) - viewport!.width / 2)).toBeLessThanOrEqual(2); + await page.getByRole("button", { name: "查看全文" }).click(); const dialog = page.getByRole("dialog", { name: "内测使用与隐私告知" }); const noticeClose = page.getByRole("button", { name: "我已阅读" }); @@ -117,3 +123,34 @@ test("TDD-WP1-SLOT-001 preserves profile fields when final capacity recheck fail await expect(page.getByLabel("社交 ID")).toHaveValue("@capacity_user"); await expect(page.getByRole("checkbox", { name: /同意/ })).toBeChecked(); }); + +test("TDD-WP1-NOTICE-001 hands a successful registration to the workspace route", async ({ page }) => { + await page.route("**/api/v1/auth/register/send", (route) => route.fulfill({ + contentType: "application/json", + status: 200, + body: JSON.stringify({ + challenge_expires_at: "2026-07-28T09:10:00.000Z", + registration_id: "00000000-0000-4000-8000-000000000006", + resend_available_at: "2026-07-28T09:01:00.000Z", + status: "verification_sent", + }), + })); + await page.route("**/api/v1/auth/register/complete", (route) => route.fulfill({ + contentType: "application/json", + status: 200, + body: JSON.stringify({ status: "registered" }), + })); + + await page.goto(webUrl); + await page.getByRole("tab", { name: "注册" }).click(); + await page.getByRole("textbox", { name: "邀请码" }).fill("DADA-P0A-TEST-4R8"); + await page.getByRole("textbox", { name: "邮箱" }).fill("handoff@example.invalid"); + await page.getByRole("button", { name: "获取验证码" }).click(); + await page.getByLabel("验证码").fill("418205"); + await page.getByLabel("创作署名").fill("Handoff User"); + await page.getByLabel("社交 ID").fill("@handoff_user"); + await page.getByRole("checkbox", { name: /同意/ }).check(); + await page.getByRole("button", { name: "注册并进入 Dada" }).click(); + + await expect(page).toHaveURL(`${webUrl}/app`); +});