Exemplo n.º 1
0
 def setUpClass(self):  # 每个用例执行之前执行
     print('开始执行用例')
     self.dr = webdriver.Chrome()
     self.dr.get('http://10.10.16.213/#/login')
     self.dr.implicitly_wait(15)
     # cls.dr.implicitly_wait(10)  # 在规定时间会自动搜索,超出时间,抛出异常(消耗时间是固定的)
     # 当使用了隐性等待执行测试的时候,如果 WebDriver没有在 DOM中找到元素,将继续等待,超出设定时间后则抛出找不到元素的异常
     # 相当于设置全局的等待,在定位元素时,对所有元素设置超时时间。隐式等待是等页面加载,而不是元素加载!!!(隐式等待就是针对页面的,显式等待是针对元素的。)
     self.dr.maximize_window()
     time.sleep(2)
     # 调用function.login方法’
     try:
         function.login(self, user_name="admin", password="******")
         time.sleep(1)
         # 断言是否登录成功
         print(
             self.dr.find_element_by_xpath(
                 ReadElement.Portal_ele(self, "Asset定位")).text)
     except:
         print("登录失败")
         # 截图
         function.error_png(self, 'test_1_login')
         self.assertEqual(
             self.dr.find_element_by_xpath(
                 ReadElement.Portal_ele(self, "Asset定位")).text, "Asset")
Exemplo n.º 2
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"
Exemplo n.º 3
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")
Exemplo n.º 4
0
 def test_007_General_setting_Weightunit(self):
     '''General settings设置Weight unit为Imperial'''
     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)
         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)
         self.assertEqual(
             self.dr.execute_script(
                 ReadElement.setting(self, "Weightunit单位")), "Imperial")
     except:
         function.save_img(self, sys._getframe().f_code.co_name)
         assert self.dr.execute_script(
             ReadElement.setting(self, "Weightunit单位")) == "Imperial"
Exemplo n.º 5
0
 def test_2_login_fail(self, user_name, password):
     '''输入正确的用户名,错误的密码,登陆失败'''
     try:
         function.login(self, user_name, password)
         time.sleep(3)
         # 断言是否登录成功
         tt = self.dr.find_element_by_css_selector(
             ReadElement.Portal_ele(self, "Welcome标志定位")).text
         print(tt)
         self.assertEqual(tt, "WELCOME")
         cc = self.dr.find_element_by_xpath(
             '/html/body/div[3]/div/div/div[1]/div/span').text
         print(cc)
     except:
         tt = self.dr.find_element_by_css_selector(
             ReadElement.Portal_ele(self, "Welcome标志定位")).text
         print(tt)
         # 截图
         function.error_png(self, 'test_2_login_fail')
         self.assertEqual(tt, "WELCOME")
Exemplo n.º 6
0
 def test_1_login(self):
     '''输入正确的用户名,密码,登陆成功'''
     # function.open_tmx(self)
     # self.dr = self.driver
     try:
         function.login(self, ReadData.Basic_data(self, "TMX用户名"),
                        ReadData.Basic_data(self, "TMX密码"))
         time.sleep(1)
         # 断言是否登录成功
         self.assertEqual(
             self.dr.find_element_by_xpath(
                 ReadElement.Portal_ele(self, "Asset定位")).text, "Asset")
         print("登录成功")
     except:
         print("登录失败")
         # 截图
         function.error_png(self, 'test_1_login')
         self.assertEqual(
             self.dr.find_element_by_xpath(
                 ReadElement.Portal_ele(self, "Asset定位")).text, "Asset")
Exemplo n.º 7
0
 def test_3_query_device(self):
     '''查询设备'''
     try:
         self.dr.find_element_by_css_selector(
             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)
         self.dr.find_element_by_xpath(
             ReadElement.device_ele(self, "点击device")).click()
         self.dr.implicitly_wait(15)
         self.dr.find_element_by_xpath(
             ReadElement.device_ele(
                 self, "devicelist输入框")).send_keys("9786545356768")
         time.sleep(1)
         self.dr.find_element_by_css_selector(
             ReadElement.device_ele(self, "查询按钮")).click()
         time.sleep(2)
     except:
         print(
             self.dr.find_element_by_css_selector(
                 ReadElement.device_ele(self, "设备个数")).text)
         function.error_png(self, sys._getframe().f_code.co_name)
         self.assertEqual(
             self.dr.find_element_by_css_selector(
                 ReadElement.device_ele(self, "设备个数")).text, "Total 1 item")
Exemplo n.º 8
0
    def test_2_query_device(self):
        try:
            self.dr.find_element_by_css_selector(
                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)
            self.dr.find_element_by_xpath(
                ReadElement.device_ele(self, "点击device")).click()
            self.dr.implicitly_wait(15)
            self.dr.find_element_by_xpath(
                ReadElement.device_ele(
                    self, "devicelist输入框")).send_keys("9786545356768")
            time.sleep(1)
            self.dr.find_element_by_css_selector(
                ReadElement.device_ele(self, "查询按钮")).click()
            time.sleep(0.5)
            print(self.dr.find_element_by_css_selector(".ivu-page-total").text)
            self.assertEqual(
                self.dr.find_element_by_css_selector(".ivu-page-total").text,
                "Total 1 item")

        except:
            print(
                self.dr.find_element_by_css_selector(
                    ReadElement.device_ele(self, "设备个数")).text)
            function.error_png(self, 'test_2_query_device')
            self.assertEqual(
                self.dr.find_element_by_css_selector(
                    ReadElement.device_ele(self, "设备个数")).text, "Total 1 item")
Exemplo n.º 9
0
    def test_3_ForgetPassword(self):
        '''用户名忘记密码'''

        try:
            self.dr.find_element_by_partial_link_text(
                ReadElement.Portal_ele(self, "忘记密码")).click()
            time.sleep(2)
            # tt=self.dr.find_element_by_css_selector(self,ReadElement.Portal_ele(self,"忘记密码Tip")).text
            # print(tt)
            self.assertEqual(
                self.dr.find_element_by_css_selector(
                    ReadElement.Portal_ele(self, "忘记密码Tip")).text, "Tip")
            time.sleep(0.5)
            # class组合属性定位class中有空格用点“.”表示
            # self.dr.find_element_by_xpath("/html/body/div[3]/div[2]/div/div/div/div/div[3]/button").click()
            self.dr.find_element_by_css_selector(
                ReadElement.Portal_ele(self, "忘记密码确认按钮")).click()
        except:
            # 截图
            function.error_png(self, ' test_7_ForgetPassword')
            self.assertEqual(
                self.dr.find_element_by_css_selector(
                    ReadElement.Portal_ele(self, "忘记密码确认按钮")).text, "OK")
Exemplo n.º 10
0
 def test_4_conditions(self):
     '''点击terms&conditions链接'''
     try:
         self.dr.find_element_by_xpath(
             ReadElement.Portal_ele(self, "conditions链接")).click()
         # self.dr.find_element_by_partial_link_text(ReadElement.Portal_ele(self,"conditions链接")).click()
         time.sleep(2)
         all = self.dr.window_handles
         # 切换到conditions页面用dr.switch_to.window不要用dr.switch_to_window
         # self.dr.switch_to_window(all[-1])
         self.dr.switch_to.window(all[-1])
         print('terms&conditions链接title:' + self.dr.title)
         # 断言
         # self.assertEqual(
         #     self.dr.title, "ThingsMatrix - Terms & Conditions")
     except:
         # 截图
         function.error_png(self, 'test_8_conditions')
         self.assertEqual(self.dr.title,
                          "ThingsMatrix - Terms & Conditions")
Exemplo n.º 11
0
    def test_5_Privacy(self):
        '''点击Privacy链接'''
        try:
            self.dr.find_element_by_partial_link_text(
                ReadElement.Portal_ele(self, "Privacy链接")).click()
            # self.dr.find_element_by_partial_link_text(ReadElement.Portal_ele(self,"conditions链接")).click()
            time.sleep(2)
            all = self.dr.window_handles

            # 切换到conditions页面用dr.switch_to.window不要用dr.switch_to_window
            self.dr.switch_to.window(all[-1])
            print(self.dr.title)
            time.sleep(2)

            # 断言
            self.assertEqual(self.dr.title, "ThingsMatrix - Privacy Policy")
        except:
            # 截图
            function.error_png(self, 'test_9_Privacy')
            self.assertEqual(self.dr.title, "ThingsMatrix - Privacy Policy")
Exemplo n.º 12
0
 def test_2_add_device(self):
     '''新增设备,列表已经存在的sn失败'''
     try:
         self.dr.find_element_by_css_selector(
             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)
         self.dr.find_element_by_xpath(
             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')
         S = self.dr.find_element_by_css_selector(
             ReadElement.device_ele(self, "新增设备SN重复提示")).text
         print(S)
         self.assertEqual(S, '10022:[sn] already exist,Please re-enter')
     except:
         sn = self.dr.find_element_by_xpath(
             ReadElement.device_ele(self, "设备列表第一个sn")).text
         print(sn)
         function.error_png(self, sys._getframe().f_code.co_name)
         print(
             self.dr.find_element_by_css_selector(
                 ReadElement.device_ele(self, "新增设备SN重复提示")).text)
         self.assertEqual(
             self.dr.find_element_by_css_selector(
                 ReadElement.device_ele(self, "新增设备SN重复提示")).text,
             '10022:[sn] already exist,Please re-enter')
         self.assertEqual(sn, '9786545356768')
Exemplo n.º 13
0
 def test_7_modify_device(self):
     '''刷新设备列表,并修改设备'''
     try:
         self.dr.find_element_by_css_selector(
             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)
         self.dr.find_element_by_xpath(
             ReadElement.device_ele(self, "点击device")).click()
         self.dr.implicitly_wait(15)
         time.sleep(1)
         self.dr.find_element_by_css_selector(
             ReadElement.device_ele(self, "设备列表刷新按钮")).click()
         time.sleep(1)
         self.dr.find_element_by_xpath(
             ReadElement.device_ele(
                 self, "devicelist输入框")).send_keys("9786545356768")
         time.sleep(1)
         self.dr.find_element_by_css_selector(
             ReadElement.device_ele(self, "查询按钮")).click()
         time.sleep(0.5)
         self.dr.find_element_by_xpath(
             ReadElement.device_ele(self, "设备列表第一个sn")).click()
         time.sleep(1)
         self.dr.find_element_by_xpath(
             ReadElement.device_ele(self, "设备列表修改按钮")).click()
         time.sleep(2)
         self.dr.execute_script(ReadElement.device_ele(self,
                                                       "Sim输入框")).clear()
         self.dr.execute_script(ReadElement.device_ele(
             self, "Sim输入框")).send_keys("888888888")
         time.sleep(1)
         self.dr.find_element_by_css_selector(
             ReadElement.device_ele(
                 self, "Description输入框")).send_keys("888888888")
         self.dr.find_element_by_xpath(ReadElement.device_ele(
             self, "提交按钮")).click()
         time.sleep(1)
         self.assertEqual(
             self.dr.find_element_by_css_selector(
                 ReadElement.device_ele(self, "Sim字段")).text, "888888888")
     except:
         function.error_png(self, sys._getframe().f_code.co_name)
         self.assertEqual(
             self.dr.find_element_by_css_selector(
                 ReadElement.device_ele(self, "Sim字段")).text, "888888888")
Exemplo n.º 14
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')
Exemplo n.º 15
0
    def test_4_screen_model(self):
        '''通过model筛选设备,并关闭筛选'''
        try:
            self.dr.find_element_by_css_selector(
                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)
            self.dr.find_element_by_xpath(
                ReadElement.device_ele(self, "点击device")).click()
            self.dr.implicitly_wait(15)
            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, "选择设备类型")).click()
            time.sleep(2)
            print(
                self.dr.find_element_by_css_selector(
                    ReadElement.device_ele(self, "断言设备类型")).text)
            self.assertEqual(
                self.dr.find_element_by_css_selector(
                    ReadElement.device_ele(self, "断言设备类型")).text, "TMX09")
        except:
            print(
                self.dr.find_element_by_css_selector(
                    ReadElement.device_ele(self, "断言设备类型")).text)
            function.error_png(self, 'test_3_screen_model')
            self.assertEqual(
                self.dr.find_element_by_css_selector(
                    ReadElement.device_ele(self, "断言设备类型")).text,
                ReadData.Basic_data(self, "断言设备类型"))
        try:
            self.dr.find_element_by_css_selector(
                ReadElement.device_ele(self, "再次点击筛选Model")).click()
            time.sleep(2)
            self.dr.find_element_by_css_selector(
                ReadElement.device_ele(self, "关闭筛选Model")).click()
            # self.dr.find_element_by_xpath(ReadElement.device_ele(self, "关闭筛选Model")).click()
            time.sleep(2)
            self.assertEqual(
                self.dr.find_element_by_css_selector(
                    ReadElement.device_ele(self, "下拉筛选Model")).text, "Model")
        except:

            print(
                self.dr.find_element_by_css_selector(
                    ReadElement.device_ele(self, "下拉筛选Model")).text)
            function.error_png(self, sys._getframe().f_code.co_name)
            self.assertEqual(
                self.dr.find_element_by_css_selector(
                    ReadElement.device_ele(self, "下拉筛选Model")).text, "Model")
Exemplo n.º 16
0
    def test_5_screen_group(self):
        '''通过group筛选设备,并关闭筛选'''
        try:
            self.dr.find_element_by_css_selector(
                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)
            self.dr.find_element_by_xpath(
                ReadElement.device_ele(self, "点击device")).click()
            self.dr.implicitly_wait(15)
            self.dr.find_element_by_css_selector(
                ReadElement.device_ele(self, "下拉筛选group")).click()
            time.sleep(2)
            self.dr.find_element_by_xpath(
                ReadElement.device_ele(self, "选择group类型")).click()
            time.sleep(2)
            print(
                self.dr.find_element_by_css_selector(
                    ReadElement.device_ele(self, "断言group类型")).text)
            self.assertEqual(
                self.dr.find_element_by_css_selector(
                    ReadElement.device_ele(self, "断言group类型")).text,
                ReadData.Basic_data(self, "断言group类型"))
        except:
            print(
                self.dr.find_element_by_css_selector(
                    ReadElement.device_ele(self, "断言group类型")).text + "fail")
            function.error_png(self, sys._getframe().f_code.co_name)
            self.assertEqual(
                self.dr.find_element_by_css_selector(
                    ReadElement.device_ele(self, "断言group类型")).text,
                ReadData.Basic_data(self, "断言group类型"))
        try:
            self.dr.find_element_by_css_selector(
                ReadElement.device_ele(self, "再次点击筛选group")).click()
            time.sleep(2)
            self.dr.find_element_by_css_selector(
                ReadElement.device_ele(self, "关闭筛选group")).click()
            # self.dr.find_element_by_xpath(ReadElement.device_ele(self, "关闭筛选Model")).click()
            time.sleep(2)
            self.assertEqual(
                self.dr.find_element_by_css_selector(
                    ReadElement.device_ele(self, "下拉筛选group")).text, "Group")
        except:

            print(
                self.dr.find_element_by_css_selector(
                    ReadElement.device_ele(self, "下拉筛选group")).text)
            #函数内部获取当前函数名称,用sys._getframe().f_code.co_name方法获取
            function.error_png(self, sys._getframe().f_code.co_name)
            self.assertEqual(
                self.dr.find_element_by_css_selector(
                    ReadElement.device_ele(self, "下拉筛选group")).text, "Group")
Exemplo n.º 17
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")
Exemplo n.º 18
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")
Exemplo n.º 19
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')
Exemplo n.º 20
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")
Exemplo n.º 21
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"