Best JavaScript code snippet using cypress
admin-model.js
Source: admin-model.js
1/**2 * @Dateï¼2016.4.263 * @Author: haoyong4 * @Description: verify modelå±5 */6define([7 "ajaxExtend"8], function (ajaxExtend) {9 "use strict";10 return (function (scope) {11 //æ¯å¦ä½¿ç¨æ¨¡ææ°æ®12 var _isUseMock = false,13 //设置请æ±çæ ¹è·¯å¾14 // _serviceHost = "http://localhost:8080/agri_I/",15 //设置请æ±ä¸ä¸æ16 _serviceContext = "/",17 //设置请æ±çurléå18 _ACTIONS_URL = {19 //ææºè®¤è¯æºæ20 Get_Ji_Gou: (_isUseMock ? "inc/jigou.json" : "inc/jigou.json"),21 //ç¨æ·22 Get_Admin_List: (_isUseMock ? "inc/mockAdminList.json" : serviceHost + "user/" + "getAdminList"),23 Add_Admin: (_isUseMock ? "inc/mockAdminList.json" : serviceHost + "user/" + "addUser"),24 Delete_User: (_isUseMock ? "inc/mockAdminList.json" : serviceHost + "user/" + "deleteUser"),25 //产å26 Delete_Product: (_isUseMock ? "inc/mockAdminList.json" : serviceHost + "product/" + "deleteProduct"),27 Get_Company_List: (_isUseMock ? "inc/mockCompanyList.json" : serviceHost + "company/" + "getCompanyList"),28 Delete_Company: (_isUseMock ? "inc/mockCompanyList.json" : serviceHost + "company/" + "deleteCompany"),29 //æ°é»èµè®¯30 getNewsTypeList: (_isUseMock ? "inc/mockNewsList.json" : serviceHost + "newsType/" + "getNewsTypeList"),31 getNewsTypeById: (_isUseMock ? "inc/mockNewsList.json" : serviceHost + "newsType/" + "getNewsTypeById"),32 addNewsType: (_isUseMock ? "inc/mockNewsList.json" : serviceHost + "newsType/" + "addNewsType"),33 updateNewsType: (_isUseMock ? "inc/mockNewsList.json" : serviceHost + "newsType/" + "updateNewsType"),34 deleteNewsType: (_isUseMock ? "inc/mockNewsList.json" : serviceHost + "newsType/" + "deleteNewsType"),35 //èµè®¯ç±»å«36 Get_News_List: (_isUseMock ? "inc/mockNewsList.json" : serviceHost + "news/" + "getNewsList"),37 Add_News: (_isUseMock ? "inc/mockAdminList.json" : serviceHost + "news/" + "addNews"),38 Delete_News: (_isUseMock ? "inc/mockAdminList.json" : serviceHost + "news/" + "deleteNews"),39 Update_News: (_isUseMock ? "inc/mockAdminList.json" : serviceHost + "news/" + "updateNews"),40 Get_News_By_ID: (_isUseMock ? "inc/mockNewsByID.json" : serviceHost + "news/" + "getNewsById"),41 //产å42 Get_Products_List: (_isUseMock ? "inc/mockProductsList.json" : serviceHost + "product/" + "null"),43 Get_Product_List_With_Page: (_isUseMock ? "inc/mockProductsList.json" : serviceHost + "product/" + "getProductListWithPage"),44 Total_Count_Product: (_isUseMock ? "inc/mockProductsList.json" : serviceHost + "product/" + "totalCountProduct"),45 //æ¥å¿å称46 getProductLogTypeList: (_isUseMock ? "inc/mockProductsList.json" : serviceHost + "productLogType/" + "getProductLogTypeList"),47 getProductLogTypeById: (_isUseMock ? "inc/mockProductsList.json" : serviceHost + "productLogType/" + "getProductLogTypeById"),48 addProductLogType: (_isUseMock ? "inc/mockProductsList.json" : serviceHost + "productLogType/" + "addProductLogType"),49 updateProductLogType: (_isUseMock ? "inc/mockProductsList.json" : serviceHost + "productLogType/" + "updateProductLogType"),50 deleteProductLogType: (_isUseMock ? "inc/mockProductsList.json" : serviceHost + "productLogType/" + "deleteProductLogType"),51 };52 /**53 * 认è¯æºæ54 */55 scope.getJigou = function (data,success, error) {56 return ajaxExtend.getData(_ACTIONS_URL.Get_Ji_Gou,data).then(success, error);57 }; /**58 * admin,verifyå表çæ¥å£59 */60 scope.getAdminList = function (data,success, error) {61 return ajaxExtend.getData(_ACTIONS_URL.Get_Admin_List,data).then(success, error);62 };63 /**64 * æ·»å ä¸ä¸ªadmin,verify65 */66 scope.addAdmin = function (data,success, error) {67 return ajaxExtend.getData(_ACTIONS_URL.Add_Admin,data).then(success, error);68 };69 /**70 * å é¤ä¸ä¸ªuser admin,verify71 */72 scope.deleteUser = function (data,success, error) {73 return ajaxExtend.getData(_ACTIONS_URL.Delete_User,data).then(success, error);74 };75 /**76 * å é¤ä¸ä¸ªäº§å77 */78 scope.deleteProduct = function (data,success, error) {79 return ajaxExtend.getData(_ACTIONS_URL.Delete_Product,data).then(success, error);80 };81 /**82 * å
¬å¸å表çæ¥å£83 */84 scope.getCompanyList = function (data,success, error) {85 return ajaxExtend.getData(_ACTIONS_URL.Get_Company_List,data).then(success, error);86 };87 /**88 * å é¤ä¸ä¸ªå
¬å¸çæ¥å£89 */90 scope.deleteCompany = function (data,success, error) {91 return ajaxExtend.getData(_ACTIONS_URL.Delete_Company,data).then(success, error);92 };93 /**94 * newså表çæ¥å£95 */96 scope.getNewsList = function (data,success, error) {97 return ajaxExtend.getData(_ACTIONS_URL.Get_News_List,data).then(success, error);98 };99 /**100 * æ·»å news101 */102 scope.addNews = function (data,success, error) {103 return ajaxExtend.getData(_ACTIONS_URL.Add_News,data).then(success, error);104 };105 /**106 * ç¼è¾æ´æ°news107 */108 scope.updateNews = function (data,success, error) {109 return ajaxExtend.getData(_ACTIONS_URL.Update_News,data).then(success, error);110 };111 /**112 * å é¤news113 */114 scope.deleteNews = function (data,success, error) {115 return ajaxExtend.getData(_ACTIONS_URL.Delete_News,data).then(success, error);116 };117 /**118 * news idè·å119 */120 scope.getNewsById = function (data,success, error) {121 return ajaxExtend.getData(_ACTIONS_URL.Get_News_By_ID,data).then(success, error);122 };123 /**124 *125 */126 scope.getNewsTypeList = function (data,success, error) {127 return ajaxExtend.getData(_ACTIONS_URL.getNewsTypeList,data).then(success, error);128 }; /**129 *130 */131 scope.getNewsTypeById = function (data,success, error) {132 return ajaxExtend.getData(_ACTIONS_URL.getNewsTypeById,data).then(success, error);133 }; /**134 *135 */136 scope.addNewsType = function (data,success, error) {137 return ajaxExtend.getData(_ACTIONS_URL.addNewsType,data).then(success, error);138 }; /**139 *140 */141 scope.updateNewsType = function (data,success, error) {142 return ajaxExtend.getData(_ACTIONS_URL.updateNewsType,data).then(success, error);143 }; /**144 *145 */146 scope.deleteNewsType = function (data,success, error) {147 return ajaxExtend.getData(_ACTIONS_URL.deleteNewsType,data).then(success, error);148 };149 /**150 * 产åå表151 */152 scope.getProductsList = function (data,success, error) {153 return ajaxExtend.getData(_ACTIONS_URL.Get_Products_List,data).then(success, error);154 };155 /**156 * 产åå表å页157 */158 scope.getProductListWithPage = function (data,success, error) {159 return ajaxExtend.getData(_ACTIONS_URL.Get_Product_List_With_Page,data).then(success, error);160 };161 /**162 * 产åæ»æ°ç»è®¡163 */164 scope.totalCountProduct = function (data,success, error) {165 return ajaxExtend.getData(_ACTIONS_URL.Total_Count_Product,data).then(success, error);166 };167 /**168 * ProductLogTypeå表çæ¥å£169 */170 scope.getProductLogTypeList = function (data,success, error) {171 return ajaxExtend.getData(_ACTIONS_URL.getProductLogTypeList,data).then(success, error);172 };173 /**174 * ProductLogTypeçæ¥å£175 */176 scope.getProductLogTypeById = function (data,success, error) {177 return ajaxExtend.getData(_ACTIONS_URL.getProductLogTypeById,data).then(success, error);178 };179 /**180 * ProductLogTypeçæ¥å£181 */182 scope.addProductLogType = function (data,success, error) {183 return ajaxExtend.getData(_ACTIONS_URL.addProductLogType,data).then(success, error);184 };185 /**186 * ProductLogTypeçæ¥å£187 */188 scope.updateProductLogType = function (data,success, error) {189 return ajaxExtend.getData(_ACTIONS_URL.updateProductLogType,data).then(success, error);190 };191 /**192 * ProductLogTypeçæ¥å£193 */194 scope.deleteProductLogType = function (data,success, error) {195 return ajaxExtend.getData(_ACTIONS_URL.deleteProductLogType,data).then(success, error);196 };197 return scope;198 }({}));...
company-model.js
Source: company-model.js
1/**2 * @Dateï¼2016.4.203 * @Author: haoyong4 * @Description: company modelå±5 */6define([7 "ajaxExtend"8], function (ajaxExtend) {9 "use strict";10 return (function (scope) {11 //æ¯å¦ä½¿ç¨æ¨¡ææ°æ®12 var _isUseMock = false,13 //设置请æ±çæ ¹è·¯å¾14 //_serviceHost = "/ipå°å + service/",15 //设置请æ±ä¸ä¸æ16 _serviceContext = "",17 //设置请æ±çurléå18 _ACTIONS_URL = {19 Get_Company_Info_BY_ID: (_isUseMock ? "/inc/monitorSystem.json" : serviceHost + "company/" + "getCompanyById"),20 Update_Company: (_isUseMock ? "inc/mockCheckAllList.json" : serviceHost + "company/" + "updateCompany"),21 Get_Product_List_By_CompanyId: (_isUseMock ? "inc/mockCheckAllList.json" : serviceHost + "product/" + "getProductListByCompanyId"),22 Delete_Product: (_isUseMock ? "inc/mockAdminList.json" : serviceHost + "product/" + "deleteProduct"),23 Add_Product: (_isUseMock ? "inc/mockAdminList.json" : serviceHost + "product/" + "addProduct"),24 //batch25 Get_Batch_List_ByProductID: (_isUseMock ? "inc/mockAdminList.json" : serviceHost + "batch/" + "getBatchListByProductId"),26 Get_Batch_List_ByProductID_AndStatus: (_isUseMock ? "inc/mockAdminList.json" : serviceHost + "batch/" + "getBatchListByProductIdAndStatus"),27 Add_Batch: (_isUseMock ? "inc/mockAdminList.json" : serviceHost + "batch/" + "addBatch"),28 deleteBatch: (_isUseMock ? "inc/mockAdminList.json" : serviceHost + "batch/" + "deleteBatch"),29 getBatchListByWithPage: (_isUseMock ? "inc/mockAdminList.json" : serviceHost + "batch/" + "getBatchListByWithPage"),30 totalCountBatchBy: (_isUseMock ? "inc/mockAdminList.json" : serviceHost + "batch/" + "totalCountBatchBy"),31 //æ¥å¿32 getProductLogListByBatch: (_isUseMock ? "inc/mockAdminList.json" : serviceHost + "productLog/" + "getProductLogListByBatch"),33 addProductLog: (_isUseMock ? "inc/mockAdminList.json" : serviceHost + "productLog/" + "addProductLog"),34 updateProductLog: (_isUseMock ? "inc/mockAdminList.json" : serviceHost + "productLog/" + "updateProductLog"),35 deleteProductLog: (_isUseMock ? "inc/mockAdminList.json" : serviceHost + "productLog/" + "deleteProductLog"),36 getProductLogTypeList: (_isUseMock ? "inc/mockProductsList.json" : serviceHost + "productLogType/" + "getProductLogTypeList"),37 //çè¨38 totalCountWord: (_isUseMock ? "inc/mockProductsList.json" : serviceHost + "word/" + "totalCountWord"),39 getWordListByWithPage: (_isUseMock ? "inc/mockProductsList.json" : serviceHost + "word/" + "getWordListByWithPage"),40 getWordById: (_isUseMock ? "inc/mockProductsList.json" : serviceHost + "word/" + "getWordById"),41 addWord: (_isUseMock ? "inc/mockProductsList.json" : serviceHost + "word/" + "addWord"),42 deleteWord: (_isUseMock ? "inc/mockProductsList.json" : serviceHost + "word/" + "deleteWord"),43 updateWord: (_isUseMock ? "inc/mockProductsList.json" : serviceHost + "word/" + "updateWord"),44 };45 /**46 * è·åä¸ä¸ªå
¬å¸47 */48 scope.getCompanyById = function (data,success, error) {49 return ajaxExtend.getData(_ACTIONS_URL.Get_Company_Info_BY_ID, data).then(success, error);50 };51 /**52 * è·åä¸ä¸ªå
¬å¸id ä¸ç产å53 */54 scope.getProductListByCompanyId = function (data,success, error) {55 return ajaxExtend.getData(_ACTIONS_URL.Get_Product_List_By_CompanyId, data).then(success, error);56 };57 /**58 * æ·»å å
¬å¸ä¸ä¸ªäº§å59 */60 scope.addProduct = function (data,success, error) {61 return ajaxExtend.getData(_ACTIONS_URL.Add_Product,data).then(success, error);62 };63 /**64 * ä¸ä¸ªäº§åææ æ¹æ¬¡65 */66 scope.getBatchListByProductId = function (data,success, error) {67 return ajaxExtend.getData(_ACTIONS_URL.Get_Batch_List_ByProductID,data).then(success, error);68 };69 /**70 * ä¸ä¸ªäº§åææ æ¹æ¬¡ status71 */72 scope.getBatchListByProductIdAndStatus = function (data,success, error) {73 return ajaxExtend.getData(_ACTIONS_URL.Get_Batch_List_ByProductID_AndStatus,data).then(success, error);74 };75 /**76 * æ¹æ¬¡å页77 */78 scope.getBatchListByWithPage = function (data,success, error) {79 return ajaxExtend.getData(_ACTIONS_URL.getBatchListByWithPage,data).then(success, error);80 };81 /**82 * æ»æ°83 */84 scope.totalCountBatchBy = function (data,success, error) {85 return ajaxExtend.getData(_ACTIONS_URL.totalCountBatchBy,data).then(success, error);86 };87 /**88 * æ·»å ä¸ä¸ªäº§å æ¹æ¬¡89 */90 scope.addBatch = function (data,success, error) {91 return ajaxExtend.getData(_ACTIONS_URL.Add_Batch,data).then(success, error);92 };93 /**94 * å é¤ä¸ä¸ªäº§å æ¹æ¬¡95 */96 scope.deleteBatch = function (data,success, error) {97 return ajaxExtend.getData(_ACTIONS_URL.deleteBatch,data).then(success, error);98 };99 /**100 * å é¤ä¸ä¸ªäº§å101 */102 scope.deleteProduct = function (data,success, error) {103 return ajaxExtend.getData(_ACTIONS_URL.Delete_Product,data).then(success, error);104 };105 /**106 * ç¼è¾å
¬å¸ä¿¡æ¯107 */108 scope.updateCompany = function (data,success, error) {109 return ajaxExtend.getData(_ACTIONS_URL.Update_Company, data).then(success, error);110 };111 /**112 * è·åæ¹æ¬¡æ¥å¿113 */114 scope.getProductLogListByBatch = function (data,success, error) {115 return ajaxExtend.getData(_ACTIONS_URL.getProductLogListByBatch, data).then(success, error);116 };117 /**118 * æ·»å æ¥å¿119 */120 scope.addProductLog = function (data,success, error) {121 return ajaxExtend.getData(_ACTIONS_URL.addProductLog, data).then(success, error);122 };123 /**124 * æ´æ°æ¥å¿125 */126 scope.updateProductLog = function (data,success, error) {127 return ajaxExtend.getData(_ACTIONS_URL.updateProductLog, data).then(success, error);128 };129 /**130 * å æ¥å¿131 */132 scope.deleteProductLog = function (data,success, error) {133 return ajaxExtend.getData(_ACTIONS_URL.deleteProductLog, data).then(success, error);134 };135 /**136 * æ¥å¿Typeå表çæ¥å£137 */138 scope.getProductLogTypeList = function (data,success, error) {139 return ajaxExtend.getData(_ACTIONS_URL.getProductLogTypeList,data).then(success, error);140 };141 /**142 * ç»è®¡çè¨143 */144 scope.totalCountWord = function (data,success, error) {145 return ajaxExtend.getData(_ACTIONS_URL.totalCountWord,data).then(success, error);146 };147 /**148 * çè¨å表149 */150 scope.getWordListByWithPage = function (data,success, error) {151 return ajaxExtend.getData(_ACTIONS_URL.getWordListByWithPage,data).then(success, error);152 };153 /**154 * è·åä¸ä¸ªçè¨155 */156 scope.getWordById = function (data,success, error) {157 return ajaxExtend.getData(_ACTIONS_URL.getWordById,data).then(success, error);158 };159 /**160 * æ·»å çè¨161 */162 scope.addWord = function (data,success, error) {163 return ajaxExtend.getData(_ACTIONS_URL.addWord,data).then(success, error);164 };165 /**166 * å é¤çè¨167 */168 scope.deleteWord = function (data,success, error) {169 return ajaxExtend.getData(_ACTIONS_URL.deleteWord,data).then(success, error);170 };171 /**172 * æ´æ°çè¨173 */174 scope.updateWord = function (data,success, error) {175 return ajaxExtend.getData(_ACTIONS_URL.updateWord,data).then(success, error);176 };177 return scope;178 }({}));...
trace-model.js
Source: trace-model.js
1/**2 * @Dateï¼2016.4.203 * @Author: haoyong4 * @Description: company modelå±5 */6define([7 "ajaxExtend"8], function (ajaxExtend) {9 "use strict";10 return (function (scope) {11 //æ¯å¦ä½¿ç¨æ¨¡ææ°æ®12 var _isUseMock = false,13 //设置请æ±çæ ¹è·¯å¾14 //_serviceHost = "/ipå°å + service/",15 //设置请æ±ä¸ä¸æ16 _serviceContext = "",17 //设置请æ±çurléå18 _ACTIONS_URL = {19 Get_Company_Info_BY_ID: (_isUseMock ? "/inc/monitorSystem.json" : serviceHost + "company/" + "getCompanyById"),20 Update_Company: (_isUseMock ? "inc/mockCheckAllList.json" : serviceHost + "company/" + "updateCompany"),21 Get_Product_List_By_CompanyId: (_isUseMock ? "inc/mockCheckAllList.json" : serviceHost + "product/" + "getProductListByCompanyId"),22 Delete_Product: (_isUseMock ? "inc/mockAdminList.json" : serviceHost + "product/" + "deleteProduct"),23 Add_Product: (_isUseMock ? "inc/mockAdminList.json" : serviceHost + "product/" + "addProduct"),24 Get_Batch_List_ByProductID: (_isUseMock ? "inc/mockAdminList.json" : serviceHost + "batch/" + "getBatchListByProductId"),25 Get_Batch_List_ByProductID_AndStatus: (_isUseMock ? "inc/mockAdminList.json" : serviceHost + "batch/" + "getBatchListByProductIdAndStatus"),26 Add_Batch: (_isUseMock ? "inc/mockAdminList.json" : serviceHost + "batch/" + "addBatch"),27 getProductById: (_isUseMock ? "inc/mockAdminList.json" : serviceHost + "product/" + "getProductById"),28 //æ¥å¿29 getProductLogListByBatch: (_isUseMock ? "inc/mockAdminList.json" : serviceHost + "productLog/" + "getProductLogListByBatch"),30 addProductLog: (_isUseMock ? "inc/mockAdminList.json" : serviceHost + "productLog/" + "addProductLog"),31 updateProductLog: (_isUseMock ? "inc/mockAdminList.json" : serviceHost + "productLog/" + "updateProductLog"),32 deleteProductLog: (_isUseMock ? "inc/mockAdminList.json" : serviceHost + "productLog/" + "deleteProductLog"),33 getProductLogTypeList: (_isUseMock ? "inc/mockProductsList.json" : serviceHost + "productLogType/" + "getProductLogTypeList"),34 };35 /**36 * product from id37 */38 scope.getProductById = function (data,success, error) {39 return ajaxExtend.getData(_ACTIONS_URL.getProductById, data).then(success, error);40 };41 /**42 * è·åä¸ä¸ªå
¬å¸43 */44 scope.getCompanyById = function (data,success, error) {45 return ajaxExtend.getData(_ACTIONS_URL.Get_Company_Info_BY_ID, data).then(success, error);46 };47 /**48 * è·åä¸ä¸ªå
¬å¸id ä¸ç产å49 */50 scope.getProductListByCompanyId = function (data,success, error) {51 return ajaxExtend.getData(_ACTIONS_URL.Get_Product_List_By_CompanyId, data).then(success, error);52 };53 /**54 * æ·»å å
¬å¸ä¸ä¸ªäº§å55 */56 scope.addProduct = function (data,success, error) {57 return ajaxExtend.getData(_ACTIONS_URL.Add_Product,data).then(success, error);58 };59 /**60 * ä¸ä¸ªäº§åææ æ¹æ¬¡61 */62 scope.getBatchListByProductId = function (data,success, error) {63 return ajaxExtend.getData(_ACTIONS_URL.Get_Batch_List_ByProductID,data).then(success, error);64 };65 /**66 * ä¸ä¸ªäº§åææ æ¹æ¬¡ status67 */68 scope.getBatchListByProductIdAndStatus = function (data,success, error) {69 return ajaxExtend.getData(_ACTIONS_URL.Get_Batch_List_ByProductID_AndStatus,data).then(success, error);70 };71 /**72 * æ·»å ä¸ä¸ªäº§å æ¹æ¬¡73 */74 scope.addBatch = function (data,success, error) {75 return ajaxExtend.getData(_ACTIONS_URL.Add_Batch,data).then(success, error);76 };77 /**78 * å é¤ä¸ä¸ªäº§å79 */80 scope.deleteProduct = function (data,success, error) {81 return ajaxExtend.getData(_ACTIONS_URL.Delete_Product,data).then(success, error);82 };83 /**84 * ç¼è¾å
¬å¸ä¿¡æ¯85 */86 scope.updateCompany = function (data,success, error) {87 return ajaxExtend.getData(_ACTIONS_URL.Update_Company, data).then(success, error);88 };89 /**90 * è·åæ¹æ¬¡æ¥å¿91 */92 scope.getProductLogListByBatch = function (data,success, error) {93 return ajaxExtend.getData(_ACTIONS_URL.getProductLogListByBatch, data).then(success, error);94 };95 /**96 * æ·»å æ¥å¿97 */98 scope.addProductLog = function (data,success, error) {99 return ajaxExtend.getData(_ACTIONS_URL.addProductLog, data).then(success, error);100 };101 /**102 * æ´æ°æ¥å¿103 */104 scope.updateProductLog = function (data,success, error) {105 return ajaxExtend.getData(_ACTIONS_URL.updateProductLog, data).then(success, error);106 };107 /**108 * å æ¥å¿109 */110 scope.deleteProductLog = function (data,success, error) {111 return ajaxExtend.getData(_ACTIONS_URL.deleteProductLog, data).then(success, error);112 };113 /**114 * æ¥å¿Typeå表çæ¥å£115 */116 scope.getProductLogTypeList = function (data,success, error) {117 return ajaxExtend.getData(_ACTIONS_URL.getProductLogTypeList,data).then(success, error);118 };119 return scope;120 }({}));...
verify-model.js
Source: verify-model.js
1/**2 * @Dateï¼2016.4.263 * @Author: haoyong4 * @Description: verify modelå±5 */6define([7 "ajaxExtend"8], function (ajaxExtend) {9 "use strict";10 return (function (scope) {11 //æ¯å¦ä½¿ç¨æ¨¡ææ°æ®12 var _isUseMock = false,13 //设置请æ±çæ ¹è·¯å¾14 // _serviceHost = "http://localhost:8080/cfsp/",15 //设置请æ±ä¸ä¸æ16 _serviceContext = "",17 //设置请æ±çurléå18 _ACTIONS_URL = {19 Get_Company_List: (_isUseMock ? "inc/mockCompanyList.json" : serviceHost + "company/" + "getCompanyList"),20 Get_CheckAll_List: (_isUseMock ? "inc/mockCheckAllList.json" : serviceHost + _serviceContext + "null"),21 Verify_Company: (_isUseMock ? "inc/mockCheckAllList.json" : serviceHost + "company/" + "verifyCompany"),22 UnVerify_Company: (_isUseMock ? "inc/mockCheckAllList.json" : serviceHost + "company/" + "unVerifyCompany"),23 Get_ReportAll_List: (_isUseMock ? "inc/mockReportAllList.json" : serviceHost + _serviceContext + "null"),24 Get_ReportOne_List: (_isUseMock ? "inc/mockReportOneList.json" : serviceHost + "product/" + "getProductListByCompanyId"),25 Get_Batch_List_By_Status: (_isUseMock ? "inc/mockReportOneList.json" : serviceHost + "batch/" + "getBatchListByStatus"),26 Update_Batch: (_isUseMock ? "inc/mockReportOneList.json" : serviceHost + "batch/" + "updateBatch"),27 updateProduct: (_isUseMock ? "inc/mockReportOneList.json" : serviceHost + "product/" + "updateProduct"),28 };29 /**30 * å
¬å¸å表çæ¥å£31 */32 scope.getCompanyList = function (data,success, error) {33 return ajaxExtend.getData(_ACTIONS_URL.Get_Company_List,data).then(success, error);34 };35 /**36 * å®¡æ ¸éè¿37 */38 scope.verifyCompany = function (data,success, error) {39 return ajaxExtend.getData(_ACTIONS_URL.Verify_Company,data).then(success, error);40 };41 /**42 * 踢ä¸å®¡æ ¸43 */44 scope.unVerifyCompany = function (data,success, error) {45 return ajaxExtend.getData(_ACTIONS_URL.UnVerify_Company,data).then(success, error);46 };47 /**48 * å®¡æ ¸å表çæ¥å£49 */50 scope.getCheckAllList = function (data,success, error) {51 return ajaxExtend.getData(_ACTIONS_URL.Get_CheckAll_List,data).then(success, error);52 };53 /**54 * 大æ¥è¡¨å表çæ¥å£55 */56 scope.getReportAllList = function (data,success, error) {57 return ajaxExtend.getData(_ACTIONS_URL.Get_ReportAll_List,data).then(success, error);58 };59 /**60 * ç»èæ¥è¡¨å表çæ¥å£61 */62 scope.getReportOneList = function (data,success, error) {63 return ajaxExtend.getData(_ACTIONS_URL.Get_ReportOne_List,data).then(success, error);64 };65 /**66 * æ ¹æ®status è·åæ¹æ¬¡å表ï¼æªå®¡æ ¸ï¼67 */68 scope.getBatchListByStatus = function (data,success, error) {69 return ajaxExtend.getData(_ACTIONS_URL.Get_Batch_List_By_Status,data).then(success, error);70 };71 /**72 * ä¿®æ¹æ¹æ¬¡status ï¼ å®¡æ ¸ï¼73 */74 scope.updateBatch = function (data,success, error) {75 return ajaxExtend.getData(_ACTIONS_URL.Update_Batch,data).then(success, error);76 };77 /**78 * ææºè®¤è¯äº§å79 */80 scope.updateProduct = function (data,success, error) {81 return ajaxExtend.getData(_ACTIONS_URL.updateProduct,data).then(success, error);82 };83 return scope;84 }({}));...
news-model.js
Source: news-model.js
1/**2 * @Dateï¼2016.4.263 * @Author: haoyong4 * @Description: verify modelå±5 */6define([7 "ajaxExtend"8], function (ajaxExtend) {9 "use strict";10 return (function (scope) {11 //æ¯å¦ä½¿ç¨æ¨¡ææ°æ®12 var _isUseMock = false,13 //设置请æ±çæ ¹è·¯å¾14 //_serviceHost = "http://localhost:8080/agri/",15 //设置请æ±ä¸ä¸æ16 _serviceContext = "",17 //设置请æ±çurléå18 _ACTIONS_URL = {19 Get_News_List: (_isUseMock ? "inc/mockNewsList.json" : serviceHost + "news/" + "getNewsList"),20 Total_Count_News: (_isUseMock ? "inc/mockNewsList.json" : serviceHost + "news/" + "totalCountNews"),21 Get_News_List_With_Page: (_isUseMock ? "inc/mockNewsList.json" : serviceHost + "news/" + "getNewsListWithPage"),22 Get_News_By_ID: (_isUseMock ? "inc/mockNewsByID.json" : serviceHost + "news/" + "getNewsById"),23 Get_News_By_ID_Next: (_isUseMock ? "inc/mockNewsByID.json" : serviceHost + "news/" + "findNewsByIdNext"),24 Get_News_By_ID_Prev: (_isUseMock ? "inc/mockNewsByID.json" : serviceHost + "news/" + "findNewsByIdPrev")25 };26 /**27 * newså表çæ¥å£28 */29 scope.getNewsList = function (data,success, error) {30 return ajaxExtend.getData(_ACTIONS_URL.Get_News_List,data).then(success, error);31 };32 /**33 * newsç»è®¡æ»æ°34 */35 scope.totalCountNews = function (data,success, error) {36 return ajaxExtend.getData(_ACTIONS_URL.Total_Count_News,data).then(success, error);37 };38 /**39 * å页40 * newså表çæ¥å£41 */42 scope.getNewsListWithPage = function (data,success, error) {43 return ajaxExtend.getData(_ACTIONS_URL.Get_News_List_With_Page,data).then(success, error);44 };45 /**46 * news idè·å47 */48 scope.getNewsById = function (data,success, error) {49 return ajaxExtend.getData(_ACTIONS_URL.Get_News_By_ID,data).then(success, error);50 };51 /**52 * newsä¸ä¸ä¸ª53 */54 scope.getNewsByIdNext = function (data,success, error) {55 return ajaxExtend.getData(_ACTIONS_URL.Get_News_By_ID_Next,data).then(success, error);56 };57 /**58 * newsä¸ä¸ä¸ª59 */60 scope.getNewsByIdPrev = function (data,success, error) {61 return ajaxExtend.getData(_ACTIONS_URL.Get_News_By_ID_Prev,data).then(success, error);62 };63 return scope;64 }({}));...
api.js
Source: api.js
1api = {2 call: function(endpoint, cb, params, ajaxExtend, type = "POST") {3 // $.LoadingOverlay("show");4 cb = cb || function(res) {};5 params = params || {};6 ajaxExtend = ajaxExtend || {};7 // Extend the data object load sent with API Ajax request.8 var data = {};9 // data.access_token = (localStorage.access_token !== undefined) ? localStorage.access_token : "";10 for (var prop in params) {11 if (params.hasOwnProperty(prop)) {12 data[prop] = params[prop];13 }14 }15 var apiAjax = {16 type: "POST",17 dataType: "json",18 async: false,19 data: data,20 success: function(res) {21 cb(res);22 },23 error: function(e) {24 console.log(e);25 }26 };27 // apiAjax.url = "http://85.214.165.56:81/api/index.php?request=" + endpoint;28 apiAjax.url = "https://costercatalog.com/affiliates/api/index.php?request=" + endpoint;29 for (var prop in ajaxExtend) {30 if (ajaxExtend.hasOwnProperty(prop)) {31 apiAjax[prop] = ajaxExtend[prop];32 }33 }34 $.ajax(apiAjax).fail(function(jqXHR, textStatus, errorThrown) {35 var res = {36 status: "fail",37 type: "Server error",38 endpoint: endpoint,39 xr: JSON.stringify(jqXHR),40 td: JSON.stringify(textStatus),41 err: JSON.stringify(errorThrown)42 }43 cb(res);44 });45 },46 isEmpty: function(obj) {47 for(var key in obj) {48 if(obj.hasOwnProperty(key))49 return false;50 }51 return true;52 }...
api_reports.js
Source: api_reports.js
1api_reports = {2 call: function(endpoint, cb, params, ajaxExtend, type = "POST") {3 // $.LoadingOverlay("show");4 cb = cb || function(res) {};5 params = params || {};6 ajaxExtend = ajaxExtend || {};7 // Extend the data object load sent with API Ajax request.8 var data = {};9 // data.access_token = (localStorage.access_token !== undefined) ? localStorage.access_token : "";10 for (var prop in params) {11 if (params.hasOwnProperty(prop)) {12 data[prop] = params[prop];13 }14 }15 var apiAjax = {16 type: "POST",17 dataType: "json",18 async: false,19 data: data,20 success: function(res) {21 cb(res);22 },23 error: function(e) {24 console.log(e);25 }26 };27 // apiAjax.url = "http://85.214.165.56:81/api/index.php?request=" + endpoint;28 apiAjax.url = "http://85.214.165.56:81/api/reports.php?request=" + endpoint;29 for (var prop in ajaxExtend) {30 if (ajaxExtend.hasOwnProperty(prop)) {31 apiAjax[prop] = ajaxExtend[prop];32 }33 }34 $.ajax(apiAjax).fail(function(jqXHR, textStatus, errorThrown) {35 var res = {36 status: "fail",37 type: "Server error",38 endpoint: endpoint,39 xr: JSON.stringify(jqXHR),40 td: JSON.stringify(textStatus),41 err: JSON.stringify(errorThrown)42 }43 cb(res);44 });45 },46 isEmpty: function(obj) {47 for(var key in obj) {48 if(obj.hasOwnProperty(key))49 return false;50 }51 return true;52 }...
api_csv.js
Source: api_csv.js
1api_csv = {2 call: function(endpoint, cb, params, ajaxExtend, type = "GET") {3 // $.LoadingOverlay("show");4 cb = cb || function(res) {};5 params = params || {};6 ajaxExtend = ajaxExtend || {};7 // Extend the data object load sent with API Ajax request.8 var data = {};9 // data.access_token = (localStorage.access_token !== undefined) ? localStorage.access_token : "";10 for (var prop in params) {11 if (params.hasOwnProperty(prop)) {12 data[prop] = params[prop];13 }14 }15 var apiAjax = {16 17 type: "GET",18 dataType: "json",19 async: false,20 data: data,21 success: function(res) {22 cb(res);23 },24 error: function(e) {25 console.log(e);26 }27 };28 apiAjax.url = "http://80.211.41.168:5000/?" + endpoint;29 for (var prop in ajaxExtend) {30 if (ajaxExtend.hasOwnProperty(prop)) {31 apiAjax[prop] = ajaxExtend[prop];32 }33 }34 $.ajax(apiAjax).fail(function(jqXHR, textStatus, errorThrown) {35 var res = {36 status: "fail",37 type: "Server error",38 endpoint: endpoint39 }40 cb(res);41 });42 },43 isEmpty: function(obj) {44 for(var key in obj) {45 if(obj.hasOwnProperty(key))46 return false;47 }48 return true;49 }...
Using AI Code Generation
1describe('My First Test', function() {2 it('Does not do much!', function() {3 cy.get('.home-list > :nth-child(1) > .home-list-item').click()4 cy.ajaxExtend({5 headers: {6 },7 }).then((response) => {8 expect(response.status).to.eq(200)9 })10 })11})12### cy.ajaxExtend(options)
Using AI Code Generation
1describe('Test Ajax', function(){2 it('Ajax Test', function(){3 cy.server()4 cy.route({5 response: {error: 'Hey comment not found'},6 }).as('UpdateComment')7 cy.get('.network-put').click()8 cy.wait('@UpdateComment')9 cy.get('.network-put-comment').should('contain', 'Hey comment not found')10 })11})
Using AI Code Generation
1Cypress.Commands.add('ajaxExtend', (method, url, body = {}, headers = {}) => {2 return cy.request({3 })4})5Cypress.Commands.add('ajax', (method, url, body = {}, headers = {}) => {6 return cy.request({7 })8})9Cypress.Commands.add('login', (username, password) => {10 cy.visit('/login')11 cy.get('#username').type(username)12 cy.get('#password').type(password)13 cy.get('button[type=submit]').click()14})15Cypress.Commands.add('logout', () => {16 cy.get('button[aria-label=Account]').click()17 cy.get('button[data-test=logout]').click()18})19Cypress.Commands.add('login', (username, password) => {20 cy.visit('/login')21 cy.get('#username').type(username)22 cy.get('#password').type(password)23 cy.get('button[type=submit]').click()24})25Cypress.Commands.add('logout', () => {26 cy.get('button[aria-label=Account]').click()27 cy.get('button[data-test=logout]').click()28})29Cypress.Commands.add('login', (username, password) => {30 cy.visit('/login')31 cy.get('#username').type(username)32 cy.get('#password').type(password)33 cy.get('button[type=submit]').click()34})35Cypress.Commands.add('logout', () => {36 cy.get('button[aria-label=Account]').click()37 cy.get('button[data-test=
Using AI Code Generation
1describe('Test', () => {2 it('Test', () => {3 cy.server();4 cy.route({5 }).as('getTest');6 cy.wait('@getTest');7 cy.get('.test').should('have.text', 'test');8 });9});10Cypress.Commands.add('ajaxExtend', (options) => {11 if (options.response) {12 cy.fixture(options.response).then((data) => {13 options.response = data;14 cy.server();15 cy.route(options);16 });17 } else {18 cy.server();19 cy.route(options);20 }21});22{23}24{25 "compilerOptions": {26 "importHelpers": true,27 "paths": {28 }29 }30}
Using AI Code Generation
1import { ajaxExtend } from 'cypress-ajax-commands';2describe('AjaxExtend', () => {3 it('should return the response when the request is successful', () => {4 const headers = {5 }6 const body = {7 }8 const options = {9 }10 ajaxExtend(options).then((response) => {11 expect(response.status).to.eq(200)12 expect(response.statusText).to.eq('OK')13 expect(response.body).to.have.property('id', 1)14 expect(response.body).to.have.property('title', 'sunt aut facere repellat provident occaecati excepturi optio reprehenderit')15 expect(response.body).to.have.property('body', 'quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto')16 expect(response.body).to.have.property('userId', 1)17 })18 })19})20describe('AjaxExtend', () => {21 it('should return the response when the request is successful', () => {22 const headers = {23 }24 const body = {25 }26 const options = {27 }28 cy.request(options).then((response) => {29 expect(response.status).to.eq(200)30 expect(response.statusText).to.eq('OK')31 expect(response.body).to.have.property('id', 1)32 expect(response.body).to.have.property('title', 'sunt aut facere repellat provident occaecati excepturi optio reprehenderit')33 expect(response.body).to.have.property('body
What is the difference between import and cy.fixture in Cypress tests?
Change directory in Cypress using cy.exec()
How to remove whitespace from a string in Cypress
How to save a variable/text to use later in Cypress test?
Is it possible to select an anchor tag which contains a h1 which contains the text "Visit Site"?
Cypress loop execution order
Cypress Cucumber, how Get to data from page in one step and use it another scenario step
How to cancel a specific request in Cypress?
Cypress object vs JQuery object, role of cy.wrap function
Cypress - Controlling which tests to run - Using Cypress for seeding
Basically when you say import file from '../fixtures/filepath/file.json'
you can use the imported file in any of methods in the particular javascript file. Whereas if you say cy.fixture(file.json)
, then the fixture context will remain within that cy.fixture block and you cannot access anywhere/outside of that cy.fixture block. Please go through the below code and you will understand the significance of it.
I recommend to use import file from '../fixtures/filepath/file.json'
For example. Run the below code to understand.
import fixtureFile from './../fixtures/userData.json';
describe('$ suite', () => {
it('Filedata prints only in cy.fixture block', () => {
cy.fixture('userData.json').then(fileData => {
cy.log(JSON.stringify(fileData)); // You can access fileData only in this block.
})
cy.log(JSON.stringify(fileData)); //This says error because you are accessing out of cypress fixture context
})
it('This will print file data with import', () => {
cy.log(JSON.stringify(fixtureFile));
})
it('This will also print file data with import', () => {
cy.log(JSON.stringify(fixtureFile));
})
});
Check out the latest blogs from LambdaTest on this topic:
“Your most unhappy customers are your greatest source of learning.”
Hola, testers! We are up with another round of exciting product updates to help scale your cross browser testing coverage. As spring cleaning looms, we’re presenting you product updates to put some spring in your testing workflow. Our development team has been working relentlessly to make our test execution platform more scalable and reliable than ever to accomplish all your testing requirements.
Agile development pushes out incremental software updates faster than traditional software releases. But the faster you release, the more tests you have to write and run – which becomes a burden as your accumulated test suites multiply. So a more intelligent approach to testing is needed for fast releases. This is where Smart Test Execution comes in.
If you were born in the 90s, you may be wondering where that browser is that you used for the first time to create HTML pages or browse the Internet. Even if you were born in the 00s, you probably didn’t use Internet Explorer until recently, except under particular circumstances, such as working on old computers in IT organizations, banks, etc. Nevertheless, I can say with my observation that Internet Explorer use declined rapidly among those using new computers.
Hey People! With the beginning of a new year, we are excited to announce a collection of new product updates! At LambdaTest, we’re committed to providing you with a comprehensive test execution platform to constantly improve the user experience and performance of your websites, web apps, and mobile apps. Our incredible team of developers came up with several new features and updates to spice up your workflow.
Cypress is a renowned Javascript-based open-source, easy-to-use end-to-end testing framework primarily used for testing web applications. Cypress is a relatively new player in the automation testing space and has been gaining much traction lately, as evidenced by the number of Forks (2.7K) and Stars (42.1K) for the project. LambdaTest’s Cypress Tutorial covers step-by-step guides that will help you learn from the basics till you run automation tests on LambdaTest.
You can elevate your expertise with end-to-end testing using the Cypress automation framework and stay one step ahead in your career by earning a Cypress certification. Check out our Cypress 101 Certification.
Watch this 3 hours of complete tutorial to learn the basics of Cypress and various Cypress commands with the Cypress testing at LambdaTest.
Get 100 minutes of automation test minutes FREE!!