Commit 470d7d65 authored by libin's avatar libin
Browse files

20190807

parent bbfb9d13
This diff is collapsed.
......@@ -13,7 +13,7 @@ from selenium.webdriver.support.ui import Select
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
import urllib
from urllib import request
from src.common import com_module
from selenium.common.exceptions import NoSuchElementException, TimeoutException
......@@ -376,24 +376,24 @@ class WebClient():
def assert_img_is_same(self,local_file_path,server_file_path):
'''拼装服务器文件访问路径'''
tmp=self.__driver.find_element_by_xpath(server_file_path).get_attribute("href")
with urllib.request.urlopen(tmp) as f1:
with request.urlopen(tmp) as f1:
s=f1.read()
print('s=',s)
'''拼装本地文件路径'''
separator = '\\' if com_module.is_windows_platform() else '/'
path = os.getcwd().split(separator)
# if ('testcase_touch' in path or 'testestcases'in path or 'testcases_pc' in path):
# file_path = separator.join(path[0:-1])+local_file_path
file_path = separator.join(path[0:-1])+local_file_path
# else:
file_path = separator.join(path[:])+local_file_path
# file_path = separator.join(path[:])+local_file_path
with open(file_path,"rb") as f2:
l=f2.read()
print('l=',l)
try:
assert s == l
except AssertionError:
raise Exception("\nAssertError: server img is " + s + \
"; lacal img is " + l)
raise Exception("\nAssertError: server img is " + str(s) + \
"; lacal img is " + str(l))
time.sleep(self.timeout)
# 获取控件尺寸
def get_elem_size(self, element_selector, find_by=By.XPATH):
......
......@@ -70,8 +70,8 @@ ATTRIBUTE_PLACEHOLDER_TEXT_START_DATE = "开始日期"
ATTRIBUTE_PLACEHOLDER_TEXT_END_DATE = "结束日期"
ATTRIBUTE_PLACEHOLDER_TEXT_ENTER_VACATION_NAME = "请输入节假日名称"
ATTRIBUTE_CLASS = "class"
ATTRIBUTE_CLASS_TEXT_DISABLED = "page-option-ewm-select div-disabled"
ATTRIBUTE_CLASS_TEXT_DISABLED2 = "page-option-ewm-select div-disabled"
ATTRIBUTE_CLASS_TEXT_DISABLED = "div-disabled" #有一两个空格的问题,所以只看关键字
ATTRIBUTE_CLASS_TEXT_DISABLED2 = "page-option-ewm-select div-disabled"
ATTRIBUTE_CLASS_TEXT_AVAILABLE = "page-option-ewm-select operation-list"
ATTRIBUTE_CLASS_LOTS_EDIT_AVAILABLE = "page-option-ewm-select" #“批量编辑”按钮可用时的属性class的值
ATTRIBUTE_CLASS_SWITCH_CHECKED = "ant-switch ant-switch-checked"
......@@ -186,9 +186,9 @@ STATUS_NOT_CHANGE_TO_BLOCK_UP = "未启用的工位不能编辑为停用"
STATUS_NOT_CHANGE_TO_NORMAL = "工位坐标信息不全不可以批量启用"
DELETE_STATION_CONFIRM_TEXT = "确认删除此工位?"
DELETE_LOTS_STATION_CONFIRM_TEXT = "您确定要删除这些工位吗?"
DELETE_STATION_FAILURE_MSG = "工位正在使用中不能删除"
DELETE_STATION_FAILURE_MSG = "工位处于预约或使用中,不支持状态修改"
DELETE_LOTS_STATION_CONFIRM_BOX_TITLE = "确认"
DELETE_LOTS_FAILURE_MSG = "S012使用中不能删除"
DELETE_LOTS_FAILURE_MSG = "工位处于预约或使用中,操作失败"
'''
空闲固定工位页面数据
'''
......
......@@ -6,7 +6,7 @@ PAGE_ONE = ".//*[@class='ant-spin-container']/ul[1]/li[3]"
PAGE_TWO = ".//*[@class='ant-spin-container']/ul[1]/li[4]"
NO_DATA_TEXT = "ant-table-placeholder"
LOTS_EDIT_BTN = "//*[@id='more']/div[2]/div/div/div/ul/li[1]/div"
LOTS_DELETE_BTN = ".//*[@class='clearfix page-option']/div[3]"
LOTS_DELETE_BTN = "//*[@id='more']/div[2]/div/div/div/ul/li[2]/div"
LOTS_CHECKBOX = ".//*[@class='ant-table-selection-column']/span[1]/div[1]/label[1]/span[1]/input[1]"
LOTS_CHECKBOX_SPAN = ".//*[@class='ant-table-selection-column']/span[1]/div[1]/label[1]/span[1]"
MORE_OPERATION = '//*[@id="more"]/div[1]/div[7]/p/a'
......@@ -43,7 +43,10 @@ ALL_ANT_DROPDOWN_BOX = ".ant-select-selection__rendered .ant-select-selection-se
STATION_NUMBER_INPUT = ".select .ant-input"
SEARCH_BTN = ".ant-btn.ant-btn-primary"
RESET_BTN = ".//*[@class='select']/button[2]"
SECOND_SEARCH_DEPARTMENT_DROPDOWNLIST = '//*[@id="main"]/div[2]/div/div/div/ul/li[3]'
SEARCH_DEPARTMENT_DROPDOWNLIST_2 = '//*[@id="main"]/div[2]/div/div/div/ul/li[3]'
SEARCH_DEPARTMENT_DROPDOWNLIST_2_2 = '//*[@id="main"]/div[6]/div/div/div/ul/li[3]/span[2]'
SEARCH_DEPARTMENT_DROPDOWNLIST_3 = '//*[@id="main"]/div[2]/div/div/div/ul/li[4]'
SEARCH_DEPARTMENT_DROPDOWNLIST_4 = '//*[@id="main"]/div[2]/div/div/div/ul/li[5]'
'''“添加工位”页面中的元素'''
......@@ -56,7 +59,7 @@ AREA_DROPDOWN_LIST = ".form-group [name='page.filter.area'] .ant-select-selectio
STATION_TYPE_FIXED = "[name='page.filter.type'] label:nth-child(1) input"
STATION_TYPE_MOBILE = "[name='page.filter.type'] label:nth-child(2) input"
DEPARTMENT_DROPDOWN_LIST = ".form-group [name='page.filter.dept'] .ant-select-selection__rendered"
DEPARTMENT_DROPDOWN_LIST_TEXT = "#form-group > li:nth-child(7) > div > span > span > span.ant-select-selection__rendered > span"
DEPARTMENT_DROPDOWN_LIST_TEXT = "#form-group > li:nth-child(7) > div > span > span > ul > li.ant-select-selection__choice > span.ant-select-selection__choice__content"
DEPARTMENT_DROPDOWN_CHECK = "#form-group > div > div > div > div > ul > li > span.ant-select-tree-node-content-wrapper.ant-select-tree-node-content-wrapper-normal > span"
DEPARTMENT_DROPDOWN_LIST_TEXT_DELETE_BTN = "[name='page.filter.dept'] .ant-select-selection__choice>span"
DEPARTMENT_DROPDOWN_LIST_TEXT_2 = ".//*[@id='form-group']/li[7]/div/div/div/div/ul/li[2]/div"
......
......@@ -14,4 +14,4 @@ MATERIAL_X_Decrease = ".clearfix .p:nth-child(2) [aria-label='Decrease Value']"
MATERIAL_Y_Increase = ".clearfix .p:nth-child(3) [aria-label='Increase Value']"
MATERIAL_Y_Decrease = ".clearfix .p:nth-child(3) [aria-label='Decrease Value']"
MATERIAL_TEXT =".material_pic text"
EDIT_MATERIAL = ".m20.materialContent tbody tr:nth-child(3) a.iconfont.icon-edit"
\ No newline at end of file
EDIT_MATERIAL = "tbody tr:nth-child(3) td:last-child a:first-child"
\ No newline at end of file
......@@ -15,13 +15,13 @@ SEARCH_PARK="[name='page.filter.park'] .ant-select-selection__rendered"
SEARCH_PARK_LIST=".//*[@id='main']/div[2]/div/div/div/ul/li[2]"
SEARCH_BUILD01="[name='page.filter.building'] input"
SEARCH_BUILD02="[name='page.filter.building'] input"
SEARCH_BUTTON01='//*[@id="main"]/div/div[2]/ul/li[3]/div/button[1]'
SEARCH_BUTTON01=".//*[@id='main']/div[1]/div[2]/ul/li[2]/div/button[1]"
SEARCH_BUTTON02=".//*[@id='main']/div[1]/div[2]/ul/li[3]/div/button[1]"
SEARCH_RESET_BUTTON01='//*[@id="main"]/div/div[2]/ul/li[3]/div/button[2]'
SEARCH_RESET_BUTTON01=".//*[@id='main']/div[1]/div[2]/ul/li[2]/div/button[2]"
SEARCH_RESET_BUTTON02=".//*[@id='main']/div[1]/div[2]/ul/li[3]/div/button[2]"
SEARCH_RESULT=".//*[@id='main']/div/div[2]/div[2]/div/div/ul/li[1]"
DELETE_BUILD_ICON=".//i[@class='iconfont icon-delete page-option-icon ']"
DELETE_OVERLAY_TITLE="/html/body/div[4]/div/div[2]/div/div[1]/div/div/div[1]/span"
DELETE_OVERLAY_TITLE="/html/body/div[3]/div/div[2]/div/div[1]/div/div/div[1]/span"
DELETE_BUILD_CONFIRM_BUTTON=".//button[@class='ant-btn ant-btn-primary ant-btn-lg']"
DELETE_BUILDE_CANCEL_BUTTON=".//button[@class='ant-btn ant-btn-lg']"
......@@ -31,4 +31,3 @@ ERROR_MESSAGE=".//div[@class='ant-message-custom-content ant-message-error']/spa
BUILDING_MANAGEMENT_PAGE_TEXT = ".//*[@id='main']/div/div[1]/span"
BUILD_BUILDTOKEN_IMG=".//*[@id='main']/div/div[2]/div[2]/div/div/div/div/div/div/table/tbody/tr/td[4]/div/span/div[1]/div[1]/span/a"
DELETE_IMG=".//i[@title='删除文件']"
......@@ -8,7 +8,7 @@ LOTS_DELETE_BTN = ".//*[@class='clearfix page-option']/div[2]"
DEPARTMENT_SEARCH_INPUT = "[name='page.filter.dept'] .ant-select-selection-selected-value"
USER_NAME_SEARCH_INPUT = "[name='page.filter.name'] input"
SEARCH_BTN = ".//*[@class='buttons']/li[1]/button[1]"
RESET_BTN = ".//*[@class='buttons']/li[2]/button[1]"
RESET_BTN = ".//*[@class='buttons']/li[1]/button[2]"
FIRST_DEPARTMENT_SELECT = ".//*[@id='main']/div[2]/div/div/div/ul/li[2]"
SECOND_LINE_DELETE_BTN = ".//*[@class='ant-table-tbody']/tr[2]/td[10]/span[1]/i[2]"
LOTS_CHECKBOX = ".//*[@class='ant-table-selection']/label[1]/span[1]/input[1]"
......
......@@ -88,9 +88,21 @@ def clear_rate_date():
# 清空除预置工位的其他数据
def clear_station():
clear_reservation()
delete_date = "DELETE FROM `mobilestation` WHERE domainId=%s AND stationNum NOT IN ('%s','%s');"%(test_data.COMPANY_ID, test_data.PRE_MOBILE_STATION_NAME, test_data.PRE_FIXED_STATION_NAME)
execute_sql(delete_date)
#清空域下的所有预约工位
def clear_reservation():
delete_sql = "DELETE FROM `reservation` WHERE domainId=" + test_data.COMPANY_ID
execute_sql(delete_sql)
delete_reservation_record = "DELETE FROM `reservationrecord` WHERE domainId=" + test_data.COMPANY_ID
execute_sql(delete_reservation_record)
#清空预置区域的所有座位
def clear_stationelement():
delete_stationelement = "DELETE FROM `stationelement` WHERE floorAreaId=%s;" % (test_data.PRE_AREA_ID)
execute_sql(delete_stationelement)
......
......@@ -58,6 +58,11 @@ def goto_map(browser):
browser.click_element(companyadmin.COMPANYADMIN_DTGL)
browser.click_element(companyadmin.COMPANYADMIN_DTGL_DTWH)
#空间素材
def goto_spacematerial(browser):
browser.click_element(companyadmin.COMPANYADMIN_DTGL) # 点击侧边栏中的“地图管理”
browser.click_element(companyadmin.COMPANYADMIN_DTGL_KJSC) # 点击“地图管理”下的“空间素材”
#空闲固定工位
def goto_available_fixed(browser):
browser.click_element(companyadmin.COMPANYADMIN_GWGL) # 点击侧边栏中的“工位维护”
......
This diff is collapsed.
......@@ -2,57 +2,17 @@ from src.common import mysql_client
from src.datalib import test_data
from src.module import deal_db_data
# 初始化数据
deal_db_data.clear_station()
deal_db_data.clear_user()
deal_db_data.clear_department()
deal_db_data.clear_area()
deal_db_data.clear_floor()
deal_db_data.clear_building()
deal_db_data.clear_park()
# 插入“园区”数据
insert_park = '''INSERT INTO `park`(allDay,amTime,city,country,domainID,parkName,parkStatus,pmTime,province,timeZone,cityName,countryName,provinceName,timeAreaName)
VALUES('01:40-18:40','01:40-12:40','beijing','china',{di},'中关村',0,'14:40-18:40','beijing','Asia/Shanghai','北京市','中国','北京市','北京'),
('01:40-18:40','01:40-12:40','beijing','china',{di},'阿里',0,'14:40-18:40','beijing','Asia/Shanghai','北京市','中国','北京市','北京');'''.format(
di=test_data.COMPANY_ID)
deal_db_data.execute_sql(insert_park)
# 插入“楼宇”数据
insert_building = '''INSERT INTO `officebuilding` (`buildingToken`, `domainId`, `officeBuildingName`, `officeBuildingStatus`, `parkId`)
VALUES('8881','{di}','A座','0',(SELECT id FROM `park` WHERE domainId={di} AND parkName='中关村')),
('8882','{di}','B座','0',(SELECT id FROM `park` WHERE domainId={di} AND parkName='中关村')),
('8883','{di}','C座','0',(SELECT id FROM `park` WHERE domainId={di} AND parkName='阿里'));'''.format(
di=test_data.COMPANY_ID)
deal_db_data.execute_sql(insert_building)
# 插入“楼层”数据
insert_floor = '''INSERT INTO `floor`(domainId,floorNum,floorStatus,officeBuildingId,parkId)
VALUES({di},'F1',0,(SELECT id FROM `officebuilding` WHERE domainId={di} AND officeBuildingName='A座'),(SELECT id FROM `park` WHERE domainId={di} AND parkName='中关村')),
({di},'F2',0,(SELECT id FROM `officebuilding` WHERE domainId={di} AND officeBuildingName='A座'),(SELECT id FROM `park` WHERE domainId={di} AND parkName='中关村')),
({di},'F3',0,(SELECT id FROM `officebuilding` WHERE domainId={di} AND officeBuildingName='C座'),(SELECT id FROM `park` WHERE domainId={di} AND parkName='阿里'));'''.format(
di=test_data.COMPANY_ID)
deal_db_data.execute_sql(insert_floor)
# 插入“区域”数据
insert_area = '''INSERT INTO `floorarea`(domainId,floorAreaNum,floorAreaStatus,floorId,floorNum,officeBuildingId,parkId,areaAge,height,width)
VALUES({di},'A1',0,(SELECT id FROM `floor` WHERE domainId={di} AND floorNum='F1'),'F1',(SELECT id FROM `officebuilding` WHERE domainId={di} AND officeBuildingName='A座'),(SELECT id FROM `park` WHERE domainId={di} AND parkName='中关村'),0,1080,1920),
({di},'A2',0,(SELECT id FROM `floor` WHERE domainId={di} AND floorNum='F3'),'F1',(SELECT id FROM `officebuilding` WHERE domainId={di} AND officeBuildingName='C座'),(SELECT id FROM `park` WHERE domainId={di} AND parkName='阿里'),0,1080,1920);'''.format(
di=test_data.COMPANY_ID)
deal_db_data.execute_sql(insert_area)
# 插入“部门”数据
insert_department = '''INSERT INTO `organization` (domainId,orgFatherId,orgName,orgStatus)
VALUES({di},{oi},'测试部门',0),({di},{oi},'运维部',0),({di},{oi},'在线教育研发部',0);'''.format(
di=test_data.COMPANY_ID, oi=test_data.PRE_DEPARTMENT_FATHER_ID)
deal_db_data.execute_sql(insert_department)
# 插入“用户”数据
insert_user = '''INSERT INTO `userinfo` (attendanceCard,domainId,email,employeeId,employeeName,orgId,PASSWORD,roleId,userFrom,userStatus)
VALUES ('327',{di},'327@qq.com','008','胡歌',(SELECT id FROM `organization` WHERE domainId={di} AND orgName='测试部门'),'wafer123',98,2,0),
('328',{di},'328@qq.com','009','Marry',(SELECT id FROM `organization` WHERE domainId={di} AND orgName='运维部'),'wafer123',98,2,0),
('329',{di},'329@qq.com','010','cyq',(SELECT id FROM `organization` WHERE domainId={di} AND orgName='在线教育研发部'),'wafer123',98,2,0);'''.format(
di=test_data.COMPANY_ID)
deal_db_data.execute_sql(insert_user)
# 插入“工位”数据
insert_station = '''INSERT INTO `mobilestation`(domainId,floorAreaId,floorAreaNum,floorId,floorNum,officeBuildingId,officeBuildingName,orgId,parkName,stationNum,stationState,stationType,userId,userName,parkId)
VALUES({di},(SELECT id FROM `floorarea` WHERE domainId={di} AND floorAreaNum='A1'),'A1',(SELECT id FROM floor WHERE domainId={di} AND floorNum='F1'),'F1',(SELECT id FROM `officebuilding` WHERE domainId={di} AND officeBuildingName='A座'),'A座',(SELECT id FROM `organization` WHERE domainId={di} AND orgName='在线教育研发部'),'中关村','S1',3,2,{ui},'{un}',(SELECT id FROM `park` WHERE domainId={di} AND parkName='中关村')),
({di},(SELECT id FROM `floorarea` WHERE domainId={di} AND floorAreaNum='A2'),'A2',(SELECT id FROM floor WHERE domainId={di} AND floorNum='F3'),'F3',(SELECT id FROM `officebuilding` WHERE domainId={di} AND officeBuildingName='C座'),'C座',(SELECT id FROM `organization` WHERE domainId={di} AND orgName='运维部'),'阿里','S2',3,1,{ui},'{un}',(SELECT id FROM `park` WHERE domainId={di} AND parkName='阿里')),
({di},(SELECT id FROM `floorarea` WHERE domainId={di} AND floorAreaNum='A1'),'A1',(SELECT id FROM floor WHERE domainId={di} AND floorNum='F1'),'F1',(SELECT id FROM `officebuilding` WHERE domainId={di} AND officeBuildingName='A座'),'A座',(SELECT id FROM `organization` WHERE domainId={di} AND orgName='测试部门'),'中关村','S3',3,1,{ui},'{un}',(SELECT id FROM `park` WHERE domainId={di} AND parkName='中关村')),
({di},(SELECT id FROM `floorarea` WHERE domainId={di} AND floorAreaNum='A2'),'A2',(SELECT id FROM floor WHERE domainId={di} AND floorNum='F3'),'F3',(SELECT id FROM `officebuilding` WHERE domainId={di} AND officeBuildingName='C座'),'C座',(SELECT id FROM `organization` WHERE domainId={di} AND orgName='在线教育研发部'),'阿里','S4',3,2,(SELECT id FROM `userinfo` WHERE domainId={di} AND employeeName='cyq'),'cyq',(SELECT id FROM `park` WHERE domainId={di} AND parkName='阿里'));
'''.format(di=test_data.COMPANY_ID, ui=test_data.PRE_USER_ID, un=test_data.PRE_USER_NAME)
deal_db_data.execute_sql(insert_station)
\ No newline at end of file
# 在“座位管理”中绑定工位
insert_stationelement = '''INSERT INTO `stationelement`(centerx,centery,cycleValue,floorAreaId,groupStationId,stationId,stationx,stationy,stationSvgId,type)
VALUES('0','0','0',%s,77,(SELECT id FROM `mobilestation` WHERE domainId=%s AND stationNum='S012'),'0','0',0,1)'''%(test_data.PRE_AREA_ID,test_data.COMPANY_ID)
print(insert_stationelement)
deal_db_data.execute_sql(insert_stationelement)
update_mobilestation = "UPDATE `mobilestation` SET stationState=0,userId=0 WHERE domainId=%s AND stationNum='S012';"%(test_data.COMPANY_ID)
print(update_mobilestation)
deal_db_data.execute_sql(update_mobilestation)
#预定工位
booking_station = '''INSERT INTO `reservation`(createTime,delayRemind,domainId,endTime,flag,occUserId,occUserName,realStartTime,reservationStatus,reservationType,signRemind,source,startTime,stationNum,userId,userName,stationId)
VALUES((SELECT CURDATE()),0,{di},(SELECT DATE_SUB(CURDATE(),INTERVAL -1 DAY)),1,{ui},'{un}',(SELECT CURDATE()),1,1,0,0,(SELECT CURDATE()) ,'S012',{ui},'{un}',(SELECT id FROM `mobilestation` WHERE domainId={di} AND stationNum='S012' ));
'''.format(di = test_data.COMPANY_ID, ui = test_data.PRE_USER_ID, un = test_data.PRE_USER_NAME)
print(booking_station)
deal_db_data.execute_sql(booking_station)
\ 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