How to use URLToken method in Playwright Internal

Best JavaScript code snippet using playwright-internal

apiRequest.js

Source:apiRequest.js Github

copy

Full Screen

1/* eslint-disable consistent-return */2import 'isomorphic-fetch';3import { saveAs } from 'file-saver';4import {5 apiELBUrlLogin,6 apiELBUrlLogout,7 apiELBUrlGetSummaryExpenseList,8 apiELBUrlGetUserList,9 apiELBUrlGetRoleList,10 apiELBUrlGetFunctionList,11 apiELBUrlGetExpGrpList,12 apiELBUrlGetExpensedtl,13 apiELBUrlUpdateUserStatus,14 apiELBUrlUpdateLayout,15 apiELBUrlGetMenuItem,16 apiELBUrlGetCpList,17 apiELBUrlUpdateRole,18 apiELBUrlGrpList,19 apiELBUrlUpdateGrpList,20 // LoRa21 apiELBUrlActiveCode,22 apiELBUrlGetSummaryList,23 // apiELBUrlGetGWList,24 apiELBUrlGetNodeList,25 apiELBUrlBindingCode,26 apiELBUrlPublishGwCmd,27 apiELBUrlGetFwList,28 apiELBUrlGetHistoryList,29 apiELBUrlGetHistoryDtlList,30 apiELBUrlUploadFw,31 // apiELBUrlGetSensorList,32 apiELBUrlDelHistory,33 apiELBUrlUpdateExpGrp,34 apiELBUrlgetRoboticList,35 apiELBUrlgetScriptList,36 apiELBUrlUpdateRAScript,37 apiELBUrlgetSysList,38 apiELBUrlUpdateGrpListbyCp,39 // Dashboard40 apiGetLayout,41 apiPlan,42 apiELBUrlGetEventList,43 apiELBUrlMqttCtl,44 apiDL,45 // robotic arm46 apiGetEventList,47 // event page48 apiELBUrlGetSensorListE,49 apiELBUrlGetEventListE,50 apiELBUrlGetGWListE,51 apiEventType,52 // getSensorByfport,53 apiRpt,54 apiRptChk,55 // alert page56 apiELBUrlGetAlertList,57 apiELBUrlAddAlertList,58 apiELBUrlDelAlertList,59 // virtual shelf60 apiTrackCnt,61 apiTrack,62 apiTag,63 api1Tag,64 apiSteelBeenShelf,65 apiTagCnt,66 apiSteelCnt,67 apiSteelBeenShelfCnt,68 apiGetDevInfobyMac,69 // tagPage70 apiGetSearchFilter,71 apiGetSearchOption,72 apiGetTrackCnt,73 apiGetTrack,74 apiGetTagType,75 apiGetTagList,76 apiGetTrackByfilterTag,77 apiGetTrackByfilterValTag,78 apiUpdateTagByAdmin,79 apiInsertTagByAdmin,80 apiGetDevMeta,81 apiGetTagByMeta,82 apiShowField,83 apiUpdateMeta,84 // personnel page85 apiZoneShowField,86 // devicePage87 apiDev,88} from '../../urls.conf';89import { getAuthToken } from './storageUtility';90import { getTripleDES } from './tripleDES';91// const SystemApiPath = '/rest/sys';92// const UserApiPath = '/rest/usr';93// const UploadApiPath = '/rest/usr/upload';94class ApiRequest {95 constructor(apiUrl) {96 this.apiUrl = apiUrl;97 this.login = this.login.bind(this);98 this.logout = this.logout.bind(this);99 this.getSummaryExpenseList = this.getSummaryExpenseList.bind(this);100 this.getSummaryWaterExpenseList = this.getSummaryWaterExpenseList.bind(this);101 this.getUserList = this.getUserList.bind(this);102 this.getRoleList = this.getRoleList.bind(this);103 this.getRoleListSearch = this.getRoleListSearch.bind(this);104 this.getFunctionList = this.getFunctionList.bind(this);105 this.getExpGrpList = this.getExpGrpList.bind(this);106 this.getExpDtl = this.getExpDtl.bind(this);107 this.searchUserList = this.searchUserList.bind(this);108 this.updateUserStatus = this.updateUserStatus.bind(this);109 this.updateLayout = this.updateLayout.bind(this);110 this.getMenuItem = this.getMenuItem.bind(this);111 this.getCpList = this.getCpList.bind(this);112 this.addUsr = this.addUsr.bind(this);113 this.addRole = this.addRole.bind(this);114 this.delUsr = this.delUsr.bind(this);115 this.getGrpList = this.getGrpList.bind(this);116 this.updateRoleByGrp = this.updateRoleByGrp.bind(this);117 this.updateRoleByFunc = this.updateRoleByFunc.bind(this);118 // LoRa119 this.activeLoraGateway = this.activeLoraGateway.bind(this);120 this.getSummaryList = this.getSummaryList.bind(this);121 this.getGWList = this.getGWList.bind(this);122 this.getNodeList = this.getNodeList.bind(this);123 this.getFwList = this.getFwList.bind(this);124 this.getHistoryList = this.getHistoryList.bind(this);125 this.getHistoryDtlList = this.getHistoryDtlList.bind(this);126 this.bindingLoraGateway = this.bindingLoraGateway.bind(this);127 this.publishGwCmd = this.publishGwCmd.bind(this);128 this.uploadFw = this.uploadFw.bind(this);129 this.getSensorList = this.getSensorList.bind(this);130 this.delHistory = this.delHistory.bind(this);131 this.addFunc = this.addFunc.bind(this);132 this.updateFunc = this.updateFunc.bind(this);133 this.updateFuncinRole = this.updateFuncinRole.bind(this);134 this.addExpGrp = this.addExpGrp.bind(this);135 this.updateExpGrp = this.updateExpGrp.bind(this);136 this.deleteExpGrp = this.deleteExpGrp.bind(this);137 this.deleteRole = this.deleteRole.bind(this);138 this.delFunc = this.delFunc.bind(this);139 // Robotic140 this.getRoboticList = this.getRoboticList.bind(this);141 this.getScriptList = this.getScriptList.bind(this);142 this.uploadRAScript = this.uploadRAScript.bind(this);143 this.deleteRAScript = this.deleteRAScript.bind(this);144 this.editRAScript = this.editRAScript.bind(this);145 this.updateRAScript = this.updateRAScript.bind(this);146 this.getExecHistory = this.getExecHistory.bind(this);147 // Admin-CP148 this.addCp = this.addCp.bind(this);149 this.deleteCp = this.deleteCp.bind(this);150 this.editCp = this.editCp.bind(this);151 this.searchCpList = this.searchCpList.bind(this);152 this.updateGrpbyCp = this.updateGrpbyCp.bind(this);153 this.updateGrpbyCpEdit = this.updateGrpbyCpEdit.bind(this);154 // Admin-System155 this.getSysList = this.getSysList.bind(this);156 this.addSys = this.addSys.bind(this);157 this.editSys = this.editSys.bind(this);158 this.deleteSys = this.deleteSys.bind(this);159 this.searchSysList = this.searchSysList.bind(this);160 // Admin-Grp161 this.addGrp = this.addGrp.bind(this);162 this.editGrp = this.editGrp.bind(this);163 this.deleteGrp = this.deleteGrp.bind(this);164 this.searchGrpList = this.searchGrpList.bind(this);165 // Admin-Function166 this.getFunctionListSearch = this.getFunctionListSearch.bind(this);167 // Dashboard168 this.getLayout = this.getLayout.bind(this);169 this.getPlanList = this.getPlanList.bind(this);170 this.uploadPlan = this.uploadPlan.bind(this);171 this.delPlanList = this.delPlanList.bind(this);172 this.mqttCtl = this.mqttCtl.bind(this);173 this.mqttCtlAir = this.mqttCtlAir.bind(this);174 this.getEventListByMac = this.getEventListByMac.bind(this);175 this.dashboardDL = this.dashboardDL.bind(this);176 this.dashboardDLPost = this.dashboardDLPost.bind(this);177 // event page178 this.getSensorListE = this.getSensorListE.bind(this);179 this.getEventList = this.getEventList.bind(this);180 this.getReportList = this.getReportList.bind(this);181 this.getEventType = this.getEventType.bind(this);182 this.getSensorByfport = this.getSensorByfport.bind(this);183 this.getReportCnt = this.getReportCnt.bind(this);184 // alert page185 this.getAlertList = this.getAlertList.bind(this);186 this.addAlertList = this.addAlertList.bind(this);187 this.delAlertList = this.delAlertList.bind(this);188 // virtual shelf189 this.getSteelCntInShelf = this.getSteelCntInShelf.bind(this);190 this.getSteelInShelf = this.getSteelInShelf.bind(this);191 this.getShelfList = this.getShelfList.bind(this);192 this.getSteelList = this.getSteelList.bind(this);193 this.getSteelBeenShelfList = this.getSteelBeenShelfList.bind(this);194 this.getTagCnt = this.getTagCnt.bind(this);195 this.getSteelCnt = this.getSteelCnt.bind(this);196 this.getSteelBeenShelfCnt = this.getSteelBeenShelfCnt.bind(this);197 this.editShelf = this.editShelf.bind(this);198 this.editSteel = this.editSteel.bind(this);199 this.getDevInfobyMac = this.getDevInfobyMac.bind(this);200 // Tag page201 this.getSearchFilter = this.getSearchFilter.bind(this);202 this.getSearchOptionWithRoot = this.getSearchOptionWithRoot.bind(this);203 this.getSearchOptionWithParentVal = this.getSearchOptionWithParentVal.bind(this);204 this.getTrackCount = this.getTrackCount.bind(this);205 this.getTrack = this.getTrack.bind(this);206 this.getTagType = this.getTagType.bind(this);207 this.getTagList = this.getTagList.bind(this);208 this.getTagListAll = this.getTagListAll.bind(this);209 this.getTrackByfilterTag = this.getTrackByfilterTag.bind(this);210 this.getTrackByfilterValTag = this.getTrackByfilterValTag.bind(this);211 this.updateTagByAdmin = this.updateTagByAdmin.bind(this);212 this.getGetDevMeta = this.getGetDevMeta.bind(this);213 this.getTagByMeta = this.getTagByMeta.bind(this);214 this.getTagByMetaWPage = this.getTagByMetaWPage.bind(this);215 this.getShowField = this.getShowField.bind(this);216 this.updateMeta = this.updateMeta.bind(this);217 this.insertTagByAdmin = this.insertTagByAdmin.bind(this);218 // Device Page219 this.addDevByAdmin = this.addDevByAdmin.bind(this);220 this.delDevByAdmin = this.delDevByAdmin.bind(this);221 this.editDevByAdmin = this.editDevByAdmin.bind(this);222 //personnel page223 this.getSearchFilterByPersonnel = this.getSearchFilterByPersonnel.bind(this);224 this.getZoneShowField = this.getZoneShowField.bind(this);225 this.getTagTypeIn2 = this.getTagTypeIn2.bind(this);226 227 }228 // POST function229 sendRequest(apiLocation, req) {230 return new Promise((resolve, reject) => {231 fetch(apiLocation, {232 method: 'POST',233 headers: {234 Accept: 'application/json',235 'Content-Type': 'application/json',236 },237 body: JSON.stringify(req),238 })239 .then(response => {240 if (response.status >= 400) {241 reject({ 'Bad response from server': response });242 }243 return response.json();244 })245 .then(result => {246 resolve(result);247 })248 .catch(err => {249 reject(err);250 });251 // const timeout = setTimeout(() => {252 // reject('Server-side Request Timeout');253 // }, 5000);254 // return timeout;255 });256 }257 // GET function258 sendRequestGet(apiLocation) {259 return new Promise((resolve, reject) => {260 fetch(apiLocation, {261 method: 'GET',262 headers: {263 Accept: 'application/json',264 'Content-Type': 'application/json',265 },266 })267 .then(response => {268 if (response.status >= 400) {269 reject({ 'Bad response from server': response });270 } else return response.json();271 })272 .then(result => {273 resolve(result);274 })275 .catch(err => {276 reject(err);277 });278 });279 }280 sendRequestGetSave(apiLocation, fileName) {281 return new Promise((resolve, reject) => {282 fetch(apiLocation, {283 method: 'GET',284 headers: {285 Accept: 'application/json',286 'Content-Type': 'application/json',287 },288 })289 .then(response => response.blob())290 .then(blob => {291 if (fileName === '') {292 saveAs(blob, 'eventList.xlsx');293 } else {294 saveAs(blob, fileName.concat('.xlsx'));295 }296 return 0;297 })298 .then(result => {299 resolve(result);300 })301 .catch(err => {302 reject(err);303 });304 });305 }306 // PUT function307 sendRequestPut(apiLocation, req) {308 return new Promise((resolve, reject) => {309 fetch(apiLocation, {310 method: 'PUT',311 headers: {312 Accept: 'application/json',313 'Content-Type': 'application/json',314 },315 body: JSON.stringify(req),316 })317 .then(response => {318 if (response.status >= 400) {319 reject({ 'Bad response from server': response });320 }321 return response.json();322 })323 .then(result => {324 resolve(result);325 })326 .catch(err => {327 reject(err);328 });329 });330 }331 // Delete function332 sendRequestDelete(apiLocation, req) {333 return new Promise((resolve, reject) => {334 fetch(apiLocation, {335 method: 'DELETE',336 headers: {337 Accept: 'application/json',338 'Content-Type': 'application/json',339 'Access-Control-Allow-Origin': 'http://10.70.51.54:1880/',340 },341 body: JSON.stringify(req),342 })343 .then(response => {344 if (response.status >= 400) {345 reject({ 'Bad response from server': response });346 }347 return response.json();348 })349 .then(result => {350 resolve(result);351 })352 .catch(err => {353 reject(err);354 });355 });356 }357 // Form POST function358 sendFormRequest(apiLocation, file, id, name, desc, version, verifier, token) {359 const data = new FormData();360 data.append('myFile', file);361 data.append('id', id);362 data.append('name', name);363 data.append('desc', desc);364 data.append('version', version);365 data.append('verifier', verifier);366 data.append('token', token);367 return new Promise((resolve, reject) => {368 fetch(apiLocation, {369 method: 'POST',370 headers: {371 Accept: 'application/json',372 'Access-Control-Allow-Origin': 'http://10.70.51.54:1880/',373 },374 body: data,375 })376 .then(response => {377 if (response.status >= 400) {378 reject({ 'Bad response from server': response });379 }380 return response.json();381 })382 .then(result => {383 resolve(result);384 })385 .catch(err => {386 reject(err);387 });388 });389 }390 // Form POST function391 sendFormReq(apiLocation, data) {392 return new Promise((resolve, reject) => {393 fetch(apiLocation, {394 method: 'POST',395 headers: {396 Accept: 'application/json',397 'Access-Control-Allow-Origin': 'http://10.70.51.54:1880/',398 },399 body: data,400 })401 .then(response => {402 if (response.status >= 400) {403 reject({ 'Bad response from server': response });404 }405 return response.json();406 })407 .then(result => {408 resolve(result);409 })410 .catch(err => {411 reject(err);412 });413 });414 }415 // Form MQTT POST function416 sendFormMQTTRequest(apiLocation, message, token) {417 const bodyStr = 'message='418 .concat(message)419 .concat('&topic=')420 .concat('GIOT-GW/DL/0000deedbafefeed')421 .concat('&token=')422 .concat(encodeURIComponent(token));423 return new Promise((resolve, reject) => {424 fetch(apiLocation, {425 method: 'POST',426 headers: {427 Accept: 'application/json',428 'Content-Type': 'application/x-www-form-urlencoded',429 },430 body: bodyStr,431 })432 .then(response => {433 if (response.status >= 400) {434 reject({ 'Bad response from server': response });435 }436 return response.json();437 })438 .then(result => {439 resolve(result);440 })441 .catch(err => {442 reject(err);443 });444 });445 }446 sendFormMQTTAirRequest(apiLocation, message, token) {447 const bodyStr = 'message='448 .concat(message)449 .concat('&topic=')450 .concat('GIOT-GW/DL/0000deedbafefef2')451 .concat('&token=')452 .concat(encodeURIComponent(token));453 return new Promise((resolve, reject) => {454 fetch(apiLocation, {455 method: 'POST',456 headers: {457 Accept: 'application/json',458 'Content-Type': 'application/x-www-form-urlencoded',459 },460 body: bodyStr,461 })462 .then(response => {463 if (response.status >= 400) {464 reject({ 'Bad response from server': response });465 }466 return response.json();467 })468 .then(result => {469 resolve(result);470 })471 .catch(err => {472 reject(err);473 });474 });475 }476 // POST477 sendRequestPost(api, body) {478 return new Promise((resolve, reject) => {479 fetch(api, {480 method: 'POST',481 headers: {482 Accept: 'application/json',483 'Content-Type': 'application/x-www-form-urlencoded',484 },485 body,486 })487 .then(response => {488 if (response.status >= 400) {489 reject({ 'Bad response from server': response });490 }491 return response.json();492 })493 .then(result => {494 resolve(result);495 })496 .catch(err => {497 reject(err);498 });499 });500 }501 // api start502 login(_acc, _pwd, _type) {503 const req = { acc: _acc, pwd: _pwd, type: _type };504 return this.sendRequest(apiELBUrlLogin, req);505 }506 logout(token) {507 // const that = this;508 const req = { token };509 return this.sendRequest(apiELBUrlLogout, req);510 }511 getSummaryExpenseList() {512 const token = getAuthToken();513 const urlToken = apiELBUrlGetSummaryExpenseList514 .concat('?token=')515 .concat(token)516 .concat('&type=e');517 return this.sendRequestGet(urlToken);518 }519 getSummaryWaterExpenseList() {520 const token = getAuthToken();521 const urlToken = apiELBUrlGetSummaryExpenseList522 .concat('?token=')523 .concat(token)524 .concat('&type=w');525 return this.sendRequestGet(urlToken);526 }527 getUserList() {528 const token = encodeURIComponent(getAuthToken());529 const urlToken = apiELBUrlGetUserList.concat('?token=').concat(token);530 return this.sendRequestGet(urlToken);531 }532 searchUserList(data) {533 const token = encodeURIComponent(getAuthToken());534 const urlToken = apiELBUrlGetUserList535 .concat('?token=')536 .concat(token)537 .concat('&search=')538 .concat(data);539 return this.sendRequestGet(urlToken);540 }541 getRoleList() {542 const token = encodeURIComponent(getAuthToken());543 const urlToken = apiELBUrlGetRoleList.concat('?token=').concat(token);544 // .concat('&type=w');545 return this.sendRequestGet(urlToken);546 }547 getRoleListSearch(data) {548 const token = encodeURIComponent(getAuthToken());549 const urlToken = apiELBUrlGetRoleList550 .concat('?token=')551 .concat(token)552 .concat('&search=')553 .concat(data);554 return this.sendRequestGet(urlToken);555 }556 getFunctionList() {557 const token = encodeURIComponent(getAuthToken());558 const urlToken = apiELBUrlGetFunctionList.concat('?token=').concat(token);559 return this.sendRequestGet(urlToken);560 }561 getFunctionListSearch(data) {562 const token = encodeURIComponent(getAuthToken());563 const urlToken = apiELBUrlGetFunctionList564 .concat('?token=')565 .concat(token)566 .concat('&search=')567 .concat(encodeURIComponent(getTripleDES('roleId:=:'.concat(data))));568 return this.sendRequestGet(urlToken);569 }570 getExpGrpList() {571 const token = encodeURIComponent(getAuthToken());572 const urlToken = apiELBUrlGetExpGrpList.concat('?token=').concat(token);573 // .concat('&type=w');574 return this.sendRequestGet(urlToken);575 }576 getExpDtl() {577 const token = getAuthToken();578 const urlToken = apiELBUrlGetExpensedtl579 .concat('?token=')580 .concat(token)581 .concat('&type=e');582 return this.sendRequestGet(urlToken);583 }584 updateUserStatus(_userName, _cpId, _roleName, _userBlockFlag) {585 const getToken = getAuthToken();586 const req = { mUserId: _userName, catId: _cpId, roleId: _roleName, userBlock: _userBlockFlag, token: getToken };587 return this.sendRequestPut(apiELBUrlUpdateUserStatus, req);588 }589 updateLayout(data) {590 const getToken = getAuthToken();591 const req = { token: getToken, layout: data.data };592 return this.sendRequest(apiELBUrlUpdateLayout, req);593 }594 getMenuItem(data) {595 const token = getAuthToken();596 const urlToken = apiELBUrlGetMenuItem597 .concat(data)598 .concat('?token=')599 .concat(encodeURIComponent(token));600 return this.sendRequestGet(urlToken);601 }602 getCpList() {603 const token = encodeURIComponent(getAuthToken());604 const urlToken = apiELBUrlGetCpList.concat('?token=').concat(token);605 return this.sendRequestGet(urlToken);606 }607 addUsr(_textName, _textEmail, _textPw, _selGender, _selCp, _roleId, _selBlock) {608 const getToken = getAuthToken();609 const req = {610 name: _textName,611 email: _textEmail,612 pwd: _textPw,613 gender: _selGender,614 catId: _selCp,615 roleId: _roleId,616 userBlock: _selBlock,617 token: getToken,618 };619 return this.sendRequest(apiELBUrlUpdateUserStatus, req);620 }621 delUsr(_userId) {622 const getToken = getAuthToken();623 const req = {624 delUserId: _userId,625 token: getToken,626 };627 return this.sendRequestDelete(apiELBUrlGetUserList, req);628 }629 addRole(_selDataLevel, _textRoleName) {630 const getToken = getAuthToken();631 const req = {632 roleId: -1,633 dataId: _selDataLevel,634 roleName: _textRoleName,635 token: getToken,636 };637 return this.sendRequest(apiELBUrlUpdateRole, req);638 }639 getGrpList() {640 const token = encodeURIComponent(getAuthToken());641 const urlToken = apiELBUrlGrpList.concat('?token=').concat(token);642 return this.sendRequestGet(urlToken);643 }644 updateRoleByGrp(_catId, _grps, _type) {645 const getToken = getAuthToken();646 const req = {647 catId: _catId,648 grps: _grps,649 type: _type,650 token: getToken,651 };652 return this.sendRequest(apiELBUrlUpdateGrpList, req);653 }654 updateRoleByFunc(catId, func, type) {655 const getToken = getAuthToken();656 const req = {657 catId,658 func,659 type,660 token: getToken,661 };662 return this.sendRequest(apiELBUrlUpdateGrpList, req);663 }664 // LoRa665 activeLoraGateway(_d) {666 // apiELBUrlActiveCode667 const tokenTmp = getAuthToken();668 const req = { d: _d, token: tokenTmp };669 return this.sendRequest(apiELBUrlActiveCode, req);670 }671 bindingLoraGateway(_d) {672 // apiELBUrlActiveCode673 const tokenTmp = getAuthToken();674 const req = { d: _d, token: tokenTmp };675 return this.sendRequest(apiELBUrlBindingCode, req);676 }677 getSummaryList() {678 const token = getAuthToken();679 const urlToken = apiELBUrlGetSummaryList.concat('?token=').concat(token);680 return this.sendRequestGet(urlToken);681 }682 getGWList() {683 const token = getAuthToken();684 const urlToken = apiELBUrlGetGWListE685 .concat('?token=')686 .concat(encodeURIComponent(token))687 .replace('{status}', -1);688 return this.sendRequestGet(urlToken);689 }690 getAlertList(data) {691 const token = getAuthToken();692 let urlToken = apiELBUrlGetAlertList.concat('?token=').concat(encodeURIComponent(token));693 if (data === undefined) {694 return this.sendRequestGet(urlToken);695 }696 if (data.fport !== undefined) {697 urlToken = urlToken.concat('&fport=', data.fport);698 }699 if (data.limit !== undefined) {700 urlToken = urlToken.concat('&limit=', data.limit);701 }702 if (data.page !== undefined) {703 urlToken = urlToken.concat('&page=', data.page);704 }705 if (data.paginate !== undefined) {706 urlToken = urlToken.concat('&paginate=', data.paginate);707 }708 if (data.sort !== undefined) {709 urlToken = urlToken.concat('&sort=', data.sort);710 }711 return this.sendRequestGet(urlToken);712 }713 addAlertList(data) {714 const token = getAuthToken();715 const dataParam = {716 token,717 data,718 };719 return this.sendRequest(apiELBUrlAddAlertList, dataParam);720 }721 delAlertList(id) {722 const token = getAuthToken();723 const dataParam = {724 token,725 };726 const delUrlApi = apiELBUrlDelAlertList.replace('{id}', id);727 return this.sendRequestDelete(delUrlApi, dataParam);728 }729 getSensorList() {730 const token = getAuthToken();731 const urlToken = apiELBUrlGetSensorListE732 .concat('?token=')733 .concat(encodeURIComponent(token))734 .replace('{status}', -1);735 return this.sendRequestGet(urlToken);736 }737 getNodeList(_org, _type, _id) {738 const token = getAuthToken();739 const urlToken = apiELBUrlGetNodeList740 .replace('{org}', _org)741 .replace('{deviceType}', _type)742 .replace('{deviceId}', _id)743 .concat('?token=')744 .concat(token);745 return this.sendRequestGet(urlToken);746 }747 getFwList() {748 const token = getAuthToken();749 const urlToken = apiELBUrlGetFwList.concat('?token=').concat(token);750 return this.sendRequestGet(urlToken);751 }752 getHistoryList() {753 const token = getAuthToken();754 const urlToken = apiELBUrlGetHistoryList755 .replace('{org}', 'kqqhst')756 .concat('?token=')757 .concat(token);758 return this.sendRequestGet(urlToken);759 }760 getHistoryDtlList(_org, _id) {761 const token = getAuthToken();762 const urlToken = apiELBUrlGetHistoryDtlList763 .replace('{org}', 'kqqhst')764 .replace('{reqId}', _id)765 .concat('?token=')766 .concat(token);767 return this.sendRequestGet(urlToken);768 }769 publishGwCmd(_org, _type, _id, _cmdType, _fwId) {770 const token = getAuthToken();771 const req = { ids: _id, token, fwId: _fwId };772 const urlToken = apiELBUrlPublishGwCmd773 .replace('{org}', _org)774 .replace('{deviceType}', _type)775 .replace('{cmd}', _cmdType);776 return this.sendRequest(urlToken, req);777 }778 uploadFw(_myfile, _id, _name, _desc, _version, _verfier) {779 const token = getAuthToken();780 return this.sendFormRequest(apiELBUrlUploadFw, _myfile, _id, _name, _desc, _version, _verfier, token);781 }782 delHistory(_id) {783 const token = getAuthToken();784 const req = { token };785 const urlToken = apiELBUrlDelHistory.replace('{org}', 'kqqhst').replace('{reqId}', _id);786 return this.sendRequestDelete(urlToken, req);787 }788 addFunc(_funcName, _funcUrl, _grpId, _hiddenFlg, _parentId) {789 const token = getAuthToken();790 const req = {791 funcId: -1,792 funcName: _funcName,793 funcUrl: _funcUrl,794 parentId: _parentId,795 sortId: 0,796 grpId: _grpId,797 hiddenFlg: _hiddenFlg,798 token,799 };800 return this.sendRequest(apiELBUrlGetFunctionList, req);801 }802 updateFunc(_funcName, _funcUrl, _grpId, _hiddenFlg, _funcId, _parentId) {803 const token = getAuthToken();804 const req = {805 funcId: _funcId,806 funcName: _funcName,807 funcUrl: _funcUrl,808 parentId: _parentId,809 sortId: 0,810 grpId: _grpId,811 hiddenFlg: _hiddenFlg,812 token,813 };814 return this.sendRequest(apiELBUrlGetFunctionList, req);815 }816 updateFuncinRole(funcId, funcName, funcUrl, parentId, sortId, grpId, hiddenFlg) {817 const token = getAuthToken();818 const req = {819 funcId,820 funcName,821 funcUrl,822 parentId,823 sortId,824 grpId,825 hiddenFlg,826 token,827 };828 return this.sendRequest(apiELBUrlGetFunctionList, req);829 }830 addExpGrp(_eGrpName) {831 const token = getAuthToken();832 const req = {833 eGrpId: -1,834 eGrpName: _eGrpName,835 token,836 };837 return this.sendRequest(apiELBUrlUpdateExpGrp, req);838 }839 updateExpGrp(_eGrpName, _eGrpId) {840 const token = getAuthToken();841 const req = {842 eGrpId: _eGrpId,843 eGrpName: _eGrpName,844 token,845 };846 return this.sendRequest(apiELBUrlUpdateExpGrp, req);847 }848 deleteExpGrp(_eGrpId) {849 const token = getAuthToken();850 const req = {851 eGrpId: _eGrpId,852 token,853 };854 return this.sendRequestDelete(apiELBUrlUpdateExpGrp, req);855 }856 deleteRole(_roleId) {857 const token = getAuthToken();858 const req = {859 roleId: _roleId,860 token,861 };862 return this.sendRequestDelete(apiELBUrlGetRoleList, req);863 }864 delFunc(_functionId) {865 const token = getAuthToken();866 const req = {867 funcId: _functionId,868 token,869 };870 return this.sendRequestDelete(apiELBUrlGetFunctionList, req);871 }872 getRoboticList() {873 const token = getAuthToken();874 const urlToken = apiELBUrlgetRoboticList.concat('?token=').concat(token);875 return this.sendRequestGet(urlToken);876 }877 getScriptList() {878 const token = getAuthToken();879 const urlToken = apiELBUrlgetScriptList.concat('?token=').concat(token);880 return this.sendRequestGet(urlToken);881 }882 uploadRAScript(_myfile, _name, _desc, _version) {883 const token = getAuthToken();884 const data = new FormData();885 data.append('myFile', _myfile);886 data.append('id', -1);887 data.append('name', _name);888 data.append('desc', _desc);889 data.append('version', _version);890 data.append('token', token);891 return this.sendFormReq(apiELBUrlgetScriptList, data);892 }893 deleteRAScript(id) {894 const token = getAuthToken();895 const req = {896 id,897 token,898 };899 return this.sendRequestDelete(apiELBUrlgetScriptList, req);900 }901 editRAScript(_id, _myfile, _name, _desc, _version) {902 const token = getAuthToken();903 const data = new FormData();904 data.append('id', _id);905 data.append('myFile', _myfile);906 data.append('name', _name);907 data.append('desc', _desc);908 data.append('version', _version);909 data.append('token', token);910 return this.sendFormReq(apiELBUrlgetScriptList, data);911 }912 updateRAScript(RAId, scriptId) {913 const token = getAuthToken();914 const req = {915 d: RAId,916 roboticFw: scriptId,917 token,918 };919 return this.sendRequest(apiELBUrlUpdateRAScript, req);920 }921 addCp(textCpName) {922 const token = getAuthToken();923 const req = {924 cpId: -1,925 cpName: textCpName,926 token,927 };928 return this.sendRequest(apiELBUrlGetCpList, req);929 }930 deleteCp(cpId) {931 const token = getAuthToken();932 const req = {933 cpId,934 token,935 };936 return this.sendRequestDelete(apiELBUrlGetCpList, req);937 }938 editCp(cpId, textCpName) {939 const token = getAuthToken();940 const req = {941 cpId,942 cpName: textCpName,943 token,944 };945 return this.sendRequest(apiELBUrlGetCpList, req);946 }947 searchCpList(data) {948 const token = getAuthToken();949 const urlToken = apiELBUrlGetCpList950 .concat('?token=')951 .concat(token)952 .concat('&search=')953 .concat(data);954 return this.sendRequestGet(urlToken);955 }956 getSysList() {957 const token = encodeURIComponent(getAuthToken());958 const urlToken = apiELBUrlgetSysList.concat('?token=').concat(token);959 return this.sendRequestGet(urlToken);960 }961 addSys(textSysName, textSysDesc, textSysValue, textSysType) {962 const token = getAuthToken();963 const req = {964 sysId: '-1',965 name: textSysName,966 value: textSysValue,967 desc: textSysDesc,968 type: textSysType,969 token,970 };971 return this.sendRequest(apiELBUrlgetSysList, req);972 }973 editSys(textSysName, textSysDesc, textSysValue, textSysType) {974 const token = getAuthToken();975 const req = {976 sysId: '0',977 name: textSysName,978 value: textSysValue,979 desc: textSysDesc,980 type: textSysType,981 token,982 };983 return this.sendRequest(apiELBUrlgetSysList, req);984 }985 deleteSys(textSysName) {986 const token = getAuthToken();987 const req = {988 name: textSysName,989 token,990 };991 return this.sendRequestDelete(apiELBUrlgetSysList, req);992 }993 searchSysList(data) {994 const token = getAuthToken();995 const urlToken = apiELBUrlgetSysList996 .concat('?token=')997 .concat(token)998 .concat('&search=')999 .concat(data);1000 return this.sendRequestGet(urlToken);1001 }1002 addGrp(textGrpName) {1003 const token = getAuthToken();1004 const req = {1005 grpId: '-1',1006 name: textGrpName,1007 token,1008 };1009 return this.sendRequest(apiELBUrlGrpList, req);1010 }1011 editGrp(textGrpName, grpId) {1012 const token = getAuthToken();1013 const req = {1014 grpId,1015 name: textGrpName,1016 token,1017 };1018 return this.sendRequest(apiELBUrlGrpList, req);1019 }1020 deleteGrp(grpId) {1021 const token = getAuthToken();1022 const req = {1023 grpId,1024 token,1025 };1026 return this.sendRequestDelete(apiELBUrlGrpList, req);1027 }1028 searchGrpList(data) {1029 const token = encodeURIComponent(getAuthToken());1030 const urlToken = apiELBUrlGrpList1031 .concat('?token=')1032 .concat(token)1033 .concat('&search=')1034 .concat(data);1035 return this.sendRequestGet(urlToken);1036 }1037 updateGrpbyCp(cpId, grpsArr) {1038 // apiELBUrlUpdateGrpListbyCp1039 const token = getAuthToken();1040 const req = {1041 type: 'GCp',1042 catId: cpId,1043 grps: grpsArr,1044 token,1045 };1046 return this.sendRequest(apiELBUrlUpdateGrpListbyCp, req);1047 }1048 updateGrpbyCpEdit(cpId, grpsArr, grpId) {1049 const token = getAuthToken();1050 const req = {1051 type: 'GCp',1052 catId: cpId,1053 grps: grpId,1054 token,1055 };1056 return this.sendRequest(apiELBUrlUpdateGrpListbyCp, req);1057 }1058 getExecHistory(_deviceType, _deviceId, _eventType, _qTime, _limit, _skip) {1059 const token = getAuthToken();1060 const urlToken = apiGetEventList1061 .replace('{deviceType}', _deviceType)1062 .replace('{deviceId}', _deviceId)1063 .replace('{eventType}', _eventType)1064 .replace('{token}', token)1065 .replace('{qTime}', _qTime)1066 .replace('{limit}', _limit)1067 .replace('{skip}', _skip);1068 return this.sendRequestGet(urlToken);1069 }1070 // Dashboard1071 getLayout() {1072 const token = getAuthToken();1073 const urlToken = apiGetLayout.concat('?token=').concat(encodeURIComponent(token));1074 return this.sendRequestGet(urlToken);1075 }1076 getPlanList() {1077 const token = getAuthToken();1078 const urlToken = apiPlan.concat('?token=').concat(encodeURIComponent(token));1079 return this.sendRequestGet(urlToken);1080 }1081 uploadPlan(file, id, planName, planDesc, planVers, planVeri) {1082 const token = getAuthToken();1083 return this.sendFormRequest(apiPlan, file, id, planName, planDesc, planVers, planVeri, token);1084 }1085 // uploadFw(_myfile, _id, _name, _desc, _version, _verfier) {1086 // const token = getAuthToken();1087 // return this.sendFormRequest(apiELBUrlUploadFw, _myfile, _id, _name, _desc, _version, _verfier, token);1088 // }1089 delPlanList() {1090 const token = getAuthToken();1091 const urlToken = apiPlan.concat('?token=').concat(token);1092 return this.sendRequestGet(urlToken);1093 }1094 // event page1095 getSensorListE() {1096 const token = getAuthToken();1097 const urlToken = apiELBUrlGetSensorListE.concat('?token=').concat(encodeURIComponent(token));1098 return this.sendRequestGet(urlToken);1099 }1100 getEventList(data) {1101 const token = getAuthToken();1102 let urlToken = apiELBUrlGetEventList.concat('?token=', encodeURIComponent(token));1103 if ('fport' in data) {1104 if (data.fport !== undefined) {1105 urlToken = urlToken.concat('&fport=', data.fport);1106 }1107 }1108 if ('macAddr' in data) {1109 if (data.macAddr !== undefined) {1110 urlToken = urlToken.concat('&macAddr=', data.macAddr);1111 }1112 }1113 if ('limit' in data) {1114 if (data.limit !== undefined) {1115 urlToken = urlToken.concat('&limit=', data.limit);1116 }1117 }1118 if ('pagi' in data) {1119 if (data.pagi !== undefined) {1120 urlToken = urlToken.concat('&page=', data.pagi);1121 }1122 }1123 if ('date' in data) {1124 urlToken = urlToken.concat('&from=', encodeURIComponent(data.date[0]), '&to=', encodeURIComponent(data.date[1]));1125 }1126 if ('fileName' in data) {1127 urlToken = urlToken.concat('&showType=xls&fileName=', data.fileName);1128 }1129 if ('search' in data) {1130 if (data.search !== undefined) {1131 urlToken = urlToken.concat('&search=', encodeURIComponent(getTripleDES(data.search)));1132 }1133 }1134 return this.sendRequestGet(urlToken);1135 }1136 getReportList(data) {1137 const token = getAuthToken();1138 let urlToken = apiRpt.concat('?token=', encodeURIComponent(token));1139 if ('fport' in data) {1140 if (data.fport !== undefined) {1141 urlToken = urlToken.concat('&fport=', data.fport);1142 }1143 }1144 if ('macAddr' in data) {1145 if (data.macAddr !== undefined) {1146 urlToken = urlToken.concat('&macAddr=', data.macAddr);1147 }1148 }1149 if ('date' in data) {1150 urlToken = urlToken.concat('&from=', encodeURIComponent(data.date[0]), '&to=', encodeURIComponent(data.date[1]));1151 }1152 if ('fileName' in data) {1153 urlToken = urlToken.concat('&showType=xls&fileName=', data.fileName);1154 }1155 return this.sendRequestGetSave(urlToken, data.fileName);1156 }1157 getReportCnt(data) {1158 const token = getAuthToken();1159 let urlToken = apiRptChk.concat('?token=', encodeURIComponent(token));1160 if ('fport' in data) {1161 if (data.fport !== undefined) {1162 urlToken = urlToken.concat('&fport=', data.fport);1163 }1164 }1165 if ('macAddr' in data) {1166 if (data.macAddr !== undefined) {1167 urlToken = urlToken.concat('&macAddr=', data.macAddr);1168 }1169 }1170 if ('date' in data) {1171 urlToken = urlToken.concat('&from=', encodeURIComponent(data.date[0]), '&to=', encodeURIComponent(data.date[1]));1172 }1173 return this.sendRequestGet(urlToken);1174 }1175 getEventListByMac(mac) {1176 const token = getAuthToken();1177 const urlToken = apiELBUrlGetEventListE1178 .concat('?token=')1179 .concat(encodeURIComponent(token))1180 .concat('&limit=10')1181 .concat('&fport=161')1182 .concat('&macAddr=')1183 .concat(mac);1184 return this.sendRequestGet(urlToken);1185 }1186 mqttCtl(_message) {1187 const token = getAuthToken();1188 return this.sendFormMQTTRequest(apiELBUrlMqttCtl, _message, token);1189 }1190 mqttCtlAir(_message) {1191 const token = getAuthToken();1192 return this.sendFormMQTTAirRequest(apiELBUrlMqttCtl, _message, token);1193 }1194 // virtual shelf1195 getSteelCntInShelf(tagId) {1196 const token = getAuthToken();1197 const urlToken = apiTrackCnt1198 .replace('{tagId}', tagId)1199 .concat('?token=')1200 .concat(encodeURIComponent(token));1201 return this.sendRequestGet(urlToken);1202 }1203 getSteelInShelf(tagId, limit, page) {1204 const token = getAuthToken();1205 let urlToken;1206 if (limit === undefined && page === undefined) {1207 urlToken = apiTrack1208 .replace('{tagId}', tagId)1209 .concat('?token=')1210 .concat(encodeURIComponent(token));1211 } else {1212 urlToken = apiTrack1213 .replace('{tagId}', tagId)1214 .concat('?token=')1215 .concat(encodeURIComponent(token))1216 .concat('&limit=', limit)1217 .concat('&paginate=true')1218 .concat('&page=', page);1219 }1220 return this.sendRequestGet(urlToken);1221 }1222 getShelfList(limit, page, searchTextTriEn) {1223 const token = getAuthToken();1224 let urlToken;1225 if (limit === undefined && page === undefined) {1226 urlToken = apiTag.concat('?token=').concat(encodeURIComponent(token));1227 } else if (searchTextTriEn === undefined) {1228 urlToken = apiTag1229 .concat('?token=')1230 .concat(encodeURIComponent(token))1231 .concat('&limit=', limit)1232 .concat('&paginate=true')1233 .concat('&page=', page);1234 } else if (searchTextTriEn !== undefined) {1235 urlToken = apiTag1236 .concat('?token=')1237 .concat(encodeURIComponent(token))1238 .concat('&limit=', limit)1239 .concat('&paginate=true')1240 .concat('&page=', page)1241 .concat('&search=', searchTextTriEn);1242 }1243 return this.sendRequestGet(urlToken);1244 }1245 getSteelList(limit, page, searchTextTriEn) {1246 const token = getAuthToken();1247 let urlToken;1248 if (searchTextTriEn === undefined) {1249 urlToken = api1Tag1250 .concat('?token=')1251 .concat(encodeURIComponent(token))1252 .concat('&limit=', limit)1253 .concat('&paginate=true')1254 .concat('&page=', page);1255 } else if (searchTextTriEn !== undefined) {1256 urlToken = api1Tag1257 .concat('?token=')1258 .concat(encodeURIComponent(token))1259 .concat('&limit=', limit)1260 .concat('&paginate=true')1261 .concat('&page=', page)1262 .concat('&search=', searchTextTriEn);1263 }1264 return this.sendRequestGet(urlToken);1265 }1266 getSteelBeenShelfList(steelId, limit, page) {1267 const token = getAuthToken();1268 const urlToken = apiSteelBeenShelf1269 .replace('{steelId}', steelId)1270 .concat('?token=')1271 .concat(encodeURIComponent(token))1272 .concat('&limit=', limit)1273 .concat('&paginate=true')1274 .concat('&page=', page);1275 return this.sendRequestGet(urlToken);1276 }1277 getTagCnt(searchTextTriEn) {1278 const token = getAuthToken();1279 let urlToken;1280 if (searchTextTriEn === undefined) {1281 urlToken = apiTagCnt.concat('?token=').concat(encodeURIComponent(token));1282 } else if (searchTextTriEn !== undefined) {1283 urlToken = apiTagCnt1284 .concat('?token=')1285 .concat(encodeURIComponent(token))1286 .concat('&search=')1287 .concat(searchTextTriEn);1288 }1289 return this.sendRequestGet(urlToken);1290 }1291 getSteelCnt(searchTextTriEn) {1292 const token = getAuthToken();1293 let urlToken;1294 if (searchTextTriEn === undefined) {1295 urlToken = apiSteelCnt.concat('?token=').concat(encodeURIComponent(token));1296 } else if (searchTextTriEn !== undefined) {1297 urlToken = apiSteelCnt1298 .concat('?token=')1299 .concat(encodeURIComponent(token))1300 .concat('&search=')1301 .concat(searchTextTriEn);1302 }1303 return this.sendRequestGet(urlToken);1304 }1305 getSteelBeenShelfCnt(steelId) {1306 const token = getAuthToken();1307 const urlToken = apiSteelBeenShelfCnt1308 .replace('{steelId}', steelId)1309 .concat('?token=')1310 .concat(encodeURIComponent(token));1311 return this.sendRequestGet(urlToken);1312 }1313 editShelf(MAC_ID, id, name, MAC_TYPE, MAC_DESC, LOC_DESC, PROC_ID, CHARGE_DEPT, EQUP_NO, STD_WT, SAFE_WT, STD_LOC_WT) {1314 const token = getAuthToken();1315 const req = {1316 MAC_ID,1317 id,1318 objId: id,1319 name,1320 MAC_TYPE,1321 MAC_DESC,1322 LOC_DESC,1323 PROC_ID,1324 CHARGE_DEPT,1325 EQUP_NO,1326 STD_WT,1327 SAFE_WT,1328 STD_LOC_WT,1329 token,1330 };1331 return this.sendRequest(apiTag, req);1332 }1333 editSteel(name, id, objId) {1334 const token = getAuthToken();1335 const req = {1336 name,1337 id,1338 objId,1339 token,1340 };1341 return this.sendRequest(api1Tag, req);1342 }1343 getEventType() {1344 const token = getAuthToken();1345 const urlToken = apiEventType.concat('?token=').concat(encodeURIComponent(token));1346 return this.sendRequestGet(urlToken);1347 }1348 getSensorByfport(fport) {1349 const token = getAuthToken();1350 const urlApi = apiELBUrlGetSensorListE1351 .concat('?token=')1352 .concat(encodeURIComponent(token))1353 .concat('&fport=')1354 .concat(fport);1355 return this.sendRequestGet(urlApi);1356 }1357 dashboardDL(data) {1358 const { fport, message, mac } = data;1359 const token = encodeURIComponent(getAuthToken());1360 const body = 'token='1361 .concat(token)1362 .concat('&message=')1363 .concat(message)1364 .concat('&mac=')1365 .concat(mac);1366 return this.sendRequestPost(apiDL.concat('/').concat(fport), body);1367 }1368 dashboardDLPost(data) {1369 const token = getAuthToken();1370 const { fport, message, mac } = data;1371 const req = { token, fport, message, mac };1372 return this.sendRequest(apiDL.concat('/', fport), req);1373 }1374 getDevInfobyMac(data) {1375 // const { mac } = data;1376 const token = encodeURIComponent(getAuthToken());1377 const urlApi = apiGetDevInfobyMac.concat('/', data, '?token=', token);1378 return this.sendRequestGet(urlApi);1379 }1380 getSearchFilter() {1381 const token = encodeURIComponent(getAuthToken());1382 const urlApi = apiGetSearchFilter.concat('?token=', token, '&showFlg=', 1);1383 return this.sendRequestGet(urlApi);1384 }1385 getSearchFilterByPersonnel() {1386 const token = encodeURIComponent(getAuthToken());1387 const urlApi = apiGetSearchFilter.concat('?token=', token, '&showFlg=', 1, '&type=personnel');1388 return this.sendRequestGet(urlApi);1389 }1390 getSearchOptionWithRoot(data) {1391 const token = encodeURIComponent(getAuthToken());1392 const urlApi = apiGetSearchOption.concat(1393 '/',1394 Object.keys(data)[0],1395 '?token=',1396 token,1397 '&fport=',1398 Object.values(data)[0].fport,1399 '&showFlg=',1400 11401 );1402 return this.sendRequestGet(urlApi);1403 }1404 getSearchOptionWithParentVal(data) {1405 const { searchField, val, child, fport } = data;1406 const token = encodeURIComponent(getAuthToken());1407 const urlApi = apiGetSearchOption.concat('/', searchField, '/', val, '/', child, '?token=', token, '&fport=', fport, '&showFlg=', 1);1408 return this.sendRequestGet(urlApi);1409 }1410 getTrackCount(data) {1411 const { type, typeId } = data;1412 const token = encodeURIComponent(getAuthToken());1413 const urlApi = apiGetTrackCnt1414 .replace('{type}', type)1415 .replace('{typeId}', typeId)1416 .concat('?token=', token, '&showFlg=', 1);1417 return this.sendRequestGet(urlApi);1418 }1419 getTrack(data) {1420 const { type, typeId } = data;1421 const token = encodeURIComponent(getAuthToken());1422 let urlApi;1423 urlApi = apiGetTrack1424 .replace('{type}', type)1425 .replace('{typeId}', typeId)1426 .concat('?token=', token);1427 if ('date' in data) {1428 urlApi = urlApi.concat('&from=', encodeURIComponent(data.date[0]), '&to=', encodeURIComponent(data.date[1]));1429 }1430 return this.sendRequestGet(urlApi);1431 }1432 getTagType() {1433 const token = encodeURIComponent(getAuthToken());1434 const urlApi = apiGetTagType.concat('?token=', token);1435 return this.sendRequestGet(urlApi);1436 }1437 getTagTypeIn2() {1438 const token = encodeURIComponent(getAuthToken());1439 const urlApi = apiGetTagType.concat('?token=', token, '&type=2');1440 return this.sendRequestGet(urlApi);1441 }1442 getTagList(data) {1443 const { type } = data;1444 const token = encodeURIComponent(getAuthToken());1445 let urlApi = apiGetTagList.concat('?token=', token).replace('{type}', type);1446 if ('id' in data) {1447 if (data.id !== undefined) {1448 urlApi = urlApi.concat('&search=', encodeURIComponent(getTripleDES(data.id)));1449 }1450 }1451 if ('date' in data) {1452 urlApi = urlApi.concat('&from=', encodeURIComponent(data.date[0]), '&to=', encodeURIComponent(data.date[1]));1453 }1454 if ('page' in data) {1455 urlApi = urlApi.concat('&page=', data.page);1456 }1457 if ('limit' in data) {1458 urlApi = urlApi.concat('&paginate=true&limit=', data.limit);1459 }1460 return this.sendRequestGet(urlApi);1461 }1462 getTagListAll(data) {1463 const { type } = data;1464 const token = encodeURIComponent(getAuthToken());1465 let urlApi = apiGetTagList.concat('?token=', token).replace('{type}', type);1466 if ('id' in data) {1467 if (data.id !== undefined) {1468 urlApi = urlApi.concat('&search=', encodeURIComponent(getTripleDES(data.id)));1469 }1470 }1471 if ('date' in data) {1472 urlApi = urlApi.concat('&from=', encodeURIComponent(data.date[0]), '&to=', encodeURIComponent(data.date[1]));1473 }1474 return this.sendRequestGet(urlApi);1475 }1476 getTrackByfilterTag(data) {1477 const { searchField, type, id } = data;1478 const token = encodeURIComponent(getAuthToken());1479 const urlApi = apiGetTrackByfilterTag1480 .concat('?token=', token, '&showFlg=', 1)1481 .replace('{searchField}', searchField)1482 .replace('{type}', type)1483 .replace('{id}', id);1484 return this.sendRequestGet(urlApi);1485 }1486 getTrackByfilterValTag(data) {1487 const { searchField, val, child, type, id } = data;1488 const token = encodeURIComponent(getAuthToken());1489 const urlApi = apiGetTrackByfilterValTag1490 .concat('?token=', token, '&showFlg=', 1, '&sort=desc&extra=NW')1491 .replace('{searchField}', searchField)1492 .replace('{val}', val)1493 .replace('{child}', child)1494 .replace('{type}', type)1495 .replace('{id}', id);1496 return this.sendRequestGet(urlApi);1497 }1498 updateTagByAdmin(data) {1499 const { desc, id, macAddr, name, priority, type } = data;1500 const urlApi = apiUpdateTagByAdmin.concat('/', type, '/', id);1501 const getToken = getAuthToken();1502 const req = { token: getToken, info: { desc, priority }, loc: { macAddr, name } };1503 return this.sendRequestPut(urlApi, req);1504 }1505 insertTagByAdmin(payload) {1506 const { macAddr, data, fport } = payload;1507 const urlApi = apiInsertTagByAdmin;1508 const getToken = getAuthToken();1509 const req = { token: getToken, data: [{ macAddr, data, fport }] };1510 return this.sendRequest(urlApi, req);1511 }1512 getGetDevMeta(data) {1513 const { fport, meta, val } = data.data;1514 const { showFlg } = data;1515 const token = encodeURIComponent(getAuthToken());1516 const urlApi = apiGetDevMeta1517 .concat('?token=', token, '&showFlg=', showFlg)1518 .replace('{fport}', fport)1519 .replace('{meta}', meta)1520 .replace('{val}', val);1521 return this.sendRequestGet(urlApi);1522 }1523 getTagByMeta(data) {1524 const { type, meta, date } = data.data;1525 // const { showFlg } = data;1526 const token = encodeURIComponent(getAuthToken());1527 let urlApi = apiGetTagByMeta1528 .concat('?token=', token, '&showFlg=', 1, '&paginate=', false)1529 .replace('{type}', type)1530 .replace('{meta}', meta);1531 if ('date' in data.data) {1532 urlApi = urlApi.concat(date);1533 }1534 return this.sendRequestGet(urlApi);1535 }1536 getTagByMetaWPage(data) {1537 const { type, meta, page } = data.data;1538 const { showFlg } = data;1539 const token = encodeURIComponent(getAuthToken());1540 const urlApi = apiGetTagByMeta1541 .concat('?token=', token, '&showFlg=', showFlg, '&paginate=', true, '&page=', page)1542 .replace('{type}', type)1543 .replace('{meta}', meta);1544 return this.sendRequestGet(urlApi);1545 }1546 getShowField(data) {1547 const { fport } = data.data;1548 const token = encodeURIComponent(getAuthToken());1549 const urlApi = apiShowField.concat('?token=', token).replace('{fport}', fport);1550 return this.sendRequestGet(urlApi);1551 }1552 getZoneShowField(data) {1553 const { fport } = data.data;1554 const token = encodeURIComponent(getAuthToken());1555 const urlApi = apiZoneShowField.concat('?token=', token).replace('{fport}', fport);1556 return this.sendRequestGet(urlApi);1557 }1558 updateMeta(dataMeta) {1559 const token = getAuthToken();1560 const data = {1561 meta: dataMeta,1562 token,1563 };1564 const urlApi = apiUpdateMeta.replace('{macAddr}', dataMeta.macAddr);1565 return this.sendRequestPut(urlApi, data);1566 }1567 addDevByAdmin(data) {1568 const token = getAuthToken();1569 const req = {1570 d: [data],1571 token,1572 };1573 return this.sendRequest(apiDev, req);1574 }1575 delDevByAdmin(data) {1576 const { deviceId } = data;1577 const token = getAuthToken();1578 const req = {1579 token,1580 };1581 return this.sendRequestDelete(apiDev.concat('/', deviceId), req);1582 }1583 editDevByAdmin(data) {1584 const { deviceId, d } = data;1585 const getToken = getAuthToken();1586 const urlApi = apiDev.concat('/', deviceId);1587 const req = { token: getToken, d };1588 return this.sendRequestPut(urlApi, req);1589 }1590}1591const api = new ApiRequest();...

Full Screen

Full Screen

api3.create.test.js

Source:api3.create.test.js Github

copy

Full Screen

1/* eslint require-atomic-updates: 0 */2/* global should */3'use strict';4require('should');5describe('API3 CREATE', function() {6 const self = this7 , testConst = require('./fixtures/api3/const.json')8 , instance = require('./fixtures/api3/instance')9 , authSubject = require('./fixtures/api3/authSubject')10 , opTools = require('../lib/api3/shared/operationTools')11 , utils = require('./fixtures/api3/utils')12 ;13 self.validDoc = {14 date: (new Date()).getTime(),15 app: testConst.TEST_APP,16 device: testConst.TEST_DEVICE + ' API3 CREATE',17 eventType: 'Correction Bolus',18 insulin: 0.319 };20 self.validDoc.identifier = opTools.calculateIdentifier(self.validDoc);21 self.timeout(20000);22 /**23 * Cleanup after successful creation24 */25 self.delete = async function deletePermanent (identifier) {26 await self.instance.delete(`${self.url}/${identifier}?permanent=true&token=${self.token.delete}`)27 .expect(204);28 };29 /**30 * Get document detail for futher processing31 */32 self.get = async function get (identifier) {33 let res = await self.instance.get(`${self.url}/${identifier}?token=${self.token.read}`)34 .expect(200);35 return res.body;36 };37 /**38 * Get document detail for futher processing39 */40 self.search = async function search (date) {41 let res = await self.instance.get(`${self.url}?date$eq=${date}&token=${self.token.read}`)42 .expect(200);43 return res.body;44 };45 before(async () => {46 self.instance = await instance.create({});47 self.app = self.instance.app;48 self.env = self.instance.env;49 self.url = '/api/v3/treatments';50 let authResult = await authSubject(self.instance.ctx.authorization.storage);51 self.subject = authResult.subject;52 self.token = authResult.token;53 self.urlToken = `${self.url}?token=${self.token.create}`;54 });55 after(() => {56 self.instance.ctx.bus.teardown();57 });58 it('should require authentication', async () => {59 let res = await self.instance.post(`${self.url}`)60 .send(self.validDoc)61 .expect(401);62 res.body.status.should.equal(401);63 res.body.message.should.equal('Missing or bad access token or JWT');64 });65 it('should not found not existing collection', async () => {66 let res = await self.instance.post(`/api/v3/NOT_EXIST?token=${self.url}`)67 .send(self.validDoc)68 .expect(404);69 res.body.should.be.empty();70 });71 it('should require create permission', async () => {72 let res = await self.instance.post(`${self.url}?token=${self.token.read}`)73 .send(self.validDoc)74 .expect(403);75 res.body.status.should.equal(403);76 res.body.message.should.equal('Missing permission api:treatments:create');77 });78 it('should reject empty body', async () => {79 await self.instance.post(self.urlToken)80 .send({ })81 .expect(400);82 });83 it('should accept valid document', async () => {84 let res = await self.instance.post(self.urlToken)85 .send(self.validDoc)86 .expect(201);87 res.body.should.be.empty();88 res.headers.location.should.equal(`${self.url}/${self.validDoc.identifier}`);89 const lastModified = new Date(res.headers['last-modified']).getTime(); // Last-Modified has trimmed milliseconds90 let body = await self.get(self.validDoc.identifier);91 body.should.containEql(self.validDoc);92 const ms = body.srvModified % 1000;93 (body.srvModified - ms).should.equal(lastModified);94 (body.srvCreated - ms).should.equal(lastModified);95 body.subject.should.equal(self.subject.apiCreate.name);96 await self.delete(self.validDoc.identifier);97 });98 it('should reject missing date', async () => {99 let doc = Object.assign({}, self.validDoc);100 delete doc.date;101 let res = await self.instance.post(self.urlToken)102 .send(doc)103 .expect(400);104 res.body.status.should.equal(400);105 res.body.message.should.equal('Bad or missing date field');106 });107 it('should reject invalid date null', async () => {108 let res = await self.instance.post(self.urlToken)109 .send(Object.assign({}, self.validDoc, { date: null }))110 .expect(400);111 res.body.status.should.equal(400);112 res.body.message.should.equal('Bad or missing date field');113 });114 it('should reject invalid date ABC', async () => {115 let res = await self.instance.post(self.urlToken)116 .send(Object.assign({}, self.validDoc, { date: 'ABC' }))117 .expect(400);118 res.body.status.should.equal(400);119 res.body.message.should.equal('Bad or missing date field');120 });121 it('should reject invalid date -1', async () => {122 let res = await self.instance.post(self.urlToken)123 .send(Object.assign({}, self.validDoc, { date: -1 }))124 .expect(400);125 res.body.status.should.equal(400);126 res.body.message.should.equal('Bad or missing date field');127 });128 it('should reject invalid date 1 (too old)', async () => {129 let res = await self.instance.post(self.urlToken)130 .send(Object.assign({}, self.validDoc, { date: 1 }))131 .expect(400);132 res.body.status.should.equal(400);133 res.body.message.should.equal('Bad or missing date field');134 });135 it('should reject invalid date - illegal format', async () => {136 let res = await self.instance.post(self.urlToken)137 .send(Object.assign({}, self.validDoc, { date: '2019-20-60T50:90:90' }))138 .expect(400);139 res.body.status.should.equal(400);140 res.body.message.should.equal('Bad or missing date field');141 });142 it('should reject invalid utcOffset -5000', async () => {143 let res = await self.instance.post(self.urlToken)144 .send(Object.assign({}, self.validDoc, { utcOffset: -5000 }))145 .expect(400);146 res.body.status.should.equal(400);147 res.body.message.should.equal('Bad or missing utcOffset field');148 });149 it('should reject invalid utcOffset ABC', async () => {150 let res = await self.instance.post(self.urlToken)151 .send(Object.assign({}, self.validDoc, { utcOffset: 'ABC' }))152 .expect(400);153 res.body.status.should.equal(400);154 res.body.message.should.equal('Bad or missing utcOffset field');155 });156 it('should accept valid utcOffset', async () => {157 await self.instance.post(self.urlToken)158 .send(Object.assign({}, self.validDoc, { utcOffset: 120 }))159 .expect(201);160 let body = await self.get(self.validDoc.identifier);161 body.utcOffset.should.equal(120);162 await self.delete(self.validDoc.identifier);163 });164 it('should reject invalid utcOffset null', async () => {165 let res = await self.instance.post(self.urlToken)166 .send(Object.assign({}, self.validDoc, { utcOffset: null }))167 .expect(400);168 res.body.status.should.equal(400);169 res.body.message.should.equal('Bad or missing utcOffset field');170 });171 it('should reject missing app', async () => {172 let doc = Object.assign({}, self.validDoc);173 delete doc.app;174 let res = await self.instance.post(self.urlToken)175 .send(doc)176 .expect(400);177 res.body.status.should.equal(400);178 res.body.message.should.equal('Bad or missing app field');179 });180 it('should reject invalid app null', async () => {181 let res = await self.instance.post(self.urlToken)182 .send(Object.assign({}, self.validDoc, { app: null }))183 .expect(400);184 res.body.status.should.equal(400);185 res.body.message.should.equal('Bad or missing app field');186 });187 it('should reject empty app', async () => {188 let res = await self.instance.post(self.urlToken)189 .send(Object.assign({}, self.validDoc, { app: '' }))190 .expect(400);191 res.body.status.should.equal(400);192 res.body.message.should.equal('Bad or missing app field');193 });194 it('should normalize date and store utcOffset', async () => {195 await self.instance.post(self.urlToken)196 .send(Object.assign({}, self.validDoc, { date: '2019-06-10T08:07:08,576+02:00' }))197 .expect(201);198 let body = await self.get(self.validDoc.identifier);199 body.date.should.equal(1560146828576);200 body.utcOffset.should.equal(120);201 await self.delete(self.validDoc.identifier);202 });203 it('should require update permission for deduplication', async () => {204 self.validDoc.date = (new Date()).getTime();205 self.validDoc.identifier = utils.randomString('32', 'aA#');206 const doc = Object.assign({}, self.validDoc);207 await self.instance.post(self.urlToken)208 .send(doc)209 .expect(201);210 let createdBody = await self.get(doc.identifier);211 createdBody.should.containEql(doc);212 const doc2 = Object.assign({}, doc);213 let res = await self.instance.post(self.urlToken)214 .send(doc2)215 .expect(403);216 res.body.status.should.equal(403);217 res.body.message.should.equal('Missing permission api:treatments:update');218 await self.delete(doc.identifier);219 });220 it('should deduplicate document by identifier', async () => {221 self.validDoc.date = (new Date()).getTime();222 self.validDoc.identifier = utils.randomString('32', 'aA#');223 const doc = Object.assign({}, self.validDoc);224 await self.instance.post(self.urlToken)225 .send(doc)226 .expect(201);227 let createdBody = await self.get(doc.identifier);228 createdBody.should.containEql(doc);229 const doc2 = Object.assign({}, doc, {230 insulin: 0.5231 });232 await self.instance.post(`${self.url}?token=${self.token.all}`)233 .send(doc2)234 .expect(204);235 let updatedBody = await self.get(doc2.identifier);236 updatedBody.should.containEql(doc2);237 await self.delete(doc2.identifier);238 });239 it('should deduplicate document by created_at+eventType', async () => {240 self.validDoc.date = (new Date()).getTime();241 self.validDoc.identifier = utils.randomString('32', 'aA#');242 const doc = Object.assign({}, self.validDoc, { 243 created_at: new Date(self.validDoc.date).toISOString() 244 });245 delete doc.identifier;246 self.instance.ctx.treatments.create([doc], async (err) => { // let's insert the document in APIv1's way247 should.not.exist(err);248 const doc2 = Object.assign({}, doc, {249 insulin: 0.4,250 identifier: utils.randomString('32', 'aA#')251 });252 delete doc2._id; // APIv1 updates input document, we must get rid of _id for the next round253 await self.instance.post(`${self.url}?token=${self.token.all}`)254 .send(doc2)255 .expect(204);256 let updatedBody = await self.get(doc2.identifier);257 updatedBody.should.containEql(doc2);258 await self.delete(doc2.identifier);259 });260 });261 it('should not deduplicate treatment only by created_at', async () => {262 self.validDoc.date = (new Date()).getTime();263 self.validDoc.identifier = utils.randomString('32', 'aA#');264 const doc = Object.assign({}, self.validDoc, { 265 created_at: new Date(self.validDoc.date).toISOString() 266 });267 delete doc.identifier;268 self.instance.ctx.treatments.create([doc], async (err) => { // let's insert the document in APIv1's way269 should.not.exist(err);270 let oldBody = await self.get(doc._id);271 delete doc._id; // APIv1 updates input document, we must get rid of _id for the next round272 oldBody.should.containEql(doc);273 const doc2 = Object.assign({}, doc, {274 eventType: 'Meal Bolus',275 insulin: 0.4,276 identifier: utils.randomString('32', 'aA#')277 });278 await self.instance.post(`${self.url}?token=${self.token.all}`)279 .send(doc2)280 .expect(201);281 let updatedBody = await self.get(doc2.identifier);282 updatedBody.should.containEql(doc2);283 updatedBody.identifier.should.not.equal(oldBody.identifier);284 await self.delete(doc2.identifier);285 await self.delete(oldBody.identifier);286 });287 });288 it('should overwrite deleted document', async () => {289 const date1 = new Date()290 , identifier = utils.randomString('32', 'aA#');291 await self.instance.post(self.urlToken)292 .send(Object.assign({}, self.validDoc, { identifier, date: date1.toISOString() }))293 .expect(201);294 await self.instance.delete(`${self.url}/${identifier}?token=${self.token.delete}`)295 .expect(204);296 const date2 = new Date();297 let res = await self.instance.post(self.urlToken)298 .send(Object.assign({}, self.validDoc, { identifier, date: date2.toISOString() }))299 .expect(403);300 res.body.status.should.be.equal(403);301 res.body.message.should.be.equal('Missing permission api:treatments:update');302 res = await self.instance.post(`${self.url}?token=${self.token.all}`)303 .send(Object.assign({}, self.validDoc, { identifier, date: date2.toISOString() }))304 .expect(204);305 res.body.should.be.empty();306 let body = await self.get(identifier);307 body.date.should.equal(date2.getTime());308 body.identifier.should.equal(identifier);309 await self.delete(identifier);310 });311 it('should calculate the identifier', async () => {312 self.validDoc.date = (new Date()).getTime();313 delete self.validDoc.identifier;314 const validIdentifier = opTools.calculateIdentifier(self.validDoc);315 let res = await self.instance.post(self.urlToken)316 .send(self.validDoc)317 .expect(201);318 res.body.should.be.empty();319 res.headers.location.should.equal(`${self.url}/${validIdentifier}`);320 self.validDoc.identifier = validIdentifier;321 let body = await self.get(validIdentifier);322 body.should.containEql(self.validDoc);323 await self.delete(validIdentifier);324 });325 it('should deduplicate by identifier calculation', async () => {326 self.validDoc.date = (new Date()).getTime();327 delete self.validDoc.identifier;328 const validIdentifier = opTools.calculateIdentifier(self.validDoc);329 let res = await self.instance.post(self.urlToken)330 .send(self.validDoc)331 .expect(201);332 res.body.should.be.empty();333 res.headers.location.should.equal(`${self.url}/${validIdentifier}`);334 self.validDoc.identifier = validIdentifier;335 let body = await self.get(validIdentifier);336 body.should.containEql(self.validDoc);337 delete self.validDoc.identifier;338 res = await self.instance.post(`${self.url}?token=${self.token.update}`)339 .send(self.validDoc)340 .expect(204);341 res.body.should.be.empty();342 res.headers.location.should.equal(`${self.url}/${validIdentifier}`);343 self.validDoc.identifier = validIdentifier;344 body = await self.search(self.validDoc.date);345 body.length.should.equal(1);346 await self.delete(validIdentifier);347 });...

Full Screen

Full Screen

api3.update.test.js

Source:api3.update.test.js Github

copy

Full Screen

1/* eslint require-atomic-updates: 0 */2/* global should */3'use strict';4require('should');5describe('API3 UPDATE', function() {6 const self = this7 , testConst = require('./fixtures/api3/const.json')8 , instance = require('./fixtures/api3/instance')9 , authSubject = require('./fixtures/api3/authSubject')10 , utils = require('./fixtures/api3/utils')11 ;12 self.validDoc = {13 identifier: utils.randomString('32', 'aA#'),14 date: (new Date()).getTime(),15 utcOffset: -180,16 app: testConst.TEST_APP,17 device: testConst.TEST_DEVICE + ' API3 UPDATE',18 eventType: 'Correction Bolus',19 insulin: 0.320 };21 self.timeout(15000);22 /**23 * Get document detail for futher processing24 */25 self.get = async function get (identifier) {26 let res = await self.instance.get(`${self.url}/${identifier}?token=${self.token.read}`)27 .expect(200);28 res.body.status.should.equal(200);29 return res.body.result;30 };31 before(async () => {32 self.instance = await instance.create({});33 self.app = self.instance.app;34 self.env = self.instance.env;35 self.col = 'treatments'36 self.url = `/api/v3/${self.col}`;37 let authResult = await authSubject(self.instance.ctx.authorization.storage);38 self.subject = authResult.subject;39 self.token = authResult.token;40 self.urlToken = `${self.url}/${self.validDoc.identifier}?token=${self.token.update}`41 self.cache = self.instance.cacheMonitor;42 });43 after(() => {44 self.instance.ctx.bus.teardown();45 });46 beforeEach(() => {47 self.cache.clear();48 });49 afterEach(() => {50 self.cache.shouldBeEmpty();51 });52 it('should require authentication', async () => {53 let res = await self.instance.put(`${self.url}/FAKE_IDENTIFIER`)54 .expect(401);55 res.body.status.should.equal(401);56 res.body.message.should.equal('Missing or bad access token or JWT');57 });58 it('should not found not existing collection', async () => {59 let res = await self.instance.put(`/api/v3/NOT_EXIST?token=${self.url}`)60 .send(self.validDoc)61 .expect(404);62 res.body.status.should.equal(404);63 });64 it('should require update permission for upsert', async () => {65 let res = await self.instance.put(`${self.url}/${self.validDoc.identifier}?token=${self.token.update}`)66 .send(self.validDoc)67 .expect(403);68 res.body.status.should.equal(403);69 res.body.message.should.equal('Missing permission api:treatments:create');70 });71 it('should upsert not existing document', async () => {72 let res = await self.instance.put(`${self.url}/${self.validDoc.identifier}?token=${self.token.all}`)73 .send(self.validDoc)74 .expect(201);75 res.body.status.should.equal(201);76 res.body.identifier.should.equal(self.validDoc.identifier);77 self.cache.nextShouldEql(self.col, self.validDoc)78 const lastModified = new Date(res.headers['last-modified']).getTime(); // Last-Modified has trimmed milliseconds79 let body = await self.get(self.validDoc.identifier);80 body.should.containEql(self.validDoc);81 should.not.exist(body.modifiedBy);82 const ms = body.srvModified % 1000;83 (body.srvModified - ms).should.equal(lastModified);84 (body.srvCreated - ms).should.equal(lastModified);85 body.subject.should.equal(self.subject.apiAll.name);86 });87 it('should update the document', async () => {88 self.validDoc.carbs = 10;89 delete self.validDoc.insulin;90 let res = await self.instance.put(self.urlToken)91 .send(self.validDoc)92 .expect(200);93 res.body.status.should.equal(200);94 self.cache.nextShouldEql(self.col, self.validDoc)95 const lastModified = new Date(res.headers['last-modified']).getTime(); // Last-Modified has trimmed milliseconds96 let body = await self.get(self.validDoc.identifier);97 body.should.containEql(self.validDoc);98 should.not.exist(body.insulin);99 should.not.exist(body.modifiedBy);100 const ms = body.srvModified % 1000;101 (body.srvModified - ms).should.equal(lastModified);102 body.subject.should.equal(self.subject.apiUpdate.name);103 });104 it('should update unmodified document since', async () => {105 const doc = Object.assign({}, self.validDoc, {106 carbs: 11107 });108 let res = await self.instance.put(self.urlToken)109 .set('If-Unmodified-Since', new Date(new Date().getTime() + 1000).toUTCString())110 .send(doc)111 .expect(200);112 res.body.status.should.equal(200);113 self.cache.nextShouldEql(self.col, doc)114 let body = await self.get(self.validDoc.identifier);115 body.should.containEql(doc);116 });117 it('should not update document modified since', async () => {118 const doc = Object.assign({}, self.validDoc, {119 carbs: 12120 });121 let body = await self.get(doc.identifier);122 self.validDoc = body;123 let res = await self.instance.put(self.urlToken)124 .set('If-Unmodified-Since', new Date(new Date(body.srvModified).getTime() - 1000).toUTCString())125 .send(doc)126 .expect(412);127 res.body.status.should.equal(412);128 body = await self.get(doc.identifier);129 body.should.eql(self.validDoc);130 });131 it('should reject date alteration', async () => {132 let res = await self.instance.put(self.urlToken)133 .send(Object.assign({}, self.validDoc, { date: self.validDoc.date + 10000 }))134 .expect(400);135 res.body.status.should.equal(400);136 res.body.message.should.equal('Field date cannot be modified by the client');137 });138 it('should reject utcOffset alteration', async () => {139 let res = await self.instance.put(self.urlToken)140 .send(Object.assign({}, self.validDoc, { utcOffset: self.utcOffset - 120 }))141 .expect(400);142 res.body.status.should.equal(400);143 res.body.message.should.equal('Field utcOffset cannot be modified by the client');144 });145 it('should reject eventType alteration', async () => {146 let res = await self.instance.put(self.urlToken)147 .send(Object.assign({}, self.validDoc, { eventType: 'MODIFIED' }))148 .expect(400);149 res.body.status.should.equal(400);150 res.body.message.should.equal('Field eventType cannot be modified by the client');151 });152 it('should reject device alteration', async () => {153 let res = await self.instance.put(self.urlToken)154 .send(Object.assign({}, self.validDoc, { device: 'MODIFIED' }))155 .expect(400);156 res.body.status.should.equal(400);157 res.body.message.should.equal('Field device cannot be modified by the client');158 });159 it('should reject app alteration', async () => {160 let res = await self.instance.put(self.urlToken)161 .send(Object.assign({}, self.validDoc, { app: 'MODIFIED' }))162 .expect(400);163 res.body.status.should.equal(400);164 res.body.message.should.equal('Field app cannot be modified by the client');165 });166 it('should reject srvCreated alteration', async () => {167 let res = await self.instance.put(self.urlToken)168 .send(Object.assign({}, self.validDoc, { srvCreated: self.validDoc.date - 10000 }))169 .expect(400);170 res.body.status.should.equal(400);171 res.body.message.should.equal('Field srvCreated cannot be modified by the client');172 });173 it('should reject subject alteration', async () => {174 let res = await self.instance.put(self.urlToken)175 .send(Object.assign({}, self.validDoc, { subject: 'MODIFIED' }))176 .expect(400);177 res.body.status.should.equal(400);178 res.body.message.should.equal('Field subject cannot be modified by the client');179 });180 it('should reject srvModified alteration', async () => {181 let res = await self.instance.put(self.urlToken)182 .send(Object.assign({}, self.validDoc, { srvModified: self.validDoc.date - 100000 }))183 .expect(400);184 res.body.status.should.equal(400);185 res.body.message.should.equal('Field srvModified cannot be modified by the client');186 });187 it('should reject modifiedBy alteration', async () => {188 let res = await self.instance.put(self.urlToken)189 .send(Object.assign({}, self.validDoc, { modifiedBy: 'MODIFIED' }))190 .expect(400);191 res.body.status.should.equal(400);192 res.body.message.should.equal('Field modifiedBy cannot be modified by the client');193 });194 it('should reject isValid alteration', async () => {195 let res = await self.instance.put(self.urlToken)196 .send(Object.assign({}, self.validDoc, { isValid: false }))197 .expect(400);198 res.body.status.should.equal(400);199 res.body.message.should.equal('Field isValid cannot be modified by the client');200 });201 it('should ignore identifier alteration in body', async () => {202 self.validDoc = await self.get(self.validDoc.identifier);203 let res = await self.instance.put(self.urlToken)204 .send(Object.assign({}, self.validDoc, { identifier: 'MODIFIED' }))205 .expect(200);206 res.body.status.should.equal(200);207 delete self.validDoc.srvModified;208 self.cache.nextShouldEql(self.col, self.validDoc)209 });210 it('should not update deleted document', async () => {211 let res = await self.instance.delete(`${self.url}/${self.validDoc.identifier}?token=${self.token.delete}`)212 .expect(200);213 res.body.status.should.equal(200);214 self.cache.nextShouldDeleteLast(self.col)215 res = await self.instance.put(self.urlToken)216 .send(self.validDoc)217 .expect(410);218 res.body.status.should.equal(410);219 });...

Full Screen

Full Screen

api3.search.test.js

Source:api3.search.test.js Github

copy

Full Screen

1/* eslint require-atomic-updates: 0 */2/* global should */3'use strict';4require('should');5describe('API3 SEARCH', function() {6 const self = this7 , testConst = require('./fixtures/api3/const.json')8 , instance = require('./fixtures/api3/instance')9 , authSubject = require('./fixtures/api3/authSubject')10 , opTools = require('../lib/api3/shared/operationTools')11 ;12 self.docs = testConst.SAMPLE_ENTRIES;13 self.timeout(15000);14 /**15 * Get document detail for futher processing16 */17 self.get = function get (identifier, done) {18 self.instance.get(`${self.url}/${identifier}?token=${self.token.read}`)19 .expect(200)20 .end((err, res) => {21 should.not.exist(err);22 done(res.body);23 });24 };25 /**26 * Create given document in a promise27 */28 self.create = (doc) => new Promise((resolve) => {29 doc.identifier = opTools.calculateIdentifier(doc);30 self.instance.post(`${self.url}?token=${self.token.all}`)31 .send(doc)32 .end((err) => {33 should.not.exist(err);34 self.get(doc.identifier, resolve);35 });36 });37 before(async () => {38 self.testStarted = new Date();39 self.instance = await instance.create({});40 self.app = self.instance.app;41 self.env = self.instance.env;42 self.url = '/api/v3/entries';43 let authResult = await authSubject(self.instance.ctx.authorization.storage);44 self.subject = authResult.subject;45 self.token = authResult.token;46 self.urlToken = `${self.url}?token=${self.token.read}`;47 self.urlTest = `${self.urlToken}&srvModified$gte=${self.testStarted.getTime()}`;48 const promises = testConst.SAMPLE_ENTRIES.map(doc => self.create(doc));49 self.docs = await Promise.all(promises);50 });51 after(() => {52 self.instance.ctx.bus.teardown();53 });54 it('should require authentication', async () => {55 let res = await self.instance.get(self.url)56 .expect(401);57 res.body.status.should.equal(401);58 res.body.message.should.equal('Missing or bad access token or JWT');59 should.not.exist(res.body.result);60 });61 it('should not found not existing collection', async () => {62 let res = await self.instance.get(`/api/v3/NOT_EXIST?token=${self.url}`)63 .send(self.validDoc)64 .expect(404);65 res.body.status.should.equal(404);66 should.not.exist(res.body.result);67 });68 it('should found at least 10 documents', async () => {69 let res = await self.instance.get(self.urlToken)70 .expect(200);71 res.body.status.should.equal(200);72 res.body.result.length.should.be.aboveOrEqual(self.docs.length);73 });74 it('should found at least 10 documents from test start', async () => {75 let res = await self.instance.get(self.urlTest)76 .expect(200);77 res.body.status.should.equal(200);78 res.body.result.length.should.be.aboveOrEqual(self.docs.length);79 });80 it('should reject invalid limit - not a number', async () => {81 let res = await self.instance.get(`${self.urlToken}&limit=INVALID`)82 .expect(400);83 res.body.status.should.equal(400);84 res.body.message.should.equal('Parameter limit out of tolerance');85 should.not.exist(res.body.result);86 });87 it('should reject invalid limit - negative number', async () => {88 let res = await self.instance.get(`${self.urlToken}&limit=-1`)89 .expect(400);90 res.body.status.should.equal(400);91 res.body.message.should.equal('Parameter limit out of tolerance');92 should.not.exist(res.body.result);93 });94 it('should reject invalid limit - zero', async () => {95 let res = await self.instance.get(`${self.urlToken}&limit=0`)96 .expect(400);97 res.body.status.should.equal(400);98 res.body.message.should.equal('Parameter limit out of tolerance');99 should.not.exist(res.body.result);100 });101 it('should accept valid limit', async () => {102 let res = await self.instance.get(`${self.urlToken}&limit=3`)103 .expect(200);104 res.body.status.should.equal(200);105 res.body.result.length.should.equal(3);106 });107 it('should reject invalid skip - not a number', async () => {108 let res = await self.instance.get(`${self.urlToken}&skip=INVALID`)109 .expect(400);110 res.body.status.should.equal(400);111 res.body.message.should.equal('Parameter skip out of tolerance');112 should.not.exist(res.body.result);113 });114 it('should reject invalid skip - negative number', async () => {115 let res = await self.instance.get(`${self.urlToken}&skip=-5`)116 .expect(400);117 res.body.status.should.equal(400);118 res.body.message.should.equal('Parameter skip out of tolerance');119 should.not.exist(res.body.result);120 });121 it('should reject both sort and sort$desc', async () => {122 let res = await self.instance.get(`${self.urlToken}&sort=date&sort$desc=created_at`)123 .expect(400);124 res.body.status.should.equal(400);125 res.body.message.should.equal('Parameters sort and sort_desc cannot be combined');126 should.not.exist(res.body.result);127 });128 it('should sort well by date field', async () => {129 let res = await self.instance.get(`${self.urlTest}&sort=date`)130 .expect(200);131 res.body.status.should.equal(200);132 const ascending = res.body.result;133 const length = ascending.length;134 length.should.be.aboveOrEqual(self.docs.length);135 res = await self.instance.get(`${self.urlTest}&sort$desc=date`)136 .expect(200);137 res.body.status.should.equal(200);138 const descending = res.body.result;139 descending.length.should.equal(length);140 for (let i in ascending) {141 ascending[i].should.eql(descending[length - i - 1]);142 if (i > 0) {143 ascending[i - 1].date.should.be.lessThanOrEqual(ascending[i].date);144 }145 }146 });147 it('should skip documents', async () => {148 let res = await self.instance.get(`${self.urlToken}&sort=date&limit=8`)149 .expect(200);150 res.body.status.should.equal(200);151 const fullDocs = res.body.result;152 fullDocs.length.should.equal(8);153 res = await self.instance.get(`${self.urlToken}&sort=date&skip=3&limit=5`)154 .expect(200);155 res.body.status.should.equal(200);156 const skipDocs = res.body.result;157 skipDocs.length.should.equal(5);158 for (let i = 0; i < 3; i++) {159 skipDocs[i].should.be.eql(fullDocs[i + 3]);160 }161 });162 it('should project selected fields', async () => {163 let res = await self.instance.get(`${self.urlToken}&fields=date,app,subject`)164 .expect(200);165 res.body.status.should.equal(200);166 res.body.result.forEach(doc => {167 const docFields = Object.getOwnPropertyNames(doc);168 docFields.sort().should.be.eql(['app', 'date', 'subject']);169 });170 });171 it('should project all fields', async () => {172 let res = await self.instance.get(`${self.urlToken}&fields=_all`)173 .expect(200);174 res.body.status.should.equal(200);175 res.body.result.forEach(doc => {176 Object.getOwnPropertyNames(doc).length.should.be.aboveOrEqual(10);177 Object.prototype.hasOwnProperty.call(doc, '_id').should.not.be.true();178 Object.prototype.hasOwnProperty.call(doc, 'identifier').should.be.true();179 Object.prototype.hasOwnProperty.call(doc, 'srvModified').should.be.true();180 Object.prototype.hasOwnProperty.call(doc, 'srvCreated').should.be.true();181 });182 });183 it('should not exceed the limit of docs count', async () => {184 const apiApp = self.instance.ctx.apiApp185 , limitBackup = apiApp.get('API3_MAX_LIMIT');186 apiApp.set('API3_MAX_LIMIT', 5);187 let res = await self.instance.get(`${self.urlToken}&limit=10`)188 .expect(400);189 res.body.status.should.equal(400);190 res.body.message.should.equal('Parameter limit out of tolerance');191 apiApp.set('API3_MAX_LIMIT', limitBackup);192 });193 it('should respect the ceiling (hard) limit of docs', async () => {194 const apiApp = self.instance.ctx.apiApp195 , limitBackup = apiApp.get('API3_MAX_LIMIT');196 apiApp.set('API3_MAX_LIMIT', 5);197 let res = await self.instance.get(`${self.urlToken}`)198 .expect(200);199 res.body.status.should.equal(200);200 res.body.result.length.should.equal(5);201 apiApp.set('API3_MAX_LIMIT', limitBackup);202 });...

Full Screen

Full Screen

api3.patch.test.js

Source:api3.patch.test.js Github

copy

Full Screen

1/* eslint require-atomic-updates: 0 */2'use strict';3require('should');4describe('API3 PATCH', function() {5 const self = this6 , testConst = require('./fixtures/api3/const.json')7 , instance = require('./fixtures/api3/instance')8 , authSubject = require('./fixtures/api3/authSubject')9 , opTools = require('../lib/api3/shared/operationTools')10 ;11 self.validDoc = {12 date: (new Date()).getTime(),13 utcOffset: -180,14 app: testConst.TEST_APP,15 device: testConst.TEST_DEVICE + ' API3 PATCH',16 eventType: 'Correction Bolus',17 insulin: 0.318 };19 self.validDoc.identifier = opTools.calculateIdentifier(self.validDoc);20 self.timeout(15000);21 /**22 * Get document detail for futher processing23 */24 self.get = async function get (identifier) {25 let res = await self.instance.get(`${self.url}/${identifier}?token=${self.token.read}`)26 .expect(200);27 res.body.status.should.equal(200);28 return res.body.result;29 };30 before(async () => {31 self.instance = await instance.create({});32 self.app = self.instance.app;33 self.env = self.instance.env;34 self.col = 'treatments';35 self.url = `/api/v3/${self.col}`;36 let authResult = await authSubject(self.instance.ctx.authorization.storage);37 self.subject = authResult.subject;38 self.token = authResult.token;39 self.urlToken = `${self.url}/${self.validDoc.identifier}?token=${self.token.update}`;40 self.cache = self.instance.cacheMonitor;41 });42 after(() => {43 self.instance.ctx.bus.teardown();44 });45 beforeEach(() => {46 self.cache.clear();47 });48 afterEach(() => {49 self.cache.shouldBeEmpty();50 });51 it('should require authentication', async () => {52 let res = await self.instance.patch(`${self.url}/FAKE_IDENTIFIER`)53 .expect(401);54 res.body.status.should.equal(401);55 res.body.message.should.equal('Missing or bad access token or JWT');56 });57 it('should not found not existing collection', async () => {58 let res = await self.instance.patch(`/api/v3/NOT_EXIST?token=${self.url}`)59 .send(self.validDoc)60 .expect(404);61 res.body.status.should.equal(404);62 });63 it('should not found not existing document', async () => {64 let res = await self.instance.patch(self.urlToken)65 .send(self.validDoc)66 .expect(404);67 res.body.status.should.equal(404);68 // now let's insert the document for further patching69 res = await self.instance.post(`${self.url}?token=${self.token.create}`)70 .send(self.validDoc)71 .expect(201);72 res.body.status.should.equal(201);73 self.cache.nextShouldEql(self.col, self.validDoc)74 });75 it('should reject identifier alteration', async () => {76 let res = await self.instance.patch(self.urlToken)77 .send(Object.assign({}, self.validDoc, { identifier: 'MODIFIED'}))78 .expect(400);79 res.body.status.should.equal(400);80 res.body.message.should.equal('Field identifier cannot be modified by the client');81 });82 it('should reject date alteration', async () => {83 let res = await self.instance.patch(self.urlToken)84 .send(Object.assign({}, self.validDoc, { date: self.validDoc.date + 10000 }))85 .expect(400);86 res.body.status.should.equal(400);87 res.body.message.should.equal('Field date cannot be modified by the client');88 });89 it('should reject utcOffset alteration', async () => {90 let res = await self.instance.patch(self.urlToken)91 .send(Object.assign({}, self.validDoc, { utcOffset: self.utcOffset - 120 }))92 .expect(400);93 res.body.status.should.equal(400);94 res.body.message.should.equal('Field utcOffset cannot be modified by the client');95 });96 it('should reject eventType alteration', async () => {97 let res = await self.instance.patch(self.urlToken)98 .send(Object.assign({}, self.validDoc, { eventType: 'MODIFIED' }))99 .expect(400);100 res.body.status.should.equal(400);101 res.body.message.should.equal('Field eventType cannot be modified by the client');102 });103 it('should reject device alteration', async () => {104 let res = await self.instance.patch(self.urlToken)105 .send(Object.assign({}, self.validDoc, { device: 'MODIFIED' }))106 .expect(400);107 res.body.status.should.equal(400);108 res.body.message.should.equal('Field device cannot be modified by the client');109 });110 it('should reject app alteration', async () => {111 let res = await self.instance.patch(self.urlToken)112 .send(Object.assign({}, self.validDoc, { app: 'MODIFIED' }))113 .expect(400);114 res.body.status.should.equal(400);115 res.body.message.should.equal('Field app cannot be modified by the client');116 });117 it('should reject srvCreated alteration', async () => {118 let res = await self.instance.patch(self.urlToken)119 .send(Object.assign({}, self.validDoc, { srvCreated: self.validDoc.date - 10000 }))120 .expect(400);121 res.body.status.should.equal(400);122 res.body.message.should.equal('Field srvCreated cannot be modified by the client');123 });124 it('should reject subject alteration', async () => {125 let res = await self.instance.patch(self.urlToken)126 .send(Object.assign({}, self.validDoc, { subject: 'MODIFIED' }))127 .expect(400);128 res.body.status.should.equal(400);129 res.body.message.should.equal('Field subject cannot be modified by the client');130 });131 it('should reject srvModified alteration', async () => {132 let res = await self.instance.patch(self.urlToken)133 .send(Object.assign({}, self.validDoc, { srvModified: self.validDoc.date - 100000 }))134 .expect(400);135 res.body.status.should.equal(400);136 res.body.message.should.equal('Field srvModified cannot be modified by the client');137 });138 it('should reject modifiedBy alteration', async () => {139 let res = await self.instance.patch(self.urlToken)140 .send(Object.assign({}, self.validDoc, { modifiedBy: 'MODIFIED' }))141 .expect(400);142 res.body.status.should.equal(400);143 res.body.message.should.equal('Field modifiedBy cannot be modified by the client');144 });145 it('should reject isValid alteration', async () => {146 let res = await self.instance.patch(self.urlToken)147 .send(Object.assign({}, self.validDoc, { isValid: false }))148 .expect(400);149 res.body.status.should.equal(400);150 res.body.message.should.equal('Field isValid cannot be modified by the client');151 });152 it('should patch document', async () => {153 self.validDoc.carbs = 10;154 let res = await self.instance.patch(self.urlToken)155 .send(self.validDoc)156 .expect(200);157 res.body.status.should.equal(200);158 let body = await self.get(self.validDoc.identifier);159 body.carbs.should.equal(10);160 body.insulin.should.equal(0.3);161 body.subject.should.equal(self.subject.apiCreate.name);162 body.modifiedBy.should.equal(self.subject.apiUpdate.name);163 self.cache.nextShouldEql(self.col, body)164 });...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 const token = await page._delegate.urlToken(url);7 console.log(token);8 await browser.close();9})();10const url = page.url();11const url = page.url();

Full Screen

Using AI Code Generation

copy

Full Screen

1const playwright = require('playwright-core');2(async () => {3 const browser = await playwright.chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 const token = await page.context().newCDPSession(page).send('URLToken.getToken');7 console.log(token.token);8 await browser.close();9})();10const playwright = require('playwright-core');11(async () => {12 const browser = await playwright.chromium.launch({13 });14 const context = await browser.newContext();15 const page = await context.newPage();16 await browser.close();17})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { URLToken } = require('playwright');2const token = URLToken.generate();3console.log(token);4const { URLToken } = require('playwright');5const token = URLToken.generate();6console.log(token);7const { URLToken } = require('playwright');8const token = URLToken.generate();9console.log(token);10const { URLToken } = require('playwright');11const token = URLToken.generate();12console.log(token);13const { URLToken } = require('playwright');14const token = URLToken.generate();15console.log(token);16const { URLToken } = require('playwright');17const token = URLToken.generate();18console.log(token);19const { URLToken } = require('playwright');20const token = URLToken.generate();21console.log(token);22const { URLToken } = require('playwright');23const token = URLToken.generate();24console.log(token);25const { URLToken } = require('playwright');26const token = URLToken.generate();27console.log(token);28const { URLToken } = require('playwright');29const token = URLToken.generate();30console.log(token);31const { URLToken } = require('playwright');32const token = URLToken.generate();33console.log(token);34const { URLToken } = require('playwright');35const token = URLToken.generate();36console.log(token);37const { URLToken } = require('playwright');38const token = URLToken.generate();39console.log(token);40const { URLToken } = require('playwright');41const token = URLToken.generate();42console.log(token);43const { URLToken } = require

Full Screen

Using AI Code Generation

copy

Full Screen

1const { URLToken } = require('@playwright/test/lib/utils/url');2const { URLToken } = require('@playwright/test/lib/utils/url');3import { URLToken } from '@playwright/test/lib/utils/url';4import { URLToken } from '@playwright/test/lib/utils/url';5import { URLToken } from '@playwright/test/lib/utils/url';6import { URLToken } from '@playwright/test/lib/utils/url';7import { URLToken } from '@playwright/test/lib/utils/url';8import { URLToken } from '@playwright/test/lib/utils/url';9import { URLToken } from '@playwright/test/lib/utils/url';10import { URLToken } from '@playwright/test/lib/utils/url';11import { URLToken } from '@playwright/test/lib/utils/url';12import { URLToken } from '@playwright

Full Screen

Using AI Code Generation

copy

Full Screen

1const { URLToken } = require('@playwright/test');2const token = URLToken.from(url);3console.log(token);4const { URLToken } = require('@playwright/test');5console.log(token);6const { URLToken } = require('@playwright/test');7console.log(token);8const { URLToken } = require('@playwright/test');9console.log(token.toString());10const { URLToken } = require('@playwright/test');11console.log(token.toURL());12const { URLToken } = require('@playwright/test');13console.log(token.toJSON());14const { URLToken } = require('@playwright/test');15console.log(token.valueOf());16const { URLToken } = require('@playwright/test');17console.log(token + '');18const { URLToken } = require('@playwright/test');19console.log(token.toString() === token + '');20const { URLToken } = require('@playwright/test');21console.log(token

Full Screen

Using AI Code Generation

copy

Full Screen

1const { URLToken } = require('playwright-core/lib/client/urlToken');2const token = URLToken.generate();3const { chromium } = require('playwright-core');4(async () => {5 const browser = await chromium.launch();6 const context = await browser.newContext();7 const page = await context.newPage();8 await browser.close();9})();10const { chromium } = require('playwright-core');11(async () => {12 const browser = await chromium.launchServer();13 browser.on('connection', (ws, request) => {14 const token = request.url.split('token=')[1];15 if (URLToken.verify(token)) {16 ws.on('close', () => {17 });18 } else {19 ws.close();20 }21 });22})();

Full Screen

Playwright tutorial

LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.

Chapters:

  1. What is Playwright : Playwright is comparatively new but has gained good popularity. Get to know some history of the Playwright with some interesting facts connected with it.
  2. How To Install Playwright : Learn in detail about what basic configuration and dependencies are required for installing Playwright and run a test. Get a step-by-step direction for installing the Playwright automation framework.
  3. Playwright Futuristic Features: Launched in 2020, Playwright gained huge popularity quickly because of some obliging features such as Playwright Test Generator and Inspector, Playwright Reporter, Playwright auto-waiting mechanism and etc. Read up on those features to master Playwright testing.
  4. What is Component Testing: Component testing in Playwright is a unique feature that allows a tester to test a single component of a web application without integrating them with other elements. Learn how to perform Component testing on the Playwright automation framework.
  5. Inputs And Buttons In Playwright: Every website has Input boxes and buttons; learn about testing inputs and buttons with different scenarios and examples.
  6. Functions and Selectors in Playwright: Learn how to launch the Chromium browser with Playwright. Also, gain a better understanding of some important functions like “BrowserContext,” which allows you to run multiple browser sessions, and “newPage” which interacts with a page.
  7. Handling Alerts and Dropdowns in Playwright : Playwright interact with different types of alerts and pop-ups, such as simple, confirmation, and prompt, and different types of dropdowns, such as single selector and multi-selector get your hands-on with handling alerts and dropdown in Playright testing.
  8. Playwright vs Puppeteer: Get to know about the difference between two testing frameworks and how they are different than one another, which browsers they support, and what features they provide.
  9. Run Playwright Tests on LambdaTest: Playwright testing with LambdaTest leverages test performance to the utmost. You can run multiple Playwright tests in Parallel with the LammbdaTest test cloud. Get a step-by-step guide to run your Playwright test on the LambdaTest platform.
  10. Playwright Python Tutorial: Playwright automation framework support all major languages such as Python, JavaScript, TypeScript, .NET and etc. However, there are various advantages to Python end-to-end testing with Playwright because of its versatile utility. Get the hang of Playwright python testing with this chapter.
  11. Playwright End To End Testing Tutorial: Get your hands on with Playwright end-to-end testing and learn to use some exciting features such as TraceViewer, Debugging, Networking, Component testing, Visual testing, and many more.
  12. Playwright Video Tutorial: Watch the video tutorials on Playwright testing from experts and get a consecutive in-depth explanation of Playwright automation testing.

Run Playwright Internal automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful