fix(login): move remember password below submit

This commit is contained in:
2026-08-21 00:46:57 +08:00
parent eedd20d061
commit 4d512b15f6
4 changed files with 69 additions and 5 deletions

View File

@@ -35,6 +35,17 @@ test.describe('Makelore Electron smoke flows', () => {
.toHaveAttribute('aria-selected', 'true');
await expect(page.getByLabel('用户名', { exact: true })).toBeVisible();
await expect(page.getByLabel('密码', { exact: true })).toBeVisible();
const loginButton = page.getByRole('button', { name: '登录', exact: true });
const rememberPasswordCheckbox = page.getByRole('checkbox', { name: '记住密码', exact: true });
await expect(rememberPasswordCheckbox).toBeVisible();
const [loginButtonBox, rememberPasswordBox] = await Promise.all([
loginButton.boundingBox(),
rememberPasswordCheckbox.boundingBox(),
]);
if (!loginButtonBox || !rememberPasswordBox) {
throw new Error('Login controls did not produce visible bounds');
}
expect(rememberPasswordBox.y).toBeGreaterThan(loginButtonBox.y + loginButtonBox.height);
await expect(page.getByRole('button', { name: '在浏览器中继续', exact: true })).toHaveCount(0);
});

View File

@@ -108,7 +108,13 @@ describe('Login page', () => {
expect(screen.getByRole('tab', { name: '验证码登录' })).toHaveAttribute('aria-selected', 'false');
expect(screen.getByLabelText('用户名')).toHaveAttribute('autocomplete', 'username');
expect(screen.getByLabelText('密码')).toHaveAttribute('autocomplete', 'current-password');
expect(await screen.findByRole('checkbox', { name: '记住密码' })).toBeEnabled();
const rememberPasswordCheckbox = await screen.findByRole('checkbox', { name: '记住密码' });
const loginButton = screen.getByRole('button', { name: '登录' });
expect(rememberPasswordCheckbox).toBeEnabled();
expect(
loginButton.compareDocumentPosition(rememberPasswordCheckbox)
& Node.DOCUMENT_POSITION_FOLLOWING,
).toBe(Node.DOCUMENT_POSITION_FOLLOWING);
expect(screen.queryByText(/浏览器|微信|注册/)).not.toBeInTheDocument();
});