|
|
@@ -552,12 +552,158 @@ class API_010_TestCase extends ApiTestCase {
|
|
|
|
|
|
console.log(`[${this.id}] 家庭信息数据:`, JSON.stringify(response.data, null, 2));
|
|
|
|
|
|
- const passed = response.status === 200;
|
|
|
- this.logResult(passed);
|
|
|
- } catch (error) {
|
|
|
- this.logResult(false, error);
|
|
|
- }
|
|
|
+const passed = response.status === 200;
|
|
|
+ this.logResult(passed);
|
|
|
+ } catch (error) {
|
|
|
+ this.logResult(false, error);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+* API-011: 指导师首次登录角色选择
|
|
|
+*/
|
|
|
+class API_011_TestCase extends ApiTestCase {
|
|
|
+ constructor() {
|
|
|
+ super('API-011', '指导师首次登录角色选择', 'P0', '/api/auth/role-select', 'POST');
|
|
|
+ }
|
|
|
+
|
|
|
+ async run() {
|
|
|
+ try {
|
|
|
+ this.requestData = { userId: 1, role: 'teacher' };
|
|
|
+ const response = await this.sendRequest(this.requestData);
|
|
|
+ this.logResult(response.status === 200);
|
|
|
+ } catch (error) {
|
|
|
+ this.logResult(false, error);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+* API-012: 指导师信息录入
|
|
|
+*/
|
|
|
+class API_012_TestCase extends ApiTestCase {
|
|
|
+ constructor() {
|
|
|
+ super('API-012', '指导师信息录入', 'P0', '/api/user/profile', 'PUT');
|
|
|
+ }
|
|
|
+
|
|
|
+ async run() {
|
|
|
+ try {
|
|
|
+ this.requestData = {
|
|
|
+ idCard: '110101199001011234',
|
|
|
+ gender: 'male',
|
|
|
+ teacherPhoto: 'https://example.com/photo.jpg',
|
|
|
+ teacherNo: 'TEACHER20260001',
|
|
|
+ certificateImage: 'https://example.com/cert.jpg'
|
|
|
+ };
|
|
|
+ const response = await this.sendRequest(this.requestData);
|
|
|
+ this.logResult(response.status === 200);
|
|
|
+ } catch (error) {
|
|
|
+ this.logResult(false, error);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+* API-013: 指导师查看关联家庭
|
|
|
+*/
|
|
|
+class API_013_TestCase extends ApiTestCase {
|
|
|
+ constructor() {
|
|
|
+ super('API-013', '指导师查看关联家庭列表', 'P0', '/api/guide/families', 'GET');
|
|
|
+ }
|
|
|
+
|
|
|
+ async run() {
|
|
|
+ try {
|
|
|
+ this.requestData = { teacherId: 1 };
|
|
|
+ const response = await this.sendRequest(this.requestData);
|
|
|
+ this.logResult(response.status === 200);
|
|
|
+ } catch (error) {
|
|
|
+ this.logResult(false, error);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+* API-014: 指导师审核任务
|
|
|
+*/
|
|
|
+class API_014_TestCase extends ApiTestCase {
|
|
|
+ constructor() {
|
|
|
+ super('API-014', '指导师审核家庭任务', 'P0', '/api/guide/tasks/1/review', 'POST');
|
|
|
+ }
|
|
|
+
|
|
|
+ async run() {
|
|
|
+ try {
|
|
|
+ this.requestData = { taskId: 1, approved: true, comment: '审核通过' };
|
|
|
+ const response = await this.sendRequest(this.requestData);
|
|
|
+ this.logResult(response.status === 200);
|
|
|
+ } catch (error) {
|
|
|
+ this.logResult(false, error);
|
|
|
}
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+* API-015: 小游戏-舒尔特方格
|
|
|
+*/
|
|
|
+class API_015_TestCase extends ApiTestCase {
|
|
|
+ constructor() {
|
|
|
+ super('API-015', '舒尔特方格开始游戏', 'P1', '/api/mini-games/schulte/start', 'POST');
|
|
|
+ }
|
|
|
+
|
|
|
+ async run() {
|
|
|
+ try {
|
|
|
+ this.requestData = { childId: 2, gridSize: 5 };
|
|
|
+ const response = await this.sendRequest(this.requestData);
|
|
|
+ this.logResult(response.status === 200);
|
|
|
+ } catch (error) {
|
|
|
+ this.logResult(false, error);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+* API-016: 小游戏-猜数字(1a2b)
|
|
|
+*/
|
|
|
+class API_016_TestCase extends ApiTestCase {
|
|
|
+ constructor() {
|
|
|
+ super('API-016', '猜数字(1a2b)开始游戏', 'P1', '/api/mini-games/1a2b/start', 'POST');
|
|
|
+ }
|
|
|
+
|
|
|
+ async run() {
|
|
|
+ try {
|
|
|
+ this.requestData = { childId: 2 };
|
|
|
+ const response = await this.sendRequest(this.requestData);
|
|
|
+ this.logResult(response.status === 200);
|
|
|
+ } catch (error) {
|
|
|
+ this.logResult(false, error);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+* API-017: 任务模板创建
|
|
|
+*/
|
|
|
+class API_017_TestCase extends ApiTestCase {
|
|
|
+ constructor() {
|
|
|
+ super('API-017', '创建任务模板', 'P1', '/api/task-templates', 'POST');
|
|
|
+ }
|
|
|
+
|
|
|
+ async run() {
|
|
|
+ try {
|
|
|
+ this.requestData = {
|
|
|
+ title: '每日阅读',
|
|
|
+ description: '阅读30分钟课外书籍',
|
|
|
+ category: 'study',
|
|
|
+ points: 3,
|
|
|
+ duration: 30,
|
|
|
+ completeTypes: ['checkin', 'text']
|
|
|
+ };
|
|
|
+ const response = await this.sendRequest(this.requestData);
|
|
|
+ this.logResult(response.status === 200);
|
|
|
+ } catch (error) {
|
|
|
+ this.logResult(false, error);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// ============================================================================
|
|
|
@@ -818,11 +964,71 @@ class WEB_007_TestCase extends WebTestCase {
|
|
|
await this.click(streetBtn.uid);
|
|
|
await this.screenshot('02_street_stats');
|
|
|
|
|
|
- this.logResult(true);
|
|
|
- } catch (error) {
|
|
|
- this.logResult(false, error);
|
|
|
- }
|
|
|
+this.logResult(true);
|
|
|
+ } catch (error) {
|
|
|
+ this.logResult(false, error);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+* WEB-008: 指导师审核家庭任务
|
|
|
+*/
|
|
|
+class WEB_008_TestCase extends WebTestCase {
|
|
|
+ constructor() {
|
|
|
+ super('WEB-008', '指导师审核家庭任务', 'P0');
|
|
|
+ }
|
|
|
+
|
|
|
+ async run() {
|
|
|
+ try {
|
|
|
+ await this.setup();
|
|
|
+ await this.loginTeacher();
|
|
|
+
|
|
|
+ // 1. 进入待审核任务
|
|
|
+ const pendingTasks = await this.waitForElement('待审核任务');
|
|
|
+ await this.click(pendingTasks.uid);
|
|
|
+ await this.screenshot('01_pending_tasks');
|
|
|
+
|
|
|
+ // 2. 审核通过
|
|
|
+ const approveBtn = await this.waitForElement('通过');
|
|
|
+ await this.click(approveBtn.uid);
|
|
|
+ await this.screenshot('02_approved');
|
|
|
+
|
|
|
+ this.logResult(true);
|
|
|
+ } catch (error) {
|
|
|
+ this.logResult(false, error);
|
|
|
}
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+* WEB-009: 指导师查看家庭任务详情
|
|
|
+*/
|
|
|
+class WEB_009_TestCase extends WebTestCase {
|
|
|
+ constructor() {
|
|
|
+ super('WEB-009', '指导师查看家庭任务详情', 'P1');
|
|
|
+ }
|
|
|
+
|
|
|
+ async run() {
|
|
|
+ try {
|
|
|
+ await this.setup();
|
|
|
+ await this.loginTeacher();
|
|
|
+
|
|
|
+ // 1. 进入我的家庭
|
|
|
+ const myFamilies = await this.waitForElement('我的家庭');
|
|
|
+ await this.click(myFamilies.uid);
|
|
|
+ await this.screenshot('01_family_list');
|
|
|
+
|
|
|
+ // 2. 查看详情
|
|
|
+ const detailBtn = await this.waitForElement('查看详情');
|
|
|
+ await this.click(detailBtn.uid);
|
|
|
+ await this.screenshot('02_family_tasks');
|
|
|
+
|
|
|
+ this.logResult(true);
|
|
|
+ } catch (error) {
|
|
|
+ this.logResult(false, error);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// ============================================================================
|
|
|
@@ -998,30 +1204,41 @@ module.exports = {
|
|
|
TestSuite,
|
|
|
TEST_CONFIG,
|
|
|
|
|
|
- // API测试用例(小程序端)
|
|
|
- apiTestCases: {
|
|
|
- API_001_TestCase,
|
|
|
- API_002_TestCase,
|
|
|
- API_003_TestCase,
|
|
|
- API_004_TestCase,
|
|
|
- API_005_TestCase,
|
|
|
- API_006_TestCase,
|
|
|
- API_007_TestCase,
|
|
|
- API_008_TestCase,
|
|
|
- API_009_TestCase,
|
|
|
- API_010_TestCase
|
|
|
- },
|
|
|
+// API测试用例(小程序端)
|
|
|
+ apiTestCases: {
|
|
|
+ API_001_TestCase,
|
|
|
+ API_002_TestCase,
|
|
|
+ API_003_TestCase,
|
|
|
+ API_004_TestCase,
|
|
|
+ API_005_TestCase,
|
|
|
+ API_006_TestCase,
|
|
|
+ API_007_TestCase,
|
|
|
+ API_008_TestCase,
|
|
|
+ API_009_TestCase,
|
|
|
+ API_010_TestCase,
|
|
|
+ // 新增模块测试用例
|
|
|
+ API_011_TestCase, // 指导师角色选择
|
|
|
+ API_012_TestCase, // 指导师信息录入
|
|
|
+ API_013_TestCase, // 指导师查看关联家庭
|
|
|
+ API_014_TestCase, // 指导师审核任务
|
|
|
+ API_015_TestCase, // 小游戏-舒尔特方格
|
|
|
+ API_016_TestCase, // 小游戏-猜数字
|
|
|
+ API_017_TestCase // 任务模板创建
|
|
|
+ },
|
|
|
|
|
|
- // Web浏览器测试用例(管理后台)
|
|
|
- webTestCases: {
|
|
|
- WEB_001_TestCase,
|
|
|
- WEB_002_TestCase,
|
|
|
- WEB_003_TestCase,
|
|
|
- WEB_004_TestCase,
|
|
|
- WEB_005_TestCase,
|
|
|
- WEB_006_TestCase,
|
|
|
- WEB_007_TestCase
|
|
|
- }
|
|
|
+// Web浏览器测试用例(管理后台)
|
|
|
+ webTestCases: {
|
|
|
+ WEB_001_TestCase,
|
|
|
+ WEB_002_TestCase,
|
|
|
+ WEB_003_TestCase,
|
|
|
+ WEB_004_TestCase,
|
|
|
+ WEB_005_TestCase,
|
|
|
+ WEB_006_TestCase,
|
|
|
+ WEB_007_TestCase,
|
|
|
+ // 新增指导师测试用例
|
|
|
+ WEB_008_TestCase, // 指导师审核家庭任务
|
|
|
+ WEB_009_TestCase // 指导师查看家庭任务详情
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
// ============================================================================
|