From 2c84072fde829a241703d2d215f46901c782fe3c Mon Sep 17 00:00:00 2001 From: 17322369953 <381713747@qq.com> Date: Tue, 21 Nov 2023 16:40:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=83=A8=E5=88=86=E9=87=87?= =?UTF-8?q?=E8=B4=AD=E6=A1=88=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/test_buy/data.yaml | 6 +- main.py | 9 +- page_class/base_page.py | 8 +- ...1b52-4ce3-aaf4-c3bfca04fe05-container.json | 1 - ...d1f3-437b-8662-ee941dff3459-attachment.txt | 12 - ...7a1b-4b16-bd12-62b6f77fe04c-container.json | 1 - ...5cdd-4f9d-8c2f-f494dceac4b1-container.json | 1 - ...fb-19cf-418e-af03-069111ef8014-result.json | 1 - ...0e40-4511-84eb-f442f7c38f3b-container.json | 1 - ...a1-10fb-42e9-8e41-ad0e7d04ed62-result.json | 1 - ...6f-20f3-495a-bc31-a1f898521b2f-result.json | 1 - ...e6-c0e4-495a-be24-99071485b507-result.json | 1 - ...3ee8-430a-9379-1640625b9f06-container.json | 1 - ...5ff1-4494-8679-f69adf7d9d72-attachment.txt | 20 -- ...9ea8-4951-892f-f038f27f1552-attachment.txt | 12 - ...7d08-47e8-8912-b02affe8ee28-container.json | 1 - ...da0c-4a38-b103-709aec13d699-attachment.txt | 40 --- ...84-68cb-454c-b456-9e9e91cc0d74-result.json | 1 - ...7bfd-4b4f-b97e-32a66a75dd84-attachment.txt | 52 ---- ...5f5b-49f9-8322-196aec366edf-container.json | 1 - ...74a4-4700-b2a1-5082e2b6c760-container.json | 1 - ...2839-4962-ba6d-605003bdfe2c-attachment.txt | 12 - ...e8-dff7-4a39-a067-da84bd772372-result.json | 1 - ...2376-4164-90d8-8eba81851367-attachment.txt | 12 - ...cc54-438b-b9b2-3d0d93d1a2ff-attachment.txt | 12 - ...68f6-4993-8c54-ee3359acb267-container.json | 1 - test_buy/page_buy.py | 85 +++++- test_buy/steps_buy.py | 256 +++++++++++++++++- test_buy/test_buy_nonseq_commodities.py | 85 +++--- test_buy/test_buy_one_nonseq_commodity.py | 17 ++ test_buy/test_buy_one_seq_commodity.py | 45 ++- test_buy/test_buy_seq_commodities.py | 46 +++- 32 files changed, 486 insertions(+), 258 deletions(-) delete mode 100644 report/0983d36b-1b52-4ce3-aaf4-c3bfca04fe05-container.json delete mode 100644 report/18d9e0ea-d1f3-437b-8662-ee941dff3459-attachment.txt delete mode 100644 report/1f6a9b69-7a1b-4b16-bd12-62b6f77fe04c-container.json delete mode 100644 report/32a60125-5cdd-4f9d-8c2f-f494dceac4b1-container.json delete mode 100644 report/3451b6fb-19cf-418e-af03-069111ef8014-result.json delete mode 100644 report/379ecb5e-0e40-4511-84eb-f442f7c38f3b-container.json delete mode 100644 report/391b25a1-10fb-42e9-8e41-ad0e7d04ed62-result.json delete mode 100644 report/524c786f-20f3-495a-bc31-a1f898521b2f-result.json delete mode 100644 report/568894e6-c0e4-495a-be24-99071485b507-result.json delete mode 100644 report/61df1257-3ee8-430a-9379-1640625b9f06-container.json delete mode 100644 report/62140e5c-5ff1-4494-8679-f69adf7d9d72-attachment.txt delete mode 100644 report/6e0334ea-9ea8-4951-892f-f038f27f1552-attachment.txt delete mode 100644 report/7c909a5d-7d08-47e8-8912-b02affe8ee28-container.json delete mode 100644 report/838fa8d4-da0c-4a38-b103-709aec13d699-attachment.txt delete mode 100644 report/8e634884-68cb-454c-b456-9e9e91cc0d74-result.json delete mode 100644 report/90997e19-7bfd-4b4f-b97e-32a66a75dd84-attachment.txt delete mode 100644 report/93df9439-5f5b-49f9-8322-196aec366edf-container.json delete mode 100644 report/a8877038-74a4-4700-b2a1-5082e2b6c760-container.json delete mode 100644 report/be48ff94-2839-4962-ba6d-605003bdfe2c-attachment.txt delete mode 100644 report/bf5ed4e8-dff7-4a39-a067-da84bd772372-result.json delete mode 100644 report/ee4b9e59-2376-4164-90d8-8eba81851367-attachment.txt delete mode 100644 report/f9bdeb94-cc54-438b-b9b2-3d0d93d1a2ff-attachment.txt delete mode 100644 report/ff7e9f78-68f6-4993-8c54-ee3359acb267-container.json diff --git a/data/test_buy/data.yaml b/data/test_buy/data.yaml index d0172ae..454974e 100644 --- a/data/test_buy/data.yaml +++ b/data/test_buy/data.yaml @@ -1,4 +1,8 @@ url: http://scdev.cmic.com.cn:8088/beta/ account: bj_qgl password: Gyxc12345 -supplier: '1003207' \ No newline at end of file +supplier: '1003207' +warehouse: '103356' +protocol: '1216167' +businessman: '11353403' +merchandise: '10006280' \ No newline at end of file diff --git a/main.py b/main.py index 5e6d53a..0a4f8b1 100644 --- a/main.py +++ b/main.py @@ -41,10 +41,13 @@ if __name__ == '__main__': # ['-vs', 'D:/pythonProject/atuobase/test_login/test_login_success.py', '--reruns', '3', '--reruns-delay', '2', '--alluredir', # report_dir, '--clean-alluredir']) # 开始执行用例 - pytest.main( - ['-vs', 'D:/pythonProject/atuobase/test_login', '--reruns', '3', '--reruns-delay', '2', '--alluredir', - report_dir, '--clean-alluredir']) + #pytest.main( + # ['-vs', 'D:/pythonProject/atuobase/test_login', 'D:/pythonProject/atuobase/test_buy/test_buy_one_nonseq_commodity.py::TestBuyOneNonseqCommodity::test_buy_one_nonseq_commodity', '--reruns', '3', '--reruns-delay', '2', '--alluredir', + # report_dir, '--clean-alluredir']) # Mail().send() + pytest.main( + ['-vs', '--reruns', '3', '--reruns-delay', '2', '--alluredir', + report_dir, '--clean-alluredir']) os.system('allure serve %s' % report_dir) # 可以在终端执行命令 pytest D:\pythonProject\atuobase\test_login\test_login_success.py diff --git a/page_class/base_page.py b/page_class/base_page.py index 80c44ca..38acefc 100644 --- a/page_class/base_page.py +++ b/page_class/base_page.py @@ -29,13 +29,18 @@ class BasePage(object): '''单击一个元素''' def single_click(self, page_element): + self.wait_seconds(1) page_element.click() + #action_chains = ActionChains(self.driver) + #action_chains.move_to_element(page_element) + #action_chains.click() + #action_chains.perform() + # self.driver.execute_script("arguments[0].click();", page_element) def single_click_then_wait(self, page_element, seconds): page_element.click() self.wait_seconds(seconds) - '''获取一个元素上的文本信息''' def get_text(self, page_element): @@ -82,6 +87,7 @@ class BasePage(object): """获取一个表,指定行的列信息""" def get_all_columns_from_row(self, row_element): + self.wait_seconds(self.time_seconds) columns = row_element.find_elements(By.TAG_NAME, "td") return columns diff --git a/report/0983d36b-1b52-4ce3-aaf4-c3bfca04fe05-container.json b/report/0983d36b-1b52-4ce3-aaf4-c3bfca04fe05-container.json deleted file mode 100644 index 9363852..0000000 --- a/report/0983d36b-1b52-4ce3-aaf4-c3bfca04fe05-container.json +++ /dev/null @@ -1 +0,0 @@ -{"uuid": "209f5de0-e30b-4271-b874-97a1c1fea87f", "children": ["a4d17bdd-9108-4e8b-ba93-0dc1b0e02b13"], "befores": [{"name": "housework", "status": "passed", "start": 1700472864625, "stop": 1700472864625}], "start": 1700472864625, "stop": 1700472871507} \ No newline at end of file diff --git a/report/18d9e0ea-d1f3-437b-8662-ee941dff3459-attachment.txt b/report/18d9e0ea-d1f3-437b-8662-ee941dff3459-attachment.txt deleted file mode 100644 index da026be..0000000 --- a/report/18d9e0ea-d1f3-437b-8662-ee941dff3459-attachment.txt +++ /dev/null @@ -1,12 +0,0 @@ -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 当前验证码的文字为:UK7B -INFO root:steps_login.py:82 输入的验证码为:UK7B \ No newline at end of file diff --git a/report/1f6a9b69-7a1b-4b16-bd12-62b6f77fe04c-container.json b/report/1f6a9b69-7a1b-4b16-bd12-62b6f77fe04c-container.json deleted file mode 100644 index 8909c39..0000000 --- a/report/1f6a9b69-7a1b-4b16-bd12-62b6f77fe04c-container.json +++ /dev/null @@ -1 +0,0 @@ -{"uuid": "73709d31-8d6d-4562-83a3-97470b15aaea", "children": ["57b2c080-a1a0-49c7-a297-f9a6c60b9322"], "befores": [{"name": "housework", "status": "passed", "start": 1700472850035, "stop": 1700472850035}], "start": 1700472850035, "stop": 1700472858023} \ No newline at end of file diff --git a/report/32a60125-5cdd-4f9d-8c2f-f494dceac4b1-container.json b/report/32a60125-5cdd-4f9d-8c2f-f494dceac4b1-container.json deleted file mode 100644 index e1cdb67..0000000 --- a/report/32a60125-5cdd-4f9d-8c2f-f494dceac4b1-container.json +++ /dev/null @@ -1 +0,0 @@ -{"uuid": "9ec1ac72-ef2d-4ab1-92b4-7242487c087b", "children": ["8df9c1dc-783a-4ee4-9855-b0898884a95b"], "befores": [{"name": "housework", "status": "passed", "start": 1700472902740, "stop": 1700472902740}], "start": 1700472902740, "stop": 1700472909413} \ No newline at end of file diff --git a/report/3451b6fb-19cf-418e-af03-069111ef8014-result.json b/report/3451b6fb-19cf-418e-af03-069111ef8014-result.json deleted file mode 100644 index de42e99..0000000 --- a/report/3451b6fb-19cf-418e-af03-069111ef8014-result.json +++ /dev/null @@ -1 +0,0 @@ -{"name": "test_login_verify_code_error", "status": "passed", "steps": [{"name": "打开浏览器", "status": "passed", "start": 1700472902741, "stop": 1700472902844}, {"name": "输入账号密码", "status": "passed", "parameters": [{"name": "flag", "value": "0"}], "start": 1700472902844, "stop": 1700472904948}, {"name": "输入验证码", "status": "passed", "parameters": [{"name": "flag", "value": "1"}], "start": 1700472904948, "stop": 1700472907364}, {"name": "点击登录", "status": "passed", "start": 1700472907364, "stop": 1700472908400}, {"name": "登录错误结果校验", "status": "passed", "parameters": [{"name": "flag", "value": "0"}], "start": 1700472908400, "stop": 1700472909411}], "attachments": [{"name": "log", "source": "f9bdeb94-cc54-438b-b9b2-3d0d93d1a2ff-attachment.txt", "type": "text/plain"}], "start": 1700472902741, "stop": 1700472909413, "uuid": "8df9c1dc-783a-4ee4-9855-b0898884a95b", "historyId": "ede6c7f0e1e7a2af3e978d67fba55397", "testCaseId": "3055648340d6ae4c20cfb3b690f12d9a", "fullName": "atuobase.test_login.test_login_verify_code_error.TestLoginVerifyCodeError#test_login_verify_code_error", "labels": [{"name": "story", "value": "登录验证码错误案例-点击登录"}, {"name": "feature", "value": "登录模块"}, {"name": "parentSuite", "value": "atuobase.test_login"}, {"name": "suite", "value": "test_login_verify_code_error"}, {"name": "subSuite", "value": "TestLoginVerifyCodeError"}, {"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_verify_code_error"}]} \ No newline at end of file diff --git a/report/379ecb5e-0e40-4511-84eb-f442f7c38f3b-container.json b/report/379ecb5e-0e40-4511-84eb-f442f7c38f3b-container.json deleted file mode 100644 index 43f512e..0000000 --- a/report/379ecb5e-0e40-4511-84eb-f442f7c38f3b-container.json +++ /dev/null @@ -1 +0,0 @@ -{"uuid": "e154583b-e6ad-42d4-a031-d62af1f3ea1b", "children": ["08f89516-a331-4f0f-87e7-f7105fd65ba0"], "befores": [{"name": "housework", "status": "passed", "start": 1700472896097, "stop": 1700472896097}], "start": 1700472896097, "stop": 1700472902735} \ No newline at end of file diff --git a/report/391b25a1-10fb-42e9-8e41-ad0e7d04ed62-result.json b/report/391b25a1-10fb-42e9-8e41-ad0e7d04ed62-result.json deleted file mode 100644 index 9d3b576..0000000 --- a/report/391b25a1-10fb-42e9-8e41-ad0e7d04ed62-result.json +++ /dev/null @@ -1 +0,0 @@ -{"name": "test_login_no_input_verifycode", "status": "passed", "steps": [{"name": "打开浏览器", "status": "passed", "start": 1700472858025, "stop": 1700472858123}, {"name": "输入账号密码", "status": "passed", "parameters": [{"name": "flag", "value": "0"}], "start": 1700472858123, "stop": 1700472860225}, {"name": "输入验证码", "status": "passed", "parameters": [{"name": "flag", "value": "2"}], "start": 1700472860225, "stop": 1700472862567}, {"name": "点击登录", "status": "passed", "start": 1700472862567, "stop": 1700472863603}, {"name": "登录错误结果校验", "status": "passed", "parameters": [{"name": "flag", "value": "3"}], "start": 1700472863603, "stop": 1700472864620}], "attachments": [{"name": "log", "source": "18d9e0ea-d1f3-437b-8662-ee941dff3459-attachment.txt", "type": "text/plain"}], "start": 1700472858025, "stop": 1700472864620, "uuid": "363fb4df-ca00-448d-aa56-0d96cfa082ed", "historyId": "1eb6d2660c1ffd3692c35d343ff5f6de", "testCaseId": "7135ee4b659905a7032c89f8e6f8102f", "fullName": "atuobase.test_login.test_login_no_input_verifycode.TestLoginNoInputVerifycode#test_login_no_input_verifycode", "labels": [{"name": "story", "value": "不输入验证码案例-点击登录"}, {"name": "feature", "value": "登录模块"}, {"name": "parentSuite", "value": "atuobase.test_login"}, {"name": "suite", "value": "test_login_no_input_verifycode"}, {"name": "subSuite", "value": "TestLoginNoInputVerifycode"}, {"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_no_input_verifycode"}]} \ No newline at end of file diff --git a/report/524c786f-20f3-495a-bc31-a1f898521b2f-result.json b/report/524c786f-20f3-495a-bc31-a1f898521b2f-result.json deleted file mode 100644 index 55ea57c..0000000 --- a/report/524c786f-20f3-495a-bc31-a1f898521b2f-result.json +++ /dev/null @@ -1 +0,0 @@ -{"name": "test_login_success_click", "status": "passed", "steps": [{"name": "打开浏览器", "status": "passed", "start": 1700472871511, "stop": 1700472871613}, {"name": "输入账号密码", "status": "passed", "parameters": [{"name": "flag", "value": "0"}], "start": 1700472871613, "stop": 1700472873712}, {"name": "输入验证码", "status": "passed", "parameters": [{"name": "flag", "value": "0"}], "start": 1700472873712, "stop": 1700472876101}, {"name": "点击登录", "status": "passed", "start": 1700472876101, "stop": 1700472877144}, {"name": "判断是否登录成功", "status": "passed", "start": 1700472877144, "stop": 1700472878217}], "attachments": [{"name": "log", "source": "ee4b9e59-2376-4164-90d8-8eba81851367-attachment.txt", "type": "text/plain"}], "start": 1700472871511, "stop": 1700472878217, "uuid": "0b88d4b8-7a55-4cb2-81cb-839660f62e0e", "historyId": "994bdc7d7f2d92350503243c6e75259e", "testCaseId": "f473e68493409c6e5d7b915b06c2bb77", "fullName": "atuobase.test_login.test_login_success.TestLoginSuccess#test_login_success_click", "labels": [{"name": "story", "value": "登录成功案例-点击登录"}, {"name": "feature", "value": "登录模块"}, {"name": "parentSuite", "value": "atuobase.test_login"}, {"name": "suite", "value": "test_login_success"}, {"name": "subSuite", "value": "TestLoginSuccess"}, {"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_success"}]} \ No newline at end of file diff --git a/report/568894e6-c0e4-495a-be24-99071485b507-result.json b/report/568894e6-c0e4-495a-be24-99071485b507-result.json deleted file mode 100644 index 900a32d..0000000 --- a/report/568894e6-c0e4-495a-be24-99071485b507-result.json +++ /dev/null @@ -1 +0,0 @@ -{"name": "test_login_no_input_userid", "status": "passed", "steps": [{"name": "打开浏览器", "status": "passed", "start": 1700472850035, "stop": 1700472851462}, {"name": "输入账号密码", "status": "passed", "parameters": [{"name": "flag", "value": "2"}], "start": 1700472851462, "stop": 1700472853542}, {"name": "输入验证码", "status": "passed", "parameters": [{"name": "flag", "value": "0"}], "start": 1700472853542, "stop": 1700472855957}, {"name": "点击登录", "status": "passed", "start": 1700472855957, "stop": 1700472857006}, {"name": "登录错误结果校验", "status": "passed", "parameters": [{"name": "flag", "value": "2"}], "start": 1700472857007, "stop": 1700472858021}], "attachments": [{"name": "log", "source": "6e0334ea-9ea8-4951-892f-f038f27f1552-attachment.txt", "type": "text/plain"}], "start": 1700472850035, "stop": 1700472858021, "uuid": "57b2c080-a1a0-49c7-a297-f9a6c60b9322", "historyId": "25dad1d66da10ac8330f09b02006392f", "testCaseId": "ad2e7b0e7feeb5ab37c5db7ceb3bf349", "fullName": "atuobase.test_login.test_login_no_input_userid.TestLoginNoInputUserid#test_login_no_input_userid", "labels": [{"name": "story", "value": "不输入用户名登录失败案例-点击登录"}, {"name": "feature", "value": "登录模块"}, {"name": "parentSuite", "value": "atuobase.test_login"}, {"name": "suite", "value": "test_login_no_input_userid"}, {"name": "subSuite", "value": "TestLoginNoInputUserid"}, {"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_no_input_userid"}]} \ No newline at end of file diff --git a/report/61df1257-3ee8-430a-9379-1640625b9f06-container.json b/report/61df1257-3ee8-430a-9379-1640625b9f06-container.json deleted file mode 100644 index 3aec523..0000000 --- a/report/61df1257-3ee8-430a-9379-1640625b9f06-container.json +++ /dev/null @@ -1 +0,0 @@ -{"uuid": "1a8c9dd2-3af3-4e5d-9a17-8525507244a2", "children": ["08f89516-a331-4f0f-87e7-f7105fd65ba0"], "befores": [{"name": "housework", "status": "passed", "start": 1700472878223, "stop": 1700472878223}], "start": 1700472878223, "stop": 1700472885205} \ No newline at end of file diff --git a/report/62140e5c-5ff1-4494-8679-f69adf7d9d72-attachment.txt b/report/62140e5c-5ff1-4494-8679-f69adf7d9d72-attachment.txt deleted file mode 100644 index a318256..0000000 --- a/report/62140e5c-5ff1-4494-8679-f69adf7d9d72-attachment.txt +++ /dev/null @@ -1,20 +0,0 @@ -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 当前验证码的文字为:OKVV -INFO root:steps_login.py:82 输入的验证码为:OKVV -ERROR root:steps_login.py:152 登录错误结果校验,案例执行失败 -ERROR root:steps_login.py:153 self.page_login.get_text(login_result_element)=验证码错误!! -ERROR root:steps_login.py:155 result_value=用户名或密码错误 -ERROR root:steps_login.py:156 self.page_login.get_text(login_result_element)与result_value不一致 -ERROR root:steps_login.py:159 登录错误结果校验问题:Assertion failed.Traceback (most recent call last): - File "D:\pythonProject\atuobase\test_login\steps_login.py", line 157, in judge_result_error - assert False -AssertionError \ No newline at end of file diff --git a/report/6e0334ea-9ea8-4951-892f-f038f27f1552-attachment.txt b/report/6e0334ea-9ea8-4951-892f-f038f27f1552-attachment.txt deleted file mode 100644 index 963e86e..0000000 --- a/report/6e0334ea-9ea8-4951-892f-f038f27f1552-attachment.txt +++ /dev/null @@ -1,12 +0,0 @@ -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 当前验证码的文字为:AX3Y -INFO root:steps_login.py:82 输入的验证码为:AX3Y \ No newline at end of file diff --git a/report/7c909a5d-7d08-47e8-8912-b02affe8ee28-container.json b/report/7c909a5d-7d08-47e8-8912-b02affe8ee28-container.json deleted file mode 100644 index e006e48..0000000 --- a/report/7c909a5d-7d08-47e8-8912-b02affe8ee28-container.json +++ /dev/null @@ -1 +0,0 @@ -{"uuid": "d3270a21-52eb-4dd6-9773-87c220812304", "children": ["363fb4df-ca00-448d-aa56-0d96cfa082ed"], "befores": [{"name": "housework", "status": "passed", "start": 1700472858025, "stop": 1700472858025}], "start": 1700472858025, "stop": 1700472864620} \ No newline at end of file diff --git a/report/838fa8d4-da0c-4a38-b103-709aec13d699-attachment.txt b/report/838fa8d4-da0c-4a38-b103-709aec13d699-attachment.txt deleted file mode 100644 index ceb08fb..0000000 --- a/report/838fa8d4-da0c-4a38-b103-709aec13d699-attachment.txt +++ /dev/null @@ -1,40 +0,0 @@ -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 当前验证码的文字为:OKVV -INFO root:steps_login.py:82 输入的验证码为:OKVV -ERROR root:steps_login.py:152 登录错误结果校验,案例执行失败 -ERROR root:steps_login.py:153 self.page_login.get_text(login_result_element)=验证码错误!! -ERROR root:steps_login.py:155 result_value=用户名或密码错误 -ERROR root:steps_login.py:156 self.page_login.get_text(login_result_element)与result_value不一致 -ERROR root:steps_login.py:159 登录错误结果校验问题:Assertion failed.Traceback (most recent call last): - File "D:\pythonProject\atuobase\test_login\steps_login.py", line 157, in judge_result_error - assert False -AssertionError -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 当前验证码的文字为:FEIT -INFO root:steps_login.py:82 输入的验证码为:FEIT -ERROR root:steps_login.py:152 登录错误结果校验,案例执行失败 -ERROR root:steps_login.py:153 self.page_login.get_text(login_result_element)=验证码错误!! -ERROR root:steps_login.py:155 result_value=用户名或密码错误 -ERROR root:steps_login.py:156 self.page_login.get_text(login_result_element)与result_value不一致 -ERROR root:steps_login.py:159 登录错误结果校验问题:Assertion failed.Traceback (most recent call last): - File "D:\pythonProject\atuobase\test_login\steps_login.py", line 157, in judge_result_error - assert False -AssertionError \ No newline at end of file diff --git a/report/8e634884-68cb-454c-b456-9e9e91cc0d74-result.json b/report/8e634884-68cb-454c-b456-9e9e91cc0d74-result.json deleted file mode 100644 index 4ea796e..0000000 --- a/report/8e634884-68cb-454c-b456-9e9e91cc0d74-result.json +++ /dev/null @@ -1 +0,0 @@ -{"name": "test_login_password_error", "status": "passed", "steps": [{"name": "打开浏览器", "status": "passed", "start": 1700472864625, "stop": 1700472864937}, {"name": "输入账号密码", "status": "passed", "parameters": [{"name": "flag", "value": "4"}], "start": 1700472864937, "stop": 1700472867041}, {"name": "输入验证码", "status": "passed", "parameters": [{"name": "flag", "value": "0"}], "start": 1700472867041, "stop": 1700472869440}, {"name": "点击登录", "status": "passed", "start": 1700472869441, "stop": 1700472870495}, {"name": "登录错误结果校验", "status": "passed", "parameters": [{"name": "flag", "value": "1"}], "start": 1700472870495, "stop": 1700472871506}], "attachments": [{"name": "log", "source": "be48ff94-2839-4962-ba6d-605003bdfe2c-attachment.txt", "type": "text/plain"}], "start": 1700472864625, "stop": 1700472871507, "uuid": "a4d17bdd-9108-4e8b-ba93-0dc1b0e02b13", "historyId": "96a8543f273893c9553c54f7b88da5f0", "testCaseId": "e5ed5afbfc3640ddaf17a72fada70aa0", "fullName": "atuobase.test_login.test_login_password_error.TestLoginPasswordError#test_login_password_error", "labels": [{"name": "story", "value": "输入错误密码登录失败案例-点击登录"}, {"name": "feature", "value": "登录模块"}, {"name": "parentSuite", "value": "atuobase.test_login"}, {"name": "suite", "value": "test_login_password_error"}, {"name": "subSuite", "value": "TestLoginPasswordError"}, {"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_password_error"}]} \ No newline at end of file diff --git a/report/90997e19-7bfd-4b4f-b97e-32a66a75dd84-attachment.txt b/report/90997e19-7bfd-4b4f-b97e-32a66a75dd84-attachment.txt deleted file mode 100644 index 387c50b..0000000 --- a/report/90997e19-7bfd-4b4f-b97e-32a66a75dd84-attachment.txt +++ /dev/null @@ -1,52 +0,0 @@ -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 当前验证码的文字为:OKVV -INFO root:steps_login.py:82 输入的验证码为:OKVV -ERROR root:steps_login.py:152 登录错误结果校验,案例执行失败 -ERROR root:steps_login.py:153 self.page_login.get_text(login_result_element)=验证码错误!! -ERROR root:steps_login.py:155 result_value=用户名或密码错误 -ERROR root:steps_login.py:156 self.page_login.get_text(login_result_element)与result_value不一致 -ERROR root:steps_login.py:159 登录错误结果校验问题:Assertion failed.Traceback (most recent call last): - File "D:\pythonProject\atuobase\test_login\steps_login.py", line 157, in judge_result_error - assert False -AssertionError -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 当前验证码的文字为:FEIT -INFO root:steps_login.py:82 输入的验证码为:FEIT -ERROR root:steps_login.py:152 登录错误结果校验,案例执行失败 -ERROR root:steps_login.py:153 self.page_login.get_text(login_result_element)=验证码错误!! -ERROR root:steps_login.py:155 result_value=用户名或密码错误 -ERROR root:steps_login.py:156 self.page_login.get_text(login_result_element)与result_value不一致 -ERROR root:steps_login.py:159 登录错误结果校验问题:Assertion failed.Traceback (most recent call last): - File "D:\pythonProject\atuobase\test_login\steps_login.py", line 157, in judge_result_error - assert False -AssertionError -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 当前验证码的文字为:DRG7 -INFO root:steps_login.py:82 输入的验证码为:DRG7 \ No newline at end of file diff --git a/report/93df9439-5f5b-49f9-8322-196aec366edf-container.json b/report/93df9439-5f5b-49f9-8322-196aec366edf-container.json deleted file mode 100644 index 224cc18..0000000 --- a/report/93df9439-5f5b-49f9-8322-196aec366edf-container.json +++ /dev/null @@ -1 +0,0 @@ -{"uuid": "cea7612f-79f8-42e4-91b4-8e19396bf6d5", "children": ["08f89516-a331-4f0f-87e7-f7105fd65ba0"], "befores": [{"name": "housework", "status": "passed", "start": 1700472887210, "stop": 1700472887210}], "start": 1700472887210, "stop": 1700472894095} \ No newline at end of file diff --git a/report/a8877038-74a4-4700-b2a1-5082e2b6c760-container.json b/report/a8877038-74a4-4700-b2a1-5082e2b6c760-container.json deleted file mode 100644 index 8e88ccb..0000000 --- a/report/a8877038-74a4-4700-b2a1-5082e2b6c760-container.json +++ /dev/null @@ -1 +0,0 @@ -{"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 diff --git a/report/be48ff94-2839-4962-ba6d-605003bdfe2c-attachment.txt b/report/be48ff94-2839-4962-ba6d-605003bdfe2c-attachment.txt deleted file mode 100644 index 6a7dced..0000000 --- a/report/be48ff94-2839-4962-ba6d-605003bdfe2c-attachment.txt +++ /dev/null @@ -1,12 +0,0 @@ -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 diff --git a/report/bf5ed4e8-dff7-4a39-a067-da84bd772372-result.json b/report/bf5ed4e8-dff7-4a39-a067-da84bd772372-result.json deleted file mode 100644 index 552ca9e..0000000 --- a/report/bf5ed4e8-dff7-4a39-a067-da84bd772372-result.json +++ /dev/null @@ -1 +0,0 @@ -{"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 \"\", 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 \"\", 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 diff --git a/report/ee4b9e59-2376-4164-90d8-8eba81851367-attachment.txt b/report/ee4b9e59-2376-4164-90d8-8eba81851367-attachment.txt deleted file mode 100644 index d10862e..0000000 --- a/report/ee4b9e59-2376-4164-90d8-8eba81851367-attachment.txt +++ /dev/null @@ -1,12 +0,0 @@ -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 diff --git a/report/f9bdeb94-cc54-438b-b9b2-3d0d93d1a2ff-attachment.txt b/report/f9bdeb94-cc54-438b-b9b2-3d0d93d1a2ff-attachment.txt deleted file mode 100644 index bf4fb6a..0000000 --- a/report/f9bdeb94-cc54-438b-b9b2-3d0d93d1a2ff-attachment.txt +++ /dev/null @@ -1,12 +0,0 @@ -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 diff --git a/report/ff7e9f78-68f6-4993-8c54-ee3359acb267-container.json b/report/ff7e9f78-68f6-4993-8c54-ee3359acb267-container.json deleted file mode 100644 index 146bc98..0000000 --- a/report/ff7e9f78-68f6-4993-8c54-ee3359acb267-container.json +++ /dev/null @@ -1 +0,0 @@ -{"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 diff --git a/test_buy/page_buy.py b/test_buy/page_buy.py index b706e54..dbfc8d3 100644 --- a/test_buy/page_buy.py +++ b/test_buy/page_buy.py @@ -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) diff --git a/test_buy/steps_buy.py b/test_buy/steps_buy.py index d4332cd..5f65d25 100644 --- a/test_buy/steps_buy.py +++ b/test_buy/steps_buy.py @@ -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) diff --git a/test_buy/test_buy_nonseq_commodities.py b/test_buy/test_buy_nonseq_commodities.py index 1c245cb..a03cd3c 100644 --- a/test_buy/test_buy_nonseq_commodities.py +++ b/test_buy/test_buy_nonseq_commodities.py @@ -1,49 +1,46 @@ # 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) diff --git a/test_buy/test_buy_one_nonseq_commodity.py b/test_buy/test_buy_one_nonseq_commodity.py index f535be5..33553e9 100644 --- a/test_buy/test_buy_one_nonseq_commodity.py +++ b/test_buy/test_buy_one_nonseq_commodity.py @@ -1,6 +1,8 @@ # 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) diff --git a/test_buy/test_buy_one_seq_commodity.py b/test_buy/test_buy_one_seq_commodity.py index 8bda035..631dd22 100644 --- a/test_buy/test_buy_one_seq_commodity.py +++ b/test_buy/test_buy_one_seq_commodity.py @@ -1,3 +1,46 @@ # 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 diff --git a/test_buy/test_buy_seq_commodities.py b/test_buy/test_buy_seq_commodities.py index 6fff66a..3fb4c5f 100644 --- a/test_buy/test_buy_seq_commodities.py +++ b/test_buy/test_buy_seq_commodities.py @@ -1,3 +1,47 @@ # 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 -- GitLab