Explorar el Código

feat: 增加采购单列表测试

xyh hace 2 años
padre
commit
dea32e8f5f

+ 58 - 0
cypress/e2e/receive.cy.ts

@@ -0,0 +1,58 @@
+import {
+  loginIntercept,
+  menuIntercept,
+  loginSetup,
+  optionsIntercept,
+  dictionaryIntercept,
+  intoMenu,
+  intercept,
+  validateTableList,
+  validateTableSearch,
+  selectClick,
+  clickDatePicker,
+} from './utils';
+
+describe('采购单列表', function() {
+  beforeEach(function() {
+    loginIntercept();
+    menuIntercept();
+    loginSetup();
+    optionsIntercept();
+    dictionaryIntercept();
+    intoMenu('采购单管理', '采购单列表');
+  });
+
+  beforeEach(function() {
+    intercept('/receiveGoods/getReceiveGoods', function({search, reply}) {
+      if (search.has('orderCode') && search.get('orderCode').length)
+        return reply({fixture: 'receive/search1'});
+      if (search.has('type') && search.get('type').length)
+        return reply({fixture: 'receive/search2'});
+      if (
+        search.has('startTime') && search.get('startTime').length
+        && search.has('endTime') && search.get('endTime').length
+      )
+        return reply({fixture: 'receive/search3'});
+
+      const page = search.get('page');
+      reply({fixture: `receive/list${page}`});
+    });
+  });
+
+  it('列表', function() {
+    validateTableList('receive_table');
+
+    const validate = validateTableSearch('receive_table');
+
+    cy.get('#filter_receiveCode').type('searchCode');
+    validate('search1');
+
+    cy.get('#filter_receiveCode').clear();
+    selectClick('filter_receiveState', 1);
+    validate('search2');
+
+    selectClick('filter_receiveState', 0);
+    clickDatePicker('date_filter_receiveDate');
+    validate('search3');
+  });
+});

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

@@ -154,3 +154,12 @@ export function closeModal() {
     );
 }
 
+export function clickDatePicker(id: string) {
+  cy.getTestId(id).click();
+
+  cy.get('.ant-picker-panels').children().eq(0).find('.ant-picker-content')
+    .find('tbody').find('td').eq(0).click();
+
+  cy.get('.ant-picker-panels').children().eq(1).find('.ant-picker-content')
+    .find('tbody').find('td').eq(0).click();
+}

+ 86 - 21
cypress/fixtures/menu/basic.json

@@ -11,7 +11,7 @@
       "page": 0,
       "limit": 0,
       "orderBy": null,
-      "menu": "23,15,16,14,13,29,26,25,47,48,49,",
+      "menu": "23,15,16,14,13,29,26,25,47,48,49,51,50,52,53,54,",
       "pid": "13"
     },
     {
@@ -24,7 +24,7 @@
       "page": 0,
       "limit": 0,
       "orderBy": null,
-      "menu": "23,15,16,14,13,29,26,25,47,48,49,",
+      "menu": "23,15,16,14,13,29,26,25,47,48,49,51,50,52,53,54,",
       "pid": "0"
     },
     {
@@ -37,7 +37,7 @@
       "page": 0,
       "limit": 0,
       "orderBy": null,
-      "menu": "23,15,16,14,13,29,26,25,47,48,49,",
+      "menu": "23,15,16,14,13,29,26,25,47,48,49,51,50,52,53,54,",
       "pid": "15"
     },
     {
@@ -50,7 +50,7 @@
       "page": 0,
       "limit": 0,
       "orderBy": null,
-      "menu": "23,15,16,14,13,29,26,25,47,48,49,",
+      "menu": "23,15,16,14,13,29,26,25,47,48,49,51,50,52,53,54,",
       "pid": "25"
     },
     {
@@ -63,34 +63,47 @@
       "page": 0,
       "limit": 0,
       "orderBy": null,
-      "menu": "23,15,16,14,13,29,26,25,47,48,49,",
+      "menu": "23,15,16,14,13,29,26,25,47,48,49,51,50,52,53,54,",
       "pid": "13"
     },
     {
-      "id": "16",
-      "name": "角色管理",
-      "url": "/role",
-      "pId": "15",
+      "id": "51",
+      "name": "采购单列表",
+      "url": "/receive",
+      "pId": "50",
       "idCode": null,
       "type": null,
       "page": 0,
       "limit": 0,
       "orderBy": null,
-      "menu": "23,15,16,14,13,29,26,25,47,48,49,",
-      "pid": "15"
+      "menu": "23,15,16,14,13,29,26,25,47,48,49,51,50,52,53,54,",
+      "pid": "50"
     },
     {
-      "id": "25",
-      "name": "仓库管理",
-      "url": ".",
-      "pId": "0",
+      "id": "54",
+      "name": "入库流水",
+      "url": "/stream/rawin",
+      "pId": "53",
       "idCode": null,
       "type": null,
       "page": 0,
       "limit": 0,
       "orderBy": null,
-      "menu": "23,15,16,14,13,29,26,25,47,48,49,",
-      "pid": "0"
+      "menu": "23,15,16,14,13,29,26,25,47,48,49,51,50,52,53,54,",
+      "pid": "53"
+    },
+    {
+      "id": "16",
+      "name": "角色管理",
+      "url": "/role",
+      "pId": "15",
+      "idCode": null,
+      "type": null,
+      "page": 0,
+      "limit": 0,
+      "orderBy": null,
+      "menu": "23,15,16,14,13,29,26,25,47,48,49,51,50,52,53,54,",
+      "pid": "15"
     },
     {
       "id": "48",
@@ -102,7 +115,7 @@
       "page": 0,
       "limit": 0,
       "orderBy": null,
-      "menu": "23,15,16,14,13,29,26,25,47,48,49,",
+      "menu": "23,15,16,14,13,29,26,25,47,48,49,51,50,52,53,54,",
       "pid": "25"
     },
     {
@@ -115,9 +128,48 @@
       "page": 0,
       "limit": 0,
       "orderBy": null,
-      "menu": "23,15,16,14,13,29,26,25,47,48,49,",
+      "menu": "23,15,16,14,13,29,26,25,47,48,49,51,50,52,53,54,",
       "pid": "25"
     },
+    {
+      "id": "50",
+      "name": "采购单管理",
+      "url": ".",
+      "pId": "0",
+      "idCode": null,
+      "type": null,
+      "page": 0,
+      "limit": 0,
+      "orderBy": null,
+      "menu": "23,15,16,14,13,29,26,25,47,48,49,51,50,52,53,54,",
+      "pid": "0"
+    },
+    {
+      "id": "52",
+      "name": "逾期采购单列表",
+      "url": "/receive/timeout",
+      "pId": "50",
+      "idCode": null,
+      "type": null,
+      "page": 0,
+      "limit": 0,
+      "orderBy": null,
+      "menu": "23,15,16,14,13,29,26,25,47,48,49,51,50,52,53,54,",
+      "pid": "50"
+    },
+    {
+      "id": "25",
+      "name": "仓库管理",
+      "url": ".",
+      "pId": "0",
+      "idCode": null,
+      "type": null,
+      "page": 0,
+      "limit": 0,
+      "orderBy": null,
+      "menu": "23,15,16,14,13,29,26,25,47,48,49,51,50,52,53,54,",
+      "pid": "0"
+    },
     {
       "id": "47",
       "name": "容器管理",
@@ -128,9 +180,22 @@
       "page": 0,
       "limit": 0,
       "orderBy": null,
-      "menu": "23,15,16,14,13,29,26,25,47,48,49,",
+      "menu": "23,15,16,14,13,29,26,25,47,48,49,51,50,52,53,54,",
       "pid": "25"
     },
+    {
+      "id": "53",
+      "name": "流水管理",
+      "url": ".",
+      "pId": "0",
+      "idCode": null,
+      "type": null,
+      "page": 0,
+      "limit": 0,
+      "orderBy": null,
+      "menu": "23,15,16,14,13,29,26,25,47,48,49,51,50,52,53,54,",
+      "pid": "0"
+    },
     {
       "id": "13",
       "name": "系统设置",
@@ -141,7 +206,7 @@
       "page": 0,
       "limit": 0,
       "orderBy": null,
-      "menu": "23,15,16,14,13,29,26,25,47,48,49,",
+      "menu": "23,15,16,14,13,29,26,25,47,48,49,51,50,52,53,54,",
       "pid": "0"
     }
   ]

+ 0 - 27
cypress/fixtures/receive/list2.json

@@ -56,33 +56,6 @@
         "startTime": null,
         "endTime": null,
         "warehousingNum": null
-      },
-      {
-        "id": "3",
-        "supplierId": null,
-        "supplierName": "供应商1",
-        "orderId": null,
-        "orderNumber": null,
-        "materialName": "材料1",
-        "materialId": null,
-        "purchaseNum": "123",
-        "arrivalNum": "456546",
-        "arrivalTime": "2023-03-01",
-        "type": "1",
-        "qualifiedNum": "1",
-        "disqualificationNum": "1",
-        "orderCode": "123",
-        "companyNumber": null,
-        "wbs": null,
-        "orderType": null,
-        "sourceType": null,
-        "entryNumber": null,
-        "moveType": null,
-        "page": 0,
-        "limit": 0,
-        "startTime": null,
-        "endTime": null,
-        "warehousingNum": null
       }
     ],
     "pageNum": 1,