Commit f1f11675 authored by libin's avatar libin
Browse files

20190628

parents

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="jdk" jdkName="Python 3.6 (Smart_workspace)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="TestRunnerService">
<option name="PROJECT_TEST_RUNNER" value="Unittests" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.6 (Smart_workspace)" project-jdk-type="Python SDK" />
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/Smart_workspace.iml" filepath="$PROJECT_DIR$/.idea/Smart_workspace.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="svn" />
</component>
</project>
\ No newline at end of file
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Smart_workspace</name>
<comment></comment>
<projects>
<project>.settings</project>
<project>PythonTester</project>
<project>tester</project>
</projects>
<buildSpec>
<buildCommand>
<name>org.python.pydev.PyDevBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.python.pydev.pythonNature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?eclipse-pydev version="1.0"?><pydev_project>
<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
<path>/Smart_workspace/src</path>
</pydev_pathproperty>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.6</pydev_property>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
</pydev_project>
eclipse.preferences.version=1
encoding//src/common/com_module.py=utf-8
encoding//src/common/keyboard_util.py=utf-8
encoding//src/common/mouse_util.py=utf-8
encoding//src/common/ssh_client.py=utf-8
encoding//src/datalib/data.py=utf-8
encoding//src/elementlib/administrator.py=utf-8
encoding//src/elementlib/companyadmin.py=utf-8
encoding//src/elementlib/touchdata.py=utf-8
encoding//src/elementlib/ttbb.py=utf-8
encoding//src/elementlib/user_login.py=utf-8
encoding//src/elementlib/xtpz_home_page.py=utf-8
encoding//src/elementlib/xtpz_xtsz.py=utf-8
encoding//src/elementlib/ydgl.py=utf-8
encoding//src/module/Login_Swp.py=utf-8
encoding//src/module/deal_db_data.py=utf-8
encoding//src/module/edit_build.py=utf-8
encoding//src/module/edit_yuanqu.py=utf-8
encoding//src/module/login_swp.py=utf-8
encoding//src/module/sendemail.py=utf-8
encoding//src/module/upload_file.py=utf-8
encoding//src/testcase_touch/001login.py=utf-8
encoding//src/testcase_touch/002login_auto_quit.py=utf-8
encoding//src/testcase_touch/005choose_qy.py=utf-8
encoding//src/testcases/testcase001.py=utf-8
encoding//src/testcases/testcase001_superadministrator_login.py=utf-8
encoding//src/testcases/testcase002.py=utf-8
encoding//src/testcases/testcase002_superadministrator_navigation_menu.py=utf-8
encoding//src/testcases/testcase003.py=utf-8
encoding//src/testcases/testcase003_superadministrator_createcompany.py=utf-8
encoding//src/testcases/testcase004.py=utf-8
encoding//src/testcases/testcase004_superadministrator_editcompany.py=utf-8
encoding//src/testcases/testcase005.py=utf-8
encoding//src/testcases/testcase005_superadministrator_deletecompany.py=utf-8
encoding//src/testcases/testcase006_superadministrator_change_password.py=utf-8
encoding//src/testcases/testcase008_Flip.py=utf-8
encoding//src/testcases/testcase008_page_turning.py=utf-8
encoding//src/testcases/testcase009_companyadmin_login.py=utf-8
encoding//src/testcases/testcase010_companyadmin_listclick.py=utf-8
encoding//src/testcases/testcase011_companyadmin_create_park.py=utf-8
encoding//src/testcases/testcase012_companyadmin_creat_build.py=utf-8
encoding//src/testcases/testcase014_companyadmin_createarea.py=utf-8
encoding//src/testcases/testcase015_companyadmin_create_department.py=utf-8
encoding//src/testcases/testcase016_companyadmin_careteuser.py=utf-8
encoding//src/testcases/testcase016_companyadmin_create_user.py=utf-8
encoding//src/testcases/testcase017_companyadmin_create_role.py=utf-8
encoding//src/testcases/testcase017_companyadmin_rolemanger.py=utf-8
encoding//src/testcases/testcase018_companyadmin_retedate.py=utf-8
encoding//src/testcases/testcase020_companyadmin_uploading_station_map.py=utf-8
encoding//src/testcases/testcase021_companyadmin_stationinfo.py=utf-8
encoding//src/testcases/testcase025_companyadmin_search_park.py=utf-8
encoding//src/testcases/testcase026_companyadmin_edit_build.py=utf-8
encoding//src/testcases/testcase029_companyadmin_edit_department.py=utf-8
encoding//src/testcases/testcase030_companyadmin_search_department.py=utf-8
encoding//src/testcases/testcase031_companyadmin_delete_department.py=utf-8
encoding//src/testcases/testcase032_companyadmin_edit_user.py=utf-8
encoding//src/testcases/testcase033_companyadmin_search_user.py=utf-8
encoding//src/testcases/testcase034_companyadmin_delete_user.py=utf-8
encoding//src/testcases/testcase035_companyadmin_edit_role.py=utf-8
encoding/<project>=UTF-8
'''
Created on 2017年8月17日
@author: gantao
'''
import unittest,time
from common import web_client
from elementlib import xtpz_lygl,companyadmin
from module import login_swp,deal_db_data
from datalib import test_data
from selenium.webdriver.common.by import By
class SearchBuild(unittest.TestCase):
def setUp(self):
sql1 = r"DELETE FROM `officebuilding` WHERE `domainId`=135 AND `officeBuildingName` !='Pre_lingyi_Square' and `parkId`=109;"
deal_db_data.execute_sql(sql1)
sql2="INSERT INTO `reservestation_autotest`.`officebuilding` (`buildingToken`, `domainId`, `officeBuildingName`, `officeBuildingStatus`, `parkId`, `useDefault`) VALUES('8881','135','零壹广场A座','0','109',NULL);\
INSERT INTO `reservestation_autotest`.`officebuilding` (`buildingToken`, `domainId`, `officeBuildingName`, `officeBuildingStatus`, `parkId`, `useDefault`) VALUES('8882','135','零壹广场B座','0','109',NULL);\
INSERT INTO `reservestation_autotest`.`officebuilding` (`buildingToken`, `domainId`, `officeBuildingName`, `officeBuildingStatus`, `parkId`, `useDefault`) VALUES('8883','135','零壹广场C座','0','109',NULL);\
INSERT INTO `reservestation_autotest`.`officebuilding` (`buildingToken`, `domainId`, `officeBuildingName`, `officeBuildingStatus`, `parkId`, `useDefault`) VALUES('8884','135','零壹广场D座','0','109',NULL);\
INSERT INTO `reservestation_autotest`.`officebuilding` (`buildingToken`, `domainId`, `officeBuildingName`, `officeBuildingStatus`, `parkId`, `useDefault`) VALUES('8885','135','零壹广场E座','0','109',NULL);\
"
deal_db_data.execute_sql(sql2)
self.browser=web_client.WebClient(test_data.URL)
login_swp.login01(self.browser, test_data.COMPANY_ADMIN_NAME, test_data.COMPANY_ADMIN_PW)
'''单园区查询'''
def test_search_build01(self):
'''删除新增的园区'''
sql = r"DELETE FROM `reservestation_autotest`.`park` WHERE `domainId`='135' and `id` !='109';"
deal_db_data.execute_sql(sql)
self.browser.click_element(companyadmin.COMPANYADMIN_XTPZ)
time.sleep(1)
self.browser.click_element(companyadmin.COMPANYADMIN_XTPZ_LYGL)
time.sleep(1)
'''
查询新添加的楼宇
'''
self.browser.sendkeys_to_element(xtpz_lygl.SEARCH_BUILD01, u"零壹广场A座", By.CSS_SELECTOR)
self.browser.click_element(xtpz_lygl.SEARCH_BUTTON01)
self.browser.assert_mark_msg(".//*[@id='main']/div/div[2]/div[2]/div/div/div/div/div/div/table/tbody/tr/td[2]", "零壹广场A座")
'''
查询中的重置功能
'''
self.browser.click_element(xtpz_lygl.SEARCH_RESET_BUTTON01)
self.browser.assert_attribute_msg(xtpz_lygl.SEARCH_BUILD01, "value",'', By.CSS_SELECTOR)
self.browser.click_element(xtpz_lygl.SEARCH_BUTTON01)
self.browser.assert_mark_msg(xtpz_lygl.SEARCH_RESULT,"共 6 条")
'''
模糊查询新添加的楼宇
'''
self.browser.sendkeys_to_element(xtpz_lygl.SEARCH_BUILD01, u"零", By.CSS_SELECTOR)
self.browser.click_element(xtpz_lygl.SEARCH_BUTTON01)
self.browser.assert_mark_msg(xtpz_lygl.SEARCH_RESULT,"共 5 条")
'''多园区查询'''
def test_search_build02(self):
'''在数据库中插入一条园区数据,构造多园区'''
'''删除新增的园区'''
sql = r"DELETE FROM `reservestation_autotest`.`park` WHERE `domainId`='135' and `id` !='109';"
deal_db_data.execute_sql(sql)
sql1="insert into `park` (`allDay`, `amTime`, `city`, `country`, `domainId`, `latitude`, `longitude`, `parkName`, `parkStatus`, `pmTime`, `province`, `timeZone`, `cityName`, `countryName`, `provinceName`, `timeAreaName`) values('00:00-23:59','00:00-12:00','beijing','china','135',NULL,NULL,'gttest','0','12:00-23:59','beijing','America/Chicago','北京市','中国','北京市','芝加哥');"
deal_db_data.execute_sql(sql1)
sql2="INSERT INTO `reservestation_autotest`.`officebuilding` (`buildingToken`, `domainId`, `officeBuildingName`, `officeBuildingStatus`, `parkId`, `useDefault`) VALUES('8881','135','零壹广场A座','0',(SELECT id FROM `park` WHERE parkName='gttest'),NULL);"
deal_db_data.execute_sql(sql2)
self.browser.click_element(companyadmin.COMPANYADMIN_XTPZ)
time.sleep(1)
self.browser.click_element(companyadmin.COMPANYADMIN_XTPZ_LYGL)
time.sleep(1)
'''
查询新添加的楼宇
'''
self.browser.click_element(xtpz_lygl.SEARCH_PARK, By.CSS_SELECTOR)
self.browser.click_element(xtpz_lygl.SEARCH_PARK_LIST)
self.browser.click_element(xtpz_lygl.SEARCH_BUTTON02)
self.browser.assert_mark_msg(xtpz_lygl.SEARCH_RESULT,"共 6 条")
self.browser.sendkeys_to_element(xtpz_lygl.SEARCH_BUILD02, u"零壹广场A座", By.CSS_SELECTOR)
self.browser.click_element(xtpz_lygl.SEARCH_BUTTON02)
self.browser.assert_mark_msg(xtpz_lygl.BUILD_LIST_NAME01, "零壹广场A座")
self.browser.assert_mark_msg(xtpz_lygl.SEARCH_RESULT,"共 1 条")
'''结果为空'''
self.browser.sendkeys_to_element(xtpz_lygl.SEARCH_BUILD02, 9527, By.CSS_SELECTOR)
self.browser.click_element(xtpz_lygl.SEARCH_BUTTON02)
self.browser.assert_mark_msg(xtpz_lygl.BUILD_LIST_EMPTY, "暂无数据")
'''
查询中的重置功能
'''
self.browser.click_element(xtpz_lygl.SEARCH_RESET_BUTTON02)
self.browser.assert_attribute_msg(xtpz_lygl.SEARCH_BUILD02, "value",'', By.CSS_SELECTOR)
self.browser.assert_mark_msg(xtpz_lygl.SEARCH_PARK, u"全部", By.CSS_SELECTOR)
self.browser.click_element(xtpz_lygl.SEARCH_BUTTON02)
self.browser.assert_mark_msg(xtpz_lygl.SEARCH_RESULT,"共 7 条")
'''删除新增的园区'''
sql = r"DELETE FROM `reservestation_autotest`.`park` WHERE `parkName` ='gttest';"
deal_db_data.execute_sql(sql)
def tearDown(self):
self.browser.exit_all_browsers()
sql = r"DELETE FROM `officebuilding` WHERE `domainId`=135 AND `officeBuildingName` !='Pre_lingyi_Square' AND domainId=135;"
deal_db_data.execute_sql(sql)
if __name__ == "__main__":
unittest.main()
\ No newline at end of file
'''-*- coding:utf-8'''
'''
Created on 2017年8月15日
@author: caoyq
'''
from common import web_client
from datalib import test_data
import unittest
from module import login_swp
from elementlib import companyadmin,xtpz_yqgl
from module import deal_db_data
from selenium.webdriver.common.by import By
class EditPark(unittest.TestCase):
def setUp(self):
self.browser = web_client.WebClient(test_data.URL)
login_swp.login01(self.browser, test_data.COMPANY_ADMIN_NAME,test_data.COMPANY_ADMIN_PW) #登陆
self.browser.click_element(companyadmin.COMPANYADMIN_XTPZ) #点击侧边栏中的“工位管理”
self.browser.click_element(companyadmin.COMPANYADMIN_XTPZ_YQGL) #点击侧边栏“工位管理”下的“园区管理”
'''
author:曹英群
createtime:2017.08.15
function:
1.修改park name
2.保存编辑内容
'''
def test_edit_yuanqu_001(self):
self.browser.click_element(xtpz_yqgl.EDIT_PARK_BTN) #点击园区表中第一行的“编辑园区”按钮
self.browser.assert_mark_msg(xtpz_yqgl.EDIT_PARK_DIALOG_TITLE,test_data.EDIT_PARK_DIALOG_TITLE) #断言弹出“编辑园区”弹框,标题是:编辑园区
self.browser.assert_attribute_msg(xtpz_yqgl.PARKNAME, test_data.PRE_ATTRIBUTE_VALUE,test_data.PRE_PARK_NAME, By.CSS_SELECTOR) #断言“编辑园区”弹框中“园区名称”显示正确
self.browser.assert_attribute_msg(xtpz_yqgl.TIMEZONE_TEXT, test_data.PRE_ATTRIBUTE_TITLE,test_data.PRE_TIMEZONE, By.CSS_SELECTOR) #断言“时区”显示正确
self.browser.assert_mark_msg(xtpz_yqgl.CITY_TEXT, test_data.PRE_CITY) #断言“城市”显示正确
self.browser.assert_attribute_msg(xtpz_yqgl.MORNING_START, test_data.PRE_ATTRIBUTE_VALUE, test_data.PRE_MORNING_START_TIME, By.CSS_SELECTOR) #断言“上午开始时间”显示正确
self.browser.assert_attribute_msg(xtpz_yqgl.MORNING_END,test_data.PRE_ATTRIBUTE_VALUE, test_data.PRE_MORNING_END_TIME, By.CSS_SELECTOR) #断言“上午结束时间”显示正确
self.browser.assert_attribute_msg(xtpz_yqgl.AFTERNOON_START, test_data.PRE_ATTRIBUTE_VALUE, test_data.PRE_AFTERNOON_START_TIME, By.CSS_SELECTOR) #断言“下午开始时间”显示正确
self.browser.assert_attribute_msg(xtpz_yqgl.AFTERNOON_END, test_data.PRE_ATTRIBUTE_VALUE, test_data.PRE_AFTERNOON_END_TIME, By.CSS_SELECTOR) #断言“下午结束时间”显示正确
self.browser.assert_attribute_msg(xtpz_yqgl.ALL_DAY_START, test_data.PRE_ATTRIBUTE_VALUE, test_data.PRE_ALL_DAY_START, By.CSS_SELECTOR) #断言“全天开始时间”显示正确
self.browser.assert_attribute_msg(xtpz_yqgl.ALL_DAY_END, test_data.PRE_ATTRIBUTE_VALUE, test_data.PRE_ALL_DAY_END, By.CSS_SELECTOR) #断言“全天结束时间”显示正确
self.browser.clear_elem_text(xtpz_yqgl.PARKNAME, By.CSS_SELECTOR) #清除“园区名称”
park_name = "change_park_name"
self.browser.sendkeys_to_element(xtpz_yqgl.PARKNAME, park_name, By.CSS_SELECTOR) #输入“园区名称”
self.browser.click_element(xtpz_yqgl.DETERMINE_BUTTON) #点击“确定”按钮
'''检查出现动态提示文本:修改成功'''
self.browser.assert_mark_msg(xtpz_yqgl.DYNAMIC_WARNING_MESSAGE, test_data.CHANGE_PARK_SUCCESS_MSG) #检查出现动态提示文本:修改成功
#断言数据库中该数据也修改
select_sql = "SELECT COUNT(*) FROM `reservestation_autotest`.`park` p WHERE p.`parkName`like 'change%';"
deal_db_data.assert_select_result(select_sql, 1)
'''
author:曹英群
createtime:2017.08.15
function:
1.修改时区,城市,上午时间,下午时间
2.放弃修改(编辑框中的“取消”)
'''
def test_edit_yuanqu_002(self):
self.browser.click_element(xtpz_yqgl.EDIT_PARK_BTN) #点击园区表中第一行的“编辑园区”图标
self.browser.assert_mark_msg(xtpz_yqgl.EDIT_PARK_DIALOG_TITLE,test_data.EDIT_PARK_DIALOG_TITLE) #断言弹出“编辑园区”弹出框,标题是:编辑园区
self.browser.assert_attribute_msg(xtpz_yqgl.PARKNAME, test_data.PRE_ATTRIBUTE_VALUE,test_data.PRE_PARK_NAME, By.CSS_SELECTOR) #断言“园区名称”显示正确
self.browser.assert_attribute_msg(xtpz_yqgl.TIMEZONE_TEXT, test_data.PRE_ATTRIBUTE_TITLE,test_data.PRE_TIMEZONE, By.CSS_SELECTOR) #断言“时区”显示正确
self.browser.assert_mark_msg(xtpz_yqgl.CITY_TEXT, test_data.PRE_CITY) #断言“城市”显示正确
self.browser.assert_attribute_msg(xtpz_yqgl.MORNING_START, test_data.PRE_ATTRIBUTE_VALUE, test_data.PRE_MORNING_START_TIME, By.CSS_SELECTOR) #断言“上午开始时间”显示正确
self.browser.assert_attribute_msg(xtpz_yqgl.MORNING_END,test_data.PRE_ATTRIBUTE_VALUE, test_data.PRE_MORNING_END_TIME, By.CSS_SELECTOR) #断言“上午结束时间”显示正确
self.browser.assert_attribute_msg(xtpz_yqgl.AFTERNOON_START, test_data.PRE_ATTRIBUTE_VALUE, test_data.PRE_AFTERNOON_START_TIME, By.CSS_SELECTOR) #断言“下午开始时间”显示正确
self.browser.assert_attribute_msg(xtpz_yqgl.AFTERNOON_END, test_data.PRE_ATTRIBUTE_VALUE, test_data.PRE_AFTERNOON_END_TIME, By.CSS_SELECTOR) #断言“下午结束时间显示正确”
self.browser.assert_attribute_msg(xtpz_yqgl.ALL_DAY_START, test_data.PRE_ATTRIBUTE_VALUE, test_data.PRE_ALL_DAY_START, By.CSS_SELECTOR) #断言“全天开始时间”显示正确
self.browser.assert_attribute_msg(xtpz_yqgl.ALL_DAY_END, test_data.PRE_ATTRIBUTE_VALUE, test_data.PRE_ALL_DAY_END, By.CSS_SELECTOR) #断言“全天结束时间”显示正确
self.browser.click_element(xtpz_yqgl.TIMEZONE, By.CSS_SELECTOR) #点击“时区”下拉框
timezone_value = "香港"
self.browser.select_option_by_css_and_text(timezone_value) #选择时区“香港”
self.browser.click_element(xtpz_yqgl.CITY, By.CSS_SELECTOR) #点击“城市”下拉框
self.browser.click_element(xtpz_yqgl.CITY_PROVINCE_HONGKONG) #选择“香港”
self.browser.click_element(xtpz_yqgl.CANCEL_BTN) #点击“取消”按钮
self.browser.click_element(xtpz_yqgl.EDIT_PARK_BTN) #再次点击“编辑园区”图标
self.browser.assert_attribute_msg(xtpz_yqgl.PARKNAME, test_data.PRE_ATTRIBUTE_VALUE,test_data.PRE_PARK_NAME, By.CSS_SELECTOR) #断言“园区名称”显示正确
self.browser.assert_attribute_msg(xtpz_yqgl.TIMEZONE_TEXT, test_data.PRE_ATTRIBUTE_TITLE,test_data.PRE_TIMEZONE, By.CSS_SELECTOR) #断言“时区”显示正确
self.browser.assert_mark_msg(xtpz_yqgl.CITY_TEXT, test_data.PRE_CITY) #断言“城市”显示正确
self.browser.click_element(xtpz_yqgl.CLOSE_BUTTON) #点击“关闭”按钮
def tearDown(self):
self.browser.exit_all_browsers()
updata_sql = '''UPDATE `reservestation_autotest`.`park` p SET p.`amTime`='00:00-12:59',p.`city`='xian',p.`country`='china',
p.`parkName`= "Pre_Xi'an_SoftWare_Park",p.`parkStatus`=0,p.`pmTime`='13:00-23:59',p.`province`='shanxi',
p.`timeAreaName`='Asia/Shanghai',p.`cityName`='西安市',p.`countryName`='中国',p.`provinceName`='陕西省',p.`timeAreaName`='北京'
WHERE p.`id`=109;'''
deal_db_data.execute_sql(updata_sql)
if __name__ == '__main__':
suit = unittest.main()
\ No newline at end of file
import unittest
from module import login_swp, deal_db_data, upload_file
from datalib import test_data
from elementlib import companyadmin
from common import web_client
from elementlib import gwwh_kjsc
from selenium.webdriver.common.by import By
import logging
class spaceMaterial(unittest.TestCase):
def setUp(self):
unittest.TestCase.setUp(self)
self.browser = web_client.WebClient(test_data.URL)
login_swp.login01(self.browser, test_data.COMPANY_ADMIN_NAME, test_data.COMPANY_ADMIN_PW) #登录
self.browser.click_element(companyadmin.COMPANYADMIN_GWWH) #点击侧边栏中的“工位维护”
self.browser.click_element(companyadmin.COMPANYADMIN_GWWH_GWSC) #点击“工位维护”下的“工位素材”
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 `reservestation_autotest`.`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_WIDTH_Decrease, By.CSS_SELECTOR)
self.browser.click_element(gwwh_kjsc.MATERIAL_HEIGHT_Increase, By.CSS_SELECTOR)
# self.browser.click_element(gwwh_kjsc.MATERIAL_HEIGHT_Decrease, 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.a(self.browser.get_attribute_value(gwwh_kjsc.MATERIAL_TEXT, "dy", By.CSS_SELECTOR), '16')
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 `reservestation_autotest`.`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 `reservestation_autotest`.`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):
# unittest.TestCase.tearDown(self)
delte_test_data = "delete from `reservestation_autotest`.`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
#coding:utf-8
import time
from datalib import test_data
from elementlib import administrator
from module import login_swp
import unittest
from common import web_client
from selenium.webdriver.common.by import By
#公共登陆模块
class EditCompany(unittest.TestCase):
def setUp(self):
self.object = web_client.WebClient(test_data.URL)
login_swp.login01(self.object, test_data.USERNAME, test_data.PASSWORD,test_data.USERNAME_SUPERADMIN)
time.sleep(2)
#创建企业域
self.object.click_element(administrator.ADMINISTRATOR_CREATECOMPANY)
COMPANY_NAME = "qweqweqwe"
COMPANY_URL = "eqweqweqwe"
self.object.sendkeys_to_element(administrator.ADMINISTRATOR_CREATECOMPANY_COMPANYNAME, COMPANY_NAME,By.CSS_SELECTOR)
self.object.sendkeys_to_element(administrator.ADMINISTRATOR_CREATECOMPANY_COMPANYURL, COMPANY_URL,By.CSS_SELECTOR)
self.object.click_element(administrator.ADMINISTRATOR_CREATECOMPANY_DETERMINE, By.CSS_SELECTOR)
#点击删除 -- 取消删除 -- 确认删除
'''先取消删除企业再确认删除企业'''
def test_delete_001(self):
COMPANY_NAME = "qweqweqwe" # 原企业名称
COMPANY_URL = "eqweqweqwe" # 原企业域名
self.object.click_element(administrator.ADMINSTRATOR_DELETE_BUTTON, By.CSS_SELECTOR) # 点击删除按钮
self.object.assert_mark_msg(administrator.ASSERT_DELETE_TEXT,test_data.ASSERT_DELETE_TEXT, By.CSS_SELECTOR) # 判断弹窗标题
self.object.click_element(administrator.CHANCLE_DELETE_BUTTON, By.CSS_SELECTOR) # 点击取消按钮
self.object.assert_mark_msg(administrator.TEXT_NAME_LINE_ONE, COMPANY_NAME) # 断言第一行企业名称没有被修改
self.object.assert_mark_msg(administrator.TEXT_URL_LINE_ONE, COMPANY_URL) # 断言第一行企业域名没有被修改
self.object.click_element(administrator.ADMINSTRATOR_DELETE_BUTTON, By.CSS_SELECTOR) # 再次点击删除按钮
self.object.assert_mark_msg(administrator.ASSERT_DELETE_TEXT, test_data.ASSERT_DELETE_TEXT, By.CSS_SELECTOR) # 再次断言弹窗标题
self.object.click_element(administrator.ENSURE_DELETE_BUTTON, By.CSS_SELECTOR) # 点击确认按钮
self.object.assert_mark_msg(administrator.ASSERT_DELETE_SUCCESS,test_data.ASSERT_DELETE_SUCCESS, By.CSS_SELECTOR) # 断言提示信息‘删除成功’
self.object.click_element(administrator.ADMINSTRATOR_DELETE_BUTTON, By.CSS_SELECTOR) # 点击包含用户的企业域后的删除按钮
self.object.click_element(administrator.ENSURE_DELETE_BUTTON, By.CSS_SELECTOR) # 点击确认按钮
self.object.assert_mark_msg(administrator.ASSERT_DELETE_ERROR, test_data.ASSERT_DELETE_ERROR,By.CSS_SELECTOR) # 断言提示信息删除失败
def tearDown(self):
self.object.exit_all_browsers()
if __name__ == '__main__':
suite = unittest.main()
\ No newline at end of file
#coding:utf-8
from datalib import test_data
from elementlib import xtpz_yqgl
from module import login_swp
import unittest
from common import web_client
from elementlib import companyadmin
from module import edit_yuanqu
from module import deal_db_data
from selenium.webdriver.common.by import By
class CreatePark(unittest.TestCase):
def setUp(self):
self.brower = web_client.WebClient(test_data.URL)
sql = "DELETE FROM `reservestation_autotest`.`park` WHERE domainID = '135' AND id<>109;"
deal_db_data.execute_sql(sql)
login_swp.login01(self.brower,test_data.COMPANY_ADMIN_NAME,test_data.COMPANY_ADMIN_PW)#登陆
self.brower.click_element(companyadmin.COMPANYADMIN_XTPZ)#点击侧边栏中的“工位管理”
self.brower.click_element(companyadmin.COMPANYADMIN_XTPZ_YQGL)#点击“工位管理”下的“园区管理”
self.brower.assert_mark_msg(xtpz_yqgl.PARK_MANAGEMENT_TEXT,test_data.PARK_MANAGEMENT_TEXT)#断言页面标题是“园区管理”
'''
author:曹英群
createtime:2017.08.15
function:
创建园区:
1. 编辑符合要求的必填项,成功创建园区
2.查询园区
'''
def test_creat_yuanqu_001(self):
self.brower.click_element(xtpz_yqgl.CREAT_PARK)#点击“添加园区”按钮
self.brower.assert_mark_msg(xtpz_yqgl.CREATE_PARK_DIALOG_TITLE, test_data.CREATE_PARK_DIALOG_TITLE, By.ID)#断言“添加园区”窗口的标题是“添加园区”
self.brower.assert_attribute_msg(xtpz_yqgl.PARKNAME, test_data.ATTRIBUTE_PLACEHOLDER, test_data.ATTRIBUTE_PLACEHOLDER_PLEASE_ENTER_PARK_NAME, By.CSS_SELECTOR)#断言“园区名称”文本框中的默认文本是“请输入园区名称”
#编辑园区各信息项
park_name = "autotest_西安软件园"
morning_start_time = "09:00"
morning_end_time = "11:30"
afternoon_start_time = "14:00"
afternonn_end_time = "18:00"
timezone_value = "北京"
edit_yuanqu.edit_park(self.brower,\
park_name, \
morning_start_time,\
morning_end_time,\
afternoon_start_time,\
afternonn_end_time,\
timezone_value,\
[xtpz_yqgl.CITY_COUNTRY,''],\
[xtpz_yqgl.CITY_PROVINCE,''],\
[xtpz_yqgl.CITY_CITY,''])
self.brower.click_element(xtpz_yqgl.DETERMINE_BUTTON)#点击”确定“按钮
'''搜索园区'''
self.brower.sendkeys_to_element(xtpz_yqgl.SEARCH_PARK_INPUT, park_name,By.CSS_SELECTOR)
self.brower.click_element(xtpz_yqgl.SEARCH_PARK_SEARCH_BTN)
'''断言搜索结果正确'''
self.brower.assert_mark_msg(xtpz_yqgl.SEARCH_RESULT_TEXT,test_data.SEARCH_RESULT_TEXT_1)
self.brower.click_element(xtpz_yqgl.SEARCH_PARK_RESET_BTN)
select_sql = "SELECT COUNT(*) FROM `reservestation_autotest`.`park` WHERE domainID = '135' AND parkName LIKE 'autotest%';"
deal_db_data.assert_select_result(select_sql, 1)
'''
author:曹英群
createtime:2017.08.15
function:
1.必填项的校验
2.parkname的最大输入字符个数
'''
def test_create_yuanqu_002(self):
self.brower.click_element(xtpz_yqgl.CREAT_PARK)#点击”添加园区“按钮
self.brower.click_element(xtpz_yqgl.DETERMINE_BUTTON)#点击”添加园区“窗口中的”确定“按钮
self.brower.assert_mark_msg(xtpz_yqgl.DYNAMIC_WARNING_MESSAGE, test_data.EMPTY_PARK_NAME_WARNING_MSG)#检查出现动态提示信息:园区名称不能为空!
'''最大输入字符数:50'''
park_name = "autotest_wafer~!@#$%^&*()_+{}:<>?,./123456qWQEDWWW"
self.brower.sendkeys_to_element(xtpz_yqgl.PARKNAME, park_name, By.CSS_SELECTOR)#输入园区名称(最大字符数)
self.brower.click_element(xtpz_yqgl.DETERMINE_BUTTON)#点击”确定“按钮
self.brower.assert_mark_msg(xtpz_yqgl.DYNAMIC_WARNING_MESSAGE, test_data.EMPTY_TIME_ZONE_WARNING_MSG)#检查出现动态提示信息:时区不能为空!
self.brower.click_element(xtpz_yqgl.TIMEZONE, By.CSS_SELECTOR)#点击”时区“下拉框
timezone_value = "新加坡"
self.brower.select_option_by_css_and_text(timezone_value)#选择时区
self.brower.click_element(xtpz_yqgl.DETERMINE_BUTTON)#点击”确定“按钮
self.brower.assert_mark_msg(xtpz_yqgl.DYNAMIC_WARNING_MESSAGE, test_data.EMPTY_CITY_WARNING_MSG)#检查出现动态提示信息:城市不能为空!
self.brower.click_element(xtpz_yqgl.CITY, By.CSS_SELECTOR)#点击”城市“下拉框
self.brower.click_element(xtpz_yqgl.CITY_COUNTRY_SINGAPORE)#选择“新加坡”
self.brower.click_element(xtpz_yqgl.DETERMINE_BUTTON)#点击“确定”按钮
self.brower.assert_mark_msg(xtpz_yqgl.DYNAMIC_WARNING_MESSAGE,test_data.EMPTY_MORNING_START_TIME_WARNING_MSG)#检查出现动态提示信息:上午起始时间不能为空!
self.brower.click_element(xtpz_yqgl.MORNING_START, By.CSS_SELECTOR)#点击“上午起始时间”
self.brower.sendkeys_to_element(xtpz_yqgl.MORNING_START_TIME1,"08:00")#输入“上午起始时间”:08:00
self.brower.click_element(xtpz_yqgl.DETERMINE_BUTTON)#点击“确定”按钮
self.brower.assert_mark_msg(xtpz_yqgl.DYNAMIC_WARNING_MESSAGE, test_data.EMPTY_MORNING_END_TIME_WARNING_MSG)#检查出现动态提示信息:上午结束时间不能为空!
self.brower.click_element(xtpz_yqgl.MORNING_END, By.CSS_SELECTOR)#点击“上午结束时间”框
self.brower.sendkeys_to_element(xtpz_yqgl.MORNING_END_TIME1,"11:00")#输入“上午结束时间”:11:00
self.brower.click_element(xtpz_yqgl.DETERMINE_BUTTON)#点击“确定”按钮
self.brower.assert_mark_msg(xtpz_yqgl.DYNAMIC_WARNING_MESSAGE, test_data.EMPTY_AFTERNOON_START_TIME_WARNING_MSG)#检查出现动态提示信息:下午起始时间不能为空!
self.brower.click_element(xtpz_yqgl.AFTERNOON_START, By.CSS_SELECTOR)#点击“下午起始时间”框
self.brower.sendkeys_to_element(xtpz_yqgl.AFTERNOON_START_TIME1,"14:30")#输入“下午起始时间”:14:30
self.brower.click_element(xtpz_yqgl.DETERMINE_BUTTON)#点击“确定”按钮
self.brower.assert_mark_msg(xtpz_yqgl.DYNAMIC_WARNING_MESSAGE, test_data.EMPTY_AFTERNOON_END_TIME_WARNING_MSG)#检查出现动态提示信息:下午结束时间不能为空!
self.brower.click_element(xtpz_yqgl.AFTERNOON_END, By.CSS_SELECTOR)#点击“下午结束时间”框
self.brower.sendkeys_to_element(xtpz_yqgl.AFTERNOON_END_TIME1,"17:30")#输入“下午结束时间”:17:30
self.brower.click_element(xtpz_yqgl.DETERMINE_BUTTON)#点击“确定”按钮
#从数据库中查询该园区
select_sql = "select count(*) from `reservestation_autotest`.`park` where domainID = '135' and parkName like 'autotest%';"
#断言查询到的数量是1
deal_db_data.assert_select_result(select_sql, 1)
'''
author:曹英群
createtime:2017.08.15
function:
1.结束时间>开始时间的校验
2.编辑框中的close按钮
'''
def test_create_yuanqu_003(self):
self.brower.click_element(xtpz_yqgl.CREAT_PARK)#点击“添加园区”按钮
#编辑园区信息项