|
@@ -9,7 +9,7 @@ const TEST_USER_PHONE = '13800001111';
|
|
|
const TEST_USER_PASSWORD = 'password123';
|
|
const TEST_USER_PASSWORD = 'password123';
|
|
|
const STATISTICS_PAGE_URL = '/pages/yongren/statistics/index';
|
|
const STATISTICS_PAGE_URL = '/pages/yongren/statistics/index';
|
|
|
|
|
|
|
|
-test.describe.serial('数据统计页测试与功能验证 - Story 13.12', () => {
|
|
|
|
|
|
|
+test.describe('数据统计页测试与功能验证 - Story 13.12', () => {
|
|
|
test.use({ storageState: undefined });
|
|
test.use({ storageState: undefined });
|
|
|
|
|
|
|
|
test('应该能够访问数据统计页', async ({ enterpriseMiniPage: miniPage }) => {
|
|
test('应该能够访问数据统计页', async ({ enterpriseMiniPage: miniPage }) => {
|
|
@@ -30,11 +30,14 @@ test.describe.serial('数据统计页测试与功能验证 - Story 13.12', () =>
|
|
|
await miniPage.navigateToStatisticsPage();
|
|
await miniPage.navigateToStatisticsPage();
|
|
|
await miniPage.page.waitForTimeout(TIMEOUTS.MEDIUM);
|
|
await miniPage.page.waitForTimeout(TIMEOUTS.MEDIUM);
|
|
|
|
|
|
|
|
- const yearSelector = miniPage.page.locator('select, [role="combobox"]').filter({ hasText: /年/ });
|
|
|
|
|
- const monthSelector = miniPage.page.locator('select, [role="combobox"]').filter({ hasText: /月/ });
|
|
|
|
|
|
|
+ // 筛选器是 Taro 自定义组件,使用文本定位器
|
|
|
|
|
+ // 检查年份筛选器(格式: "2026年")
|
|
|
|
|
+ const yearSelector = miniPage.page.getByText(/\d{4}年/);
|
|
|
|
|
+ const monthSelector = miniPage.page.getByText(/\d+月/);
|
|
|
const hasYearSelector = await yearSelector.count() > 0;
|
|
const hasYearSelector = await yearSelector.count() > 0;
|
|
|
const hasMonthSelector = await monthSelector.count() > 0;
|
|
const hasMonthSelector = await monthSelector.count() > 0;
|
|
|
- expect(hasYearSelector || hasMonthSelector).toBeTruthy();
|
|
|
|
|
|
|
+ expect(hasYearSelector).toBeTruthy();
|
|
|
|
|
+ expect(hasMonthSelector).toBeTruthy();
|
|
|
console.debug('[AC1.2] 筛选器 UI 元素 ✓');
|
|
console.debug('[AC1.2] 筛选器 UI 元素 ✓');
|
|
|
});
|
|
});
|
|
|
|
|
|
|
@@ -108,7 +111,8 @@ test.describe.serial('数据统计页测试与功能验证 - Story 13.12', () =>
|
|
|
const employedCard = cards.find(c => c.cardName.includes('在职') || c.cardName.includes('人数'));
|
|
const employedCard = cards.find(c => c.cardName.includes('在职') || c.cardName.includes('人数'));
|
|
|
expect(employedCard).toBeDefined();
|
|
expect(employedCard).toBeDefined();
|
|
|
if (employedCard) {
|
|
if (employedCard) {
|
|
|
- expect(employedCard.currentValue).toMatch(/d+/);
|
|
|
|
|
|
|
+ // 接受数字或空数据占位符 "--"
|
|
|
|
|
+ expect(employedCard.currentValue).toMatch(/(\d+|--)/);
|
|
|
}
|
|
}
|
|
|
console.debug('[AC3.1] 在职人数数据正确性 ✓');
|
|
console.debug('[AC3.1] 在职人数数据正确性 ✓');
|
|
|
});
|
|
});
|
|
@@ -125,7 +129,8 @@ test.describe.serial('数据统计页测试与功能验证 - Story 13.12', () =>
|
|
|
const salaryCard = cards.find(c => c.cardName.includes('薪资') || c.cardName.includes('平均'));
|
|
const salaryCard = cards.find(c => c.cardName.includes('薪资') || c.cardName.includes('平均'));
|
|
|
expect(salaryCard).toBeDefined();
|
|
expect(salaryCard).toBeDefined();
|
|
|
if (salaryCard) {
|
|
if (salaryCard) {
|
|
|
- expect(salaryCard.currentValue).toMatch(/d+|¥|元/);
|
|
|
|
|
|
|
+ // 接受数字(可能包含货币符号)或空数据占位符 "--"
|
|
|
|
|
+ expect(salaryCard.currentValue).toMatch(/(\d+|¥|元|--)/);
|
|
|
}
|
|
}
|
|
|
console.debug('[AC3.2] 平均薪资数据正确性 ✓');
|
|
console.debug('[AC3.2] 平均薪资数据正确性 ✓');
|
|
|
});
|
|
});
|