Commit 933b11db authored by gaotao's avatar gaotao

基本信息控件

parent 987bbc5d
......@@ -15,7 +15,7 @@ def get_engine(file, url):
image_path = os.path.join(image_path, log_name)
image_path += '.png'
engine = BrowserEngine(image_path, log_name, url)
engine = BrowserEngine(image_path, log_name, url.upper())
ret = f(engine, *args, **kwargs)
......
......@@ -78,19 +78,19 @@ class BrowserEngine(ReadConfig):
self.logger.info("the testUrl : %s" % url)
self.driver.get(url)
def load_image(self):
print(self.image_path)
image_dir, image_name = os.path.split(self.image_path)
image_list = os.listdir(image_dir)
if image_name in image_list:
image_name_list = list(filter(lambda x: re.findall(image_name + r'-\d{1,}\.png', x), image_list))
image_name_index_list = list(map(lambda x: int(x.split('-|.')[-2]) if '-' in x else 0, image_name_list))
next_image_name_index = max(image_name_index_list) + 1 if image_name_index_list else 1
next_image_name = os.path.join(image_dir, image_name.replace('.png', f'-{next_image_name_index}.png'))
else:
next_image_name = self.image_path
print(next_image_name)
self.driver.get_screenshot_as_file(next_image_name)
# def load_image(self):
# print(self.image_path)
# image_dir, image_name = os.path.split(self.image_path)
# image_list = os.listdir(image_dir)
# if image_name in image_list:
# image_name_list = list(filter(lambda x: re.findall(image_name + r'-\d{1,}\.png', x), image_list))
# image_name_index_list = list(map(lambda x: int(x.split('-|.')[-2]) if '-' in x else 0, image_name_list))
# next_image_name_index = max(image_name_index_list) + 1 if image_name_index_list else 1
# next_image_name = os.path.join(image_dir, image_name.replace('.png', f'-{next_image_name_index}.png'))
# else:
# next_image_name = self.image_path
# print(next_image_name)
# self.driver.get_screenshot_as_file(next_image_name)
def __del__(self):
try:
......
......@@ -7,6 +7,8 @@ markers= login
select
addxyr
delxyr
nullxyr
gsjd
case4
case5
\ No newline at end of file
reset
basicmatter1
basicmatter
\ No newline at end of file
......@@ -243,7 +243,7 @@ function filter_table(elem) {
}
</script>
<h1>report.html</h1>
<p>Report generated on 07-Jul-2020 at 11:54:02 by <a href="https://pypi.python.org/pypi/pytest-html">pytest-html</a> v2.1.1</p>
<p>Report generated on 21-Jul-2020 at 14:06:52 by <a href="https://pypi.python.org/pypi/pytest-html">pytest-html</a> v2.1.1</p>
<h2>Environment</h2>
<table id="environment">
<tr>
......@@ -259,8 +259,8 @@ function filter_table(elem) {
<td>Python</td>
<td>3.6.8</td></tr></table>
<h2>Summary</h2>
<p>3 tests ran in 83.68 seconds. </p>
<p class="filter" hidden="true">(Un)check the boxes to filter the results.</p><input checked="true" class="filter" data-test-result="passed" hidden="true" name="filter_checkbox" onChange="filter_table(this)" type="checkbox"/><span class="passed">3 passed</span>, <input checked="true" class="filter" data-test-result="skipped" disabled="true" hidden="true" name="filter_checkbox" onChange="filter_table(this)" type="checkbox"/><span class="skipped">0 skipped</span>, <input checked="true" class="filter" data-test-result="failed" disabled="true" hidden="true" name="filter_checkbox" onChange="filter_table(this)" type="checkbox"/><span class="failed">0 failed</span>, <input checked="true" class="filter" data-test-result="error" disabled="true" hidden="true" name="filter_checkbox" onChange="filter_table(this)" type="checkbox"/><span class="error">0 errors</span>, <input checked="true" class="filter" data-test-result="xfailed" disabled="true" hidden="true" name="filter_checkbox" onChange="filter_table(this)" type="checkbox"/><span class="xfailed">0 expected failures</span>, <input checked="true" class="filter" data-test-result="xpassed" disabled="true" hidden="true" name="filter_checkbox" onChange="filter_table(this)" type="checkbox"/><span class="xpassed">0 unexpected passes</span>, <input checked="true" class="filter" data-test-result="rerun" disabled="true" hidden="true" name="filter_checkbox" onChange="filter_table(this)" type="checkbox"/><span class="rerun">0 rerun</span>
<p>1 tests ran in 40.89 seconds. </p>
<p class="filter" hidden="true">(Un)check the boxes to filter the results.</p><input checked="true" class="filter" data-test-result="passed" hidden="true" name="filter_checkbox" onChange="filter_table(this)" type="checkbox"/><span class="passed">1 passed</span>, <input checked="true" class="filter" data-test-result="skipped" disabled="true" hidden="true" name="filter_checkbox" onChange="filter_table(this)" type="checkbox"/><span class="skipped">0 skipped</span>, <input checked="true" class="filter" data-test-result="failed" disabled="true" hidden="true" name="filter_checkbox" onChange="filter_table(this)" type="checkbox"/><span class="failed">0 failed</span>, <input checked="true" class="filter" data-test-result="error" disabled="true" hidden="true" name="filter_checkbox" onChange="filter_table(this)" type="checkbox"/><span class="error">0 errors</span>, <input checked="true" class="filter" data-test-result="xfailed" disabled="true" hidden="true" name="filter_checkbox" onChange="filter_table(this)" type="checkbox"/><span class="xfailed">0 expected failures</span>, <input checked="true" class="filter" data-test-result="xpassed" disabled="true" hidden="true" name="filter_checkbox" onChange="filter_table(this)" type="checkbox"/><span class="xpassed">0 unexpected passes</span>, <input checked="true" class="filter" data-test-result="rerun" disabled="true" hidden="true" name="filter_checkbox" onChange="filter_table(this)" type="checkbox"/><span class="rerun">0 rerun</span>
<h2>Results</h2>
<table id="results-table">
<thead id="results-table-head">
......@@ -274,113 +274,36 @@ function filter_table(elem) {
<tbody class="passed results-table-row">
<tr>
<td class="col-result">Passed</td>
<td class="col-name">test_login.py::test_login</td>
<td class="col-duration">16.43</td>
<td class="col-name">test_jbaq.py::test_nullbirth</td>
<td class="col-duration">40.70</td>
<td class="col-links"></td></tr>
<tr>
<td class="extra" colspan="4">
<div class="log"> ------------------------------Captured stdout call------------------------------ <br/>周朝阳 qazwsxedc http://192.168.2.31/cm
<br/> ------------------------------Captured stderr call------------------------------ <br/>[2020-07-07 11:52:38,724] - [ INFO] - [ test_login] - [ read_config.py] - [ 29] - the configPath: C:\Users\80980\znfz_autotest\config\config.ini
[2020-07-07 11:52:41,972] - [ INFO] - [ test_login] - [ read_config.py] - [ 33] - the browserType : Chrome
[2020-07-07 11:52:41,975] - [ INFO] - [ test_login] - [ browser_engine.py] - [ 28] - browserName: Chrome
[2020-07-07 11:52:43,071] - [ INFO] - [ test_login] - [ browser_engine.py] - [ 33] - Open url: http://192.168.2.31/cm
[2020-07-07 11:52:46,198] - [ INFO] - [ test_login] - [ browser_engine.py] - [ 36] - Maximize the current window.
[2020-07-07 11:52:46,204] - [ INFO] - [ test_login] - [ browser_engine.py] - [ 38] - Set implicitly wait 10 seconds.
[2020-07-07 11:52:47,206] - [ INFO] - [ test_login] - [ read_config.py] - [ 43] - the userInfo : 周朝阳
[2020-07-07 11:52:47,206] - [ INFO] - [ test_login] - [ read_config.py] - [ 43] - the userInfo : qazwsxedc
[2020-07-07 11:52:47,206] - [ INFO] - [ test_login] - [ test_login.py] - [ 26] - username: 周朝阳
[2020-07-07 11:52:47,206] - [ INFO] - [ test_login] - [ test_login.py] - [ 27] - password :qazwsxedc
[2020-07-07 11:52:47,206] - [ INFO] - [ test_login] - [ test_login.py] - [ 28] - Open url: http://192.168.2.31/cm
[2020-07-07 11:52:47,242] - [ INFO] - [ test_login] - [ test_login.py] - [ 32] - tags.text:请选择所属部门
[2020-07-07 11:52:48,501] - [ INFO] - [ test_login] - [ test_login.py] - [ 40] - tags2.text:瓯海区院
[2020-07-07 11:52:52,320] - [ INFO] - [ test_login] - [ __init__.py] - [ 23] - 执行时间:13.596333742141724s
<br/> -------------------------------Captured log call-------------------------------- <br/>INFO  test_login:read_config.py:29 the configPath: C:\Users\80980\znfz_autotest\config\config.ini
INFO  test_login:read_config.py:33 the browserType : Chrome
INFO  test_login:browser_engine.py:28 browserName: Chrome
INFO  test_login:browser_engine.py:33 Open url: http://192.168.2.31/cm
INFO  test_login:browser_engine.py:36 Maximize the current window.
INFO  test_login:browser_engine.py:38 Set implicitly wait 10 seconds.
INFO  test_login:read_config.py:43 the userInfo : 周朝阳
INFO  test_login:read_config.py:43 the userInfo : qazwsxedc
INFO  test_login:test_login.py:26 username: 周朝阳
INFO  test_login:test_login.py:27 password :qazwsxedc
INFO  test_login:test_login.py:28 Open url: http://192.168.2.31/cm
INFO  test_login:test_login.py:32 tags.text:请选择所属部门
INFO  test_login:test_login.py:40 tags2.text:瓯海区院
INFO  test_login:__init__.py:23 执行时间:13.596333742141724s<br/></div></td></tr></tbody>
<tbody class="passed results-table-row">
<tr>
<td class="col-result">Passed</td>
<td class="col-name">test_login.py::test_login_pwerr</td>
<td class="col-duration">33.02</td>
<td class="col-links"></td></tr>
<tr>
<td class="extra" colspan="4">
<div class="log"> ------------------------------Captured stdout call------------------------------ <br/>C:\Users\80980\znfz_autotest\tests\images\test_login.png
[WinError 3] 系统找不到指定的路径。: &#x27;C:\\Users\\80980\\znfz_autotest\\tests\\images&#x27;
<br/> ------------------------------Captured stderr call------------------------------ <br/>[2020-07-07 11:52:55,163] - [ INFO] - [ test_login] - [ read_config.py] - [ 29] - the configPath: C:\Users\80980\znfz_autotest\config\config.ini
[2020-07-07 11:52:58,456] - [ INFO] - [ test_login] - [ read_config.py] - [ 33] - the browserType : Chrome
[2020-07-07 11:52:58,456] - [ INFO] - [ test_login] - [ browser_engine.py] - [ 28] - browserName: Chrome
[2020-07-07 11:52:59,454] - [ INFO] - [ test_login] - [ browser_engine.py] - [ 33] - Open url: http://192.168.2.31/cm
[2020-07-07 11:53:02,590] - [ INFO] - [ test_login] - [ browser_engine.py] - [ 36] - Maximize the current window.
[2020-07-07 11:53:02,592] - [ INFO] - [ test_login] - [ browser_engine.py] - [ 38] - Set implicitly wait 10 seconds.
[2020-07-07 11:53:03,592] - [ INFO] - [ test_login] - [ read_config.py] - [ 43] - the userInfo : 周朝阳
[2020-07-07 11:53:03,592] - [ INFO] - [ test_login] - [ read_config.py] - [ 43] - the userInfo : qazwsxedc
[2020-07-07 11:53:03,592] - [ INFO] - [ test_login] - [ test_login.py] - [ 59] - username: 周朝阳
[2020-07-07 11:53:03,593] - [ INFO] - [ test_login] - [ test_login.py] - [ 60] - password :qazwsxedc
[2020-07-07 11:53:03,593] - [ INFO] - [ test_login] - [ test_login.py] - [ 61] - Open url: http://192.168.2.31/cm
[2020-07-07 11:53:03,628] - [ INFO] - [ test_login] - [ test_login.py] - [ 67] - tags.text:请选择所属部门
[2020-07-07 11:53:04,903] - [ INFO] - [ test_login] - [ test_login.py] - [ 75] - tags2.text:瓯海区院
<br/> -------------------------------Captured log call-------------------------------- <br/>INFO  test_login:read_config.py:29 the configPath: C:\Users\80980\znfz_autotest\config\config.ini
INFO  test_login:read_config.py:33 the browserType : Chrome
INFO  test_login:browser_engine.py:28 browserName: Chrome
INFO  test_login:browser_engine.py:33 Open url: http://192.168.2.31/cm
INFO  test_login:browser_engine.py:36 Maximize the current window.
INFO  test_login:browser_engine.py:38 Set implicitly wait 10 seconds.
INFO  test_login:read_config.py:43 the userInfo : 周朝阳
INFO  test_login:read_config.py:43 the userInfo : qazwsxedc
INFO  test_login:test_login.py:59 username: 周朝阳
INFO  test_login:test_login.py:60 password :qazwsxedc
INFO  test_login:test_login.py:61 Open url: http://192.168.2.31/cm
INFO  test_login:test_login.py:67 tags.text:请选择所属部门
INFO  test_login:test_login.py:75 tags2.text:瓯海区院<br/></div></td></tr></tbody>
<tbody class="passed results-table-row">
<tr>
<td class="col-result">Passed</td>
<td class="col-name">test_login.py::test_login_usererr</td>
<td class="col-duration">34.07</td>
<td class="col-links"></td></tr>
<tr>
<td class="extra" colspan="4">
<div class="log"> ------------------------------Captured stderr call------------------------------ <br/>[2020-07-07 11:53:28,188] - [ INFO] - [ test_login] - [ read_config.py] - [ 29] - the configPath: C:\Users\80980\znfz_autotest\config\config.ini
[2020-07-07 11:53:31,363] - [ INFO] - [ test_login] - [ read_config.py] - [ 33] - the browserType : Chrome
[2020-07-07 11:53:31,364] - [ INFO] - [ test_login] - [ browser_engine.py] - [ 28] - browserName: Chrome
[2020-07-07 11:53:32,351] - [ INFO] - [ test_login] - [ browser_engine.py] - [ 33] - Open url: http://192.168.2.31/cm
[2020-07-07 11:53:35,477] - [ INFO] - [ test_login] - [ browser_engine.py] - [ 36] - Maximize the current window.
[2020-07-07 11:53:35,479] - [ INFO] - [ test_login] - [ browser_engine.py] - [ 38] - Set implicitly wait 10 seconds.
[2020-07-07 11:53:36,480] - [ INFO] - [ test_login] - [ read_config.py] - [ 43] - the userInfo : 周朝阳
[2020-07-07 11:53:36,480] - [ INFO] - [ test_login] - [ read_config.py] - [ 43] - the userInfo : qazwsxedc
[2020-07-07 11:53:36,480] - [ INFO] - [ test_login] - [ test_login.py] - [ 107] - username: 周朝阳
[2020-07-07 11:53:36,480] - [ INFO] - [ test_login] - [ test_login.py] - [ 108] - password :qazwsxedc
[2020-07-07 11:53:36,480] - [ INFO] - [ test_login] - [ test_login.py] - [ 109] - Open url: http://192.168.2.31/cm
[2020-07-07 11:53:36,509] - [ INFO] - [ test_login] - [ test_login.py] - [ 115] - tags.text:请选择所属部门
[2020-07-07 11:53:37,765] - [ INFO] - [ test_login] - [ test_login.py] - [ 123] - tags2.text:瓯海区院
[2020-07-07 11:53:59,721] - [ INFO] - [ test_login] - [ test_login.py] - [ 134] - test_login_password_err:不输入账户,返回正确的错误信息,text:请输入账户名!
[2020-07-07 11:54:00,106] - [ INFO] - [ test_login] - [ test_login.py] - [ 141] - test_login_password_err:输入错误账户,返回正确的错误信息,text:账户或密码错误
[2020-07-07 11:54:00,106] - [ INFO] - [ test_login] - [ __init__.py] - [ 23] - 执行时间:31.919700384140015s
<br/> -------------------------------Captured log call-------------------------------- <br/>INFO  test_login:read_config.py:29 the configPath: C:\Users\80980\znfz_autotest\config\config.ini
INFO  test_login:read_config.py:33 the browserType : Chrome
INFO  test_login:browser_engine.py:28 browserName: Chrome
INFO  test_login:browser_engine.py:33 Open url: http://192.168.2.31/cm
INFO  test_login:browser_engine.py:36 Maximize the current window.
INFO  test_login:browser_engine.py:38 Set implicitly wait 10 seconds.
INFO  test_login:read_config.py:43 the userInfo : 周朝阳
INFO  test_login:read_config.py:43 the userInfo : qazwsxedc
INFO  test_login:test_login.py:107 username: 周朝阳
INFO  test_login:test_login.py:108 password :qazwsxedc
INFO  test_login:test_login.py:109 Open url: http://192.168.2.31/cm
INFO  test_login:test_login.py:115 tags.text:请选择所属部门
INFO  test_login:test_login.py:123 tags2.text:瓯海区院
INFO  test_login:test_login.py:134 test_login_password_err:不输入账户,返回正确的错误信息,text:请输入账户名!
INFO  test_login:test_login.py:141 test_login_password_err:输入错误账户,返回正确的错误信息,text:账户或密码错误
INFO  test_login:__init__.py:23 执行时间:31.919700384140015s<br/></div></td></tr></tbody></table></body></html>
\ No newline at end of file
<div class="log"> ------------------------------Captured stdout call------------------------------ <br/>assert 0 == 1
+ where 0 = len([])
<br/> ------------------------------Captured stderr call------------------------------ <br/>[2020-07-21 14:06:11,544] - [ INFO] - [ test_jbaq] - [ read_config.py] - [ 29] - the configPath: C:\Users\80980\znfz_autotest\config\config.ini
[2020-07-21 14:06:14,747] - [ INFO] - [ test_jbaq] - [ read_config.py] - [ 33] - the browserType : Chrome
[2020-07-21 14:06:14,748] - [ INFO] - [ test_jbaq] - [ browser_engine.py] - [ 28] - browserName: Chrome
[2020-07-21 14:06:26,572] - [ INFO] - [ test_jbaq] - [ browser_engine.py] - [ 33] - Open url: http://2u8997d500.zicp.vip:46630/cm
[2020-07-21 14:06:29,695] - [ INFO] - [ test_jbaq] - [ browser_engine.py] - [ 36] - Maximize the current window.
[2020-07-21 14:06:29,697] - [ INFO] - [ test_jbaq] - [ browser_engine.py] - [ 38] - Set implicitly wait 10 seconds.
[2020-07-21 14:06:29,697] - [ INFO] - [ test_jbaq] - [ read_config.py] - [ 43] - the userInfo : 周朝阳
[2020-07-21 14:06:29,697] - [ INFO] - [ test_jbaq] - [ read_config.py] - [ 43] - the userInfo : qazwsxedc
[2020-07-21 14:06:29,697] - [ INFO] - [ test_jbaq] - [ browser_engine.py] - [ 47] - username: 周朝阳
[2020-07-21 14:06:29,736] - [ INFO] - [ test_jbaq] - [ browser_engine.py] - [ 52] - tags.text:请选择所属部门
[2020-07-21 14:06:31,003] - [ INFO] - [ test_jbaq] - [ browser_engine.py] - [ 61] - tags2.text:瓯海区院
[2020-07-21 14:06:33,460] - [ INFO] - [ test_jbaq] - [ read_config.py] - [ 48] - the gsjdCase : 瓯检起诉受[2020]33030400557号
[2020-07-21 14:06:33,460] - [ INFO] - [ test_jbaq] - [ browser_engine.py] - [ 78] - the testUrl : http://2u8997d500.zicp.vip:46630/cm/currencydeal/瓯检起诉受[2020]33030400557号/case?bmsah=瓯检起诉受[2020]33030400557号
<br/> -------------------------------Captured log call-------------------------------- <br/>INFO  test_jbaq:read_config.py:29 the configPath: C:\Users\80980\znfz_autotest\config\config.ini
INFO  test_jbaq:read_config.py:33 the browserType : Chrome
INFO  test_jbaq:browser_engine.py:28 browserName: Chrome
INFO  test_jbaq:browser_engine.py:33 Open url: http://2u8997d500.zicp.vip:46630/cm
INFO  test_jbaq:browser_engine.py:36 Maximize the current window.
INFO  test_jbaq:browser_engine.py:38 Set implicitly wait 10 seconds.
INFO  test_jbaq:read_config.py:43 the userInfo : 周朝阳
INFO  test_jbaq:read_config.py:43 the userInfo : qazwsxedc
INFO  test_jbaq:browser_engine.py:47 username: 周朝阳
INFO  test_jbaq:browser_engine.py:52 tags.text:请选择所属部门
INFO  test_jbaq:browser_engine.py:61 tags2.text:瓯海区院
INFO  test_jbaq:read_config.py:48 the gsjdCase : 瓯检起诉受[2020]33030400557号
INFO  test_jbaq:browser_engine.py:78 the testUrl : http://2u8997d500.zicp.vip:46630/cm/currencydeal/瓯检起诉受[2020]33030400557号/case?bmsah=瓯检起诉受[2020]33030400557号<br/></div></td></tr></tbody></table></body></html>
\ No newline at end of file
# import pytest
# import sys
#
# sys.path.append('..')
# from basepage.check_gsjd import CheckGsjd
#
# @pytest.mark.gsjd
# def test_gsid_case1():
#
# # browser = BrowserEngine()
# # driver = browser.login_znfz()
#
# test = CheckGsjd('check_gsjd')
# driver = test.choose_gsjd()
# test.choose_gsjd_case()
from engine import get_engine
import pytest,time
@pytest.mark.select
@get_engine(__file__,'URL')
def test_full_select(engine):
for i in ['审查逮捕','审查起诉']:
scdb = engine.driver.xpath(f"//span[text()='{i}']/..").get(0)
if scdb:
scdb.click()
else:
engine.logger.error(f'{i}元素获取错误')
return
case_id = engine.get_caseId('caseId')
input = engine.driver.xpath("//input[@id='ajmc']").get(0)
if input:
input.send_keys(case_id)
else:
engine.logger.error(f'{i}---input元素获取错误')
return
time.sleep(0.5)
select = engine.driver.xpath("//button[@type='submit']").get(0)
if select:
select.click()
else:
engine.logger.error(f'{i}---select元素获取错误')
return
time.sleep(1)
anjian_list = engine.driver.xpath("//tbody[@class='ant-table-tbody']/tr")
assert len(anjian_list) == 1 and anjian_list[0].get_attribute('data-row-key') == case_id
@pytest.mark.select
@get_engine(__file__,'URL')
def test_sub_select(engine):
for i in ['审查逮捕','审查起诉']:
scdb = engine.driver.xpath(f"//span[text()='{i}']/..").get(0)
if scdb:
scdb.click()
else:
engine.logger.error(f'{i}元素获取错误')
return
case_id = engine.get_caseId('caseId')[11:-2]
input = engine.driver.xpath("//input[@id='ajmc']").get(0)
if input:
input.send_keys(case_id)
else:
engine.logger.error(f'{i}---input元素获取错误')
return
time.sleep(0.5)
select = engine.driver.xpath("//button[@type='submit']").get(0)
if select:
select.click()
else:
engine.logger.error(f'{i}---select元素获取错误')
return
time.sleep(1)
anjian_list = engine.driver.xpath("//tbody[@class='ant-table-tbody']/tr")
assert len(anjian_list) == 1 and case_id in anjian_list[0].get_attribute('data-row-key')
@pytest.mark.select
@get_engine(__file__,'URL')
def test_null_select(engine):
for i in ['审查逮捕','审查起诉']:
scdb = engine.driver.xpath(f"//span[text()='{i}']/..").get(0)
if scdb:
scdb.click()
else:
engine.logger.error(f'{i}元素获取错误')
return
case_id = engine.get_caseId('caseId')[11:-2]
anjian_list = [anjian.get_attribute('data-row-key') for anjian in engine.driver.xpath("//tbody[@class='ant-table-tbody']/tr")]
select = engine.driver.xpath("//button[@type='submit']").get(0)
if select:
select.click()
else:
engine.logger.error(f'{i}---select元素获取错误')
return
time.sleep(1)
new_anjian_list = [anjian.get_attribute('data-row-key') for anjian in engine.driver.xpath("//tbody[@class='ant-table-tbody']/tr")]
assert new_anjian_list == anjian_list
@pytest.mark.select
@get_engine(__file__,'URL')
def test_fullname_select(engine):
for i in ['审查逮捕','审查起诉']:
scdb = engine.driver.xpath(f"//span[text()='{i}']/..").get(0)
if scdb:
scdb.click()
else:
engine.logger.error(f'{i}元素获取错误')
return
case_name = engine.get_caseId('caseName')
input = engine.driver.xpath("//input[@id='ajmc']").get(0)
if input:
input.send_keys(case_name)
else:
engine.logger.error(f'{i}---input元素获取错误')
return
time.sleep(0.5)
select = engine.driver.xpath("//button[@type='submit']").get(0)
if select:
select.click()
else:
engine.logger.error(f'{i}---select元素获取错误')
return
time.sleep(1)
anjian_name = engine.driver.xpath("//tbody[@class='ant-table-tbody']/tr/td/p/span[@class='bg___2A-Dw']")[0].text
assert anjian_name == case_name
@pytest.mark.select
@get_engine(__file__,'URL')
def test_subname_select(engine):
for i in ['审查逮捕','审查起诉']:
scdb = engine.driver.xpath(f"//span[text()='{i}']/..").get(0)
if scdb:
scdb.click()
else:
engine.logger.error(f'{i}元素获取错误')
return
case_name = engine.get_caseId('caseName')[:3]
input = engine.driver.xpath("//input[@id='ajmc']").get(0)
if input:
input.send_keys(case_name)
else:
engine.logger.error(f'{i}---input元素获取错误')
return
time.sleep(0.5)
select = engine.driver.xpath("//button[@type='submit']").get(0)
if select:
select.click()
else:
engine.logger.error(f'{i}---select元素获取错误')
return
time.sleep(1)
anjian_name = engine.driver.xpath("//tbody[@class='ant-table-tbody']/tr/td/p/span[@class='bg___2A-Dw']")[0].text
assert case_name in anjian_name
@pytest.mark.select
@get_engine(__file__,'URL')
def test_errname_select(engine):
for i in ['审查逮捕','审查起诉']:
scdb = engine.driver.xpath(f"//span[text()='{i}']/..").get(0)
if scdb:
scdb.click()
else:
engine.logger.error(f'{i}元素获取错误')
return
# case_name = engine.get_caseId('caseName')[:3]
input = engine.driver.xpath("//input[@id='ajmc']").get(0)
if input:
input.send_keys('aaa')
else:
engine.logger.error(f'{i}---input元素获取错误')
return
time.sleep(0.5)
select = engine.driver.xpath("//button[@type='submit']").get(0)
if select:
select.click()
else:
engine.logger.error(f'{i}---select元素获取错误')
return
time.sleep(1)
anjian_name = engine.driver.xpath("//tbody[@class='ant-table-tbody']/tr")
assert anjian_name ==[]
@pytest.mark.reset
@get_engine(__file__,'URL')
def test_reset(engine):
for i in ['审查逮捕','审查起诉']:
scdb = engine.driver.xpath(f"//span[text()='{i}']/..").get(0)
if scdb:
scdb.click()
else:
engine.logger.error(f'{i}元素获取错误')
return
# 办理阶段
select_button1 = engine.driver.xpath("//div[@id='zt']").get(0)
if select_button1:
select_button1.click()
else:
engine.logger.error(f'{i}---办理阶段-元素获取错误')
return
time.sleep(0.5)
subselect_button1 = engine.driver.xpath("//li[text()='未结']").get(0)
if subselect_button1:
subselect_button1.click()
else:
engine.logger.error(f'{i}---办理阶段-元素获取错误')
return
time.sleep(0.5)
# 移动案由
select_button2 = engine.driver.xpath("//div[@id='ysay']").get(0)
if select_button2:
select_button2.click()
else:
engine.logger.error(f'{i}---移送案由-元素获取错误')
return
time.sleep(0.5)
subselect_button2 = engine.driver.xpath("//li[text()='盗窃罪']").get(0)
if subselect_button2:
subselect_button2.click()
else:
engine.logger.error(f'{i}---移送案由-元素获取错误')
return
time.sleep(0.5)
reset = engine.driver.xpath("//button[@type='submit']").get(0)
if reset:
reset.click()
else:
engine.logger.error(f'{i}---select元素获取错误')
return
time.sleep(1)
select_button1 = engine.driver.xpath("//div[@id='zt']//div[@class='ant-select-selection-selected-value']").get(0).text
select_button2 = engine.driver.xpath("//div[@id='ysay']//div[@class='ant-select-selection-selected-value']").get(0).text
assert select_button1 == '全部'
assert select_button2 == '全部'
......@@ -68,3 +68,215 @@ def test_addxyr(engine):
new_xyr_list = engine.driver.xpath("//div[contains(@class,'item___2HoCU')]")
assert len(xyr_list) - len(new_xyr_list) == 1,'嫌疑人数-1'
@pytest.mark.nullxyr
@get_engine(__file__,'JBAQ_URL')
def test_null_xyr(engine):
engine.xpath("//input[@id='起诉意见书_犯罪嫌疑人_0_犯罪嫌疑人姓名']")[0].clear()
time.sleep(0.5)
save_button = engine.xpath("//span[text()='保存']")[0]
save_button.click()
time.sleep(0.5)
message = engine.xpath("//div[@class='ant-message']//span[text()='有必填项未填']")
assert len(message) == 1
@pytest.mark.basicmatter1
@get_engine(__file__,'JBAQ_URL')
def test_nullbirth(engine):
time.sleep(0.5)
engine.driver.xpath("//div[@title='出生日期']/following-sibling::div[1]//input")[0].clear()
time.sleep(0.5)
save_button = engine.driver.xpath("//span[text()='保存']/..")[0]
save_button.click()
time.sleep(0.5)
message = engine.driver.xpath("//div[@class='ant-message']//span[text()='有必填项未填']")
assert len(message) == 1
@pytest.mark.basicmatter
@get_engine(__file__, 'JBAQ_URL')
def test_nullID(engine):
time.sleep(0.5)
engine.driver.xpath("//input[@id='起诉意见书_犯罪嫌疑人_0_身份证号码']")[0].clear()
time.sleep(0.5)
save_button = engine.driver.xpath("//span[text()='保存']/..")[0]
save_button.click()
time.sleep(0.5)
message = engine.driver.xpath("//div[@class='ant-message']//span[text()='有必填项未填']")
assert len(message) == 1
# @pytest.mark.basicmatter # todo
# @get_engine(__file__, 'JBAQ_URL')
# def test_nulledu(engine):
# engine.driver.xpath("//div[@id='起诉意见书_犯罪嫌疑人_0_文化程度']")[0].clear()
# time.sleep(0.5)
# save_button = engine.driver.xpath("//span[text()='保存']/..")[0]
# save_button.click()
# time.sleep(0.5)
# message = engine.driver.xpath("//div[@class='ant-message']//span[text()='有必填项未填']")
# assert len(message) == 1
@pytest.mark.basicmatter
@get_engine(__file__, 'JBAQ_URL')
def test_notnulledu(engine):
engine.driver.xpath("//div[@id='起诉意见书_犯罪嫌疑人_0_文化程度']")[0].click()
engine.driver.xpath("//li[@data='小学']")[0].click()
time.sleep(0.5)
save_button = engine.driver.xpath("//span[text()='保存']/..")[0]
save_button.click()
time.sleep(0.5)
message = engine.driver.xpath("//div[@class='ant-message']//span[contains(text(),'保存成功')]")
assert len(message) == 1
@pytest.mark.basicmatter
@get_engine(__file__, 'JBAQ_URL')
def test_nullDomicile(engine):
engine.driver.xpath("//input[@id='起诉意见书_犯罪嫌疑人_0_户籍所在地']")[0].clear()
time.sleep(0.5)
save_button = engine.driver.xpath("//span[text()='保存']/..")[0]
save_button.click()
time.sleep(0.5)
message = engine.driver.xpath("//div[@class='ant-message']//span[text()='有必填项未填']")
assert len(message) == 1
@pytest.mark.basicmatter
@get_engine(__file__, 'JBAQ_URL')
def test_notnullDomicile(engine):
engine.driver.xpath("//input[@id='起诉意见书_犯罪嫌疑人_0_户籍所在地']")[0].clear().send_keys('123')
time.sleep(0.5)
save_button = engine.driver.xpath("//span[text()='保存']/..")[0]
save_button.click()
time.sleep(0.5)
message = engine.driver.xpath("//div[@class='ant-message']//span[contains(text(),'保存成功')]")
assert len(message) == 1
@pytest.mark.basicmatter
@get_engine(__file__, 'JBAQ_URL')
def test_nulladdr(engine):
engine.driver.xpath("//input[@id='起诉意见书_犯罪嫌疑人_0_住址']")[0].clear()
time.sleep(0.5)
save_button = engine.driver.xpath("//span[text()='保存']/..")[0]
save_button.click()
time.sleep(0.5)
message = engine.driver.xpath("//div[@class='ant-message']//span[text()='有必填项未填']")
assert len(message) == 1
@pytest.mark.basicmatter
@get_engine(__file__, 'JBAQ_URL')
def test_notnulladdr(engine):
engine.driver.xpath("//input[@id='起诉意见书_犯罪嫌疑人_0_住址']")[0].clear().send_keys('123')
time.sleep(0.5)
save_button = engine.driver.xpath("//span[text()='保存']/..")[0]
save_button.click()
time.sleep(0.5)
message = engine.driver.xpath("//div[@class='ant-message']//span[contains(text(),'保存成功')]")
assert len(message) == 1
# @pytest.mark.nullSpecifPerson # todo
# @get_engine(__file__, 'JBAQ_URL')
# def test_null_xyr(engine):
# # engine.driver.xpath("//input[@id='起诉意见书_犯罪嫌疑人_0_住址']")[0].clear().send_keys('123')
# time.sleep(0.5)
# save_button = engine.driver.xpath("//span[text()='保存']/..")[0]
# save_button.click()
# time.sleep(0.5)
# message = engine.driver.xpath("//div[@class='ant-message']//span[text()='有必填项未填']")
# assert len(message) == 1
@pytest.mark.basicmatter
@get_engine(__file__, 'JBAQ_URL')
def test_notnullSpecifPerson(engine):
engine.driver.xpath("//div[@id='起诉意见书_犯罪嫌疑人_0_特定人员']")[0].click()
engine.driver.xpath("//li[@data='聋哑人']")[0].click()
time.sleep(0.5)
save_button = engine.driver.xpath("//span[text()='保存']/..")[0]
save_button.click()
time.sleep(0.5)
message = engine.driver.xpath("//div[@class='ant-message']//span[contains(text(),'保存成功')]")
assert len(message) == 1
# @pytest.mark.nullSpecialID # todo
# @get_engine(__file__, 'JBAQ_URL')
# def test_null_xyr(engine):
# # engine.driver.xpath("//input[@id='起诉意见书_犯罪嫌疑人_0_特殊身份']")[0].clear().send_keys('123')
# time.sleep(0.5)
# save_button = engine.driver.xpath("//span[text()='保存']/..")[0]
# save_button.click()
# time.sleep(0.5)
# message = engine.driver.xpath("//div[@class='ant-message']//span[text()='有必填项未填']")
# assert len(message) == 1
@pytest.mark.basicmatter
@get_engine(__file__, 'JBAQ_URL')
def test_notnullSpecialID(engine):
engine.driver.xpath("//div[@id='起诉意见书_犯罪嫌疑人_0_特殊身份']")[0].click()
engine.driver.xpath("//li[@data='国家工作人员']")[0].click()
time.sleep(0.5)
save_button = engine.driver.xpath("//span[text()='保存']/..")[0]
save_button.click()
time.sleep(0.5)
message = engine.driver.xpath("//div[@class='ant-message']//span[contains(text(),'保存成功')]")
assert len(message) == 1
@pytest.mark.basicmatter
@get_engine(__file__, 'JBAQ_URL')
def test_nullFilingTime(engine):
engine.driver.xpath("//div[@title='立案时间']/following-sibling::div[1]//input")[0].clear()
time.sleep(0.5)
save_button = engine.driver.xpath("//span[text()='保存']/..")[0]
save_button.click()
time.sleep(0.5)
message = engine.driver.xpath("//div[@class='ant-message']//span[contains(text(),'保存成功')]")
assert len(message) == 1
@pytest.mark.basicmatter
@get_engine(__file__, 'JBAQ_URL')
def test_IncorrectFormatFilingTime(engine):
engine.driver.xpath("//div[@title='立案时间']/following-sibling::div[1]//input")[0].clear().send_keys('5月5日')
time.sleep(0.5)
save_button = engine.driver.xpath("//span[text()='保存']/..")[0]
save_button.click()
time.sleep(0.5)
message = engine.driver.xpath("//div[@class='ant-message']//span[text()='日期格式不正确!']")
assert len(message) == 1
@pytest.mark.basicmatter
@get_engine(__file__, 'JBAQ_URL')
def test_correctFormatFilingTime(engine):
engine.driver.xpath("//div[@title='立案时间']/following-sibling::div[1]//input")[0].clear().send_keys('2020年05月05日')
time.sleep(0.5)
save_button = engine.driver.xpath("//span[text()='保存']/..")[0]
save_button.click()
time.sleep(0.5)
message = engine.driver.xpath("//div[@class='ant-message']//span[contains(text(),'保存成功')]")
assert len(message) == 1
Markdown is supported
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