|
|
@@ -157,4 +157,90 @@ test.describe('【场景流程】家庭收益管理流程', () => {
|
|
|
const records = page.locator('.record-item, .earnings-record');
|
|
|
expect(await records.first().isVisible().catch(() => false)).toBeTruthy();
|
|
|
});
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 场景5:管理员视角 — 家庭收益管理
|
|
|
+ * 角色:管理员
|
|
|
+ * 触发条件:进入后台家庭收益管理页面
|
|
|
+ * 校验:查看家庭列表和收益记录
|
|
|
+ */
|
|
|
+ test('[场景5] 管理员管理家庭收益', async ({ page }) => {
|
|
|
+ // 管理员登录(admin 后台)
|
|
|
+ await page.goto('http://cfc.iwintrue.com/admin/login');
|
|
|
+ await page.waitForTimeout(1000);
|
|
|
+
|
|
|
+ const adminPhone = '13701366188';
|
|
|
+ await page.locator('input[placeholder="请输入手机号"]').fill(adminPhone);
|
|
|
+ await page.locator('button:has-text("登录")').click();
|
|
|
+ await page.waitForTimeout(2000);
|
|
|
+
|
|
|
+ // 进入家庭收益管理
|
|
|
+ await page.goto('http://cfc.iwintrue.com/admin/family-earnings');
|
|
|
+ await page.waitForLoadState('networkidle');
|
|
|
+
|
|
|
+ // 验证家庭列表加载
|
|
|
+ const familyRows = page.locator('.el-table__row, .family-row');
|
|
|
+ expect(await familyRows.count()).toBeGreaterThanOrEqual(0);
|
|
|
+
|
|
|
+ // 点击查看详情
|
|
|
+ if (await familyRows.count() > 0) {
|
|
|
+ const firstRow = familyRows.first();
|
|
|
+ const viewBtn = firstRow.locator('button:has-text("查看")');
|
|
|
+ await viewBtn.click();
|
|
|
+ await page.waitForTimeout(500);
|
|
|
+
|
|
|
+ // 验证概览数据加载
|
|
|
+ const summaryData = page.locator('.summary-card, .earnings-summary');
|
|
|
+ expect(await summaryData.isVisible()).toBeTruthy();
|
|
|
+
|
|
|
+ // 查看收益记录
|
|
|
+ const recordTab = page.locator('.tab-item:has-text("收益记录")');
|
|
|
+ await recordTab.click();
|
|
|
+ await page.waitForTimeout(500);
|
|
|
+
|
|
|
+ const recordRows = page.locator('.el-table__row, .record-row');
|
|
|
+ expect(await recordRows.count()).toBeGreaterThanOrEqual(0);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 场景6:提现申请审核流程
|
|
|
+ * 角色:管理员
|
|
|
+ * 触发条件:进入后台提现审核页面
|
|
|
+ * 校验:能查看待审核记录并操作
|
|
|
+ */
|
|
|
+ test('[场景6] 提现申请审核', async ({ page }) => {
|
|
|
+ // 管理员登录(admin 后台)
|
|
|
+ await page.goto('http://cfc.iwintrue.com/admin/login');
|
|
|
+ await page.locator('input[placeholder="请输入手机号"]').fill('13701366188');
|
|
|
+ await page.locator('button:has-text("登录")').click();
|
|
|
+ await page.waitForTimeout(2000);
|
|
|
+
|
|
|
+ // 进入提现审核
|
|
|
+ await page.goto('http://cfc.iwintrue.com/admin/family-earnings/withdraw');
|
|
|
+ await page.waitForLoadState('networkidle');
|
|
|
+
|
|
|
+ // 验证待审核记录加载
|
|
|
+ const withdrawRows = page.locator('.el-table__row, .withdraw-row');
|
|
|
+ const rowCount = await withdrawRows.count();
|
|
|
+
|
|
|
+ if (rowCount > 0) {
|
|
|
+ // 审核通过第一条
|
|
|
+ const approveBtn = withdrawRows.first().locator('button:has-text("通过")');
|
|
|
+ await approveBtn.click();
|
|
|
+ await page.waitForTimeout(500);
|
|
|
+
|
|
|
+ // 提交
|
|
|
+ const submitBtn = page.locator('.confirm-btn, .el-button--primary');
|
|
|
+ await submitBtn.click();
|
|
|
+ await page.waitForTimeout(1000);
|
|
|
+
|
|
|
+ // 验证提示
|
|
|
+ const successTip = page.locator('.modal-success, .toast-success');
|
|
|
+ expect(await successTip.isVisible().catch(() => false)).toBeTruthy();
|
|
|
+ } else {
|
|
|
+ // 无待审核记录,跳过
|
|
|
+ expect(true).toBeTruthy();
|
|
|
+ }
|
|
|
+ });
|
|
|
});
|