|
|
@@ -22,7 +22,7 @@ export class AdminLoginPage {
|
|
|
this.usernameInput = page.getByPlaceholder('请输入用户名');
|
|
|
this.passwordInput = page.getByPlaceholder('请输入密码');
|
|
|
this.submitButton = page.getByRole('button', { name: '登录' });
|
|
|
- this.togglePasswordButton = page.locator('button[aria-label*="密码"], button[aria-label*="显示"], button[aria-label*="隐藏"]');
|
|
|
+ this.togglePasswordButton = page.locator('button:has(img), [aria-label*="密码"], [aria-label*="显示"], [aria-label*="隐藏"]').nth(1);
|
|
|
this.pageTitle = page.getByRole('heading', { name: '管理后台登录' });
|
|
|
this.welcomeText = page.getByText('请输入您的账号和密码继续操作');
|
|
|
this.successToast = page.locator('[data-sonner-toast][data-type="success"]');
|
|
|
@@ -31,8 +31,8 @@ export class AdminLoginPage {
|
|
|
this.passwordError = page.locator('text=请输入密码');
|
|
|
this.testAccountInfo = page.locator('text=测试账号:');
|
|
|
this.loadingSpinner = page.locator('[aria-busy="true"], .loading-spinner, .spinner');
|
|
|
- this.backgroundElement = page.locator('main, .background, [class*="bg-"]').first();
|
|
|
- this.loginCard = page.locator('.card, .login-card, .form-card').first();
|
|
|
+ this.backgroundElement = page.locator('body, main').first();
|
|
|
+ this.loginCard = page.locator('form, .card, [role="form"]').first();
|
|
|
}
|
|
|
|
|
|
async goto() {
|
|
|
@@ -51,11 +51,11 @@ export class AdminLoginPage {
|
|
|
await expect(this.errorToast).toBeVisible();
|
|
|
}
|
|
|
|
|
|
- async expectToBeVisible() {
|
|
|
- await expect(this.pageTitle).toBeVisible();
|
|
|
- await expect(this.usernameInput).toBeVisible();
|
|
|
- await expect(this.passwordInput).toBeVisible();
|
|
|
- await expect(this.submitButton).toBeVisible();
|
|
|
+ async expectToBeVisible(options?: { timeout?: number }) {
|
|
|
+ await expect(this.pageTitle).toBeVisible(options);
|
|
|
+ await expect(this.usernameInput).toBeVisible(options);
|
|
|
+ await expect(this.passwordInput).toBeVisible(options);
|
|
|
+ await expect(this.submitButton).toBeVisible(options);
|
|
|
}
|
|
|
|
|
|
async login(username: string, password: string) {
|