Commit 3471aba5 authored by libin's avatar libin
Browse files

20190723

parent b75b17d4
This diff is collapsed.
......@@ -14,6 +14,7 @@ from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
import urllib
import logging
from src.common import com_module
from selenium.common.exceptions import NoSuchElementException, TimeoutException
......@@ -22,6 +23,8 @@ from datetime import datetime
class WebClient():
__driver = None
logging.basicConfig(level=logging.INFO)
def __init__(self, url):
self.url = url
self.timeout = 2
......@@ -182,7 +185,16 @@ class WebClient():
time.sleep(self.timeout)
i = i + 1
del i
# 到最后一页,element_selector取上一层,默认控件在最最底端
def to_last_page(self, element_selector, if_scrool_to_bottom=1):
selector = element_selector + "/li[last()-1]"
if if_scrool_to_bottom == 1:
self.scroll_to_bottom()
self.wait_unit_elem(selector, By.XPATH)
element = self.get_element(selector, By.XPATH)
element.click()
time.sleep(self.timeout)
# 按命令滚动浏览器滚动条,document.body.scrollTop
def scroll_to_command(self, command):
......@@ -244,6 +256,7 @@ class WebClient():
try:
self.wait_unit_elem(element_selector, find_by)
txtmsg = self.get_element(element_selector, find_by).text
logging.info("==> expected text:" + msg+ ",extual text:" + txtmsg)
assert msg in txtmsg
# try:
# assert msg in txtmsg
......@@ -258,7 +271,7 @@ class WebClient():
def assert_multiple_mark_msg(self,elements_selector,msg,find_by=By.XPATH):
self.wait_unit_elem(elements_selector, find_by)
txtmsgs = self.get_elements(elements_selector, find_by)
print(txtmsgs)
logging.info("==> expected text:" + msg+ ",extual text:" + txtmsgs)
for txtmsg in txtmsgs:
txt = txtmsg.text
assert msg in txt
......@@ -286,7 +299,7 @@ class WebClient():
def assert_attribute_msg(self, element_selector, attr, msg, find_by=By.XPATH):
self.wait_unit_elem(element_selector, find_by)
attrmsg = self.get_element(element_selector, find_by).get_attribute(attr)
print(attrmsg)
logging.info("extual attribute:" + attrmsg)
assert msg in attrmsg
# try:
# assert msg in attrmsg
......@@ -299,6 +312,7 @@ class WebClient():
def assert_multiple_attribute_msg(self,element_selector,attr,msg,find_by=By.XPATH):
self.wait_unit_elem(element_selector, find_by)
attributes = self.get_elements(element_selector, find_by)
logging.info("extual attributes:" + attributes)
for attribute in attributes:
attribute_msg = attribute.get_attribute(attr)
assert msg in attribute_msg
......
......@@ -20,9 +20,10 @@ SERVER_IP = "wstest.virsical.cn"
SER_USERNAME = "waferxa"
SER_PASSWD = "wafer.com"
SER_PORT = '22'
COMPANY_NAME = "wafer-lygc"
COMPANY_URL = "wafersystems.com"
COMPANY_URL_NEW = "wafersystems2.com"
COMPANY_NAME = "autotest"
COMPANY_URL = "autotest.com"
COMPANY_ID = "65"
COMPANY_URL_NEW = "autotest2.com"
COMPANY_URL_EMPTY = "waferxa.com"
COMPANYADMIN_NAME = "admin@"+COMPANY_URL
......@@ -309,37 +310,43 @@ BUILD_UPLOAD_FILE_PATH="\\img\\AIO_machine.jpg"
PRE_ATTRIBUTE_VALUE = 'value'
PRE_ATTRIBUTE_TITLE = 'title'
PRE_PARK_NAME = "西安软件园"
PRE_PARK_ID = "475"
PRE_TIMEZONE = '北京'
PRE_CITY = "中国 / 陕西省 / 西安市"
PRE_MORNING_START_TIME = "00:00"
PRE_MORNING_END_TIME = "12:59"
PRE_MORNING_START_TIME = "09:00"
PRE_MORNING_END_TIME = "12:00"
PRE_AFTERNOON_START_TIME = "13:00"
PRE_AFTERNOON_END_TIME = "23:59"
PRE_ALL_DAY_START = "00:00"
PRE_ALL_DAY_END = "23:59"
PRE_AFTERNOON_END_TIME = "18:00"
PRE_ALL_DAY_START = "09:00"
PRE_ALL_DAY_END = "18:00"
'''
预置的部门数据
'''
PRE_DEPARTMENT_NAME = "Pre_Testing_Department"
PRE_DEPARTMENT_NAME = "产品测试部"
PRE_DEPARTMENT_ID = "497"
'''预置的楼宇数据'''
PRE_BUILD_NAME ="Pre_lingyi_Square"
PRE_BUILD_BUILDTOKEN ="951"
PRE_BUILD_NAME ="零壹广场"
PRE_BUILD_ID ="18"
PRE_BUILD_BUILDTOKEN ="autotest001"
'''预置楼层信息'''
PRE_FLOOR_NAME = "Pre_Floor_3"
PRE_FLOOR_NAME = "3"
PRE_FLOOR_ID = "15"
'''预制区域信息'''
PRE_AREA_NAME = "Pre_Part_A"
PRE_AREA_NAME = "东区"
PRE_AREA_ID = "28"
'''
预置的用户数据
'''
PRE_USER_NAME = "Pre_SET"
PRE_USER_JOB_NUMBER = "001"
PRE_USER_CARD_NUMBER = "123"
PRE_USER_EMAIL = "wafer@123.com"
PRE_USER_NAME = "autotest"
PRE_USER_ID = "942"
PRE_USER_JOB_NUMBER = "autotest"
PRE_USER_CARD_NUMBER = "autotest"
PRE_USER_EMAIL = "at@autotest.com"
PRE_USER_DEPARTMENT = "Pre_Testing_Department"
PRE_USER_ROLE = "普通用户"
PRE_USER_WORKSTATION_NUMBER = "FS001"
......@@ -347,23 +354,31 @@ PRE_USER_WORKSTATION_NUMBER = "FS001"
'''
系统默认的角色数据
'''
COMMON_USER_ROLE_ID = "231"
COMMON_USER_ROLE_NAME = u"普通用户"
COMMON_USER_DEPARTMENT = u"所有部门"
COMMON_USER_MENU = '{"backMenu":"1,2,3,4,5,6,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,44,48,50,51,52,53,54,55,56,57,58","webMenu":"30,31,32,33,34,35,36,37,38,39,40,42,43,46,47,53"}'
COMMON_USER_SCOPES = '{"scopes":[{"scopeType":-1,"tableIds":0}]}'
COMMON_USER_ROLEURL = '1,2,3,4,5,6,7,8,11,13,15,16,17,18,19,20,21,22,26,27,28,29,31,32,33,34,35,36,37,38,39,45,46,50,51,52,53,55,57,58,62,63,64,65,66,67,68,69,70,71,90,91,92,93,94,98,99,100,101,102,106,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133'
COMMON_USER_RANGE = "Pre_Xi'an_SoftWare_Park"
SPECIAL_USER_ROLE_NAME = u"特殊预约用户"
SPECIAL_USER_ROLE_ID = "232"
SPECIAL_USER_DEPARTMENT = u"所有部门"
SPECIAL_USER_MENU = '{"backMenu":"1,2,3,4,5,6,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,44,48,50,51,52,53,54,55,56,57,58","webMenu":"30,31,32,33,34,35,36,37,38,39,40,42,43,46,47,53"}'
SPECIAL_USER_SCOPES = '{"scopes":[{"scopeType":-1,"tableIds":0}]}'
SPECIAL_USER_ROLEURL = '1,2,3,4,5,6,7,8,11,13,15,16,17,18,19,20,21,22,26,27,28,29,31,32,33,34,35,36,37,38,39,45,46,50,51,52,53,55,57,58,62,63,64,65,66,67,68,69,70,71,90,91,92,93,94,98,99,100,101,102,106,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133'
SPECIAL_USER_RANGE = "Pre_Xi'an_SoftWare_Park"
'''预置的工位数据'''
PRE_MOBILE_STATION_NAME = "PM001"
PRE_FIXED_STATION_NAME = "PF002"
PRE_STATION_PARK = "Pre_Xi'an_SoftWare_Park"
PRE_STATION_BUILDING = "Pre_lingyi_Square"
PRE_STATION_FLOOR = "Pre_Floor_3"
PRE_STATION_AREA = "Pre_Part_A"
PRE_STATION_DEPARTMENT = "Pre_Testing_Department"
PRE_STATION_PARK = PRE_PARK_NAME
PRE_STATION_BUILDING = PRE_BUILD_NAME
PRE_STATION_FLOOR = PRE_FLOOR_NAME
PRE_STATION_AREA = PRE_AREA_NAME
PRE_STATION_DEPARTMENT = PRE_DEPARTMENT_NAME
PRE_STATION_STATUS = "待绑定"
PRE_STATION_USER = "Pre_SET"
PRE_STATION_USER = PRE_USER_NAME
'''空间素材'''
STATION_SPACE_MATERIAL=u"空间素材"
......
......@@ -43,7 +43,7 @@ ASSERT_EDIT_ERROR = ".ant-message-custom-content.ant-message-error>span"
TEXT_NAME_LINE_ONE = ".//*[@id='main']/div/div[2]/div[2]/div/div/div/div/div/div/table/tbody/tr[last()]/td[2]"
TEXT_URL_LINE_ONE = ".//*[@id='main']/div/div[2]/div[2]/div/div/div/div/div/div/table/tbody/tr[last()]/td[3]"
#删除
ADMINSTRATOR_DELETE_BUTTON = ".ant-table-tbody tr:nth-child(1) td:nth-child(4) i:nth-child(2)"
ADMINSTRATOR_DELETE_BUTTON = ".ant-table-tbody tr:nth-last-child(1) td:nth-child(4) i:nth-child(2)"
CHANCLE_DELETE_BUTTON = ".ant-confirm-btns button:nth-child(1)"
ENSURE_DELETE_BUTTON = ".ant-confirm-btns button:nth-child(2)"
ASSERT_DELETE_TEXT = ".ant-confirm-content"
......@@ -53,4 +53,5 @@ ASSERT_DELETE_ERROR = ".ant-message-custom-content.ant-message-error>span"
ADMINISTRATOR_FLIP_2 = ".//li[@title='2']"
ADMINISTRATOR_FLIP_3 = ".//li[@title='3']"
ADMINISTRATOR_FLIP_NEXT = ".ant-pagination-next"
ADMINISTRATOR_FLIP_PREVIOUS = ".ant-pagination-prev"
\ No newline at end of file
ADMINISTRATOR_FLIP_PREVIOUS = ".ant-pagination-prev"
ADMINISTRATOR_PAGE_BTN = '//*[@id="main"]/div/div[2]/div[2]/div/div/ul'
\ No newline at end of file
......@@ -17,21 +17,24 @@ COMPANYADMIN_TJBB_YCSYTJ = ".//a[@href='/main/report/exceptionIndex']"
COMPANYADMIN_TJBB_YHZWSYTJ = ".//a[@href='/main/report/userSeatIndex']"
COMPANYADMIN_TJBB_LSJL = ".//a[@href='/main/report/historyIndex']"
'''工位维护'''
COMPANYADMIN_GWWH = ".//i[@class='iconfont icon-yidonggongwei']"
COMPANYADMIN_GWWH = '//*[@id="workstationIndex"]/div/div/div[1]/div/ul/li[5]/div'
COMPANYADMIN_GWWH_GWDT = ".//a[@href='/main/station/map']"
COMPANYADMIN_GWWH_GWXX = ".//a[@href='/main/station/stationManageIndex']"
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_XTPZ = '//*[@id="workstationIndex"]/div/div/div[1]/div/ul/li[4]/div/span/span'
COMPANYADMIN_XTPZ_YQGL = '//*[@id="sub3$Menu"]/li[1]/a'
COMPANYADMIN_XTPZ_LYGL = ".//a[@href='/main/data/building']"
COMPANYADMIN_XTPZ_LCGL = ".//a[@href='/main/data/floorManageIndex']"
COMPANYADMIN_XTPZ_QYGL = ".//a[@href='/main/data/area']"
COMPANYADMIN_XTPZ_BMGL = ".//a[@href='/main/data/deptManageIndex']"
COMPANYADMIN_XTPZ_YHXX = ".//a[@href='/main/data/userManageIndex']"
COMPANYADMIN_XTPZ_JSGL = ".//a[@href='/main/data/roleManageIndex']"
COMPANYADMIN_XTPZ_GZRGL = ".//a[@href='/main/data/holiday']"
COMPANYADMIN_XTPZ_LYGL = '//*[@id="sub3$Menu"]/li[2]/a'
COMPANYADMIN_XTPZ_LCGL = '//*[@id="sub3$Menu"]/li[3]/a'
COMPANYADMIN_XTPZ_QYGL = '//*[@id="sub3$Menu"]/li[4]/a'
COMPANYADMIN_XTPZ_BMGL = '//*[@id="sub3$Menu"]/li[5]/a'
COMPANYADMIN_XTPZ_YHXX = '//*[@id="sub3$Menu"]/li[6]/a'
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
......@@ -54,7 +54,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 [name='page.filter.dept'] .ant-select-selection__rendered"
DEPARTMENT_DROPDOWN_LIST_TEXT = "#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"
USER_INPUT = "[name='page.filter.user'] input"
......
......@@ -7,7 +7,7 @@ CONFIRM_BTN = ".//*[@class='ant-modal-content']/div[3]/button[2]"
ADD_DEPARTMENT_TEXT_INPUT = "[name='department.manage.name']>input"
DEPARTMENT_MANAGEMENT_TEXT = ".//*[@id='main']/div/div[1]"
DEPARTMENT_SEARCH_RESULT_TEXT = ".//*[@id='main']/div/div[3]/div[2]/div/div/ul/li[1]"
EDIT_DEPARTMENT_BTN = ".//*[@class='ant-table-tbody']/tr[1]/td[6]/span[1]/i[1]"
EDIT_DEPARTMENT_BTN = '//*[@id="main"]/div/div[3]/div[2]/div/div/div/div/div/div/table/tbody/tr/td[5]/span/i[1]'
FIRST_LINE_DEPARTMENT_NAME_TEXT = ".//*[@class='ant-table-tbody']/tr[1]/td[3]"
SEARCH_INPUT = ".select .ant-input"
SEARCH_BTN = ".//*[@class='filter clearfix']/ul[1]/li[2]/button[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