test: 补充E2E错误场景 - 注册用户名为空/缺字段反向测试
CI/CD Pipeline / Staging E2E Tests (push) Failing after 72h45m46s
CI/CD Pipeline / Deploy Staging (push) Failing after 72h47m47s
CI/CD Pipeline / Frontend Lint (push) Failing after 72h48m20s
CI/CD Pipeline / Validate Code Quality And Tests (push) Failing after 72h49m41s
CI/CD Pipeline / Production Browser E2E (push) Failing after 1731h16m49s
CI/CD Pipeline / Deploy Production (push) Failing after 1731h16m51s
CI/CD Pipeline / Build Production Runtime Images (push) Failing after 1731h21m55s
CI/CD Pipeline / Staging E2E Tests (push) Failing after 72h45m46s
CI/CD Pipeline / Deploy Staging (push) Failing after 72h47m47s
CI/CD Pipeline / Frontend Lint (push) Failing after 72h48m20s
CI/CD Pipeline / Validate Code Quality And Tests (push) Failing after 72h49m41s
CI/CD Pipeline / Production Browser E2E (push) Failing after 1731h16m49s
CI/CD Pipeline / Deploy Production (push) Failing after 1731h16m51s
CI/CD Pipeline / Build Production Runtime Images (push) Failing after 1731h21m55s
新增2个注册反向测试用例: - 注册用户名为空 - 验证返回400校验错误 - 注册缺用户名字段 - 验证返回422校验错误 加上原有的5个场景(邮箱已存在、弱密码、密码错误、账号不存在、项目名 为空),共覆盖7个错误场景。全部在staging环境验证通过。
This commit is contained in:
@@ -150,6 +150,36 @@ test.describe("认证流程", () => {
|
||||
expect([400, 422]).toContain(response.status());
|
||||
});
|
||||
|
||||
test("注册用户名为空 - 反向", async ({ request }) => {
|
||||
const response = await request.post(`${apiBase}/auth/register`, {
|
||||
data: {
|
||||
email: uniqueEmail("emptyuser"),
|
||||
password: PASSWORD,
|
||||
username: "",
|
||||
display_name: "Empty Username",
|
||||
},
|
||||
});
|
||||
|
||||
expect([400, 422], "用户名为空应返回 4xx 校验错误").toContain(
|
||||
response.status(),
|
||||
);
|
||||
});
|
||||
|
||||
test("注册缺用户名字段 - 反向", async ({ request }) => {
|
||||
const response = await request.post(`${apiBase}/auth/register`, {
|
||||
data: {
|
||||
email: uniqueEmail("nouser"),
|
||||
password: PASSWORD,
|
||||
display_name: "No Username Field",
|
||||
},
|
||||
});
|
||||
|
||||
expect(
|
||||
[400, 422],
|
||||
"缺少用户名字段应返回 4xx 校验错误",
|
||||
).toContain(response.status());
|
||||
});
|
||||
|
||||
// ─── 登录 ────────────────────────────────────────────
|
||||
|
||||
test("登录成功 - 正向", async ({ request }) => {
|
||||
|
||||
Reference in New Issue
Block a user