def step_add_good(self, driver, url, model_name): Login.step_login(driver, url, '18817933821', '123456') time.sleep(3) PublicModel.select_model(driver, model_name) time.sleep(5) driver.find_elements_by_xpath(GoodsManagement.c['add_goods']).click() time.sleep(3) driver.find_elements_by_xpath( GoodsManagement.c['add_goods']).send_keys("测试商品") driver.find_elements_by_xpath( GoodsManagement.c['goodsEditor']).send_keys("测试商品信息") driver.find_elements_by_xpath(GoodsManagement.c['goodsPic']).send_keys( "E:\Pycharm\workspace\ZL_AutoTest\Data\pic.jpg") driver.find_elements_by_xpath(GoodsManagement.c['goodsSkuBtn']).click() driver.find_elements_by_xpath( GoodsManagement.c['skuName']).send_keys("测试SKU") driver.find_elements_by_xpath( GoodsManagement.c['skuValue']).send_keys("测试SKU Value" + "\n") driver.find_elements_by_xpath(GoodsManagement.c['skuPic']).send_keys( "E:\Pycharm\workspace\ZL_AutoTest\Data\pic.jpg") driver.find_elements_by_xpath( GoodsManagement.c['skuPrice']).send_keys("0.01") driver.find_elements_by_xpath( GoodsManagement.c['skuStock']).send_keys("10") driver.find_elements_by_xpath( GoodsManagement.c['skuNum']).send_keys("SKU123456") driver.find_elements_by_xpath(GoodsManagement.c['goodsGroup']).click() driver.find_elements_by_xpath( GoodsManagement.c['good_category']).click()
def post(uri, body=None): #body1 = json.dumps(body) ses = Login.login() url = "http://192.168.1.115:8088" + uri res = ses.post(url, json=body, verify=False) return res
def test_get_th_list(self): global head head = Login.Login().get_token() get_th_list_resp = request.get_request(url=url + 'returnReason/list', params={'pageNum': 1, 'pageSize': 10},headers=head) resp_json = get_th_list_resp.json() json_data = resp_json['data'] data_list = json_data['list'] item = data_list[0] global item_id item_id = item['id'] assertion.assert_code(get_th_list_resp.status_code, 200) assertion.assert_in_text(resp_json['message'], '成功')
def get(uri): ses = Login.login() url = dirConfig.host + uri res = ses.get(url, verify=False) return res
def post(uri, body=None): ses = Login.login() url = dirConfig.host + uri res = ses.post(url, json=body, verify=False) return res
import allure import pytest from Common import Request, Assert, read_excel, Login request = Request.Request() assertions = Assert.Assertions() url = Login.url head = Login.Login().get_token() thyy_id = 0 excel_list = read_excel.read_excel_list('./document/退货.xlsx') ids_list = [] for i in range(len(excel_list)): # 删除excel_list中每个小list的最后一个元素,并赋值给ids_pop ids_pop = excel_list[i].pop() # 将ids_pop添加到 ids_list 里面 ids_list.append(ids_pop) @allure.feature("退货原因模块") class Test_thyy(): @allure.story("查询退货原因") def test_sel(self): thyy_sel_resp = request.get_request(url=url + 'returnReason/list', params={ 'pageNum': 1, 'pageSize': 5 }, headers=head) assertions.assert_code(thyy_sel_resp.status_code, 200) resp_json = thyy_sel_resp.json()
def get(uri): ses = Login.login() url = "http://192.168.1.115:8088" + uri res = ses.get(url, verify=False) return res
import allure import pytest from Common import Request, Assert, read_excel, Login request = Request.Request() assertinons = Assert.Assertions() ids_list = [] tyh_id = 0 hede = Login.Login().get_token() url = 'http://192.168.60.132:8080/' excel_list = read_excel.read_excel_list('./document/退货.xlsx') for i in range(len(excel_list)): ids_pop = excel_list[i].pop() ids_list.append(ids_pop) @allure.feature('退货接口') class Test_Return_goods: @allure.story('退货列表') def test_Coupon_in(self): in_if = request.get_request(url=url + 'returnReason/list', params={ '?pageNum': 1, 'pageSize': 5 },