示例#1
0
文件: Created.py 项目: jwy0729/app
 def create(self, source):
     try:
         cp = configparser.SafeConfigParser()
         cp.read('base.ini', encoding='utf-8')
         phone = base.id_text(
             'com.facilityone.product.shang:id/edit_item_content_et')
         if phone == "" or phone is None:
             base.id_sendkey(
                 'com.facilityone.product.shang:id/edit_item_content_et',
                 '15042540563')
             phone = '15042540563'
         base.id_click(
             'com.facilityone.product.shang:id/report_department_ll')
         base.id_sendkey(
             'com.facilityone.product.shang:id/search_edit_text',
             cp.get('workorder', 'department'))
         base.id_click(
             'com.facilityone.product.shang:id/report_select_item_rl')
         try:
             base.name_click('确定')
         except BaseException:
             print('只有一级部门')
         if source == '工单':
             base.id_click(
                 'com.facilityone.product.shang:id/report_position_ll')
             base.id_sendkey(
                 'com.facilityone.product.shang:id/search_edit_text',
                 cp.get('workorder', 'location'))
             base.id_click(
                 'com.facilityone.product.shang:id/report_select_item_rl')
             try:
                 base.name_click('确定')
             except BaseException:
                 print('只有一级位置')
         base.id_click(
             'com.facilityone.product.shang:id/report_service_type_ll')
         base.id_sendkey(
             'com.facilityone.product.shang:id/search_edit_text',
             cp.get('workorder', 'type'))
         base.id_click(
             'com.facilityone.product.shang:id/report_select_item_rl')
         try:
             base.name_click('确定')
         except BaseException:
             print('只有一级服务类型')
         base.id_click(
             'com.facilityone.product.shang:id/report_priority_ll')
         base.id_click(
             'com.facilityone.product.shang:id/report_select_item_rl')
         priority = base.id_text(
             'com.facilityone.product.shang:id/edit_item_content_tv')
         WCreated.DropDown.dropDown()
         i = random.randint(0, 1000)
         if source == '工单':
             base.name_sendkey('请输入内容', '测试描述' + str(i))
         base.name_click('提交')
         if source == '工单':
             return '测试描述' + str(i)
     except BaseException:
         self.assertEqual(0, 1, "工单创建模块,测试未通过")
示例#2
0
 def storageIn(self, material):
     try:
         cp = configparser.SafeConfigParser()
         cp.read('base.ini', encoding='utf-8')
         try:
             base.name_click(u'入库')
         except BaseException:
             try:
                 base.name_click(u'库存')
                 base.name_click(u'入库')
             except BaseException:
                 base.name_click(u'工作')
                 base.name_click(u'库存')
                 base.name_click(u'入库')
         sleep(2)
         base.name_click('点击选择仓库')
         base.driver.implicitly_wait(300)
         base.id_sendkey(
             'com.facilityone.product.shang:id/search_edit_text',
             cp.get('invebtory', 'warehouse'))
         sleep(2)
         l = len(
             base.driver.find_elements_by_class_name(
                 'android.widget.RelativeLayout'))
         base.class_name_click_number('android.widget.RelativeLayout',
                                      int(int(l) - 1))
         base.driver.implicitly_wait(0)
         i = random.randint(0, 10000)
         base.id_sendkey(
             'com.facilityone.product.shang:id/multi_input_content_et',
             '描述' + str(i))
         base.driver.find_element_by_xpath(
             '/hierarchy/android.widget.FrameLayout/cn.bingoogolapple.swipebacklayout.BGASwipeBackLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout[1]/android.view.ViewGroup/android.widget.LinearLayout/android.widget.LinearLayout[2]/android.widget.LinearLayout[1]'
         ).click()
         base.driver.implicitly_wait(300)
         base.id_sendkey(
             'com.facilityone.product.shang:id/search_edit_text', material)
         sleep(2)
         base.driver.find_element_by_xpath(
             '/hierarchy/android.widget.FrameLayout/cn.bingoogolapple.swipebacklayout.BGASwipeBackLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout[2]/android.widget.LinearLayout/android.widget.LinearLayout[2]/android.widget.FrameLayout/android.widget.ListView/android.widget.LinearLayout[1]'
         ).click()
         base.driver.implicitly_wait(0)
         base.id_click('com.facilityone.product.shang:id/ll_root')
         base.id_click(
             'com.facilityone.product.shang:id/material_add_batch')
         base.name_sendkey('请输入供应商名称', '供应商' + str(i))
         base.name_click('请选择过期时间')
         base.name_click('确定')
         due_date = base.id_text(
             'com.facilityone.product.shang:id/et_select_due_date')
         base.id_sendkey('com.facilityone.product.shang:id/et_cost', str(i))
         base.id_sendkey('com.facilityone.product.shang:id/et_amount', 2)
         base.name_click('保存')
         sleep(1)
         base.name_click('保存')
         base.id_click(
             'com.facilityone.product.shang:id/inventory_save_btn')
     except BaseException:
         self.assertEqual(0, 1, "库存入库模块,入库测试未通过")
示例#3
0
 def create(self):
     try:
         cp = configparser.SafeConfigParser()
         cp.read('base.ini', encoding='utf-8')
         try:
             base.name_click(u'新建物资')
         except BaseException:
             try:
                 base.name_click(u'库存')
                 base.name_click(u'新建物资')
             except BaseException:
                 base.name_click(u'工作')
                 base.name_click(u'库存')
                 base.name_click(u'新建物资')
         base.name_click('点击选择仓库')
         base.driver.implicitly_wait(300)
         base.id_sendkey('com.facilityone.product.shang:id/search_edit_text', cp.get('invebtory', 'warehouse'))
         sleep(2)
         l = len(base.driver.find_elements_by_class_name('android.widget.RelativeLayout'))
         base.class_name_click_number('android.widget.RelativeLayout', int(int(l) - 1))
         base.driver.implicitly_wait(0)
         i = random.randint(0, 10000)
         base.id_sendkey('com.facilityone.product.shang:id/et_shelves', '货架信息' + str(i))
         base.id_sendkey('com.facilityone.product.shang:id/material_info_name', '物资' + str(i))
         base.id_sendkey('com.facilityone.product.shang:id/material_info_code', 'bm' + str(i))
         base.id_sendkey('com.facilityone.product.shang:id/material_info_unit', 'kg' + str(i))
         create.DropDown.dropDown()
         base.driver.implicitly_wait(200)
         base.id_sendkey('com.facilityone.product.shang:id/material_info_brand', '品牌' + str(i))
         base.driver.implicitly_wait(0)
         base.id_sendkey('com.facilityone.product.shang:id/material_info_model', 'NHG' + str(i))
         base.id_sendkey('com.facilityone.product.shang:id/material_info_ratified_price', str(i))
         create.DropDown.dropDown()
         base.id_sendkey('com.facilityone.product.shang:id/material_info_minimum_stock', 21)
         base.driver.implicitly_wait(200)
         base.id_sendkey('com.facilityone.product.shang:id/material_info_initial_number', 10)
         base.driver.implicitly_wait(0)
         base.name_sendkey('请输入或选择供应商', '供应商' + str(i))
         create.DropDown.dropDown(base)
         base.id_sendkey('com.facilityone.product.shang:id/et_cost', 22)
         base.id_click('com.facilityone.product.shang:id/et_select_due_date')
         base.name_click('确定')
         due_date = base.id_text('com.facilityone.product.shang:id/et_select_due_date')
         create.DropDown.dropDown()
         base.name_sendkey('请输入备注', '库存备注' + str(i))
         base.name_click("保存")
         sleep(7)
         return '物资' + str(i)
     except BaseException:
         self.assertEqual(0,1, "库存新建物资模块,测试未通过")
示例#4
0
文件: Create.py 项目: jwy0729/app
 def create(self):
     try:
         cp = configparser.SafeConfigParser()
         cp.read('base.ini', encoding='utf-8')
         try:
             base.name_click(u'创建新需求')
         except BaseException:
             try:
                 base.name_click(u'服务台')
                 base.name_click(u'创建新需求')
             except BaseException:
                 base.name_click(u'工作')
                 base.name_click(u'服务台')
                 base.name_click(u'创建新需求')
         name = str(base.id_text('com.facilityone.product.shang:id/demand_create_operator_et'))
         phone = str(base.id_text('com.facilityone.product.shang:id/demand_create_operator_phone_et'))
         if phone == "" or phone is None:
             base.class_name_sendkey_number('android.widget.EditText', 1, '15542835749')
             phone = '15542835749'
         print(name + ',' + phone)
         sleep(2)
         base.name_click(u'请选择需求类型')
         base.class_name_sendkey('android.widget.EditText', cp.get('requirment', 'type'))
         sleep(1)
         base.class_name_click_number('android.widget.RelativeLayout', 1)
         sleep(2)
         i = random.randint(0, 10000)
         sleep(1)
         try:
             base.name_click('确定')
             print(12)
         except BaseException:
             print('无子集')
         sleep(1)
         base.name_sendkey('请输入需求描述', '测试' + str(i))
         des = '测试' + str(i)
         print(des)
         base.name_click(u'提交')
         createtime = datetime.datetime.now().strftime('M-D h:m')
         inf = Information()
         inf.setdes(des)
         inf.setname(name)
         inf.setCreateTime(createtime)
         inf.settype(cp.get('requirment', 'type'))
         return inf
     except BaseException:
         self.assertEqual(0,1, "创建需求模块,测试未通过")
示例#5
0
 def save(self, no):
     try:
         i = random.randint(0, 1000)
         try:
             base.id_click(
                 'com.facilityone.product.shang:id/service_demand_item_handle_content_add_iv'
             )
         except BaseException:
             base.name_click(no)
             base.id_click(
                 'com.facilityone.product.shang:id/service_demand_item_handle_content_add_iv'
             )
         base.name_sendkey('请输入处理內容', '测试工作内容' + str(i))
         base.name_click(u'保存')
         uncompleted.click.click()
         base.name_click(u'保存')
     except:
         self.assertEqual(0, 1, "待处理需求模块,保存测试未通过")
示例#6
0
文件: MyReserved.py 项目: jwy0729/app
 def cancellation(self):
     try:
         base.name_click(u'我的预定')
     except BaseException:
         try:
             base.name_click(u'库存')
             base.name_click(u'我的预定')
         except BaseException:
             base.name_click(u'工作')
             base.name_click(u'库存')
             base.name_click(u'我的预定')
     try:
         base.driver.implicitly_wait(300)
         base.driver.find_element_by_xpath(
             '/hierarchy/android.widget.FrameLayout/cn.bingoogolapple.swipebacklayout.BGASwipeBackLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout[2]/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.ListView/android.widget.LinearLayout[1]'
         ).click()
         base.driver.implicitly_wait(0)
         i = random.randint(0, 10000)
         base.name_click('取消预定')
         base.name_sendkey('请输入原因', '取消预定' + str(i))
         base.name_click('确定')
         MyReserved.returnpage.returnpage()
     except BaseException:
         self.assertEqual(0, 1, "库存我的预定模块,取消预定测试未通过")
示例#7
0
 def login1(self):
     sleep(12)
     cp = configparser.SafeConfigParser()
     cp.read('E:\\app\\base.ini', encoding='utf-8')
     sleep(2)
     try:
         view = base.calss_name_size('android.view.View')
         h = int(view['height'])
         w = int(int(view['width']) * 0.7)
         w1 = int(w - 500)
         # print(str(w1)+','+str(w))
         i = 1
         for i in range(3):
             sleep(2)
             base.driver.swipe(w, h, w1, h, 5000)
             sleep(2)
         base.class_name_click('android.widget.Button')
         TouchAction(base.driver).long_press(
             base.by_id(
                 'com.facilityone.product.shang:id/login_modify_server_ip_tv'
             )).wait(7000).perform()
         sleep(1)
         url = str(base.class_name_text('android.widget.EditText'))
         print(url)
         if url != str(cp.get('url', 'url')):
             base.class_name_clear('android.widget.EditText')
             base.class_name_sendkey('android.widget.EditText',
                                     cp.get('url', 'url'))
         base.id_click('com.facilityone.product.shang:id/mod_ip_sure_btn')
         base.id_clear('com.facilityone.product.shang:id/edittext')
         base.name_sendkey(u'用户名', cp.get('login', 'name'))
         base.driver.find_elements_by_id(
             'com.facilityone.product.shang:id/edittext')[1].send_keys(
                 cp.get('login', 'password'))
         base.id_click('com.facilityone.product.shang:id/login_login_btn')
         a = "第一次登陆"
         return a
     except BaseException:
         print('不是安装后第一次登陆')
     sleep(2)
     try:
         TouchAction(base.driver).long_press(
             base.by_id(
                 'com.facilityone.product.shang:id/login_modify_server_ip_tv'
             )).wait(7000).perform()
         sleep(1)
         url = str(base.class_name_text('android.widget.EditText'))
         if url != str(cp.get('url', 'url')):
             base.class_name_clear('android.widget.EditText')
             base.class_name_sendkey('android.widget.EditText',
                                     cp.get('url', 'url'))
         sleep(1)
         base.id_click('com.facilityone.product.shang:id/mod_ip_sure_btn')
         base.id_clear('com.facilityone.product.shang:id/edittext')
         base.name_sendkey(u'用户名', cp.get('login', 'name'))
         base.driver.find_elements_by_id(
             'com.facilityone.product.shang:id/edittext')[1].send_keys(
                 cp.get('login', 'password'))
         base.id_click('com.facilityone.product.shang:id/login_login_btn')
     except:
         print('已登录状态')