Esempio n. 1
0
 def test_002_General_setting_Language(self):
     '''General settings语言设置,中切换为英文'''
     try:
         function.by_ccs(self, ReadElement.setting(self,
                                                   "settings图标")).click()
         time.sleep(0.5)
         self.dr.execute_script(ReadElement.setting(
             self, "Generalsettings")).click()
         time.sleep(0.5)
         self.dr.execute_script(ReadElement.setting(self, "Edit按钮")).click()
         time.sleep(0.5)
         self.dr.execute_script(ReadElement.setting(self, "语言下拉列表")).click()
         time.sleep(0.5)
         self.dr.execute_script(ReadElement.setting(self,
                                                    "选择English")).click()
         self.dr.implicitly_wait(10)
         self.dr.execute_script(ReadElement.setting(self, "save按钮")).click()
         self.sleep(1)
         self.assertEqual(
             self.dr.execute_script(ReadElement.setting(self, "长度单位")).text,
             "Metric")
     except:
         print(
             self.dr.execute_script(ReadElement.setting(self, "长度单位")).text)
         function.save_img(self, sys._getframe().f_code.co_name)
         self.assertEqual(
             self.dr.execute_script(ReadElement.setting(self, "长度单位")).text,
             "Metric")
Esempio n. 2
0
 def test_008_General_setting_Weightunit(self):
     '''General settings设置Weight unit为Metric'''
     try:
         function.by_ccs(self, ReadElement.setting(self,
                                                   "settings图标")).click()
         time.sleep(1)
         self.dr.execute_script(ReadElement.setting(
             self, "Generalsettings")).click()
         time.sleep(0.5)
         self.dr.execute_script(ReadElement.setting(self, "Edit按钮")).click()
         time.sleep(0.5)
         self.dr.execute_script(ReadElement.setting(
             self, "WeightMetric")).click()
         self.dr.implicitly_wait(10)
         time.sleep(2)
         self.dr.execute_script(ReadElement.setting(self, "save按钮")).click()
         time.sleep(0.5)
         print(
             self.dr.execute_script(
                 ReadElement.setting(self, "Weightunit单位")))
         time.sleep(0.5)
     except:
         function.save_img(self, sys._getframe().f_code.co_name)
         assert self.dr.execute_script(
             ReadElement.setting(self, "Weightunit单位")) == "Metric"
Esempio n. 3
0
 def test_006_General_setting_googlemap(self):
     '''General settings设置谷歌地图'''
     try:
         function.by_ccs(self, ReadElement.setting(self,
                                                   "settings图标")).click()
         time.sleep(1)
         self.dr.execute_script(ReadElement.setting(
             self, "Generalsettings")).click()
         time.sleep(0.5)
         self.dr.execute_script(ReadElement.setting(self, "Edit按钮")).click()
         time.sleep(0.5)
         self.dr.execute_script(ReadElement.setting(self,
                                                    "下拉选择MAP")).click()
         time.sleep(0.5)
         self.dr.implicitly_wait(10)
         function.by_ccs(self, ReadElement.setting(self, "选择谷歌地图")).click()
         self.dr.implicitly_wait(10)
         self.dr.execute_script(ReadElement.setting(self, "save按钮")).click()
         time.sleep(0.5)
         print(self.dr.execute_script(ReadElement.setting(self, "断言当前地图")))
         time.sleep(0.5)
         self.assertEqual(
             self.dr.execute_script(ReadElement.setting(self, "断言当前地图")),
             "Google Map")
     except:
         function.save_img(self, sys._getframe().f_code.co_name)
         assert self.dr.execute_script(ReadElement.setting(
             self, "断言当前地图")) == "Google Map"
Esempio n. 4
0
 def test_011_General_setting_Dashboard_Device_Management(self):
     '''设置Dashboard Setting-Device Management检查'''
     try:
         function.by_ccs(self, ReadElement.setting(self,
                                                   "settings图标")).click()
         time.sleep(1)
         self.dr.execute_script(ReadElement.setting(
             self, "Generalsettings")).click()
         time.sleep(0.5)
         self.dr.execute_script(ReadElement.setting(self, "Edit按钮")).click()
         time.sleep(1)
         self.dr.execute_script(ReadElement.setting(
             self, "选择Management仪表盘")).click()
         time.sleep(1)
         self.click(ReadElement.setting(self, "选择group仪表盘"))
         time.sleep(1)
         self.dr.execute_script(ReadElement.setting(self, "save按钮")).click()
         time.sleep(1)
         self.click(ReadElement.setting(self, "Asset下拉操作"))
         time.sleep(0.5)
         self.click_xpath(ReadElement.setting(self, "DeviceManagement"))
         self.sleep(0.5)
         self.dr.execute_script(ReadElement.setting(self,
                                                    "点击group")).click()
         self.sleep(0.5)
         self.click(ReadElement.setting(self, "点击ManagementDashboard"))
         self.sleep(2)
         self.refresh()
         self.click(ReadElement.setting(self, "点击ManagementDashboard"))
         self.sleep(1)
         self.click('.dashboard-box')
         self.sleep(1)
         self.dr.execute_script(ReadElement.setting(self, "滑动滚动条"))
         self.sleep(1)
         print(
             self.dr.execute_script(
                 ReadElement.setting(self, "断言group仪表盘最后一个的名称")))
         self.assertEqual(
             self.dr.execute_script(
                 ReadElement.setting(self, "断言group仪表盘最后一个的名称")), 'pie')
     except:
         function.save_img(self, sys._getframe().f_code.co_name)
         self.assertEqual(
             self.dr.execute_script(
                 ReadElement.setting(self, "断言group仪表盘最后一个的名称")), 'pie')
Esempio n. 5
0
 def test_1_add_device(self):
     '''新增设备成功'''
     try:
         function.by_ccs(self, ReadElement.device_ele(self,
                                                      "Asset下拉操作")).click()
         time.sleep(0.5)
         # self.dr.find_element_by_partial_link_text("Device").click()
         # print(self.dr.find_element_by_css_selector(ReadElement.device_ele(self, "点击device")).text)
         function.by_xpath(self,
                           ReadElement.device_ele(self,
                                                  "点击device")).click()
         self.dr.implicitly_wait(15)
         self.dr.find_element_by_css_selector(
             ReadElement.device_ele(self, "添加设备按钮")).click()
         time.sleep(1)
         # 通过复制JSpath定位
         self.dr.find_element_by_css_selector(
             ReadElement.device_ele(self, "点击model")).click()
         time.sleep(1)
         self.dr.find_element_by_xpath(
             ReadElement.device_ele(self, "选择TMX08model")).click()
         time.sleep(1)
         self.dr.find_element_by_css_selector(
             ReadElement.device_ele(self,
                                    "SN输入框")).send_keys("9786545356768")
         time.sleep(0.5)
         self.dr.find_element_by_css_selector(
             ReadElement.device_ele(self, "点击GROUP")).click()
         time.sleep(0.3)
         self.dr.find_element_by_css_selector(
             ReadElement.device_ele(self, "选择GROUP")).click()
         self.dr.find_element_by_css_selector(
             ReadElement.device_ele(self, "设备提交按钮")).click()
         time.sleep(1)
         # 断言是否新增成功
         tt = self.dr.find_element_by_xpath(
             ReadElement.device_ele(self, "设备列表第一个sn")).text
         self.assertEqual(tt, '9786545356768')
     except:
         sn = self.dr.find_element_by_xpath(
             ReadElement.device_ele(self, "设备列表第一个sn")).text
         print(sn)
         function.error_png(self, 'test_1_add_device')
         self.assertEqual(sn, '9786545356768')
Esempio n. 6
0
 def test_009_General_setting_Only_admin_active(self):
     '''admin用户设置GeneralSetting时仅该用户生效该设置'''
     try:
         function.by_ccs(self, ReadElement.setting(self,
                                                   "settings图标")).click()
         time.sleep(1)
         self.dr.execute_script(ReadElement.setting(
             self, "Generalsettings")).click()
         time.sleep(0.5)
         self.dr.execute_script(ReadElement.setting(self, "Edit按钮")).click()
         time.sleep(0.5)
         self.dr.execute_script(ReadElement.setting(
             self, "WeightImperial")).click()
         self.dr.implicitly_wait(10)
         time.sleep(2)
         self.dr.execute_script(ReadElement.setting(self, "save按钮")).click()
         time.sleep(0.5)
         print(
             self.dr.execute_script(
                 ReadElement.setting(self, "Weightunit单位")))
         assert self.dr.execute_script(
             ReadElement.setting(self, "Weightunit单位")) == "Imperial"
         time.sleep(0.5)
         self.click(ReadElement.setting(self, "用户登陆标识"))
         self.click(ReadElement.setting(self, "退出登陆"))
         function.login(self, ReadData.Basic_data(self, "TMXuser用户"),
                        ReadData.Basic_data(self, "TMXuser密码"))
         time.sleep(1)
         print(self.execute_script(ReadElement.setting(self, "用户登陆标识TEXT")))
         self.assertEqual(
             self.execute_script(ReadElement.setting(self, "用户登陆标识TEXT")),
             "CW")
         function.by_ccs(self, ReadElement.setting(self,
                                                   "settings图标")).click()
         time.sleep(1)
         self.dr.execute_script(ReadElement.setting(
             self, "Generalsettings")).click()
         assert self.dr.execute_script(
             ReadElement.setting(self, "Weightunit单位")) == "Metric"
     except:
         function.save_img(self, sys._getframe().f_code.co_name)
         assert self.dr.execute_script(
             ReadElement.setting(self, "Weightunit单位")) == "Metric"
Esempio n. 7
0
 def test_010_General_setting_Only_user_active(self):
     '''user用户设置GeneralSetting时仅该用户生效该设置'''
     try:
         function.by_ccs(self, ReadElement.setting(self,
                                                   "settings图标")).click()
         time.sleep(1)
         self.dr.execute_script(ReadElement.setting(
             self, "Generalsettings")).click()
         time.sleep(0.5)
         print(self.dr.execute_script(ReadElement.setting(self, "断言当前地图")))
         time.sleep(0.5)
         self.assertEqual(
             self.dr.execute_script(ReadElement.setting(self, "断言当前地图")),
             "Google Map")
         time.sleep(0.5)
         self.click(ReadElement.setting(self, "用户登陆标识"))
         self.click(ReadElement.setting(self, "退出登陆"))
         function.login(self, ReadData.Basic_data(self, "TMXuser用户"),
                        ReadData.Basic_data(self, "TMXuser密码"))
         time.sleep(1)
         print(self.execute_script(ReadElement.setting(self, "用户登陆标识TEXT")))
         self.assertEqual(
             self.execute_script(ReadElement.setting(self, "用户登陆标识TEXT")),
             "CW")
         time.sleep(1)
         function.by_ccs(self, ReadElement.setting(self,
                                                   "settings图标")).click()
         time.sleep(1)
         self.click(ReadElement.setting(self, "user用户Edit按钮"))
         time.sleep(0.5)
         self.dr.execute_script(ReadElement.setting(self,
                                                    "下拉选择MAP")).click()
         time.sleep(0.5)
         self.dr.implicitly_wait(10)
         function.by_ccs(self, ReadElement.setting(self, "选择百度地图")).click()
         self.dr.execute_script(ReadElement.setting(self, "save按钮")).click()
         time.sleep(0.5)
         print(self.dr.execute_script(ReadElement.setting(self, "断言当前地图")))
         time.sleep(0.5)
         self.assertEqual(
             self.dr.execute_script(ReadElement.setting(self, "断言当前地图")),
             "Baidu Map")
     except:
         function.save_img(self, sys._getframe().f_code.co_name)
         self.assertEqual(
             self.dr.execute_script(ReadElement.setting(self, "断言当前地图")),
             "Baidu Map")
Esempio n. 8
0
 def test_004_General_setting_timezone(self):
     '''General settings设置自动时区+重置设置'''
     try:
         function.by_ccs(self, ReadElement.setting(self,
                                                   "settings图标")).click()
         time.sleep(0.5)
         self.dr.execute_script(ReadElement.setting(
             self, "Generalsettings")).click()
         time.sleep(0.5)
         self.dr.execute_script(ReadElement.setting(self, "Edit按钮")).click()
         time.sleep(0.5)
         function.by_ccs(self, ReadElement.setting(self, "自动时区关闭")).click()
         self.dr.implicitly_wait(10)
         function.by_ccs(self, ReadElement.setting(self, "时区输入框")).click()
         time.sleep(2)
         self.dr.execute_script(ReadElement.setting(self,
                                                    "NEWYORK时区")).click()
         time.sleep(1)
         self.dr.implicitly_wait(10)
         self.dr.execute_script(ReadElement.setting(self, "save按钮")).click()
         time.sleep(0.5)
         self.dr.execute_script(ReadElement.setting(
             self, "Restore default")).click()
         time.sleep(1)
         self.assertEqual(
             function.by_ccs(self, ReadElement.setting(self,
                                                       "Restore提示语")).text,
             "Restored to company default settings")
         print("Restore提示语:" + function.by_ccs(
             self, ReadElement.setting(self, "Restore提示语")).text)
         self.assertEqual(
             function.by_ccs(self, ReadElement.setting(self,
                                                       "Time zone")).text,
             "Asia/Shanghai")
         self.assertEqual(
             function.by_ccs(self, ReadElement.setting(self, "时区点")).text,
             "GMT +08:00")
         self.dr.execute_script(ReadElement.setting(self, "Edit按钮")).click()
         self.dr.implicitly_wait(10)
         self.dr.execute_script(ReadElement.setting(self, "save按钮")).click()
         time.sleep(0.5)
     except:
         print(
             function.by_ccs(self, ReadElement.setting(self,
                                                       "Time zone")).text)
         print(function.by_ccs(self, ReadElement.setting(self, "时区点")).text)
         function.save_img(self, sys._getframe().f_code.co_name)
         self.assertEqual(
             function.by_ccs(self, ReadElement.setting(self,
                                                       "Restore提示语")).text,
             "Restored to company default settings")
         self.assertEqual(
             function.by_ccs(self, ReadElement.setting(self,
                                                       "Time zone")).text,
             "Asia/Shanghai")
         self.assertEqual(
             function.by_ccs(self, ReadElement.setting(self, "时区点")).text,
             "GMT +08:00")
Esempio n. 9
0
 def test_003_General_setting_timezone(self):
     '''General settings手动设置纽约时区,并还原自动时区'''
     try:
         function.by_ccs(self, ReadElement.setting(self,
                                                   "settings图标")).click()
         time.sleep(0.5)
         self.dr.execute_script(ReadElement.setting(
             self, "Generalsettings")).click()
         time.sleep(0.5)
         self.dr.execute_script(ReadElement.setting(self, "Edit按钮")).click()
         time.sleep(0.5)
         function.by_ccs(self, ReadElement.setting(self, "自动时区关闭")).click()
         self.dr.implicitly_wait(10)
         function.by_ccs(self, ReadElement.setting(self, "时区输入框")).click()
         time.sleep(1)
         self.dr.execute_script(ReadElement.setting(self,
                                                    "NEWYORK时区")).click()
         time.sleep(2)
         self.dr.implicitly_wait(10)
         self.dr.execute_script(ReadElement.setting(self, "save按钮")).click()
         time.sleep(1)
         self.assertEqual(
             function.by_ccs(self, ReadElement.setting(self,
                                                       "Time zone")).text,
             "America/New_York")
         self.assertEqual(
             function.by_ccs(self, ReadElement.setting(self, "时区点")).text,
             "GMT -04:00")
         self.dr.execute_script(ReadElement.setting(self, "Edit按钮")).click()
         time.sleep(0.5)
         function.by_ccs(self, ReadElement.setting(self, "自动时区开启")).click()
         self.dr.implicitly_wait(10)
         self.dr.execute_script(ReadElement.setting(self, "save按钮")).click()
         time.sleep(1)
     except:
         print(
             function.by_ccs(self, ReadElement.setting(self,
                                                       "Time zone")).text)
         print(function.by_ccs(self, ReadElement.setting(self, "时区点")).text)
         function.save_img(self, sys._getframe().f_code.co_name)
         self.assertEqual(
             function.by_ccs(self, ReadElement.setting(self,
                                                       "Time zone")).text,
             "America/New_York")
         self.assertEqual(
             function.by_ccs(self, ReadElement.setting(self, "时区点")).text,
             "GMT -04:00")