Commit 82a1222f authored by libin's avatar libin
Browse files

20190725图片较多

parent bec8f038
This diff is collapsed.
......@@ -10,7 +10,7 @@ COMPANYADMIN_SHOUYE = ".//a[@href='/main']"
COMPANYADMIN_YDGL = ".//a[@href='/main/booking']"
'''统计报表'''
COMPANYADMIN_TJBB = ".//i[@class='iconfont icon-tongji']"
# COMPANYADMIN_TJBB = ".//i[@class='iconfont icon-tongji']"
COMPANYADMIN_TJBB_YDLTJ = ".//a[@href='/main/report/bookingRateIndex']"
COMPANYADMIN_TJBB_LYLTJ = ".//a[@href='/main/report/usingIndex']"
COMPANYADMIN_TJBB_YCSYTJ = ".//a[@href='/main/report/exceptionIndex']"
......@@ -23,9 +23,9 @@ COMPANYADMIN_GWWH_GWXX = '//*[@id="sub4$Menu"]/li[1]'
COMPANYADMIN_GWWH_KXGDGW = ".//a[@href='/main/station/fixed']"
COMPANYADMIN_GWWH_ZWCX = ".//a[@href='/main/station/search']"
COMPANYADMIN_GWWH_GWSC = ".//a[@href='/main/station/space']"
COMPANYADMIN_DTGL = '//*[@id="workstationIndex"]/div/div/div[1]/div/ul/li[6]/div'
COMPANYADMIN_DTGL_DTWH = '//*[@id="sub5$Menu"]/li[1]'
COMPANYADMIN_DTGL_KJSC = '//*[@id="sub5$Menu"]/li[2]'
# COMPANYADMIN_DTGL = '//*[@id="workstationIndex"]/div/div/div[1]/div/ul/li[6]/div'
# COMPANYADMIN_DTGL_DTWH = '//*[@id="sub5$Menu"]/li[1]'
# COMPANYADMIN_DTGL_KJSC = '//*[@id="sub5$Menu"]/li[2]'
'''工位管理'''
COMPANYADMIN_XTPZ = '//*[@id="workstationIndex"]/div/div/div[1]/div/ul/li[4]/div/span/span'
......@@ -39,4 +39,52 @@ COMPANYADMIN_XTPZ_JSGL = '//*[@id="sub3$Menu"]/li[7]/a'
COMPANYADMIN_XTPZ_LBGL = '//*[@id="sub3$Menu"]/li[8]/a'
COMPANYADMIN_XTPZ_GZRGL = '//*[@id="sub3$Menu"]/li[9]/a'
COMPANYADMIN_XTPZ_XTSZ = ".//a[@href='/main/data/system']"
COMPANYADMIN_XTPZ_LCGL_NAME = ".//*[@id='sub3$Menu']/li[3]/a"
\ No newline at end of file
COMPANYADMIN_XTPZ_LCGL_NAME = ".//*[@id='sub3$Menu']/li[3]/a"
'''
新配置,将逐步删除上面重复部分
'''
'''系统设置'''
COMPANYADMIN_XTSZ = '//*[@id="workstationIndex"]/div/div/div[1]/div/ul/li[4]/div/span/span'
COMPANYADMIN_XTSZ_YQGL = '//*[@id="sub3$Menu"]/li[1]/a'
COMPANYADMIN_XTSZ_LYGL = '//*[@id="sub3$Menu"]/li[2]/a'
COMPANYADMIN_XTSZ_LCGL = '//*[@id="sub3$Menu"]/li[3]/a'
COMPANYADMIN_XTSZ_QYGL = '//*[@id="sub3$Menu"]/li[4]/a'
COMPANYADMIN_XTSZ_BMGL = '//*[@id="sub3$Menu"]/li[5]/a'
COMPANYADMIN_XTSZ_YHXX = '//*[@id="sub3$Menu"]/li[6]/a'
COMPANYADMIN_XTSZ_JSGL = '//*[@id="sub3$Menu"]/li[7]/a'
COMPANYADMIN_XTSZ_LBGL = '//*[@id="sub3$Menu"]/li[8]/a'
COMPANYADMIN_XTSZ_GZRGL = '//*[@id="sub3$Menu"]/li[9]/a'
COMPANYADMIN_XTSZ_SSGL = '//*[@id="sub3$Menu"]/li[10]/a'
COMPANYADMIN_XTSZ_XTPZ = '//*[@id="sub3$Menu"]/li[11]/a'
'''资源管理'''
COMPANYADMIN_ZYGL = '//*[@id="workstationIndex"]/div/div/div[1]/div/ul/li[5]/div'
COMPANYADMIN_ZYGL_GWXX = '//*[@id="sub4$Menu"]/li[1]'
COMPANYADMIN_ZYGL_KJZYXX = '//*[@id="sub4$Menu"]/li[2]'
'''地图管理'''
COMPANYADMIN_DTGL = '//*[@id="workstationIndex"]/div/div/div[1]/div/ul/li[6]/div'
COMPANYADMIN_DTGL_DTWH = '//*[@id="sub5$Menu"]/li[1]'
COMPANYADMIN_DTGL_KJSC = '//*[@id="sub5$Menu"]/li[2]'
'''工位管理'''
COMPANYADMIN_GWGL = '//*[@id="workstationIndex"]/div/div/div[1]/div/ul/li[7]/div'
COMPANYADMIN_GWGL_KXGDGW = '//*[@id="sub6$Menu"]/li[1]'
COMPANYADMIN_GWGL_GWBX = '//*[@id="sub6$Menu"]/li[2]'
COMPANYADMIN_GWGL_ZWCX = '//*[@id="sub6$Menu"]/li[3]'
COMPANYADMIN_GWGL_GWXCJL = '//*[@id="sub6$Menu"]/li[4]'
'''系统日志'''
COMPANYADMIN_XTRZ = '//*[@id="workstationIndex"]/div/div/div[1]/div/ul/li[8]/div'
COMPANYADMIN_XTRZ_CZRZ = '//*[@id="sub7$Menu"]/li[1]'
'''统计报表'''
COMPANYADMIN_TJBB = '//*[@id="workstationIndex"]/div/div/div[1]/div/ul/li[9]/div'
COMPANYADMIN_TJBB_YDGWYDL = '//*[@id="sub8$Menu"]/li[1]'
COMPANYADMIN_TJBB_YDGWLYL = '//*[@id="sub8$Menu"]/li[2]'
COMPANYADMIN_TJBB_YDGWWSYL = '//*[@id="sub8$Menu"]/li[3]'
COMPANYADMIN_TJBB_YDGWSYL = '//*[@id="sub8$Menu"]/li[4]'
COMPANYADMIN_TJBB_YDGWSYJL = '//*[@id="sub8$Menu"]/li[5]'
COMPANYADMIN_TJBB_KJZYTJ = '//*[@id="sub8$Menu"]/li[6]'
\ No newline at end of file
......@@ -2,7 +2,7 @@ SPACE_MATERIAL = ".box-head>span"
UPLOAD_MATERIAL = ".anticon-cloud-upload-o"
UPLOAD_MATERIAL_TITLE = ".ant-modal-title"
MATERIAL_NAME= "[name='svgName'] input"
UPLOAD_BUTTON = "[name = 'menu.station.upload'] button"
UPLOAD_BUTTON = "[name = 'menu.station.uploadMaterial'] button"
MATERIAL_FILE = "\\img\\space_material.svg"
OK_BUTTON = ".ant-modal-footer .ant-btn.ant-btn-primary"
MATERIAL_WIDTH_Increase = ".material .M-scale:nth-child(1) [aria-label='Increase Value']"
......
......@@ -2,3 +2,6 @@
[0704/123625.698:ERROR:process_info.cc(550)] ReadMemoryInfo failed
[0704/123625.698:ERROR:scoped_process_suspend.cc(40)] NtResumeProcess: 已尝试访问正在退出的过程。 (0xc000010a)
[0724/125509.648:ERROR:prune_crash_reports.cc(34)] PruneCrashReportDatabase: Failed to get pending reports
[0725/123815.810:ERROR:process_info.cc(329)] VirtualQueryEx: 拒绝访问。 (0x5)
[0725/123815.811:ERROR:process_info.cc(550)] ReadMemoryInfo failed
[0725/123815.811:ERROR:scoped_process_suspend.cc(40)] NtResumeProcess: 已尝试访问正在退出的过程。 (0xc000010a)
......@@ -7,13 +7,13 @@ from src.dep import HTMLTestRunner
from src.common import web_client
testunit = unittest.TestSuite()
test_dir = '../testcase_for_test'
test_dir = '../testcases_admin'
tests = unittest.defaultTestLoader.discover(test_dir, pattern='*.py',
top_level_dir=None)
l
test_report = '../report/'
now = time.strftime("%Y_%m_%d_%H_%M_%S") # 获取当前时间
......
import unittest
from src.module import login_swp, deal_db_data, upload_file
from src.datalib import test_data
from src.elementlib import companyadmin
from src.common import web_client
from src.elementlib import gwwh_kjsc
from selenium.webdriver.common.by import By
import logging
class spaceMaterial(unittest.TestCase):
def setUp(self):
self.browser = web_client.WebClient(test_data.MANAGE_URL)
delte_test_data = "delete from `stationsvg` WHERE svgName ='xkj'"
deal_db_data.execute_sql(delte_test_data)
login_swp.login01(self.browser, test_data.COMPANYADMIN_NAME, test_data.COMPANYADMIN_PW) #登录
self.browser.click_element(companyadmin.COMPANYADMIN_DTGL) #点击侧边栏中的“地图管理”
self.browser.click_element(companyadmin.COMPANYADMIN_DTGL_KJSC) #点击“地图管理”下的“空间素材”
logging.basicConfig(level = logging.INFO)
self.browser.assert_mark_msg(gwwh_kjsc.SPACE_MATERIAL, test_data.STATION_SPACE_MATERIAL, By.CSS_SELECTOR)
def test_addmaterial_01(self):
self.browser.click_element(gwwh_kjsc.UPLOAD_MATERIAL, By.CSS_SELECTOR)
self.browser.assert_mark_msg(gwwh_kjsc.UPLOAD_MATERIAL_TITLE, test_data.STATION_UPLOAD_MATERIAL_TITLE, By.CSS_SELECTOR)
self.browser.assert_element_disabled(gwwh_kjsc.OK_BUTTON, By.CSS_SELECTOR)
self.browser.click_element(gwwh_kjsc.MATERIAL_NAME, By.CSS_SELECTOR)
self.browser.sendkeys_to_element(gwwh_kjsc.MATERIAL_NAME, "xkj", By.CSS_SELECTOR)
self.browser.assert_element_disabled(gwwh_kjsc.OK_BUTTON, By.CSS_SELECTOR)
self.browser.click_element(gwwh_kjsc.UPLOAD_BUTTON, By.CSS_SELECTOR)
upload_file.uploading_file(self.browser, gwwh_kjsc.MATERIAL_FILE)
self.browser.is_enabled(gwwh_kjsc.OK_BUTTON, By.CSS_SELECTOR)
self.browser.click_element(gwwh_kjsc.OK_BUTTON, By.CSS_SELECTOR)
select_date = "SELECT COUNT(*) FROM `stationsvg` WHERE svgState=0 AND svgName ='xkj'"
logging.info(deal_db_data.execute_sql(select_date))
deal_db_data.assert_select_result(select_date, 1)
def test_addmaterial_02(self):
self.browser.click_element(gwwh_kjsc.UPLOAD_MATERIAL, By.CSS_SELECTOR)
self.browser.assert_mark_msg(gwwh_kjsc.UPLOAD_MATERIAL_TITLE, test_data.STATION_UPLOAD_MATERIAL_TITLE, By.CSS_SELECTOR)
self.browser.click_element(gwwh_kjsc.MATERIAL_NAME, By.CSS_SELECTOR)
self.browser.sendkeys_to_element(gwwh_kjsc.MATERIAL_NAME, "xkj", By.CSS_SELECTOR)
self.browser.click_element(gwwh_kjsc.UPLOAD_BUTTON, By.CSS_SELECTOR)
upload_file.uploading_file(self.browser, gwwh_kjsc.MATERIAL_FILE)
self.browser.is_enabled(gwwh_kjsc.OK_BUTTON, By.CSS_SELECTOR)
self.browser.click_element(gwwh_kjsc.MATERIAL_WIDTH_Increase, By.CSS_SELECTOR)
self.browser.click_element(gwwh_kjsc.MATERIAL_HEIGHT_Increase, By.CSS_SELECTOR)
self.browser.click_element(gwwh_kjsc.MATERIAL_X_Increase, By.CSS_SELECTOR)
self.browser.click_element(gwwh_kjsc.MATERIAL_TEXT, By.CSS_SELECTOR)
text_value = self.browser.get_attribute_value(gwwh_kjsc.MATERIAL_TEXT, "dx", By.CSS_SELECTOR)
print(text_value)
self.browser.assert_equal_msg(text_value, "31")
self.browser.assert_attribute_msg(gwwh_kjsc.MATERIAL_TEXT,"dx", "31", By.CSS_SELECTOR)
self.browser.click_element(gwwh_kjsc.MATERIAL_Y_Increase, By.CSS_SELECTOR)
self.browser.assert_attribute_msg(gwwh_kjsc.MATERIAL_TEXT,"dy", "16", By.CSS_SELECTOR)
self.browser.click_element(gwwh_kjsc.OK_BUTTON, By.CSS_SELECTOR)
test_data_count = "SELECT COUNT(*) FROM `stationsvg` WHERE svgState=0 AND svgName ='xkj'"
logging.info(deal_db_data.execute_sql(test_data_count))
deal_db_data.assert_select_result(test_data_count, 1)
def test_addmaterial_03(self):
self.browser.click_element(gwwh_kjsc.UPLOAD_MATERIAL, By.CSS_SELECTOR)
self.browser.assert_mark_msg(gwwh_kjsc.UPLOAD_MATERIAL_TITLE, test_data.STATION_UPLOAD_MATERIAL_TITLE, By.CSS_SELECTOR)
self.browser.click_element(gwwh_kjsc.MATERIAL_NAME, By.CSS_SELECTOR)
self.browser.sendkeys_to_element(gwwh_kjsc.MATERIAL_NAME, "xkj", By.CSS_SELECTOR)
self.browser.click_element(gwwh_kjsc.UPLOAD_BUTTON, By.CSS_SELECTOR)
upload_file.uploading_file(self.browser, gwwh_kjsc.MATERIAL_FILE)
self.browser.is_enabled(gwwh_kjsc.OK_BUTTON, By.CSS_SELECTOR)
self.browser.click_element(gwwh_kjsc.MATERIAL_WIDTH_Decrease, By.CSS_SELECTOR)
self.browser.click_element(gwwh_kjsc.MATERIAL_HEIGHT_Decrease, By.CSS_SELECTOR)
self.browser.click_element(gwwh_kjsc.MATERIAL_X_Decrease, By.CSS_SELECTOR)
self.browser.assert_attribute_msg(gwwh_kjsc.MATERIAL_TEXT,"dx", "29", By.CSS_SELECTOR)
self.browser.click_element(gwwh_kjsc.MATERIAL_Y_Decrease, By.CSS_SELECTOR)
self.browser.assert_attribute_msg(gwwh_kjsc.MATERIAL_TEXT,"dy", "14", By.CSS_SELECTOR)
self.browser.click_element(gwwh_kjsc.OK_BUTTON, By.CSS_SELECTOR)
test_data_count = "SELECT COUNT(*) FROM `stationsvg` WHERE svgState=0 AND svgName ='xkj'"
logging.info(deal_db_data.execute_sql(test_data_count))
deal_db_data.assert_select_result(test_data_count, 1)
def tearDown(self):
self.imgs = self.browser.imgs
delte_test_data = "delete from `stationsvg` WHERE svgName ='xkj'"
deal_db_data.execute_sql(delte_test_data)
self.browser.exit_all_browsers()
if __name__=="__main__":
unittest.main()
\ No newline at end of file
import unittest
from src.module import login_swp, deal_db_data, upload_file
from src.datalib import test_data
from src.elementlib import companyadmin
from src.common import web_client
from src.elementlib import gwwh_kjsc
from selenium.webdriver.common.by import By
import logging
import time
class editSpaceMaterial(unittest.TestCase):
def setUp(self):
self.browser = web_client.WebClient(test_data.MANAGE_URL)
login_swp.login01(self.browser, test_data.COMPANYADMIN_NAME, test_data.COMPANYADMIN_PW) #登录
self.browser.click_element(companyadmin.COMPANYADMIN_DTGL) #点击侧边栏中的“工位维护”
self.browser.click_element(companyadmin.COMPANYADMIN_DTGL_KJSC) #点击“工位维护”下的“工位素材”
logging.basicConfig(level = logging.INFO)
self.browser.assert_mark_msg(gwwh_kjsc.SPACE_MATERIAL, test_data.STATION_SPACE_MATERIAL, By.CSS_SELECTOR)
self.browser.click_element(gwwh_kjsc.UPLOAD_MATERIAL, By.CSS_SELECTOR)
self.browser.assert_mark_msg(gwwh_kjsc.UPLOAD_MATERIAL_TITLE, test_data.STATION_UPLOAD_MATERIAL_TITLE, By.CSS_SELECTOR)
self.browser.assert_element_disabled(gwwh_kjsc.OK_BUTTON, By.CSS_SELECTOR)
self.browser.click_element(gwwh_kjsc.MATERIAL_NAME, By.CSS_SELECTOR)
self.browser.sendkeys_to_element(gwwh_kjsc.MATERIAL_NAME, "xkj", By.CSS_SELECTOR)
self.browser.assert_element_disabled(gwwh_kjsc.OK_BUTTON, By.CSS_SELECTOR)
self.browser.click_element(gwwh_kjsc.UPLOAD_BUTTON, By.CSS_SELECTOR)
upload_file.uploading_file(self.browser, gwwh_kjsc.MATERIAL_FILE)
self.browser.is_enabled(gwwh_kjsc.OK_BUTTON, By.CSS_SELECTOR)
self.browser.click_element(gwwh_kjsc.OK_BUTTON, By.CSS_SELECTOR)
def test_editmaterial_01(self):
time.sleep(5)
self.browser.click_element(gwwh_kjsc.EDIT_MATERIAL, By.CSS_SELECTOR)
self.browser.assert_mark_msg(gwwh_kjsc.UPLOAD_MATERIAL_TITLE, test_data.STATION_UPLOAD_MATERIAL_TITLE, By.CSS_SELECTOR)
self.browser.is_enabled(gwwh_kjsc.OK_BUTTON, By.CSS_SELECTOR)
self.browser.assert_attribute_msg(gwwh_kjsc.MATERIAL_NAME, "value", "xkj", By.CSS_SELECTOR)
self.browser.check_all_text(gwwh_kjsc.MATERIAL_NAME, By.CSS_SELECTOR)
self.browser.delete_text(gwwh_kjsc.MATERIAL_NAME, By.CSS_SELECTOR)
logging.info("a")
time.sleep(5)
self.browser.assert_element_disabled(gwwh_kjsc.OK_BUTTON, By.CSS_SELECTOR)
self.browser.click_element(gwwh_kjsc.MATERIAL_NAME, By.CSS_SELECTOR)
self.browser.sendkeys_to_element(gwwh_kjsc.MATERIAL_NAME, "xkj", By.CSS_SELECTOR)
self.browser.is_enabled(gwwh_kjsc.OK_BUTTON, By.CSS_SELECTOR)
self.browser.click_element(gwwh_kjsc.OK_BUTTON, By.CSS_SELECTOR)
select_date = "SELECT COUNT(*) FROM `stationsvg` WHERE svgState=0 AND svgName ='xkj'"
logging.info(deal_db_data.execute_sql(select_date))
deal_db_data.assert_select_result(select_date, 1)
def test_editmaterial_02(self):
time.sleep(5)
self.browser.click_element(gwwh_kjsc.EDIT_MATERIAL, By.CSS_SELECTOR)
self.browser.click_element(gwwh_kjsc.UPLOAD_BUTTON, By.CSS_SELECTOR)
upload_file.uploading_file(self.browser, gwwh_kjsc.MATERIAL_FILE)
self.browser.is_enabled(gwwh_kjsc.OK_BUTTON, By.CSS_SELECTOR)
self.browser.click_element(gwwh_kjsc.MATERIAL_WIDTH_Increase, By.CSS_SELECTOR)
self.browser.click_element(gwwh_kjsc.MATERIAL_HEIGHT_Increase, By.CSS_SELECTOR)
self.browser.click_element(gwwh_kjsc.MATERIAL_X_Increase, By.CSS_SELECTOR)
self.browser.click_element(gwwh_kjsc.MATERIAL_TEXT, By.CSS_SELECTOR)
text_value = self.browser.get_attribute_value(gwwh_kjsc.MATERIAL_TEXT, "dx", By.CSS_SELECTOR)
print(text_value)
self.browser.assert_equal_msg(text_value, "31")
self.browser.assert_attribute_msg(gwwh_kjsc.MATERIAL_TEXT,"dx", "31", By.CSS_SELECTOR)
self.browser.click_element(gwwh_kjsc.MATERIAL_Y_Increase, By.CSS_SELECTOR)
self.browser.assert_attribute_msg(gwwh_kjsc.MATERIAL_TEXT,"dy", "16", By.CSS_SELECTOR)
self.browser.click_element(gwwh_kjsc.OK_BUTTON, By.CSS_SELECTOR)
test_data_count = "SELECT COUNT(*) FROM `stationsvg` WHERE svgState=0 AND svgName ='xkj'"
logging.info(deal_db_data.execute_sql(test_data_count))
deal_db_data.assert_select_result(test_data_count, 1)
def test_editmaterial_03(self):
time.sleep(5)
self.browser.click_element(gwwh_kjsc.EDIT_MATERIAL, By.CSS_SELECTOR)
self.browser.assert_mark_msg(gwwh_kjsc.UPLOAD_MATERIAL_TITLE, test_data.STATION_UPLOAD_MATERIAL_TITLE, By.CSS_SELECTOR)
upload_file.uploading_file(self.browser, gwwh_kjsc.MATERIAL_FILE)
self.browser.is_enabled(gwwh_kjsc.OK_BUTTON, By.CSS_SELECTOR)
self.browser.click_element(gwwh_kjsc.MATERIAL_WIDTH_Decrease, By.CSS_SELECTOR)
self.browser.click_element(gwwh_kjsc.MATERIAL_HEIGHT_Decrease, By.CSS_SELECTOR)
self.browser.click_element(gwwh_kjsc.MATERIAL_X_Decrease, By.CSS_SELECTOR)
self.browser.assert_attribute_msg(gwwh_kjsc.MATERIAL_TEXT,"dx", "29", By.CSS_SELECTOR)
self.browser.click_element(gwwh_kjsc.MATERIAL_Y_Decrease, By.CSS_SELECTOR)
self.browser.assert_attribute_msg(gwwh_kjsc.MATERIAL_TEXT,"dy", "14", By.CSS_SELECTOR)
self.browser.click_element(gwwh_kjsc.OK_BUTTON, By.CSS_SELECTOR)
test_data_count = "SELECT COUNT(*) FROM `stationsvg` WHERE svgState=0 AND svgName ='xkj'"
logging.info(deal_db_data.execute_sql(test_data_count))
deal_db_data.assert_select_result(test_data_count, 1)
def tearDown(self):
self.imgs = self.browser.imgs
delte_test_data = "delete from `stationsvg` WHERE svgName ='xkj'"
deal_db_data.execute_sql(delte_test_data)
self.browser.exit_all_browsers()
if __name__=="__main__":
unittest.main()
\ No newline at end of file
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