Commit 2c84072f authored by 17322369953's avatar 17322369953
Browse files

添加部分采购案例

parent 8841d1b8
{"uuid": "8875d9a7-29b9-44cd-9426-39856af38bb9", "children": ["0b88d4b8-7a55-4cb2-81cb-839660f62e0e"], "befores": [{"name": "housework", "status": "passed", "start": 1700472871510, "stop": 1700472871510}], "start": 1700472871510, "stop": 1700472878217}
\ No newline at end of file
INFO root:read_yaml.py:34 当前的yaml文件路径:D:\pythonProject\atuobase\data\test_login\data.yaml
INFO root:read_yaml.py:37 文件data中字段url值为http://scdev.cmic.com.cn:8088/beta/
INFO root:steps_login.py:26 当前url: http://scdev.cmic.com.cn:8088/beta/
INFO root:read_yaml.py:34 当前的yaml文件路径:D:\pythonProject\atuobase\data\test_login\data.yaml
INFO root:read_yaml.py:37 文件data中字段url值为http://scdev.cmic.com.cn:8088/beta/
INFO root:read_yaml.py:34 当前的yaml文件路径:D:\pythonProject\atuobase\data\test_login\data.yaml
INFO root:read_yaml.py:37 文件data中字段account值为bj_qgl
INFO root:read_yaml.py:34 当前的yaml文件路径:D:\pythonProject\atuobase\data\test_login\data.yaml
INFO root:read_yaml.py:37 文件data中字段password值为Gyxc12345
INFO root:verifycode.py:9 开始解析验证码
INFO root:verifycode.py:23 当前验证码的文字为:ADFH
INFO root:steps_login.py:82 输入的验证码为:ADFH
\ No newline at end of file
{"name": "test_login_userid_error", "status": "passed", "steps": [{"name": "打开浏览器", "status": "passed", "start": 1700472878223, "stop": 1700472878349}, {"name": "输入账号密码", "status": "passed", "parameters": [{"name": "flag", "value": "3"}], "start": 1700472878350, "stop": 1700472880453}, {"name": "输入验证码", "status": "passed", "parameters": [{"name": "flag", "value": "0"}], "start": 1700472880453, "stop": 1700472882843}, {"name": "点击登录", "status": "passed", "start": 1700472882843, "stop": 1700472883879}, {"name": "登录错误结果校验", "status": "broken", "statusDetails": {"message": "TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType\n", "trace": " File \"D:\\python\\Lib\\site-packages\\allure_commons\\_allure.py\", line 192, in impl\n return func(*a, **kw)\n ^^^^^^^^^^^^^^\n File \"D:\\pythonProject\\atuobase\\test_login\\steps_login.py\", line 161, in judge_result_error\n allure.attach.file(source=ScreenShot(self.driver, module, int(time.time())).screen_shot(), name='失败截图',\n File \"D:\\python\\Lib\\site-packages\\allure_commons\\_allure.py\", line 203, in file\n plugin_manager.hook.attach_file(source=source, name=name, attachment_type=attachment_type, extension=extension)\n File \"D:\\python\\Lib\\site-packages\\pluggy\\_hooks.py\", line 265, in __call__\n return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"D:\\python\\Lib\\site-packages\\pluggy\\_manager.py\", line 80, in _hookexec\n return self._inner_hookexec(hook_name, methods, kwargs, firstresult)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"D:\\python\\Lib\\site-packages\\pluggy\\_callers.py\", line 60, in _multicall\n return outcome.get_result()\n ^^^^^^^^^^^^^^^^^^^^\n File \"D:\\python\\Lib\\site-packages\\pluggy\\_result.py\", line 60, in get_result\n raise ex[1].with_traceback(ex[2])\n File \"D:\\python\\Lib\\site-packages\\pluggy\\_callers.py\", line 39, in _multicall\n res = hook_impl.function(*args)\n ^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"D:\\python\\Lib\\site-packages\\allure_pytest\\listener.py\", line 233, in attach_file\n self.allure_logger.attach_file(uuid4(), source, name=name, attachment_type=attachment_type, extension=extension)\n File \"D:\\python\\Lib\\site-packages\\allure_commons\\reporter.py\", line 160, in attach_file\n plugin_manager.hook.report_attached_file(source=source, file_name=file_name)\n File \"D:\\python\\Lib\\site-packages\\pluggy\\_hooks.py\", line 265, in __call__\n return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"D:\\python\\Lib\\site-packages\\pluggy\\_manager.py\", line 80, in _hookexec\n return self._inner_hookexec(hook_name, methods, kwargs, firstresult)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"D:\\python\\Lib\\site-packages\\pluggy\\_callers.py\", line 60, in _multicall\n return outcome.get_result()\n ^^^^^^^^^^^^^^^^^^^^\n File \"D:\\python\\Lib\\site-packages\\pluggy\\_result.py\", line 60, in get_result\n raise ex[1].with_traceback(ex[2])\n File \"D:\\python\\Lib\\site-packages\\pluggy\\_callers.py\", line 39, in _multicall\n res = hook_impl.function(*args)\n ^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"D:\\python\\Lib\\site-packages\\allure_commons\\logger.py\", line 44, in report_attached_file\n shutil.copy2(source, destination)\n File \"D:\\python\\Lib\\shutil.py\", line 436, in copy2\n copyfile(src, dst, follow_symlinks=follow_symlinks)\n File \"D:\\python\\Lib\\shutil.py\", line 235, in copyfile\n if _samefile(src, dst):\n ^^^^^^^^^^^^^^^^^^^\n File \"D:\\python\\Lib\\shutil.py\", line 212, in _samefile\n return os.path.samefile(src, dst)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"<frozen genericpath>\", line 100, in samefile\n"}, "attachments": [{"name": "失败截图", "source": "af606344-8bdf-4398-b801-cdb8823782a2-attachment.png", "type": "image/png"}], "parameters": [{"name": "flag", "value": "1"}], "start": 1700472883879, "stop": 1700472885056}, {"name": "打开浏览器", "status": "passed", "start": 1700472887210, "stop": 1700472887296}, {"name": "输入账号密码", "status": "passed", "parameters": [{"name": "flag", "value": "3"}], "start": 1700472887296, "stop": 1700472889400}, {"name": "输入验证码", "status": "passed", "parameters": [{"name": "flag", "value": "0"}], "start": 1700472889400, "stop": 1700472891806}, {"name": "点击登录", "status": "passed", "start": 1700472891806, "stop": 1700472892857}, {"name": "登录错误结果校验", "status": "broken", "statusDetails": {"message": "TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType\n", "trace": " File \"D:\\python\\Lib\\site-packages\\allure_commons\\_allure.py\", line 192, in impl\n return func(*a, **kw)\n ^^^^^^^^^^^^^^\n File \"D:\\pythonProject\\atuobase\\test_login\\steps_login.py\", line 161, in judge_result_error\n allure.attach.file(source=ScreenShot(self.driver, module, int(time.time())).screen_shot(), name='失败截图',\n File \"D:\\python\\Lib\\site-packages\\allure_commons\\_allure.py\", line 203, in file\n plugin_manager.hook.attach_file(source=source, name=name, attachment_type=attachment_type, extension=extension)\n File \"D:\\python\\Lib\\site-packages\\pluggy\\_hooks.py\", line 265, in __call__\n return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"D:\\python\\Lib\\site-packages\\pluggy\\_manager.py\", line 80, in _hookexec\n return self._inner_hookexec(hook_name, methods, kwargs, firstresult)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"D:\\python\\Lib\\site-packages\\pluggy\\_callers.py\", line 60, in _multicall\n return outcome.get_result()\n ^^^^^^^^^^^^^^^^^^^^\n File \"D:\\python\\Lib\\site-packages\\pluggy\\_result.py\", line 60, in get_result\n raise ex[1].with_traceback(ex[2])\n File \"D:\\python\\Lib\\site-packages\\pluggy\\_callers.py\", line 39, in _multicall\n res = hook_impl.function(*args)\n ^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"D:\\python\\Lib\\site-packages\\allure_pytest\\listener.py\", line 233, in attach_file\n self.allure_logger.attach_file(uuid4(), source, name=name, attachment_type=attachment_type, extension=extension)\n File \"D:\\python\\Lib\\site-packages\\allure_commons\\reporter.py\", line 160, in attach_file\n plugin_manager.hook.report_attached_file(source=source, file_name=file_name)\n File \"D:\\python\\Lib\\site-packages\\pluggy\\_hooks.py\", line 265, in __call__\n return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"D:\\python\\Lib\\site-packages\\pluggy\\_manager.py\", line 80, in _hookexec\n return self._inner_hookexec(hook_name, methods, kwargs, firstresult)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"D:\\python\\Lib\\site-packages\\pluggy\\_callers.py\", line 60, in _multicall\n return outcome.get_result()\n ^^^^^^^^^^^^^^^^^^^^\n File \"D:\\python\\Lib\\site-packages\\pluggy\\_result.py\", line 60, in get_result\n raise ex[1].with_traceback(ex[2])\n File \"D:\\python\\Lib\\site-packages\\pluggy\\_callers.py\", line 39, in _multicall\n res = hook_impl.function(*args)\n ^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"D:\\python\\Lib\\site-packages\\allure_commons\\logger.py\", line 44, in report_attached_file\n shutil.copy2(source, destination)\n File \"D:\\python\\Lib\\shutil.py\", line 436, in copy2\n copyfile(src, dst, follow_symlinks=follow_symlinks)\n File \"D:\\python\\Lib\\shutil.py\", line 235, in copyfile\n if _samefile(src, dst):\n ^^^^^^^^^^^^^^^^^^^\n File \"D:\\python\\Lib\\shutil.py\", line 212, in _samefile\n return os.path.samefile(src, dst)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"<frozen genericpath>\", line 100, in samefile\n"}, "attachments": [{"name": "失败截图", "source": "2f1ccb99-571e-4855-8d4b-29eb65ba3119-attachment.png", "type": "image/png"}], "parameters": [{"name": "flag", "value": "1"}], "start": 1700472892857, "stop": 1700472894023}, {"name": "打开浏览器", "status": "passed", "start": 1700472896097, "stop": 1700472896189}, {"name": "输入账号密码", "status": "passed", "parameters": [{"name": "flag", "value": "3"}], "start": 1700472896189, "stop": 1700472898290}, {"name": "输入验证码", "status": "passed", "parameters": [{"name": "flag", "value": "0"}], "start": 1700472898290, "stop": 1700472900674}, {"name": "点击登录", "status": "passed", "start": 1700472900674, "stop": 1700472901720}, {"name": "登录错误结果校验", "status": "passed", "parameters": [{"name": "flag", "value": "1"}], "start": 1700472901720, "stop": 1700472902735}], "attachments": [{"name": "log", "source": "62140e5c-5ff1-4494-8679-f69adf7d9d72-attachment.txt", "type": "text/plain"}, {"name": "log", "source": "838fa8d4-da0c-4a38-b103-709aec13d699-attachment.txt", "type": "text/plain"}, {"name": "log", "source": "90997e19-7bfd-4b4f-b97e-32a66a75dd84-attachment.txt", "type": "text/plain"}], "start": 1700472896097, "stop": 1700472902735, "uuid": "08f89516-a331-4f0f-87e7-f7105fd65ba0", "historyId": "2cd12ebe58a5248bd1891c86832c88ea", "testCaseId": "9c192e6178a33cdc4b540de5288026eb", "fullName": "atuobase.test_login.test_login_userid_error.TestLoginUseridError#test_login_userid_error", "labels": [{"name": "story", "value": "登录用户名错误案例-点击登录"}, {"name": "feature", "value": "登录模块"}, {"name": "parentSuite", "value": "atuobase.test_login"}, {"name": "suite", "value": "test_login_userid_error"}, {"name": "subSuite", "value": "TestLoginUseridError"}, {"name": "host", "value": "HUAWEI"}, {"name": "thread", "value": "13928-MainThread"}, {"name": "framework", "value": "pytest"}, {"name": "language", "value": "cpython3"}, {"name": "package", "value": "atuobase.test_login.test_login_userid_error"}, {"name": "story", "value": "登录用户名错误案例-点击登录"}, {"name": "feature", "value": "登录模块"}, {"name": "parentSuite", "value": "atuobase.test_login"}, {"name": "suite", "value": "test_login_userid_error"}, {"name": "subSuite", "value": "TestLoginUseridError"}, {"name": "host", "value": "HUAWEI"}, {"name": "thread", "value": "13928-MainThread"}, {"name": "framework", "value": "pytest"}, {"name": "language", "value": "cpython3"}, {"name": "package", "value": "atuobase.test_login.test_login_userid_error"}, {"name": "story", "value": "登录用户名错误案例-点击登录"}, {"name": "feature", "value": "登录模块"}, {"name": "parentSuite", "value": "atuobase.test_login"}, {"name": "suite", "value": "test_login_userid_error"}, {"name": "subSuite", "value": "TestLoginUseridError"}, {"name": "host", "value": "HUAWEI"}, {"name": "thread", "value": "13928-MainThread"}, {"name": "framework", "value": "pytest"}, {"name": "language", "value": "cpython3"}, {"name": "package", "value": "atuobase.test_login.test_login_userid_error"}]}
\ No newline at end of file
INFO root:read_yaml.py:34 当前的yaml文件路径:D:\pythonProject\atuobase\data\test_login\data.yaml
INFO root:read_yaml.py:37 文件data中字段url值为http://scdev.cmic.com.cn:8088/beta/
INFO root:steps_login.py:26 当前url: http://scdev.cmic.com.cn:8088/beta/
INFO root:read_yaml.py:34 当前的yaml文件路径:D:\pythonProject\atuobase\data\test_login\data.yaml
INFO root:read_yaml.py:37 文件data中字段url值为http://scdev.cmic.com.cn:8088/beta/
INFO root:read_yaml.py:34 当前的yaml文件路径:D:\pythonProject\atuobase\data\test_login\data.yaml
INFO root:read_yaml.py:37 文件data中字段account值为bj_qgl
INFO root:read_yaml.py:34 当前的yaml文件路径:D:\pythonProject\atuobase\data\test_login\data.yaml
INFO root:read_yaml.py:37 文件data中字段password值为Gyxc12345
INFO root:verifycode.py:9 开始解析验证码
INFO root:verifycode.py:23 当前验证码的文字为:VG7V
INFO root:steps_login.py:82 输入的验证码为:VG7V
\ No newline at end of file
INFO root:read_yaml.py:34 当前的yaml文件路径:D:\pythonProject\atuobase\data\test_login\data.yaml
INFO root:read_yaml.py:37 文件data中字段url值为http://scdev.cmic.com.cn:8088/beta/
INFO root:steps_login.py:26 当前url: http://scdev.cmic.com.cn:8088/beta/
INFO root:read_yaml.py:34 当前的yaml文件路径:D:\pythonProject\atuobase\data\test_login\data.yaml
INFO root:read_yaml.py:37 文件data中字段url值为http://scdev.cmic.com.cn:8088/beta/
INFO root:read_yaml.py:34 当前的yaml文件路径:D:\pythonProject\atuobase\data\test_login\data.yaml
INFO root:read_yaml.py:37 文件data中字段account值为bj_qgl
INFO root:read_yaml.py:34 当前的yaml文件路径:D:\pythonProject\atuobase\data\test_login\data.yaml
INFO root:read_yaml.py:37 文件data中字段password值为Gyxc12345
INFO root:verifycode.py:9 开始解析验证码
INFO root:verifycode.py:23 当前验证码的文字为:UXNU
INFO root:steps_login.py:82 输入的验证码为:4571
\ No newline at end of file
{"uuid": "607d0bf8-d2fd-416b-b7b2-01b2b828c1e0", "children": ["57b2c080-a1a0-49c7-a297-f9a6c60b9322", "363fb4df-ca00-448d-aa56-0d96cfa082ed", "a4d17bdd-9108-4e8b-ba93-0dc1b0e02b13", "0b88d4b8-7a55-4cb2-81cb-839660f62e0e", "08f89516-a331-4f0f-87e7-f7105fd65ba0", "8df9c1dc-783a-4ee4-9855-b0898884a95b"], "befores": [{"name": "driver_fixture", "status": "passed", "start": 1700472847793, "stop": 1700472850035}], "start": 1700472847793, "stop": 1700472909413}
\ No newline at end of file
......@@ -27,32 +27,34 @@ class PageBuy(PageLogin):
# 公司表dialog body
_company_dialog_locator = (
By.XPATH, '//div[starts-with(@id,"el-id-") and contains(@id,"-21") and @class="el-dialog__body"]')
# 公司表-----这个只能找绝对路径了,开发太狠了
# _company_table_locator = (
# By.XPATH, '/html/body/div[6]/div/div/div/div[1]/div[2]/div[1]/div/div/div/div[1]/div[3]/div/div[1]/div/table')
_company_table_locator = (By.CLASS_NAME, "el-table__body")
# 公司确定按钮
_company_table_ensure_locator = (By.XPATH, '//span[@class="ensureBtn"]/button/span[text() = "确定"]')
# 仓库信息
_ware_info_locator = (By.ID, 'tab-a58f571e-7488-4c22-bec0-67428972871d')
# 主体信息
_main_info_locator = (By.ID, 'tab-7667cf55-c391-4f2c-a5ba-c0f6d27b6d3a')
'''仓库信息'''
# 仓库输入内容
_warehouse_content_locator = (By.XPATH, '//input[starts-with(@id,"el-id-") and contains(@id,"-122")]')
# 请求查询仓库元素
_ware_request_locator = (By.XPATH, '//input[starts-with(@id,"el-id-") and contains(@id,"-107")]/../span/span/i')
_ware_request_locator = (By.XPATH, '//input[starts-with(@id,"el-id-") and contains(@id,"-122")]/../span/span/i')
# _ware_request_locator = (By.XPATH, '//div[text() = "仓库名称"]/../div[@class="el-form-item__content"]/descendant::i[@class="awsui-iconfont" and @style="cursor: pointer;"]')
# _ware_request_locator = (By.XPATH,'//div[@id =contains(text(),"仓库名称")]')
# 仓库输入元素
_ware_input_locator = (By.XPATH, '//input[@placeholder = "模糊检索:仓库名称,仓库编码"]')
# 仓库搜索元素
_ware_search_locator = (By.XPATH, '//input[@placeholder = "模糊检索:仓库名称,仓库编码"]/../span/span/i')
# 仓库表-----这个只能找绝对路径了,开发太狠了
# _ware_table_locator = (
# By.XPATH, '/html/body/div[8]/div/div/div/div[1]/div[2]/div[1]/div/div/div/div[1]/div[3]/div/div[1]/div/table')
# 仓库表,通过dialog定位
# _ware_table_locator = (By.XPATH, '//div[@role = "dialog" and @aria-label = "选择仓库"]/*/table[@class = "el-table__body"]')
# _ware_dialog_locator = (
# By.XPATH, '//div[starts-with(@id,"el-id-") and contains(@id,"-26") and @class="el-dialog__body"]')
# _ware_dialog_locator = (By.XPATH, '//div[@role="dialog" and @aria-label="选择仓库"]')
_ware_dialog_locator = (
By.XPATH, '//div[starts-with(@id,"el-id-") and contains(@id,"-26") and @class="el-dialog__body"]')
By.XPATH, '//div[starts-with(@id,"el-id-") and contains(@id,"-32") and @class="el-dialog__body"]')
_ware_table_locator = 'By.XPATH, "//table[@class = "el-table__body""'
# 仓库表确认元素---这中确定看着可以统一
_ware_table_ensure_locator = (By.XPATH, '//span[@class="ensureBtn"]/button/span[text() = "确定"]')
'''供应商信息'''
# 供应商内容
_supplier_content_locator = (By.XPATH, '//input[starts-with(@id,"el-id-") and contains(@id,"-119")]')
# 查询供应商请求元素
_supplier_request_locator = (By.XPATH, '//input[starts-with(@id,"el-id-") and contains(@id,"-119")]/../span/span/i')
# 供应商输入信息
......@@ -70,6 +72,10 @@ class PageBuy(PageLogin):
_dialog_ensure_locator = './*/span[@class="ensureBtn"]/button/span[text() = "确定"]'
'''协议信息'''
# 协议输入内容元素
_protocol_content_locator = (By.XPATH, '//input[starts-with(@id,"el-id-") and contains(@id,"-124")]')
# 协议请求元素
_protocol_request_locator = (By.XPATH, '//input[starts-with(@id,"el-id-") and contains(@id,"-109")]/../span/span/i')
# 协议输入元素
......@@ -82,6 +88,9 @@ class PageBuy(PageLogin):
_protocol_dialog_locator = (
By.XPATH, '//div[starts-with(@id,"el-id-") and contains(@id,"-36") and @class="el-dialog__body"]')
'''业务员信息'''
# 业务员输入内容元素
_businessman_content_locator = (By.XPATH, '//input[starts-with(@id,"el-id-") and contains(@id,"-127")]')
# 业务员请求元素
_businessman_request_locator = (
By.XPATH, '//input[starts-with(@id,"el-id-") and contains(@id,"-110")]/../span/span/i')
......@@ -94,11 +103,15 @@ class PageBuy(PageLogin):
_businessman_dialog_locator = (
By.XPATH, '//div[starts-with(@id,"el-id-") and contains(@id,"-41") and @class="el-dialog__body"]')
'''商品信息'''
# 商品最高复选框
_merchandise_all_select_locator = (By.XPATH,
'/html/body/div[38]/div/div/div/div[1]/div[2]/div[1]/div/div[2]/div/div[1]/div[2]/table/thead/tr/th[1]/div/label')
# 商品录入按钮
_merchandise_locator = (By.XPATH, '//span[text()="商品录入"]')
_merchandise_locator = (By.XPATH, '//span[text()="添加商品"]')
# 商品dialog
_merchandise_dialog_locator = (
By.XPATH, '//div[starts-with(@id,"el-id-") and contains(@id,"-124") and @class="el-dialog__body"]')
By.XPATH, '//div[starts-with(@id,"el-id-") and contains(@id,"-136") and @class="el-dialog__body"]')
# 商品输入元素
_merchandise_input_locator = (By.XPATH, '//input[@placeholder="模糊检索:商品编码,商品名称,规格型号,厂家物料编码"]')
# 商品搜索元素
......@@ -115,12 +128,15 @@ class PageBuy(PageLogin):
# 保存按钮
# _save_locator = (By.XPATH, '//*[@id="process-toolbar"]/button[4]/span/text()')
_save_locator = (By.XPATH, '//*[@id="process-toolbar"]/*/span[text()="保存"]')
# _submit_locator
_submit_locator = (By.XPATH, '//*[@id="process-toolbar"]/*/span[text()="提交"]')
# 订单号
_order_no_locator = (By.XPATH, '//*[@id="0b83dfe6-67bc-46bf-b271-5e768a59e415"]/div/div[2]/span')
# 商品明细表
_detail_table = (
By.XPATH, '//*[@id="a55ef0dd-0262-4caa-b701-684a33007ac5"]/div/div[2]/div/div/div[2]/div[2]/div[1]/div[2]/table')
By.XPATH,
'//*[@id="a55ef0dd-0262-4caa-b701-684a33007ac5"]/div/div[2]/div/div/div[2]/div[2]/div[1]/div[2]/table')
# _detail_table = (
# By.XPATH, '//*[@id="a55ef0dd-0262-4caa-b701-684a33007ac5"]/*/table[@class="vxe-table--body"]')
......@@ -198,6 +214,12 @@ class PageBuy(PageLogin):
def get_main_info(self):
return self.get_element_wait_presence(self._main_info_locator)
'''仓库信息hold'''
'''获取仓库内容元素'''
def get_warehouse_content(self):
return self.get_element_wait_presence(self._warehouse_content_locator)
'''获取请求查询仓库元素'''
def get_ware_request(self):
......@@ -213,6 +235,13 @@ class PageBuy(PageLogin):
def get_ware_search(self):
return self.get_element_wait_presence(self._ware_search_locator)
'''选择某行'''
def select_one_row(self, row):
tds = row.find_elements(By.TAG_NAME, "td")
span = tds[1].find_element(By.XPATH, './div/label/span[1]')
span.click()
'''获取仓库dialog'''
def get_ware_dialog(self):
......@@ -232,6 +261,12 @@ class PageBuy(PageLogin):
# return self.get_child(ware_dialog, self._ware_table_ensure_locator)
'''供应商信息hold'''
'''获取供应商内容元素'''
def get_supplier_content(self):
return self.get_element_wait_presence(self._supplier_content_locator)
'''获取供应商dialog元素'''
def get_supplier_dialog(self):
......@@ -300,6 +335,12 @@ class PageBuy(PageLogin):
def get_company_dialog(self):
return self.get_element_wait_presence(self._company_dialog_locator)
'''协议信息hold'''
'''获取协议输入内容'''
def get_protocol_context(self):
return self.get_element_wait_presence(self._protocol_content_locator)
'''获取协议请求元素'''
def get_protocol_request(self):
......@@ -320,6 +361,12 @@ class PageBuy(PageLogin):
def get_protocol_dialog(self):
return self.get_element_wait_presence(self._protocol_dialog_locator)
'''业务员信息hold'''
'''获取业务员输入信息'''
def get_businessman_content(self):
return self.get_element_wait_presence(self._businessman_content_locator)
'''获取业务员请求元素'''
def get_businessman_request(self):
......@@ -339,6 +386,10 @@ class PageBuy(PageLogin):
def get_businessman_dialog(self):
return self.get_element_wait_presence(self._businessman_dialog_locator)
'''商品信息hold'''
'''获取商品全选复选框'''
def get_merchandise_all_select(self):
return self.get_element_wait_presence(self._merchandise_all_select_locator)
'''商品录入按钮'''
......@@ -374,3 +425,7 @@ class PageBuy(PageLogin):
def get_detail_table(self):
return self.get_element_wait_presence(self._detail_table)
'''订单提交'''
def get_submit_element(self):
return self.get_element_wait_presence(self._submit_locator)
......@@ -2,6 +2,8 @@
# ddate:2023/11/20 10:15
import traceback
import allure
from selenium.webdriver.chrome import webdriver
from selenium.webdriver import ActionChains
from common import constant
from common.logger import log
from common.read_yaml import get_filed_from_yaml
......@@ -65,7 +67,8 @@ class StepsBuy(object):
log.info('登录成功,开始执行案例。')
break
if i <= 0:
log.error(f'验证码已经连续{max_retry}次识别失败,本案例执行时登录失败,请检查环境是否出现问题,特别是分辨率是否调整。')
log.error(
f'验证码已经连续{max_retry}次识别失败,本案例执行时登录失败,请检查环境是否出现问题,特别是分辨率是否调整。')
assert False
log.info(f'登录成功。')
except Exception as e:
......@@ -115,7 +118,7 @@ class StepsBuy(object):
assert False
@allure.step("输入供应商")
def input_supplier(self):
def input_supplier_bk(self):
try:
# 先从yaml中获取供应商内容
supplier_content = get_filed_from_yaml(module, "data", "supplier")
......@@ -136,17 +139,19 @@ class StepsBuy(object):
supplier_table_rows = self.page_buy.get_all_rows_from_tale(supplier_table)
# 遍历供应商
for i, current_row in enumerate(supplier_table_rows):
self.page_buy.single_click(current_row)
# 获取当前供应商的列信息
columns = self.page_buy.get_all_columns_from_row(current_row)
# 遍历列内容,这里只是先打印出日志,便于查看问题
for j, curr_column in enumerate(columns):
log.info('查询出供应商表,的第 %s 行,第 %s 列的内容为 %s' % (i, j, self.page_buy.get_text(curr_column)))
log.info(
'查询出供应商表,的第 %s 行,第 %s 列的内容为 %s' % (i, j, self.page_buy.get_text(curr_column)))
# 挑选出一列,因为前端是模糊查询,有可能是供应商编码,有可能是供应商名称,匹配第一条即可
if (supplier_content in self.page_buy.get_text(columns[1])) or (
supplier_content in self.page_buy.get_text(columns[2])):
'''选中当前行'''
#self.page_buy.single_click(current_row)
#self.page_buy.single_click(columns[1])
# self.page_buy.single_click(current_row)
# self.page_buy.single_click(columns[1])
current_row.click()
'''点击确认'''
supplier_table_ensure = self.page_buy.get_ensure_from_dialog(supplier_dialog)
......@@ -158,17 +163,258 @@ class StepsBuy(object):
log.error(f'输入供应商问题:{e.__doc__}{traceback.format_exc()}')
assert False
@allure.step("输入供应商")
def input_supplier(self):
try:
# 先从yaml中获取供应商内容
supplier_content = get_filed_from_yaml(module, "data", "supplier")
# 获取供应商输入内容元素
supplier_input = self.page_buy.get_supplier_content()
# 输入供应商
self.page_buy.input_text(supplier_input, supplier_content)
log.info(f'供应商{supplier_content}输入成功。')
except Exception as e:
log.error(f'输入供应商问题:{e.__doc__}{traceback.format_exc()}')
assert False
@allure.step("输入仓库")
def input_warehouse_bk(self):
try:
# 先从yaml中获取仓库内容
ware_content = get_filed_from_yaml(module, "data", "warehouse")
# 点击仓库请求按钮
ware_request = self.page_buy.get_ware_request()
self.page_buy.single_click(ware_request)
# 输入仓库数据
# ware_input = self.page_buy.get_ware_input()
# self.page_buy.input_text(ware_input, ware_content)
# 搜索仓库信息
ware_search = self.page_buy.get_ware_search()
self.page_buy.single_click(ware_search)
# 仓库dialog
ware_dialog = self.page_buy.get_ware_dialog()
# 确定仓库信息的表
ware_table = self.page_buy.get_table_from_dialog(ware_dialog)
# 获取该表下的行数据集
ware_table_rows = self.page_buy.get_all_rows_from_tale(ware_table)
log.info("仓库表的行数:%s" % len(ware_table_rows))
# 遍历仓库表行
for i, current_row in enumerate(ware_table_rows):
# 获取当前行的列
columns = self.page_buy.get_all_columns_from_row(current_row)
log.info(f'仓库表第{i}行一共有{len(columns)}列。')
# 遍历列内容,这里只是先打印出日志,便于查看问题
for j, curr_column in enumerate(columns):
log.info(
'查询出仓库表,的第 %s 行,第 %s 列的内容为 %s' % (i, j, self.page_buy.get_text(curr_column)))
# 挑选出一列,因为前端是模糊查询,有可能是仓库编码,有可能是仓库名称,匹配第一条即可
if (ware_content in self.page_buy.get_text(columns[1])) or (
ware_content in self.page_buy.get_text(columns[2])):
'''选中当前行'''
# self.driver.execute_script("arguments[0].click();", current_row)
# self.page_buy.single_click(current_row)
self.page_buy.select_one_row(current_row)
'''点击确认'''
ware_table_ensure = self.page_buy.get_ensure_from_dialog(ware_dialog)
self.page_buy.single_click(ware_table_ensure)
'''选中后退出,不再查询'''
break
log.info(f'仓库{ware_content}输入成功。')
except Exception as e:
log.error(f'输入仓库问题:{e.__doc__}{traceback.format_exc()}')
assert False
@allure.step("输入仓库")
def input_warehouse_bk(self):
try:
# 先从yaml中获取仓库内容
ware_content = get_filed_from_yaml(module, "data", "warehouse")
# 点击仓库请求按钮
ware_request = self.page_buy.get_ware_request()
self.page_buy.single_click(ware_request)
# 输入仓库数据
# ware_input = self.page_buy.get_ware_input()
# self.page_buy.input_text(ware_input, ware_content)
# 搜索仓库信息
ware_search = self.page_buy.get_ware_search()
self.page_buy.single_click(ware_search)
# 仓库dialog
ware_dialog = self.page_buy.get_ware_dialog()
# 确定仓库信息的表
ware_table = self.page_buy.get_table_from_dialog(ware_dialog)
# 获取该表下的行数据集
ware_table_rows = self.page_buy.get_all_rows_from_tale(ware_table)
log.info("仓库表的行数:%s" % len(ware_table_rows))
# 遍历仓库表行
for i, current_row in enumerate(ware_table_rows):
# 获取当前行的列
columns = self.page_buy.get_all_columns_from_row(current_row)
log.info(f'仓库表第{i}行一共有{len(columns)}列。')
# 遍历列内容,这里只是先打印出日志,便于查看问题
for j, curr_column in enumerate(columns):
log.info(
'查询出仓库表,的第 %s 行,第 %s 列的内容为 %s' % (i, j, self.page_buy.get_text(curr_column)))
# 挑选出一列,因为前端是模糊查询,有可能是仓库编码,有可能是仓库名称,匹配第一条即可
if (ware_content in self.page_buy.get_text(columns[1])) or (
ware_content in self.page_buy.get_text(columns[2])):
'''选中当前行'''
# self.driver.execute_script("arguments[0].click();", current_row)
# self.page_buy.single_click(current_row)
self.page_buy.select_one_row(current_row)
'''点击确认'''
ware_table_ensure = self.page_buy.get_ensure_from_dialog(ware_dialog)
self.page_buy.single_click(ware_table_ensure)
'''选中后退出,不再查询'''
break
log.info(f'仓库{ware_content}输入成功。')
except Exception as e:
log.error(f'输入仓库问题:{e.__doc__}{traceback.format_exc()}')
assert False
@allure.step("输入仓库")
def input_warehouse(self):
try:
# 先从yaml中获取仓库内容
ware_content = get_filed_from_yaml(module, "data", "warehouse")
# 点击仓库输入内容元素
warehouse_content_input = self.page_buy.get_warehouse_content()
# 输入仓库信息
self.page_buy.input_text(warehouse_content_input, ware_content)
log.info(f'仓库{ware_content}输入成功。')
except Exception as e:
log.error(f'输入仓库问题:{e.__doc__}{traceback.format_exc()}')
assert False
@allure.step("输入协议")
def input_protocol(self):
try:
# 先从yaml中获取协议内容
protocol_content = get_filed_from_yaml(module, "data", "protocol")
# 获取协议输入内容元素
protocol_content_input = self.page_buy.get_protocol_context()
# 输入仓库信息
self.page_buy.input_text(protocol_content_input, protocol_content)
log.info(f'协议{protocol_content}输入成功。')
except Exception as e:
log.error(f'输入协议问题:{e.__doc__}{traceback.format_exc()}')
assert False
@allure.step("输入业务员")
def input_businessman(self):
try:
# 先从yaml中获取协议内容
businessman_content = get_filed_from_yaml(module, "data", "businessman")
# 获取业务员输入内容元素
businessman_content_input = self.page_buy.get_businessman_content()
# 输入仓库信息
self.page_buy.input_text(businessman_content_input, businessman_content)
log.info(f'业务员{businessman_content}输入成功。')
except Exception as e:
log.error(f'输入业务员问题:{e.__doc__}{traceback.format_exc()}')
assert False
@allure.step("添加商品")
def add_merchandise(self):
try:
# 先从yaml中获取协议内容
merchandise_content = get_filed_from_yaml(module, "data", "merchandise")
# 点击商品录入按钮
merchandise = self.page_buy.get_merchandise()
self.page_buy.single_click(merchandise)
# 获取商品dialog
merchandise_dialog = self.page_buy.get_merchandise_dialog()
# 输入商品信息
# merchandise_input = self.page.get_input_from_dialog(merchandise_dialog)
merchandise_input = self.page_buy.get_merchandise_input()
self.page_buy.input_text(merchandise_input, merchandise_content)
# 点击搜索
# merchandise_search = self.page.get_search_from_dialog(merchandise_dialog)
merchandise_search = self.page_buy.get_merchandise_search()
self.page_buy.single_click(merchandise_search)
# 获取搜索出来的表信息
merchandise_table = self.page_buy.get_table_from_dialog(merchandise_dialog)
# 获取表的全部行
merchandise_table_rows = self.page_buy.get_all_rows_from_tale(merchandise_table)
# 遍历行
for i, current_row in enumerate(merchandise_table_rows):
# 获取当前供应商的列信息
columns = self.page_buy.get_all_columns_from_row(current_row)
# 遍历列内容,这里只是先打印出日志,便于查看问题
for j, curr_column in enumerate(columns):
log.info(
'查询出商品表,的第 %s 行,第 %s 列的内容为 %s' % (i, j, self.page_buy.get_text(curr_column)))
# 挑选出一列,模糊查询,匹配商品编码,商品名称,规格型号,厂家物料编码
if ((merchandise_content in self.page_buy.get_text(columns[1])) or
(merchandise_content in self.page_buy.get_text(columns[3])) or
(merchandise_content in self.page_buy.get_text(columns[4])) or
(merchandise_content in self.page_buy.get_text(columns[6]))):
'''选中当前行'''
'''先获取复选框'''
box = self.page_buy.get_merchandise_all_select()
self.page_buy.single_click(box)
'''点击确认'''
ensure = self.page_buy.get_ensure_from_dialog(merchandise_dialog)
self.page_buy.single_click(ensure)
'''选中后退出,不再查询'''
break
log.info(f'商品{merchandise_content}输入成功。')
except Exception as e:
log.error(f'添加商品问题:{e.__doc__}{traceback.format_exc()}')
assert False
@allure.step("明细处理")
def detail_proc(self):
try:
# 获取商品明细表
detail_table = self.page_buy.get_detail_table()
# 获取明细表中所有行
detail_rows = self.page_buy.get_all_rows_from_tale(detail_table)
# 遍历商品行,填入商品数量
for i, current_row in enumerate(detail_rows):
# 获取当前行所有的列
columns = self.page_buy.get_all_columns_from_row(current_row)
# 遍历列内容,这里只是先打印出日志,便于查看问题
for j, curr_column in enumerate(columns):
# 第1列columns[1]为数量
if j == 1:
# 先点击该元素
self.page_buy.single_click(columns[j])
# 再获取输入元素信息
quantity_element = self.page_buy.get_input_from_column(columns[j])
# 输入数量
quantity_element.clear()
self.page_buy.input_text(quantity_element, 1000)
# 第10列columns[10]为含税单价
if j == 10:
# 先点击该元素
self.page_buy.single_click(columns[j])
# 再获取输入元素信息
price_element = self.page_buy.get_input_from_column(columns[j])
# 输入价格
price_element.clear()
self.page_buy.input_text(price_element, 100)
log.info('详情清单,的第 %s 行,第 %s 列的内容为 %s' % (i, j, self.page_buy.get_text(curr_column)))
log.info(f'商品明细处理成功。')
except Exception as e:
log.error(f'商品明细处理问题:{e.__doc__}{traceback.format_exc()}')
assert False
@allure.step("订单保存处理")
def save_proc(self):
# 保存
save_button = self.page_buy.get_save()
self.page_buy.single_click(save_button)
# 获取采购单号
order_no = self.page_buy.get_order_no()
log.info("订单号:%s" % self.page_buy.get_text(order_no))
@allure.step("订单提交处理")
def submit_proc(self):
# 保存
submit_button = self.page_buy.get_submit_element()
self.page_buy.single_click(submit_button)
# author:qinguanglei
# ddate:2023/11/14 16:47
# 购买多个序列号商品
import os
import time
from pip._internal.commands import inspect
from selenium import webdriver
from selenium.webdriver import Keys
from selenium.webdriver.common.by import By
from guke.common.logger import log
from guke.common.read_yaml import get_value_by_filed_from_yaml
def test_buy_nonseq_commodities():
option = webdriver.ChromeOptions()
# option.add_experimental_option("detach", True) # 设置不要自动关闭浏览器
# 获取驱动器
driver = webdriver.Chrome(options=option)
# 最大化页面
driver.maximize_window()
driver.get("http://scdev.cmic.com.cn:8088/beta/")
driver.implicitly_wait(10)
# 获取公共信息,注意公共信息的内容在案例的同级目录下
# 获取本案例的绝对路径,绝对路径的目录就是该案例的同级目录
# 需要知道哪个文件名
direction = os.path.join(os.path.dirname(os.path.abspath(__file__)), '../data/test_buy/data.yaml')
# 取文件中的user栏位
account = get_value_by_filed_from_yaml(direction, 'account')
# 取文件中的password栏位
password = get_value_by_filed_from_yaml(direction, 'password')
log.info('获取的密码为%s', password)
root_dir = os.path.abspath(os.sep)
print(root_dir)
# BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# user =
driver.find_element(By.ID, 'input1').clear()
driver.find_element(By.ID, 'input1').send_keys(account)
driver.find_element(By.ID, 'input2').clear()
driver.find_element(By.ID, 'input2').send_keys(password)
driver.find_element(By.ID, 'input2').send_keys(Keys.ENTER)
time.sleep(1)
import allure
import pytest
from test_buy.steps_buy import StepsBuy
@allure.feature('采购模块')
class TestBuyNonseqCommodities(object):
@pytest.fixture(scope='function', autouse=True)
def housework(self, driver_fixture):
# 驱动器从fixture传来
self.driver = driver_fixture
@allure.story('购买多个序列号商品')
def test_buy_nonseq_commodities(self):
# 载入步骤集合
steps_buy = StepsBuy(self.driver)
# 打开浏览器
steps_buy.open_browser()
# 登录
steps_buy.login()
# 进入普通采购单页面
steps_buy.enter_buy_op_page()
# 进入新建单据界面
steps_buy.enter_new_op_frame()
# 输入供应商
steps_buy.input_supplier()
# 输入仓库
steps_buy.input_warehouse()
# 输入合同协议
steps_buy.input_protocol()
# 输入业务员员
steps_buy.input_businessman()
# 添加商品
steps_buy.add_merchandise()
# 商品明细处理
steps_buy.detail_proc()
# 订单保存处理
steps_buy.save_proc()
# 订单提交
steps_buy.submit_proc()
time.sleep(15)
# author:qinguanglei
# ddate:2023/11/14 16:47
# 购买一个非序列号商品
import time
import allure
import pytest
from test_buy.steps_buy import StepsBuy
......@@ -27,3 +29,18 @@ class TestBuyOneNonseqCommodity(object):
steps_buy.enter_new_op_frame()
# 输入供应商
steps_buy.input_supplier()
# 输入仓库
steps_buy.input_warehouse()
# 输入合同协议
steps_buy.input_protocol()
# 输入业务员员
steps_buy.input_businessman()
# 添加商品
steps_buy.add_merchandise()
# 商品明细处理
steps_buy.detail_proc()
# 订单保存处理
steps_buy.save_proc()
# 订单提交
steps_buy.submit_proc()
time.sleep(15)
# author:qinguanglei
# ddate:2023/11/14 16:47
# 购买1个序列号商品
\ No newline at end of file
# 购买1个序列号商品
import time
import allure
import pytest
from test_buy.steps_buy import StepsBuy
@allure.feature('采购模块')
class TestBuyOneSeqCommodity(object):
@pytest.fixture(scope='function', autouse=True)
def housework(self, driver_fixture):
# 驱动器从fixture传来
self.driver = driver_fixture
@allure.story('购买1个序列号商品')
def test_buy_one_seq_commodity(self):
# 载入步骤集合
steps_buy = StepsBuy(self.driver)
# 打开浏览器
steps_buy.open_browser()
# 登录
steps_buy.login()
# 进入普通采购单页面
steps_buy.enter_buy_op_page()
# 进入新建单据界面
steps_buy.enter_new_op_frame()
# 输入供应商
steps_buy.input_supplier()
# 输入仓库
steps_buy.input_warehouse()
# 输入合同协议
steps_buy.input_protocol()
# 输入业务员员
steps_buy.input_businessman()
# 添加商品
steps_buy.add_merchandise()
# 商品明细处理
steps_buy.detail_proc()
# 订单保存处理
steps_buy.save_proc()
# 订单提交
steps_buy.submit_proc()
time.sleep(15)
\ No newline at end of file
# author:qinguanglei
# ddate:2023/11/14 16:47
# 购买多个序列号商品
\ No newline at end of file
# 购买多个序列号商品
import time
import allure
import pytest
from test_buy.steps_buy import StepsBuy
@allure.feature('采购模块')
class TestBuySeqCommodities(object):
@pytest.fixture(scope='function', autouse=True)
def housework(self, driver_fixture):
# 驱动器从fixture传来
self.driver = driver_fixture
@allure.story('购买多个序列号商品')
def test_buy_seq_commodities(self):
# 载入步骤集合
steps_buy = StepsBuy(self.driver)
# 打开浏览器
steps_buy.open_browser()
# 登录
steps_buy.login()
# 进入普通采购单页面
steps_buy.enter_buy_op_page()
# 进入新建单据界面
steps_buy.enter_new_op_frame()
# 输入供应商
steps_buy.input_supplier()
# 输入仓库
steps_buy.input_warehouse()
# 输入合同协议
steps_buy.input_protocol()
# 输入业务员员
steps_buy.input_businessman()
# 添加商品
steps_buy.add_merchandise()
# 商品明细处理
steps_buy.detail_proc()
# 订单保存处理
steps_buy.save_proc()
# 订单提交
steps_buy.submit_proc()
time.sleep(15)
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment