How to use axios.post method in Appium Base Driver

Best JavaScript code snippet using appium-base-driver

Run Appium Base Driver automation tests on LambdaTest cloud grid

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

API.js

Source: API.js Github

copy
1import axios from "axios";
2
3export const API = {
4  
5    saveNewUser: function(user, notify, image) {
6      const obj = {
7        user: user,
8        notify: notify,
9        image: image
10      }
11      return axios.post("/api/user/register", obj);
12    },
13    loginUser: function(loginData) {
14      return axios.post("/api/user/login", loginData);
15    },
16    getUserbyId: function(id) {
17      return axios.post("/api/user/" + id);
18    },
19    checkFriendRequest: function(username) {
20      return axios.post("/api/user/friendRequest/" + username)
21    },
22    acceptFriendRequest: function(username, friendUsername) {
23      return axios.post("/api/user/acceptFriendRequest/" + username, {friendUsername: friendUsername})
24    },
25    declineFriendRequest: function(username, friendUsername) {
26      return axios.post("/api/user/declineFriendRequest/" + username, {friendUsername: friendUsername})
27    },
28    getAllUsersPantheon: function(username) {
29      return axios.post("/api/user/allPantheon/" + username);
30    },
31    allUserPantheons: function(username, user) {
32      return axios.post("/api/user/allUserPantheons/" + username, user)
33    },
34    // saveReview: function(user, review) {
35    //   return axios.post("/api/user/review/" + user, review);
36    // },
37    // getReview: function(id) {
38    //   return axios.post("/api/user/mediaReview/" + id);
39    // },
40    // getMaxRatings: function() {
41    //   return axios.post("api/maxRatings");
42    // },
43    addFriend: function(username, selector, input) {
44      const obj = {
45        username: username,
46        selector: selector,
47        input: input
48      };
49      return axios.post("api/user/addFriend/" + username, obj);
50    },
51    getFriends: function(username) {
52      return axios.post("api/user/getFriends/" + username);
53    },
54    getFriendsPantheon: function (user) {
55      return axios.post("api/user/getFriendsPantheon/" + user.username, user)
56    },
57    savePantheon: function(data) {
58      return axios.post("api/pantheon", data);
59    },
60    getNonAcceptedPantheons: function(username) {
61      return axios.post("api/pantheon/" + username);
62    },
63    getUserPantheonInteractions: function(username) {
64      return axios.post("api/user/pantheonInteractions/" + username)
65    },
66    acceptPantheon: function(id, username) {
67      const obj = {
68        username: username
69      };
70      return axios.post("api/user/pantheon/" + id, obj)
71    },
72    declinePantheon: function(id, username) {
73      const obj = {
74        username: username
75      };
76      return axios.post("api/user/pantheonDeclined/" + id, obj)
77    },
78    getPantheonBattle: function(username) {
79      return axios.post("api/pantheon/selectMusic/" + username)
80    },
81    saveSong: function(username, song, pantheonId) {
82      const obj = {
83        song: song,
84        pantheonId: pantheonId
85      };
86      return axios.post("api/pantheon/song/" + username, obj)
87    },
88    checkPantheonTimer: function(username) {
89      return axios.post("api/pantheon/timer/" + username);
90    },
91    submitVote: function(username, fighter, pantheonId, battle, number) {
92      const obj = {
93        username: username,
94        fighter: fighter,
95        battle: battle,
96        number: number
97      };
98      return axios.post("api/pantheon/vote/" + pantheonId, obj)
99    },
100    finalVote: function(username) {
101      return axios.post("api/pantheon/finalVote/" + username);
102    },
103    getResultsPantheon: function (username) {
104      return axios.post("api/pantheon/results/" + username);
105    },
106    submitFinalVote: function(username, fighter, pantheonId, battle) {
107      const obj = {
108        username: username,
109        fighter: fighter,
110        battle: battle,
111      };
112      return axios.post("api/pantheon/finalVoting/" + pantheonId, obj)
113    },
114    checkFinalTimer: function(username) {
115      return axios.post("api/pantheon/finalTimer/" + username);
116    },
117    getWinner: function(username) {
118      return axios.post("api/pantheon/winner/" + username);
119    },
120    completePantheon: function(username) {
121      return axios.post("api/pantheon/complete/" + username)
122    }
123    // getActivePantheon: function(id) {
124    //   return axios.post("api/pantheon/creator/" + id);
125    // },
126    // startMusic: function (item) {
127    //   console.log(item)
128    //   return axios.post("api/pantheon/music/" + item.id, item);
129    // },
130    // getMusic: function (username) {
131    //   return axios.post("api/pantheon/find/" + username)
132    // },
133    // submitBattle: function (obj, username) {
134    //   return axios.post("api/pantheon/battle/" + username, obj)
135    // },
136    // getVotingPantheon: function (username) {
137    //   return axios.post("api/pantheon/voting/" + username);
138    // },
139    // saveVotes: function (obj) {
140    //   return axios.post("api/pantheon/saveVotes/" + obj.username, obj)
141    // },
142    // getResults: function (username) {
143    //   return axios.post("api/pantheon/results/" + username)
144    // },
145    // createFinalBattle: function (id) {
146    //   return axios.post("api/pantheon/finalBattle/" + id)
147    // },
148    // getFinalMusic: function (username) {
149    //   return axios.post("api/pantheon/finalMusic/" + username)
150    // },
151    // submitFinalBattle: function (obj, username) {
152    //   return axios.post("api/pantheon/finalMusicChoice/" + username, obj)
153    // },
154    // getFinalVotingPantheon: function (username) {
155    //   return axios.post("api/pantheon/finalVoting/" + username);
156    // },
157    // saveFinalVotes: function (obj, username) {
158    //   return axios.post("api/pantheon/saveFinalVotes/" + username, obj)
159    // },
160    // getFinalResults: function (username) {
161    //   return axios.post("api/pantheon/finalResults/" + username)
162    // },
163    // completePantheon: function (pantheonId) {
164    //   return axios.post("api/pantheon/complete/" + pantheonId)
165    // }
166};
Full Screen

depart.js

Source: depart.js Github

copy
1/**
2 * 部门actions
3 */
4import $axios from "../constants/constant";
5
6/**
7 * 获取部门列表
8 * @param {*} params
9 */
10export function getDepartSelect(params) {
11  return $axios.post("/depart/select", params);
12}
13
14/**
15 * 获取部门列表
16 * @param {*} params
17 */
18export function getDepartList(params) {
19  return $axios.post("/depart/list", params);
20}
21
22/**
23 * 新增修改部门
24 * @param {*} params
25 */
26export function addOrUpdateDepart(params) {
27  return $axios.post("/depart/add", params);
28}
29
30/**
31 * 资产列表
32 * @param {*} params
33 */
34export function getAssetsList(params) {
35  return $axios.post("/assests/list", params);
36}
37
38/**
39 * 保存资产
40 * @param {*} params
41 */
42export function addOrUpdateAssets(params) {
43  return $axios.post("/assests/save", params);
44}
45
46/**
47 * 删除资产
48 * @param {*} id
49 */
50export function deleteAssetsById(id) {
51  return $axios.post(`/assests/delete/${id}`);
52}
53
54/**
55 * 报废资产
56 * @param {*} id
57 */
58export function loseAssetsById(id) {
59  return $axios.post(`/assests/lose/${id}`);
60}
61
62/**
63 * 获取我申请的维修单
64 * @param {*} params
65 */
66export function getKeepMyList(params) {
67  return $axios.post("/keep/my/list", params);
68}
69
70/**
71 * 维修人员
72 * @param {*} params
73 */
74export function getKeepUserSelect(params) {
75  return $axios.post("/keep/user/select", params);
76}
77
78/**
79 * 待审核列表
80 * @param {*} params
81 */
82export function getVerifyList(params) {
83  return $axios.post("/keep/verify/list", params);
84}
85
86/**
87 * 保存资产
88 * @param {*} params
89 */
90export function addOrUpdateKeep(params) {
91  return $axios.post("/keep/add", params);
92}
93
94/**
95 * 维修申请待审核
96 * @param {*} params
97 */
98export function getKeepApplyVerify(params) {
99  return $axios.post("/keep/apply/verify", params);
100}
101
102/**
103 * 维修申请拒绝
104 * @param {*} params
105 */
106export function getKeepApplyRefuse(params) {
107  return $axios.post("/keep/apply/refuse", params);
108}
109
110/**
111 * 维修审核待审核
112 * @param {*} params
113 */
114export function getKeepAdminVerify(params) {
115  return $axios.post("/keep/admin/verify", params);
116}
117
118/**
119 * 维修审核已驳回
120 * @param {*} params
121 */
122export function getKeepAdminRefuse(params) {
123  return $axios.post("/keep/admin/refuse", params);
124}
125
126/**
127 * 审核维修单
128 * @param {*} params
129 */
130export function shKeepVerify(params) {
131  return $axios.post("/keep/verify", params);
132}
133
134/**
135 * 维修进度待维修
136 * @param {*} params
137 */
138export function getSpeedKeeping(params) {
139  return $axios.post("/keep/speed/keeping", params);
140}
141
142/**
143 * 维修进度待维修
144 * @param {*} params
145 */
146export function getSpeedFinishi(params) {
147  return $axios.post("/keep/speed/finish", params);
148}
149
150/**
151 * 自主巡检
152 * @param {*} params
153 */
154export function getPatrolAutoList(params) {
155  return $axios.post("/patrol/auto/list", params);
156}
157
158/**
159 * 定期巡检
160 * @param {*} params
161 */
162export function getPatrolTimeList(params) {
163  return $axios.post("/patrol/time/list", params);
164}
165
166/**
167 * 新增编辑异常记录
168 * @param {*} type
169 * @param {*} params
170 */
171export function addOrUpdateYichang(type, params) {
172  return $axios.post(`/patrol/${type}/save`, params);
173}
174
175/**
176 * 删除巡检
177 * @param {*} id
178 */
179export function deletePatrol(id) {
180  return $axios.post(`/patrol/delete/${id}`);
181}
182
183export function getParrolDetail(id) {
184  return $axios.post(`/patrol/find/${id}`);
185}
186
187/**
188 * 获取首页数据
189 */
190export function getIndexData(params) {
191  return $axios.post("/data/chart", params);
192}
193
194/**
195 * 删除
196 * @param {*} id
197 */
198export function deleteKeep(id) {
199  return $axios.post(`/keep/delete/${id}`);
200}
201
202/**
203 * 详情
204 */
205export function getKeepDetail(id) {
206  return $axios.post(`/keep/find/${id}`);
207}
208
209export function subKeepRemark(params) {
210  return $axios.post("/keep/remark", params);
211}
212
Full Screen

ship.js

Source: ship.js Github

copy
1 import axios from '../axios';
2
3let base =configURL.shipUrl;    // 船务
4
5let base2 = configURL.infoUrl;   // 资讯
6
7let base3 = configURL.appUrl; //app船务
8
9
10
11// 我要租船
12export const start = params => { return axios.post(`${base}/shipPact/queryValueSetEle.json`, params).then(res => res.data); };
13
14export const saveForm = params => { return axios.post(`${base}/pallet/save.json`, params).then(res => res.data); };
15
16export const trader = params => { return axios.post(`${base}/traderNameList.json`, params).then(res => res.data); };
17
18export const shipInfoData = params => { return axios.post(`${base}/sysShip/findSysShipByImoName.json`, params).then(res => res.data); };    //船舶资料
19
20export const queryValueSet = params => { return axios.post(`${base}/sysShip/queryValueSet.json`, params).then(res => res.data); };    //船舶资料 下拉
21
22export const tideData = params => { return axios.post(`${base}/tide/findTideListByPortDate.json`, params).then(res => res.data); };    //潮汐
23
24export const tideDataApp = params => { return axios.post(`${base3}/ship/tide/findTideListByPortDate.json`, params).then(res => res.data); };    //潮汐
25
26export const conversionAllData = params => { return axios.post(`${base}/om/unit/findAll.json`, params).then(res => res.data); };    //单位换算 - 全
27
28export const conversionData = params => { return axios.post(`${base}/om/unit/getRateInfo.json`, params).then(res => res.data); };    //单位换算 - 单
29
30export const basicData = params => { return axios.post(`${base}/om/basicTariff/findBasicTariffByPort.json`, params).then(res => res.data); };    //基础运价
31
32export const queryTrack = params => { return axios.post(`${base}/shipPact/queryTrack.json`, params).then(res => res.data); };    //船务跟踪
33
34export const bootsInfo = params => { return axios.post(`${base}/shipPlate/findShipPlateDetailForground.json`, params).then(res => res.data); }; //船盘信息
35
36export const shippingCost = params => { return axios.post(`${base}/om/dealPoints/getDealPointsDates.json`, params).then(res => res.data); } //运费估算 船型
37
38export const costLoad = params => { return axios.post(`${base}/om/basicTariff/findAllPortList.json`, params).then(res => res.data); } //运费估算 装卸港
39
40export const CostSearch = params => { return axios.post(`${base}/om/basicTariff/freightTools.json`, params).then(res => res.data); } //运费估算
41
42export const CostDates = params => { return axios.post(`${base}/om/dealPoints/getDealPointsDates.json`, params).then(res => res.data); } // 运费详情日期
43
44export const bootsList = params => {return axios.post(`${base}/shipPlate/queryAllShipPlateList.json`, params).then(res => res.data);} // 胎盘列表
45
46export const transMore = params => {return axios.post(`${base}/transit/queryMoreTransitList.json`, params).then(res => res.data);} // 全程概览更多
47
48export const goodsList = params => { return axios.post(`${base}/pallet/findMorePalletList.json`, params).then(res => res.data);};   // 货盘列表
49
50export const goodsInfo = params => { return axios.post(`${base}/pallet/findPalletDetail.json`, params).then(res => res.data);};   // 货盘列表
51
52
53// 首页
54export const topInfo = params => { return axios.post(`${base}/shipPlate/findShipPlateList.json`, params).then(res => res.data); };
55
56export const dayInfo = params => { return axios.post(`${base}/om/dealPoints/getTodayDealPoints.json`, params).then(res => res.data); };
57
58//export const oceanInfo = params => { return axios.post(`${base2}/front/infoList.json`, params).then(res => res.data); };  //海运
59//
60//export const daysInfo = params => { return axios.post(`${base2}/front/infoList.json`, params).then(res => res.data); }; //日报
61
62export const userLoad = params => { return axios.get(`${base}/current_user/get.json`, params).then(res => res.data);};   // 登入
63
64export const userLoadInfo = params => { return axios.get(`${base2}/current_user/get.json`, params).then(res => res.data);};   // 资讯登入
65
66export const goodData = params => { return axios.post(`${base}/pallet/findPalletList.json`, params).then(res => res.data);};   // 货盘滚动
67
68export const oceanInfo = params => { return axios.post(`${base2}/front/infoListOS.json`, params).then(res => res.data); };  //海运
69
70export const daysInfo = params => { return axios.post(`${base2}/front/infoListOS.json`, params).then(res => res.data); }; //日报
71
72export const mapgui = params => { return axios.post(`${base}/api/geojson/waypoint.json`, params).then(res => res.data); };
73
74export const columnList = params => { return axios.post(`${base2}/column/columnList.json`, params).then(res => res.data); }; //大咖秀
75
76export const  dingYue = params => { return axios.post(`${base2}/subscribe/subscribeColumn.json`, params).then(res => res.data); }; //订阅专栏
77
78export const  cancle = params => { return axios.post(`${base2}/subscribe/removeSubscribe.json`, params).then(res => res.data); }; //取消关注
79
80export const  ShipPlateDetail = params => { return axios.post(`${base}/shipPlate/findShipPlateDetailByShip.json`, params).then(res => res.data); }; //船盘详情
81
82export const Lloydsfile = params => { return axios.post(`${base}/api/weather/lsRecord.json`, params).then(res => res.data); }; //劳氏档案
83
84export const typhoon = params => { return axios.post(`${base}/api/weather/typhoon.json`, params).then(res => res.data);}; //台风
85
86export const navigationWarning = params => { return axios.post(`${base}/api/weather/navigationWarning.json`, params).then(res => res.data);}; //海盗、航线预警
87
88export const weatherTime = params => { return axios.get(`${base}/api/weather/dateSchedule.json`).then(res => res.data);}; //气象海况气象时间列表
89 
90export const weatherForecast = params => { return axios.post(`${base}/api/weather/forecast.json`, params).then(res => res.data);}; //三天气象预报接口
91
92 export const homeInfo = params => { return axios.post(`${base}/om/dealPoints/queryDealPoints.json`, params).then(res => res.data);}; //通知信息
93 
94 export const portWeather = params => { return axios.get(`${base}/api/weather/seaportWeather.json`,{params:params}).then(res => res.data);}; //港口天气
95 
96 export const myShips = params => { return axios.get(`${base}/api/fleet/queryFleets.json`).then(res => res.data);}; //我的船队
97 
98
Full Screen

quality.js

Source: quality.js Github

copy
1import axios from 'axios'
2export default {
3   /*品质计划 api*/ 
4   //查看检测计划信息,详情
5   queryQualityPlan: params => axios.post('/m2_quality/quality/queryQualityPlan.do', params),
6   //查询检测计划的修改历史
7   queryPlanUpdateHistory: params => axios.post('/m2_quality/quality/queryPlanUpdateHistory.do', params),
8   //编辑计划的负责人
9   updateQualityPlan: params => axios.post('/m2_quality/quality/updateQualityPlan.do', params),
10   //删除计划
11   deleteQualityPlan: params => axios.post('/m2_quality/quality/deleteQualityPlan.do', params),
12   //查询物料信息
13   queryMaterial: params => axios.post('/warehouse/warehouseManage/materialBasic/queryMaterial.do', params),
14   //在计划里修改报告的名字和负责人
15   updateReportInPlan: params => axios.post('/m2_quality/quality/updateReportInPlan.do', params),
16   //新增检测计划
17   saveQualityPlan: params => axios.post('/m2_quality/quality/saveQualityPlan.do', params),
18
19   /*品质报告 api*/
20   //查看检测报告信息,详情
21   queryQualityReport: params => axios.post('/m2_quality/quality/queryQualityReport.do', params),
22
23   /*品质方案 api*/ 
24   //查看检测方案信息,详情
25   queryQualityTemplate: params => axios.post('/m2_quality/quality/queryQualityTemplate.do', params),
26   //新增检测方案基础信息
27   saveQualityTemplate: params => axios.post('/m2_quality/quality/saveQualityTemplate.do', params),
28
29  /*品质投诉 api*/
30  //查询品质投诉信息
31  queryQualityComplain: params => axios.post('/m2_quality/quality/queryQualityComplain.do', params),
32  //删除品质投诉
33  deleteQualityComplain: params => axios.post('/m2_quality/quality/deleteQualityComplain.do', params),
34  //新增品质投诉
35  saveQualityComplain: params => axios.post('/m2_quality/quality/saveQualityComplain.do', params),
36  //生成检测计划,检测报告,投诉编号
37  generateNumber: params => axios.post('/m2_quality/quality/generateNumber.do', params),
38  //查看不良代号信息,详情
39  queryQualityUnqualified: params => axios.post('/m2_quality/quality/queryQualityUnqualified.do', params),
40  //编辑品质投诉
41  updateQualityComplain: params => axios.post('/m2_quality/quality/updateQualityComplain.do', params),
42
43 
44
45  /*品质基础数据 api*/
46  //新增检测类型
47  saveQualityProjectType: params => axios.post('/m2_quality/quality/saveQualityProjectType.do', params),
48  //删除检测类型
49  deleteQualityProjectType: params => axios.post('/m2_quality/quality/deleteQualityProjectType.do', params),
50  //修改检测类型
51  updateQualityProjectType: params => axios.post('/m2_quality/quality/updateQualityProjectType.do', params),
52  //查看检测类型
53  queryQualityProjectType: params => axios.post('/m2_quality/quality/queryQualityProjectType.do', params),
54
55  //新增检测方式
56  saveQualityCheckMethod: params => axios.post('/m2_quality/quality/saveQualityCheckMethod.do', params),
57  //删除检测方式
58  deleteQualityCheckMethod: params => axios.post('/m2_quality/quality/deleteQualityCheckMethod.do', params),
59  //修改检测方式
60  updateQualityCheckMethod: params => axios.post('/m2_quality/quality/updateQualityCheckMethod.do', params),
61  //查看检测方式信息,详情
62  queryQualityCheckMethod: params => axios.post('/m2_quality/quality/queryQualityCheckMethod.do', params),
63
64  //新增检测工具
65  saveQualityAppliance: params => axios.post('/m2_quality/quality/saveQualityAppliance.do', params),
66  //删除检测工具
67  deleteQualityAppliance: params => axios.post('/m2_quality/quality/deleteQualityAppliance.do', params),
68  //修改检测工具
69  updateQualityAppliance: params => axios.post('/m2_quality/quality/updateQualityAppliance.do', params),
70  //查看检测工具信息,详情
71  queryQualityAppliance: params => axios.post('/m2_quality/quality/queryQualityAppliance.do', params),
72
73  //新增不良品
74  saveQualityUnqualified: params => axios.post('/m2_quality/quality/saveQualityUnqualified.do', params),
75  //删除不良品
76  deleteQualityUnqualified: params => axios.post('/m2_quality/quality/deleteQualityUnqualified.do', params),
77  //修改不良品
78  updateQualityUnqualified: params => axios.post('/m2_quality/quality/updateQualityUnqualified.do', params),
79  //查看不良品信息,详情
80  queryQualityUnqualified: params => axios.post('/m2_quality/quality/queryQualityUnqualified.do', params),
81
82  //新增检测项目
83  saveQualityProject: params => axios.post('/m2_quality/quality/saveQualityProject.do', params),
84  //删除检测项目
85  deleteQualityProject: params => axios.post('/m2_quality/quality/deleteQualityProject.do', params),
86  //编辑检测项目
87  updateQualityProject: params => axios.post('/m2_quality/quality/updateQualityProject.do', params),
88  //查询检测项目
89  queryQualityProject: params => axios.post('/m2_quality/quality/queryQualityProject.do', params),
90
91  //新增检测标准
92  saveQualityStandard: params => axios.post('/m2_quality/quality/saveQualityStandard.do', params),
93  //删除检测标准
94  deleteQualityStandard: params => axios.post('/m2_quality/quality/deleteQualityStandard.do', params),
95  //编辑检测标准
96  updateQualityStandard: params => axios.post('m2_quality/quality/updateQualityStandard.do', params),
97  //查看检测标准
98  queryQualityStandard: params => axios.post('/m2_quality/quality/queryQualityStandard.do', params),
99  }
Full Screen

Accelerate Your Automation Test Cycles With LambdaTest

Leverage LambdaTest’s cloud-based platform to execute your automation tests in parallel and trim down your test execution time significantly. Your first 100 automation testing minutes are on us.

Try LambdaTest

Run JavaScript Tests on LambdaTest Cloud Grid

Execute automation tests with Appium Base Driver on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free
LambdaTestX

We use cookies to give you the best experience. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. Learn More in our Cookies policy, Privacy & Terms of service

Allow Cookie
Sarah

I hope you find the best code examples for your project.

If you want to accelerate automated browser testing, try LambdaTest. Your first 100 automation testing minutes are FREE.

Sarah Elson (Product & Growth Lead)