Browse Source

test: 修正测试问题

xyh 2 years ago
parent
commit
db78a6d2f1
4 changed files with 18 additions and 7 deletions
  1. 1 1
      cypress.config.ts
  2. 9 6
      cypress/e2e/error.cy.ts
  3. 3 0
      cypress/e2e/purchase.cy.ts
  4. 5 0
      cypress/e2e/utils/utils.ts

+ 1 - 1
cypress.config.ts

@@ -5,7 +5,7 @@ const address = ip.address();
 
 export default defineConfig({
   e2e: {
-    baseUrl: `http://${address}:3001`,
+    baseUrl: `http://${address}:3002`,
     viewportHeight: 2500,
     viewportWidth: 1920,
   },

+ 9 - 6
cypress/e2e/error.cy.ts

@@ -38,11 +38,6 @@ describe('gs错误日志', function () {
   });
 
   it('table', function () {
-    validateExport('error_log_table');
-    // 重试
-    tableBtnClick('error_log_table', 0);
-
-    validateMessageContent('已重试');
     validateTableList('error_log_table');
     validateTableSearch(
       'error_log_table',
@@ -50,8 +45,8 @@ describe('gs错误日志', function () {
         'url',
         'errorInfo',
         'dataVal',
-        'type',
         {id: 'date', type: 'date', enableTime: true},
+        'type',
       ],
       {
         toolId: 'error_log_filter',
@@ -59,4 +54,12 @@ describe('gs错误日志', function () {
       },
     );
   });
+
+  it('operation', function () {
+    validateExport('error_log_table');
+
+    // 重试
+    tableBtnClick('error_log_table', 0);
+    validateMessageContent('已重试');
+  });
 });

+ 3 - 0
cypress/e2e/purchase.cy.ts

@@ -80,7 +80,10 @@ describe('采购单列表', function () {
           value: 'timeout',
           eq: 1,
           defaultValue: '全部',
+          defaultEq: 0,
         },
+        'wllbCode',
+        'materialName',
       ],
       {
         toolId: 'purchase_filter',

+ 5 - 0
cypress/e2e/utils/utils.ts

@@ -124,6 +124,7 @@ export function validateTableSearch(
         value: string;
         eq?: number;
         defaultValue?: string;
+        defaultEq?: number;
       }
     | {id: string; type: 'date'; enableTime?: boolean}
     | string
@@ -145,6 +146,10 @@ export function validateTableSearch(
       if (typeof key === 'string') {
         cy.getTestId(toolId).find(`[data-testid="filter_${key}"]`).clear();
       } else {
+        if (key.type === 'select' && key.defaultEq !== void 0) {
+          selectClick(`filter_${key.id}`, key.defaultEq);
+          return;
+        }
         const {id, type} = key;
         const clearId =
           type === 'select' ? '.ant-select-clear' : '.ant-picker-clear';