Best JavaScript code snippet using appium-xcuitest-driver
Model.js
Source:Model.js
...111 });112 //详æ
页ç»ä¸æ¥å£ï¼æ ¹æ®reqTypeç±»å请æ±ä¸åçæ°æ®113 _ret.DetailModel = new Inherit.Class(_base, {114 __propertys__: function () {115 this.url = this.setUrl('10124/json/GetProductDetail');116 this.param = {};117 this.result = null;118 }119 });120 //详æ
页é¢å®é¡»ç¥,è¿åçæ°æ®åå
¥localStorage121 _ret.DetailBookingNoteModel = new Inherit.Class(_base, {122 __propertys__: function () {123 this.url = this.setUrl('10124/json/GetProductDetail');124 this.param = {};125 this.result = store.DetailBookNoteStore.getInstance();126 }127 });128 //详æ
页é¢é,è¿åçæ°æ®åå
¥localStorage129 _ret.DetailLeaderModel = new Inherit.Class(_base, {130 __propertys__: function () {131 this.url = this.setUrl('10124/json/GetProductDetail');132 this.param = {};133 this.result = store.DetailLeaderStore.getInstance();134 }135 });136 //详æ
页ç¾è¯,è¿åçæ°æ®åå
¥localStorage137 _ret.DetailVisaModel = new Inherit.Class(_base, {138 __propertys__: function () {139 this.url = this.setUrl('10124/json/GetProductDetail');140 this.param = {};141 this.result = store.DetailVisaStore.getInstance();142 }143 });144 //详æ
页å¾ç详æ
,è¿åçæ°æ®åå
¥localStorage145 _ret.DetailPicModel = new Inherit.Class(_base, {146 __propertys__: function () {147 this.url = this.setUrl('10124/json/GetProductDetail');148 this.param = {};149 this.result = store.DetailPicStore.getInstance();150 }151 });152 //详æ
页产åæè¿°ï¼äº§åç¹è²ï¼,è¿åçæ°æ®åå
¥localStorage153 _ret.DetailDescriptionModel = new Inherit.Class(_base, {154 __propertys__: function () {155 this.url = this.setUrl('10124/json/GetProductDetail');156 this.param = {};157 this.result = store.DetailDescriptionStore.getInstance();158 }159 });160 //详æ
页çæ161 _ret.DetailScheduleModel = new Inherit.Class(_base, {162 __propertys__: function () {163 this.url = this.setUrl('10124/json/GetProductCalendar');164 this.param = {};165 }166 });167 //详æ
页æ¯ç¹è¯¦æ
168 _ret.DetailProductSightModel = new Inherit.Class(_base, {169 __propertys__: function () {170 this.url = this.setUrl('10124/json/GetProductSight');171 this.param = {};172 }173 });174 //å¡«å页175 _ret.OrderModel = new Inherit.Class(_base, {176 __propertys__: function () {177 this.url = this.setUrl('10124/json/GetBookForm');178 this.param = {179 'RequestTypeList': '1,2,3,4,5,6,7,8,9',180 Version: config.appVersion181 }182 this.result = store.OrderStore.getInstance();183 }184 });185 // é¢å®é¡µï¼ä»·æ ¼æ¥å186 _ret.BookingPriceCalendar = new Inherit.Class(_base, {187 __propertys__: function () {188 this.url = this.setUrl('10124/json/GetProductCalendar');189 /**190 this.param = {191 pId: 51114,192 saleCity: 2,193 departureCity: 2,194 sDate: '2014-03-13',195 eDate: '2014-04-20'196 }197 */198 this.result = null;199 this.dataformat = function (json) {200 return json;201 };202 }203 });204 // peic@Ctrip.com èµæºæ¥è¯¢ -- é¢å® step2205 _ret.BookingResourceSearch = new Inherit.Class(_base, {206 __propertys__: function () {207 this.url = this.setUrl('10124/json/ResourceSearch');208 //this.baseurl.domain = 'localhost:8989';209 //this.baseurl.path = '';210 //this.url = 'resource_search';211 /*212 this.param = {213 // ProductId214 pId: 51114,215 // DepartureCityId216 departCId: 2,217 // DepartureDate218 departDate: '2014-03-05',219 // AdultQuantity220 adultNum: 2,221 // ChildQuantity222 childNum: 0,223 // SaleCityId224 saleCId: 2,225 ocMode: 2,226 // GUID227 guid: '',228 chosedResource: ''229 };230 */231 this.result = store.BookingResourceSearch.getInstance();232 this.dataformat = function (json) {233 return json;234 }235 }236 });237 // èµæºé
åºééæ¥è¯¢238 _ret.BookingResourceHotelSearch = new Inherit.Class(_base, {239 __propertys__: function () {240 this.url = this.setUrl('10124/json/HotelSearch');241 this.param = {};242 this.result = null;243 }244 });245 // peic@Ctrip.com èµæºæ¥è¯¢ -- é¢å® step2 -- åéèµæº246 _ret.BookingSelectSingle = new Inherit.Class(_base, {247 __propertys__: function () {248 this.url = this.setUrl('10124/json/SingleResourceSearch');249 /*250 this.param = {251 "pId": 51114,252 "departCId": 2,253 "segmId": 125159,254 "segmNumb": 3,255 "departDate": "2014-03-15",256 "adultQ": 2,257 "childQ": 0258 };259 */260 this.result = null;261 this.dataformat = function (json) {262 return json;263 }264 }265 });266 _ret.QuestionModel = new Inherit.Class(_base, {267 __propertys__: function () {268 this.url = this.setUrl('10124/json/GetProductDetail');269 this.param = {270 "ProductId": 0,271 "RequestTypeList": [6],272 "Start": 1,273 "ReturnCount": 3274 };275 this.result = null;276 }277 });278 _ret.QuestionByAuthModel = new Inherit.Class(_base, {279 __propertys__: function () {280 this.url = this.setUrl('10124/json/GetProductDetailByAuth');281 this.param = {282 "ProductId": 0,283 "RequestTypeList": [6],284 "Start": 1,285 "ReturnCount": 3286 };287 this.result = null;288 }289 });290 //常ç¨æ
客å表291 _ret.PassengersModel = new Inherit.Class(_base, {292 __propertys__: function () {293 this.url = this.setUrl('10124/json/GetBookForm');294 this.param = {295 'RequestTypeList': '1'296 }297 this.result = store.PassengersStore.getInstance();298 }299 });300 _ret.PassengersListModel = new Inherit.Class(_base, {301 __propertys__: function () {302 this.url = '10090/GetMemberUsers.json';303 this.param = {};304 }305 });306 //常æ
ç¼è¾307 _ret.PassengerEditModel = new Inherit.Class(_base, {308 __propertys__: function () {309 this.url = '10090/MutateMemberUser.json';310 this.param = {};311 this.param = store.PassengerEditStore.getInstance();312 }313 });314 //é¢è®¢é¡»ç¥315 _ret.OrderContractOrder = new Inherit.Class(_base, {316 __propertys__: function () {317 this.url = this.setUrl('10124/json/GetBookForm');318 this.param = {319 'RequestTypeList': '11'320 }321 this.result = null;322 }323 });324 // æç´¢ç»æå表325 _ret.VacationsListModel = new Inherit.Class(_base, {326 __propertys__: function () {327 this.url = this.setUrl('10124/json/ProductSearch');328 this.param = {329 "SaleCityId": 2,330 "StartCityId": 2,331 "KeyWord": "beijing",332 "AddressSelectorId": 0,333 "LineType": 1,334 "Start": 1,335 "ReturnCount": 100336 };337 this.result = null;338 }339 });340 // ç®çå°å表341 _ret.DestinationListModel = new Inherit.Class(_base, {342 __propertys__: function () {343 this.url = this.setUrl('10124/json/GetProductDestination');344 this.param = {345 "DepartureCityId": 2,346 "RequestOptions": 3347 };348 this.result = store.DestinationListStore.getInstance();349 }350 });351 // é¦é¡µç¹åå表352 _ret.SpecialSaleSearchModel = new Inherit.Class(_base, {353 __propertys__: function () {354 this.url = '10043/json/SpecialSaleSearch';355 this.param = {356 Tab: 3, // ç¹åç±»å å
¨é¨357 PkgType: 'grouptravel', // 产åç±»åï¼grouptravelè·å¢æ¸¸ãfreetravelèªç±è¡ã空为å
¨é¨ï¼358 Departkey: '', // åºåå°Key359 DepartMonth: 0, // æ份 0 å
¨é¨ 1 å½æ 2 ä¸æ ä¾æ¬¡ç±»æ¨360 Destkey: '', // ç®çå°361 Sort: 0, // é»è®¤å¼(综åååº 1 ä»·æ ¼ååº 2 ä»·æ ¼éåº)362 PageIndex: 1, // 第å 页363 PageSize: 5, // 页é¢å°ºå¯¸364 SaleCity: 2 // å®åå° é»è®¤è®¾ä¸º2ä¸æµ·365 },366 this.result = null;367 }368 });369 // ç®çå°æç´¢å表370 _ret.DestSearchList = new Inherit.Class(_base, {371 __propertys__: function () {372 this.url = '10124/json/AddressSelectorIntelliSense';373 this.param = {374 "key": "",375 "depCityId": 0376 };377 }378 });379 //å建订å380 _ret.CreateOrderModel = new Inherit.Class(_base, {381 __propertys__: function () {382 this.url = this.setUrl('10124/json/CreateOrder');383 this.param = { Version: config.appVersion };384 this.result = store.OrderCreateStore.getInstance();385 }386 });387 //ä¿å订å388 _ret.SaveOrderModel = new Inherit.Class(_base, {389 __propertys__: function () {390 this.url = this.setUrl('10124/json/SaveOrder');391 this.param = {};392 this.result = null;393 }394 });395 //æååä¿å396 _ret.SaveTempOrderModel = new Inherit.Class(_base, {397 __propertys__: function () {398 this.url = this.setUrl('10124/json/SaveOrder');399 this.param = {};400 this.result = null;401 }402 });403 //ä¼æ å¸éªè¯404 _ret.CouponVerifyModel = new Inherit.Class(_base, {405 __propertys__: function () {406 this.url = this.setUrl('10124/json/PromotionValidation');407 this.param = { Version: config.appVersion };408 this.result = null;409 }410 });411 //订åæ交412 _ret.OrderSubmitModel = new Inherit.Class(_base, {413 __propertys__: function () {414 this.url = this.setUrl('10124/json/SubmitOrder');415 this.param = {};416 this.result = null;417 }418 });419 // 订å详æ
420 _ret.OrderDetailModel = new Inherit.Class(_base, {421 __propertys__: function () {422 this.url = this.setUrl('10124/json/GetOrderDetail');423 //this.baseurl = {424 // domain: 'doc.ui.sh.ctriptravel.com',425 // path: 'json/index.php/'426 //};427 //this.url = '53.json';428 this.param = {};429 this.result = null;430 }431 });432 // 订å详æ
æç»433 _ret.OrderDetailListModel = new Inherit.Class(_base, {434 __propertys__: function () {435 this.url = this.setUrl('10124/json/GetOrderResourceDetail');436 this.param = {};437 //this.result = store.OrderDetailListStore.getInstance();438 this.result = null;439 }440 });441 // åæ¶è®¢å442 _ret.OrderCancelModel = new Inherit.Class(_base, {443 __propertys__: function () {444 this.url = this.setUrl('10124/json/CancelOrder');445 this.param = {};446 this.result = null;447 }448 });449 //ä¿®æ¹è®¢å450 _ret.OrderModificationModel = new Inherit.Class(_base, {451 __propertys__: function () {452 this.url = this.setUrl('10124/json/UpdateOrder');453 this.param = {};454 this.result = null;455 }456 });457 // é¦é¡µäº§åæ¨è458 _ret.homeInfoModel = new Inherit.Class(_base, {459 __propertys__: function () {460 this.url = this.setUrl('10124/json/GetHomeInfo');461 this.param = { 'SalesCityID': 2 };462 this.result = null;463 }464 });465 // Cç§æ产å466 _ret.CsKillAdModel = new Inherit.Class(_base, {467 __propertys__: function () {468 this.url = '10043/json/GetSecKillSetting';469 this.result = null;470 }471 });472 // Cç§æ产å473 _ret.CsKillModel = new Inherit.Class(_base, {474 __propertys__: function () {475 this.url = '10043/json/GetProducts';476 this.result = null;477 }478 });479 // è¡ç¨ç¹è¯480 _ret.OrderCommentModel = new Inherit.Class(_base, {481 __propertys__: function () {482 this.url = this.setUrl('10124/json/GetProductCommentList');483 }484 });485 _ret.OrderCommentSubmitModel = new Inherit.Class(_base, {486 __propertys__: function () {487 this.url = this.setUrl('10124/json/CreateProductComment');488 }489 });490 _ret.OrderCommentShareModel = new Inherit.Class(_base, {491 __propertys__: function () {492 this.url = this.setUrl('10124/json/ShareProductComment');493 }494 });495 //æ£æ¥æ¯å¦æ¶è496 _ret.InMyCollectionModel = new Inherit.Class(_base, {497 __propertys__: function () {498 this.url = '10108/json/IsMyFavorites';499 this.result = null;500 }501 });502 //æ·»å æ¶è503 _ret.AddCollectionModel = new Inherit.Class(_base, {504 __propertys__: function () {505 this.url = '10108/json/MyFavoritesAdd';506 this.result = null;507 }508 });509 //åæ¶æ¶è510 _ret.RemoveCollectionModel = new Inherit.Class(_base, {511 __propertys__: function () {512 this.url = '10108/json/MyFavoritesDelete';513 this.result = null;514 }515 });516 //è·åæç订é
517 _ret.GetSubscriptionModel = new Inherit.Class(_base, {518 __propertys__: function () {519 this.url = this.setUrl('10124/json/GetSubscriptionList');520 this.result = null;521 }522 });523 //æ·»å 订é
524 _ret.AddSubscriptionModel = new Inherit.Class(_base, {525 __propertys__: function () {526 this.url = this.setUrl('10124/json/CreateSubscriptions');527 this.result = null;528 }529 });530 //å é¤è®¢é
531 _ret.RemoveSubscriptionModel = new Inherit.Class(_base, {532 __propertys__: function () {533 this.url = this.setUrl('10124/json/DeleteSubscriptionList');534 this.result = null;535 }536 });537 //è·å订é
设置538 _ret.GetSubscriptionSetting = new Inherit.Class(_base, {539 __propertys__: function () {540 this.url = this.setUrl('10124/json/GetSubscriptionSetting');541 this.result = null;542 }543 });544 //æ´æ°è®¢é
设置545 _ret.UpdateSubscriptionSetting = new Inherit.Class(_base, {546 __propertys__: function () {547 this.url = this.setUrl('10124/json/UpdateSubscriptionSetting');548 this.result = null;549 }550 });551 //æ£æ¥æ¯å¦å¯ä»¥é¢è®¢552 _ret.OrderCanBookingModel = new Inherit.Class(_base, {553 __propertys__: function () {554 this.url = this.setUrl('10124/json/OrderCanBookingValidation');555 this.result = null;556 }557 });558 //游å¦559 _ret.OrderStudyModel = new Inherit.Class(_base, {560 __propertys__: function () {561 this.url = this.setUrl('10124/json/ProductSearch');562 this.result = null;563 }564 });565 //æºç¥¨éæ©566 _ret.BookingFlightModel = new Inherit.Class(_base, {567 __propertys__: function () {568 this.url = this.setUrl('10124/json/FlightSearch');569 this.result = null;570 }571 });572 //åºå¢è¯´æ书573 _ret.OrderGuide = new Inherit.Class(_base, {574 __propertys__: function () {575 this.url = this.setUrl('10124/json/GetTourNoticeInfo');576 this.result = null;577 }578 });579 //游轮éè±æ¿580 _ret.BookingCruiseModel = new Inherit.Class(_base, {581 __propertys__: function () {582 this.url = this.setUrl('10124/json/CruiseSearch');583 this.result = null;584 }585 });586 //å¤ææ¯å¦é¢é587 _ret.TourAssistJudgeIsLeader = new Inherit.Class(_base, {588 __propertys__: function () {589 this.url = '10072/json/TourAssistJudgeIsLeader';590 this.result = store.TourAssistJudgeIsLeaderStore.getInstance();591 }592 });593 // å¨è¯¢é®ç594 _ret.DetailAskSubmitModel = new Inherit.Class(_base, {595 __propertys__: function () {596 this.url = this.setUrl('10124/json/CreateProductQA');597 }598 });599 // 常ç¨å票æ¬å¤´å表600 _ret.InvoiceTitleListModel = new Inherit.Class(_base, {601 __propertys__: function () {602 this.url = '10091/GetInvoiceTitleList.json';603 }604 });605 // æ°å¢ãç¼è¾å¸¸ç¨å票æ¬å¤´606 _ret.InvoiceTitleEditModel = new Inherit.Class(_base, {607 __propertys__: function () {608 this.url = '10091/MutateInvoiceTitle.json';609 }610 });611 // åæ¶billno612 _ret.CancelBillNoModel = new Inherit.Class(_base, {613 __propertys__: function () {614 this.url = this.setUrl('10124/json/CancelOrderBill');615 }616 });617 // å¢éå©æçå
¥å£å¤æ618 _ret.TourIsTourOrder = new Inherit.Class(_base, {619 __propertys__: function () {620 this.url = '10072/json/TourIsTourOrder';621 }622 });623 // è·åAllianceID sid624 _ret.UserExtensionInfoModel = new Inherit.Class(_base, {625 __propertys__: function () {626 this.url = this.setUrl('10124/json/GetUserExtensionInfo');627 this.param = {'Flag':'h5'}628 }629 });630 // è·åæç足迹631 _ret.GetFootPrintModel = new Inherit.Class(_base, {632 __propertys__: function () {633 this.url = '10124/json/GetMyTrace';634 this.param = {635 'DeviceId': '',636 'PlatForm': '',637 'NetWorkStatus': 0638 };639 this.result = null;640 }641 });642 // æ·»å æç足迹643 _ret.AddFootPrintModel = new Inherit.Class(_base, {644 __propertys__: function () {645 this.url = '10124/json/CreateTrace';646 this.param = {647 'DeviceId': '',648 'ProductId': 0,649 'SaleCityId': 0,650 'DepartureCityId': 0,651 'PlatForm': ''652 };653 this.result = null;654 }655 });656 // å é¤æç足迹657 _ret.DelFootPrintModel = new Inherit.Class(_base, {658 __propertys__: function () {659 this.url = '10124/json/DeleteTraces';660 this.param = {661 'TraceIds': [],662 'PlatForm': '',663 'DeviceId': ''664 };665 this.result = null;666 }667 });668 //订åå享 å å¯è®¢åID669 _ret.OrderShareModel = new Inherit.Class(_base, {670 __propertys__: function () {671 this.url = this.setUrl('10124/json/CreateShareOrder');672 this.result = null;673 }674 });675 //订åå享 详ç»å
容676 _ret.OrderShareDetailModel = new Inherit.Class(_base, {677 __propertys__: function () {678 this.url = this.setUrl('10124/json/GetShareOrderDetail');679 this.result = null;680 }681 });682 // é
éå°åç¼è¾683 _ret.CustomerAddrEditModel = new Inherit.Class(_base, {684 __propertys__: function () {685 this.url = '10090/mutateuseraddress.json';686 }687 });688 // é
éå°åå é¤689 _ret.CustomerAddrDeleteModel = new Inherit.Class(_base, {690 __propertys__: function () {691 this.url = '10090/deleteuseraddress.json';692 }...
Customer.js
Source:Customer.js
...15 return this.getApiUrl() + frag + ".php";16 }17 verifyLogin(username,password){18 return new Promise((resolve,reject)=>{19 var url = this.setUrl("verifyLogin");20 var formData = new FormData();21 formData.append('username',username);22 formData.append('password',password);23 fetch(url,{24 method:'POST',25 body: formData,26 }).then(res=>{27 resolve(res.json());28 }).catch(err=>{29 reject(err);30 }); 31 });32 }33 add(array){34 return new Promise((resolve,reject)=>{35 var url = this.setUrl("add");36 var formData = new FormData();37 formData.append('first_name',array.first_name);38 formData.append('middle_name',array.middle_name);39 formData.append('last_name',array.last_name);40 formData.append('address',array.address);41 formData.append('status',array.status);42 formData.append('email',array.email);43 formData.append('mobile_number',array.mobile_number);44 formData.append('username',array.username);45 formData.append('password',array.password);46 formData.append('gender',array.gender);47 formData.append('dev_share_stats',array.dev_share_stats);48 fetch(url,{49 method:'POST',50 body: formData,51 }).then(res=>{52 53 resolve(JSON.parse(res.text()));54 }).catch(err=>{55 reject(err);56 });57 });58 }59 updateBasic(array){60 return new Promise((resolve,reject)=>{61 var url = this.setUrl("updateBasic");62 var formData = new FormData();63 formData.append('session_id',array.session_id);64 formData.append('customer_id',array.customer_id);65 formData.append('first_name',array.first_name);66 formData.append('middle_name',array.middle_name);67 formData.append('last_name',array.last_name);68 formData.append('address',array.address);69 formData.append('status',array.status);70 formData.append('email',array.email);71 formData.append('mobile_number',array.mobile_number);72 formData.append('gender',array.gender);73 formData.append('dev_share_stats',array.gender);74 formData.append('dev_share_stats',array.dev_share_stats);75 fetch(url,{76 method:'POST',77 body: formData,78 }).then(res=>{79 80 resolve(res.json());81 }).catch(err=>{82 reject(err);83 });84 });85 }86 updateUsername(array){87 return new Promise((resolve,reject)=>{88 var url = this.setUrl("updateUsername");89 var formData = new FormData();90 formData.append('session_id',array.session_id);91 formData.append('customer_id',array.customer_id);92 formData.append('username',array.username);93 fetch(url,{94 method:'POST',95 body: formData,96 }).then(res=>{97 resolve(res.json());98 }).catch(err=>{99 reject(err);100 });101 });102 }103 updatePassword(array){104 return new Promise((resolve,reject)=>{105 var url = this.setUrl("updatePassword");106 var formData = new FormData();107 formData.append('session_id',array.session_id);108 formData.append('customer_id',array.customer_id);109 formData.append('password',array.password);110 fetch(url,{111 method:'POST',112 body: formData,113 }).then(res=>{114 resolve(res.json());115 }).catch(err=>{116 reject(err);117 });118 });119 }120 get(array){121 return new Promise((resolve,reject)=>{122 var url = this.setUrl("get");123 var formData = new FormData();124 formData.append('session_id',array.session_id);125 formData.append('customer_id',array.customer_id);126 fetch(url,{127 method:'POST',128 body: formData,129 }).then(res=>{130 resolve(res.json());131 }).catch(err=>{132 reject(err);133 });134 });135 }136 getByUsername(array){137 return new Promise((resolve,reject)=>{138 var url = this.setUrl("getByUsername");139 var formData = new FormData();140 formData.append('session_id',array.session_id);141 formData.append('username',array.username);142 fetch(url,{143 method:'POST',144 body: formData,145 }).then(res=>{146 resolve(res.json());147 }).catch(err=>{148 reject(err);149 });150 });151 }152 delete(array){153 return new Promise((resolve,reject)=>{154 var url = this.setUrl("delete");155 var formData = new FormData();156 formData.append('session_id',array.session_id);157 formData.append('customer_id',array.customer_id);158 fetch(url,{159 method:'POST',160 body: formData,161 }).then(res=>{162 resolve(res.json());163 }).catch(err=>{164 reject(err);165 });166 });167 }168 usernameExists(array){169 return new Promise((resolve,reject)=>{170 var url = this.setUrl("usernameExists");171 var formData = new FormData();172 formData.append('session_id',array.session_id);173 formData.append('username',array.username);174 fetch(url,{175 method:'POST',176 body: formData,177 }).then(res=>{178 resolve(res.json());179 }).catch(err=>{180 reject(err);181 });182 });183 }184 searchBy(array){185 return new Promise((resolve,reject)=>{186 var url = this.setUrl("searchBy");187 var formData = new FormData();188 formData.append('session_id',array.session_id);189 formData.append('category',array.category);190 formData.append('query',array.query);191 fetch(url,{192 method:'POST',193 body: formData,194 }).then(res=>{195 resolve(res.json());196 }).catch(err=>{197 reject(err);198 });199 });200 }201 getAll(array){202 return new Promise((resolve,reject)=>{203 var url = this.setUrl("getAll");204 var formData = new FormData();205 formData.append('session_id',array.session_id);206 fetch(url,{207 method:'POST',208 body: formData,209 }).then(res=>{210 resolve(res.json());211 }).catch(err=>{212 reject(err);213 });214 })215 }...
Admin.js
Source:Admin.js
...15 return this.getApiUrl() + frag + ".php";16 }17 verifyLogin(username,password){18 return new Promise((resolve,reject)=>{19 var url = this.setUrl("verifyLogin");20 var formData = new FormData();21 formData.append('username',username);22 formData.append('password',password);23 fetch(url,{24 method:'POST',25 body: formData,26 }).then(res=>{27 resolve(res.json());28 }).catch(err=>{29 reject(err);30 }); 31 });32 }33 add(array){34 return new Promise((resolve,reject)=>{35 var url = this.setUrl("add");36 var formData = new FormData();37 formData.append('first_name',array.first_name);38 formData.append('middle_name',array.middle_name);39 formData.append('last_name',array.last_name);40 formData.append('department',array.department);41 formData.append('position',array.position);42 formData.append('email',array.email);43 formData.append('mobile_number',array.mobile_number);44 formData.append('username',array.username);45 formData.append('password',array.password);46 formData.append('gender',array.gender);47 fetch(url,{48 method:'POST',49 body: formData,50 }).then(res=>{51 resolve(res.json());52 }).catch(err=>{53 reject(err);54 });55 });56 }57 updateBasic(array){58 return new Promise((resolve,reject)=>{59 var url = this.setUrl("updateBasic");60 var formData = new FormData();61 formData.append('session_id',array.session_id);62 formData.append('admin_id',array.admin_id);63 formData.append('first_name',array.first_name);64 formData.append('middle_name',array.middle_name);65 formData.append('last_name',array.last_name);66 formData.append('department',array.department);67 formData.append('position',array.position);68 formData.append('email',array.email);69 formData.append('mobile_number',array.mobile_number);70 formData.append('gender',array.gender);71 fetch(url,{72 method:'POST',73 body: formData,74 }).then(res=>{75 resolve(res.json());76 }).catch(err=>{77 reject(err);78 });79 });80 }81 updateUsername(array){82 return new Promise((resolve,reject)=>{83 var url = this.setUrl("updateUsername");84 var formData = new FormData();85 formData.append('session_id',array.session_id);86 formData.append('admin_id',array.admin_id);87 formData.append('username',array.username);88 fetch(url,{89 method:'POST',90 body: formData,91 }).then(res=>{92 resolve(res.json());93 }).catch(err=>{94 reject(err);95 });96 });97 }98 updatePassword(array){99 return new Promise((resolve,reject)=>{100 var url = this.setUrl("updatePassword");101 var formData = new FormData();102 formData.append('session_id',array.session_id);103 formData.append('admin_id',array.admin_id);104 formData.append('password',array.password);105 fetch(url,{106 method:'POST',107 body: formData,108 }).then(res=>{109 resolve(res.json());110 }).catch(err=>{111 reject(err);112 });113 });114 }115 get(array){116 return new Promise((resolve,reject)=>{117 var url = this.setUrl("get");118 var formData = new FormData();119 formData.append('session_id',array.session_id);120 formData.append('admin_id',array.admin_id);121 fetch(url,{122 method:'POST',123 body: formData,124 }).then(res=>{125 resolve(res.json());126 }).catch(err=>{127 reject(err);128 });129 });130 }131 getByUsername(array){132 return new Promise((resolve,reject)=>{133 var url = this.setUrl("getByUsername");134 var formData = new FormData();135 formData.append('session_id',array.session_id);136 formData.append('username',array.username);137 fetch(url,{138 method:'POST',139 body: formData,140 }).then(res=>{141 resolve(res.json());142 }).catch(err=>{143 reject(err);144 });145 });146 }147 delete(array){148 return new Promise((resolve,reject)=>{149 var url = this.setUrl("delete");150 var formData = new FormData();151 formData.append('session_id',array.session_id);152 formData.append('admin_id',array.admin_id);153 fetch(url,{154 method:'POST',155 body: formData,156 }).then(res=>{157 resolve(res.json());158 }).catch(err=>{159 reject(err);160 });161 });162 }163 usernameExists(array){164 return new Promise((resolve,reject)=>{165 var url = this.setUrl("usernameExists");166 var formData = new FormData();167 formData.append('session_id',array.session_id);168 formData.append('username',array.username);169 fetch(url,{170 method:'POST',171 body: formData,172 }).then(res=>{173 resolve(res.json());174 }).catch(err=>{175 reject(err);176 });177 });178 }179 getAll(array){180 return new Promise((resolve,reject)=>{181 var url = this.setUrl("getAll");182 var formData = new FormData();183 formData.append('session_id',array.session_id);184 fetch(url,{185 method:'POST',186 body: formData,187 }).then(res=>{188 resolve(res.json());189 }).catch(err=>{190 reject(err);191 });192 })193 }...
Chatroom.js
Source:Chatroom.js
...15 return this.getApiUrl() + frag + ".php";16 }17 getAll(session_id){18 return new Promise((resolve,reject)=>{19 var url = this.setUrl("getAll");20 var formData = new FormData();21 formData.append('session_id',session_id);22 fetch(url,{23 method:'POST',24 body: formData,25 }).then(res=>{26 resolve(res.json());27 }).catch(err=>{28 reject(err);29 });30 });31 }32 get(session_id,chatroom_id){33 return new Promise((resolve,reject)=>{34 var url = this.setUrl("get");35 var formData = new FormData();36 formData.append('session_id',session_id);37 formData.append('chatroom_id',chatroom_id);38 fetch(url,{39 method:'POST',40 body: formData,41 }).then(res=>{42 resolve(res.json());43 }).catch(err=>{44 reject(err);45 });46 });47 }48 getByCode(session_id,code){49 return new Promise((resolve,reject)=>{50 var url = this.setUrl("getByCode");51 var formData = new FormData();52 formData.append('session_id',session_id);53 formData.append('code',code);54 fetch(url,{55 method:'POST',56 body: formData,57 }).then(res=>{58 resolve(res.json());59 }).catch(err=>{60 reject(err);61 });62 });63 }64 delete(session_id,chatroom_id){65 return new Promise((resolve,reject)=>{66 var url = this.setUrl("delete");67 var formData = new FormData();68 formData.append('session_id',session_id);69 formData.append('chatroom_id',chatroom_id);70 fetch(url,{71 method:'POST',72 body: formData,73 }).then(res=>{74 resolve(res.json());75 }).catch(err=>{76 reject(err);77 });78 });79 }80 add(array){81 return new Promise((resolve,reject)=>{82 var url = this.setUrl("add");83 var formData = new FormData();84 formData.append('session_id',array.session_id);85 formData.append('name',array.name);86 formData.append('category',array.category);87 formData.append('tags',array.tags);88 formData.append('code',array.code);89 formData.append('description',array.description);90 formData.append('image_url',array.image_url);91 fetch(url,{92 method:'POST',93 body: formData,94 }).then(res=>{95 resolve(res.json());96 }).catch(err=>{97 reject(err);98 });99 });100 }101 update(array){102 return new Promise((resolve,reject)=>{103 var url = this.setUrl("update");104 var formData = new FormData();105 formData.append('session_id',array.session_id);106 formData.append('chatroom_id',array.chatroom_id);107 formData.append('name',array.name);108 formData.append('category',array.category);109 formData.append('tags',array.tags);110 formData.append('code',array.code);111 formData.append('description',array.description);112 formData.append('image_url',array.image_url);113 fetch(url,{114 method:'POST',115 body: formData,116 }).then(res=>{117 resolve(res.json());...
ChatMessage.js
Source:ChatMessage.js
...15 return this.getApiUrl() + frag + ".php";16 }17 getAll(session_id){18 return new Promise((resolve,reject)=>{19 var url = this.setUrl("getAll");20 var formData = new FormData();21 formData.append('session_id',session_id);22 fetch(url,{23 method:'POST',24 body: formData,25 }).then(res=>{26 resolve(res.json());27 }).catch(err=>{28 reject(err);29 });30 });31 }32 get(session_id,message_id){33 return new Promise((resolve,reject)=>{34 var url = this.setUrl("get");35 var formData = new FormData();36 formData.append('session_id',session_id);37 formData.append('chatroom_id',message_id);38 fetch(url,{39 method:'POST',40 body: formData,41 }).then(res=>{42 resolve(res.json());43 }).catch(err=>{44 reject(err);45 });46 });47 }48 getByChatroomId(session_id,chatroom_id){49 return new Promise((resolve,reject)=>{50 var url = this.setUrl("getByChatroomId");51 var formData = new FormData();52 formData.append('session_id',session_id);53 formData.append('chatroom_id',chatroom_id);54 fetch(url,{55 method:'POST',56 body: formData,57 }).then(res=>{58 resolve(res.json());59 }).catch(err=>{60 reject(err);61 });62 });63 }64 deleteByChatroomId(session_id,chatroom_id){65 return new Promise((resolve,reject)=>{66 var url = this.setUrl("deleteByChatroomId");67 var formData = new FormData();68 formData.append('session_id',session_id);69 formData.append('chatroom_id',chatroom_id);70 fetch(url,{71 method:'POST',72 body: formData,73 }).then(res=>{74 resolve(res.json());75 }).catch(err=>{76 reject(err);77 });78 });79 }80 delete(session_id,message_id){81 return new Promise((resolve,reject)=>{82 var url = this.setUrl("delete");83 var formData = new FormData();84 formData.append('session_id',session_id);85 formData.append('message_id',message_id);86 fetch(url,{87 method:'POST',88 body: formData,89 }).then(res=>{90 resolve(res.json());91 }).catch(err=>{92 reject(err);93 });94 });95 }96 add(array){97 return new Promise((resolve,reject)=>{98 var url = this.setUrl("add");99 var formData = new FormData();100 formData.append('session_id',array.session_id);101 formData.append('chatroom_id',array.chatroom_id);102 formData.append('customer_id',array.customer_id);103 formData.append('body',array.body);104 fetch(url,{105 method:'POST',106 body: formData,107 }).then(res=>{108 resolve(res.json());109 }).catch(err=>{110 reject(err);111 });112 });...
Session.js
Source:Session.js
...15 return this.getApiUrl() + frag + ".php";16 }17 isValid(session_id){18 return new Promise((resolve,reject)=>{19 var url = this.setUrl("isValid");20 var formData = new FormData();21 formData.append("this_session_id",session_id);22 fetch(url,{23 method:'POST',24 body:formData25 }).then(res=>{26 resolve(res.json());27 }).catch(err=>{28 reject(err);29 })30 });31 }32 forceExpire(session_id,this_session_id){33 return new Promise((resolve,reject)=>{34 var url = this.setUrl("forceExpire");35 var formData = new FormData();36 formData.append("session_id",session_id);37 formData.append("this_session_id",this_session_id);38 fetch(url,{39 method:'POST',40 body:formData41 }).then(res=>{42 resolve(res.json());43 }).catch(err=>{44 reject(err);45 })46 });47 }48 get(session_id,this_session_id){49 return new Promise((resolve,reject)=>{50 var url = this.setUrl("get");51 var formData = new FormData();52 formData.append("session_id",session_id);53 formData.append("this_session_id",this_session_id);54 fetch(url,{55 method:'POST',56 body:formData57 }).then(res=>{58 resolve(res.json());59 }).catch(err=>{60 reject(err);61 })62 });63 }64 getByCustomerId(session_id,customer_id){65 return new Promise((resolve,reject)=>{66 var url = this.setUrl("getByCustomerId");67 var formData = new FormData();68 formData.append("session_id",session_id);69 formData.append("customer_id",customer_id);70 fetch(url,{71 method:'POST',72 body:formData73 }).then(res=>{74 resolve(res.json());75 }).catch(err=>{76 reject(err);77 })78 });79 }80 getByAdminId(session_id,admin_id){81 return new Promise((resolve,reject)=>{82 var url = this.setUrl("getByAdminId");83 var formData = new FormData();84 formData.append("session_id",session_id);85 formData.append("admin_id",admin_id);86 fetch(url,{87 method:'POST',88 body:formData89 }).then(res=>{90 resolve(res.json());91 }).catch(err=>{92 reject(err);93 })94 });95 }96}
router.js
Source:router.js
...7 }8 setUrl(url, cb, method) {9 this.urls.push({url: new UrlPattern(url), cb, method})10 }11 head(url, cb) {this.setUrl(url, cb, 'HEAD')}12 get(url, cb) {this.setUrl(url, cb, 'GET')}13 post(url, cb) {this.setUrl(url, cb, 'POST')}14 put(url, cb) {this.setUrl(url, cb, 'PUT')}15 patch(url, cb) {this.setUrl(url, cb, 'PATCH')}16 delete(url, cb) {this.setUrl(url, cb, 'DELETE')}17 options(url, cb) {this.setUrl(url, cb, 'OPTIONS')}18 async matchAll(req, res) {19 const route = _.find(this.urls, ({url, method}) => !!url.match(req.getPath()) && method === req.getMethod())20 if (route) {21 const params = route.url.match(req.getPath())22 req.setParams(params)23 res.json(await route.cb(req, res))24 } else {25 res26 .setStatus(404)27 .json(await this.notFound(req, res))28 }29 }30 set404(callback) {31 this.notFound = callback...
ifixitapi.js
Source:ifixitapi.js
...6 create: function() {7 this.inherited(arguments);8 },9 getType: function(type) {10 this.setUrl(this.point + 'guides/' + type);11 this.call();12 },13 getGuide: function(guideid) {14 this.setUrl(this.point + 'guide/' + guideid);15 this.call();16 },17 getDevice: function(device) {18 this.setUrl(this.point + 'device/' + device);19 this.call();20 },21 getAreas: function() {22 this.setUrl(this.point + 'areas');23 this.call();24 },25 getApi: function(end) {26 this.setUrl(this.point + this.end);27 this.call();28 },29 getImage: function(imageid) {30 this.setUrl(this.point + 'image/' + imageid);31 this.call();32 }...
Using AI Code Generation
1var driver = new webdriver.Builder()2 .withCapabilities({3 })4 .build();5driver.quit();6var driver = new webdriver.Builder()7 .withCapabilities({8 })9 .build();10driver.quit();11var driver = new webdriver.Builder()12 .withCapabilities({13 })14 .build();15driver.quit();16var driver = new webdriver.Builder()
Using AI Code Generation
1const appium = require('appium');2const { XCUITestDriver } = appium;3const driver = new XCUITestDriver();4driver.setUrl(url);5const appium = require('appium');6const { XCUITestDriver } = appium;7const driver = new XCUITestDriver();8const url = driver.getUrl();9const appium = require('appium');10const { XCUITestDriver } = appium;11const driver = new XCUITestDriver();12const proxyAvoidList = driver.getProxyAvoidList();13const appium = require('appium');14const { XCUITestDriver } = appium;15const driver = new XCUITestDriver();16const proxyAvoidList = ['localhost'];17driver.setProxyAvoidList(proxyAvoidList);18const appium = require('appium');19const { XCUITestDriver } = appium;20const driver = new XCUITestDriver();21const proxyRequired = driver.getProxyRequired();22const appium = require('appium');23const { XCUITestDriver } = appium;24const driver = new XCUITestDriver();25const proxyRequired = true;26driver.setProxyRequired(proxyRequired);27const appium = require('appium');28const { XCUITestDriver } = appium;29const driver = new XCUITestDriver();30const proxyHost = driver.getProxyHost();31const appium = require('appium');32const { XCUITestDriver } = appium;
Using AI Code Generation
1describe('test', () => {2 it('test', async () => {3 })4})5describe('test', () => {6 it('test', async () => {7 await browser.getUrl()8 })9})10describe('test', () => {11 it('test', async () => {12 await browser.getTitle()13 })14})15describe('test', () => {16 it('test', async () => {17 await browser.getWindowHandles()18 })19})20describe('test', () => {21 it('test', async () => {22 await browser.getWindowHandle()23 })24})25describe('test', () => {26 it('test', async () => {
Using AI Code Generation
1const wd = require('wd');2const path = require('path');3const assert = require('assert');4const { exec } = require('child_process');5const appPath = path.resolve('/Users/username/Downloads/Calculator.app');6const appiumPath = path.resolve('/Users/username/Downloads/appium-1.6.4-1.6.4-3-g3d0a3b6-dirty');7const appiumLogFile = path.resolve('/Users/username/Downloads/appium.log');8const appiumLogFile = path.resolve('/Users/username/Downloads/appium.log');9const appiumLogFile = path.resolve('/Users/username/Downloads/appium.log');10const appiumLogFile = path.resolve('/Users/username/Downloads/appium.log');
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!