Пример #1
0
    def test_4yestoday(cls):
        '''查询系统昨日数据'''
        driver = cls.driver
        test = BaseAction(driver)
        # 点击条件选择
        test.Click("xpath", "//*[@id='_R201414']//span[1]/span[2]")
        # 点击时间选择
        test.Click("xpath", "//*[@id='_R201414']//tr[1]/td[6]//div[2]/div")
        # 选中昨天
        test.Click("xpath", "//*[@id='_R201414']//tr[1]/td[6]//div[2]/li[1]")
        # 点击提交按钮
        test.Click("xpath", "//*[@id='_R201414']//div[1]//tr[2]//input")
        test.Wait(3)
        # 滚动到底部
        test.scrollLow("id", "inputPageText201414")  # 滑动到页面底部
        test.Wait(3)
        # 获取分页数据
        cls.switch_page()
        log.info("查询昨日数据,保存到excel")
        # 获取系统中的总计里程和时长
        excel1 = "F:\\PyTesting\\AutoTest\\log\\excel\\Mile.xls"
        excel = Excel(excel1, 0)
        row = excel.get_rows()
        col = excel.get_cols()
        sum_time = excel.get_cell_value(row - 1, col - 4)
        sum_mile = excel.get_cell_value(row - 1, col - 3)
        print("行驶总时间:", float(sum_time.split('秒')[0]))
        print("行驶总里程:", sum_mile)
        log.info("获取里程时间数据")

        # 获取数据库中的总计里程和时长
        excel2 = "F:\\PyTesting\\AutoTest\\log\\excel\\Mile_Y_DB.xlsx"
        excel_db = Excel(excel2, 0)
        row1 = excel_db.get_rows()
        col1 = excel_db.get_cols()
        sum_mile1 = 0.0
        sum_time1 = 0.0
        for x in range(1, row1):
            sum_time1 = float(excel_db.get_cell_value(row1 - x, 4)) + sum_time1
            sum_mile1 = float(excel_db.get_cell_value(row1 - x, 5)) + sum_mile1
        print("数据库中行驶总时间:", sum_time1)
        print("数据库中行驶总里程:", sum_mile1)
        log.info("获取数据库中里程时间数据")
        sum_time1 == sum_time and sum_mile1 == sum_mile
        try:
            sum_time1 == sum_time and sum_mile1 == sum_mile
            log.info("数据查询成功!")
        except AssertionError as e:
            log.info("数据查询失败,页面数据和系统数据不一致!")
            raise
        log.info("验证数据")
Пример #2
0
 def test_4getdata(cls):
     '''跳转到报表查询界面,获取页面数据'''
     driver = cls.driver
     test = BaseAction(driver)
     test.Click("id", "gps_toolbar_leftbutton_div_w")
     test.Click("id", "gps_main_menu_report_s_p")
     test.wait(5)
     test.Click("id", "id202694")
     test.wait(5)
     cls.switch_page()
Пример #3
0
 def test_2skip(cls):
     '''跳转到报表查询界面'''
     driver = cls.driver
     test = BaseAction(driver)
     test.Click("id", "gps_toolbar_leftbutton_div_w")
     # 点击报表查询按钮
     test.Click("id", "gps_main_menu_report_s_p")
     test.wait(5)
     # 点击单车里程油耗报表按钮
     test.Click("id", "id401010")
     test.wait(5)
Пример #4
0
 def test_2skip(cls):
     '''跳转到报表查询界面'''
     driver = cls.driver
     test = BaseAction(driver)
     test.Click("id", "gps_toolbar_leftbutton_div_w")
     test.Click("id", "gps_main_menu_report_s_p")
     time.sleep(3)
     test.Click("id", "id410001")
     time.sleep(3)
     test.get_windows_img('跳转成功')
     report_name = test.Get_text("xpath",
                                 "//*[@id='rnavigation']/li[2]/span[2]")
     try:
         cls.assertEqual(report_name, 'SIM卡到期统计')
     except AssertionError as e:
         print("找不到报表标题:", report_name)
         raise
Пример #5
0
 def test_4today(cls):
     '''查询系统今日数据'''
     driver = cls.driver
     test = BaseAction(driver)
     test.Click("xpath",
                "//*[@id='platCheck_searchHeader']//td[1]/span[2]/span")
     test.Click("id", "EasierUI_SELECT_platCheck_container1")
     test.Click("xpath",
                "//*[@id='EasierUI_SELECT_platCheck_container1']//li[1]")
     test.Click("id", "platCheck_submit")
     log.info("查询今日数据")
     test.wait(5)
     cls.switch_page()
     log.info("验证数据")
     excel = "F:\\PyTesting\\AutoTest\\log\\excel\\Plat_Query.xls"
     excel1 = "F:\\PyTesting\\AutoTest\\log\\excel\\Plat_T_DB.xlsx"
     try:
         cls.assertTrue(
             test_read_excel(3, excel, excel1, "Plat_T_Result.xlsx"))
         log.info("数据查询成功!")
     except AssertionError as e:
         log.info("数据查询失败,页面数据和系统数据不一致!")
         raise
     test.wait(10)
Пример #6
0
 def test_4today(cls):
     '''查询今日数据'''
     driver = cls.driver
     test = BaseAction(driver)
     test.Click("xpath",
                "//*[@id='warnData_searchHeader']/table/tbody/tr/td[1]")
     test.Click("id", "EasierUI_SELECT_warnData_container2")
     test.Click(
         "xpath",
         "//*[@id='EasierUI_SELECT_warnData_container2']/ul/li[1]/a")
     test.Click("id", "staticData_submit")
     log.info("查询今日数据")
     test.wait(5)
     cls.switch_page()
     log.info("验证数据")
     excel = "F:\\PyTesting\\AutoTest\\log\\excel\\History_TARG.xls"
     excel1 = "F:\\PyTesting\\AutoTest\\log\\excel\\History_Today_DB.xlsx"
     try:
         cls.assertTrue(
             test_read_excel(0, excel, excel1, "Today_Result.xlsx"))
         print("数据查询成功!")
     except AssertionError as e:
         log.info("数据查询失败,页面数据和系统数据不一致!")
         raise
Пример #7
0
 def test_2skip(cls):
     '''跳转到报表查询界面'''
     driver = cls.driver
     test = BaseAction(driver)
     test.Click("id", "gps_toolbar_leftbutton_div_w")
     test.Click("id", "gps_main_menu_report_s_p")
     time.sleep(2)  # 等待元素加载
     test.Click("id", "id201286")
     time.sleep(2)
     report_name = test.Get_text("xpath",
                                 "//*[@id='rnavigation']/li[2]/span[2]")
     try:
         cls.assertEqual(report_name, '报警类型统计')
         print("页面跳转成功!")
     except AssertionError as e:
         print("跳转失败,找不到报表标题:", report_name)
         raise
Пример #8
0
 def test_4select(cls):
     '''查询当前公司的SIM信息'''
     driver = cls.driver
     test = BaseAction(driver)
     test.Click("xpath", "//*[@id='simExpireData_searchHeader']//span[1]")
     time.sleep(2)
     test.Click("id", "deptName")
     time.sleep(2)
     test.Click("id", "treeDemo_1_span")
     time.sleep(2)
     test.Click("id", "simExpireData_submit")
     time.sleep(2)
     cls.switch_page()
     log.info("获取当前公司下的SIM信息")
     excel = "F:\\PyTesting\\AutoTest\\log\\excel\\Sim.xls"
     excel1 = "F:\\PyTesting\\AutoTest\\log\\excel\\Sim_DB.xlsx"
     try:
         cls.assertTrue(test_read_excel(1, excel, excel1,
                                        "Sim_Result.xlsx"))
         print("数据查询成功!")
     except AssertionError as e:
         log.info("数据查询失败,页面数据和系统数据不一致!")
         raise
Пример #9
0
 def test_3select(cls):
     '''选择查询车辆和时间'''
     driver = cls.driver
     test = BaseAction(driver)
     # 点击搜索框
     test.Click("xpath", "//*[@id='oil_radio_tree_content']/div[1]/input")
     # 输入要查询的车辆车牌号信息
     test.Input("xpath", "//*[@id='oil_radio_tree_content']/div[1]/input", "济宁00001")
     # 点击查询按钮
     test.Click("xpath", "//*[@id='oil_radio_tree_content']/div[1]/a")
     test.Wait(3)
     # 选中要查询的车辆
     test.Click("xpath",
                "//*[@class='checkboxcontent']/span[@id='20180131171228000000000000008188-jquery-extend-ui-radio']/span[2]")
     # 点击返回框
     test.wait(3)
     test.Click("xpath", "//*[@id='oil_radio_tree_content']/div[4]")
     # 点击下一步
     test.wait(2)
     test.Click("xpath", "//*[@id='tyre_next_setting']")
     report_name = test.Get_text("xpath", "//*[@id='rnavigation']/li[2]/span[2]")
     try:
         cls.assertEqual(report_name, '单车行驶里程及油耗报表')
         log.info("跳转到单车行驶里程及油耗报表查询界面")
     except AssertionError as e:
         test.get_windows_img('单车行驶里程及油耗报表')
         print("找不到报表标题:", report_name)
         raise
     test.scrollLow("id", "turnPageButton")  # 滑动到页面底部
     test.Wait(2)
     cls.switch_page()
Пример #10
0
 def test_2skip(cls):
     '''跳转到报表查询界面'''
     driver = cls.driver
     test = BaseAction(driver)
     test.Click("id", "gps_toolbar_leftbutton_div_w")
     test.Click("id", "gps_main_menu_report_s_p")
     test.wait(5)
     test.Click("id", "id401013")
     test.wait(5)
     test.get_windows_img('查岗报表跳转成功')
     report_name = test.Get_text("xpath",
                                 "//*[@class='main_table']//li[2]/span[2]")
     try:
         cls.assertEqual(report_name, '平台查岗报表')
         log.info("跳转到查岗报表查询界面")
     except AssertionError as e:
         print("找不到报表标题:", report_name)
         raise
Пример #11
0
 def test_2skip(cls):
     '''跳转到报表查询界面'''
     driver = cls.driver
     test = BaseAction(driver)
     test.Click("id", "gps_toolbar_leftbutton_div_w")
     test.Click("id", "gps_main_menu_report_s_p")
     test.wait(5)
     test.Click("id", "id201414")
     test.wait(5)
     report_name = test.Get_text("xpath", "//*[@id='rnavigation']/li[2]/span[2]")
     try:
         cls.assertEqual(report_name, '车辆行驶里程及油耗报表')
         log.info("跳转到车辆里程油耗报表查询界面")
     except AssertionError as e:
         test.get_windows_img('车辆里程油耗报表跳转')
         print("找不到报表标题:", report_name)
         raise
Пример #12
0
    def test_3getdata(cls):
        '''跳转到报表查询界面,获取页面数据'''
        driver = cls.driver
        test = BaseAction(driver)
        # 点击条件选择
        test.Click("xpath",
                   "//*[@id='comptrollerData_searchHeader']//td[1]/span[2]")
        test.Wait(1)
        # 输入要查询的用户
        test.Input("id", "userName", "baoyong123")
        # 点击开始时间控件
        test.Click("xpath", "//*[@id='dataStartTime']")
        test.Wait(1)
        # 执行js,使时间控件可读
        js = 'document.getElementById("dataStartTime").removeAttribute("readonly")'
        js1 = 'document.getElementById("dataEndTime").removeAttribute("readonly")'
        test.Excecute_Script(js)
        test.Excecute_Script(js1)
        # 输入查询开始和结束时间
        test.Input("id", "dataStartTime", t_date2)
        # 点击结束时间控件
        test.Click("xpath", "//*[@id='dataEndTime']")
        test.Input("id", "dataEndTime", t_date1)

        # js_begin = 'document.getElementById("dataStartTime").value="2018-08-20"'
        # js_end = 'document.getElementById("dataEndTime").value="2018-08-27"'
        # test.Excecute_Script(js_begin)
        # test.Excecute_Script(js_end)
        test.Click("id", "comptrollerData_submit")
        log.info("提交")
        test.Wait(3)
        cls.switch_page()
Пример #13
0
 def __init__(self, driver):
     BaseAction.__init__(self, driver)