当手术计费弹窗中点击"签发"耗材时,因耗材的locationId(发放库房)为空导致后端异常。 在DoctorStationAdviceAppServiceImpl.handDevice方法中,当locationId为null时,使用登录用户的科室ID作为默认值, 与NurseBillingAppService中的处理方式保持一致。
39 lines
1.8 KiB
TypeScript
Executable File
39 lines
1.8 KiB
TypeScript
Executable File
import { test, expect } from '@playwright/test';
|
|
import { LoginPage } from '../pages/LoginPage';
|
|
import { TEST_USERS } from '../utils/test-data';
|
|
|
|
test.describe('🔐 登录模块', () => {
|
|
let loginPage: LoginPage;
|
|
|
|
test.beforeEach(async ({ page }) => {
|
|
loginPage = new LoginPage(page);
|
|
await loginPage.goto();
|
|
});
|
|
|
|
test('TC-LOGIN-001: 管理员正常登录 @smoke', async ({ page }) => {
|
|
await loginPage.login(TEST_USERS.admin.username, TEST_USERS.admin.password);
|
|
await loginPage.expectLoginSuccess();
|
|
});
|
|
|
|
test('TC-LOGIN-002: 错误密码登录 @smoke', async ({ page }) => {
|
|
await loginPage.login(TEST_USERS.admin.username, 'wrong_password_123');
|
|
// Check for any error indication (message, toast, or stayed on login page)
|
|
const hasError = await page.locator('.el-message--error, .el-message-box, text=密码错误, text=用户名或密码错误').isVisible().catch(() => false);
|
|
const stillOnLogin = page.url().includes('login') || page.url() === 'http://localhost:81/' || page.url() === 'http://localhost:81/index';
|
|
expect(hasError || stillOnLogin).toBeTruthy();
|
|
});
|
|
|
|
test('TC-LOGIN-003: 空用户名登录', async ({ page }) => {
|
|
await loginPage.login('', TEST_USERS.admin.password);
|
|
// Should show validation error or stay on login page
|
|
const hasError = await page.locator('.el-form-item__error, .el-message--error').isVisible().catch(() => false);
|
|
const stillOnLogin = page.url().includes('login') || page.url() === 'http://localhost:81/';
|
|
expect(hasError || stillOnLogin).toBeTruthy();
|
|
});
|
|
|
|
test('TC-LOGIN-004: 密码输入框可见性切换', async ({ page }) => {
|
|
const passwordInput = page.locator('input[placeholder="密码"]');
|
|
await expect(passwordInput).toHaveAttribute('type', 'password');
|
|
});
|
|
});
|