Ejemplo n.º 1
0
 def cancel_endcall(self):
     self.end_call()
     ObjectMap.getElement(self.driver, 'id',
                          pp.getOptionValue('通话界面', '取消挂断')).click()
Ejemplo n.º 2
0
 def leave_meeting(self):
     self.end_call()
     ObjectMap.getElement(self.driver, 'id',
                          pp.getOptionValue('通话界面', '离开会议')).click()
Ejemplo n.º 3
0
 def end_meeting(self):
     self.end_call()
     # ObjectMap.getElement(self.driver,'id',pp.getOptionValue('通话界面','挂断')).click()
     ObjectMap.getElement(self.driver, 'id',
                          pp.getOptionValue('通话界面', '结束会议')).click()
Ejemplo n.º 4
0
    def login_Cloud(self, username, pwd, server):

        ObjectMap.getElement(self.driver, "id",
                             self.pp.getOptionValue('启动页选项',
                                                    'Cloud服务器')).click()
        #点击账号登录页签
        ObjectMap.getElement(self.driver, "xpath",
                             self.pp.getOptionValue('Cloud_Account',
                                                    '账号登录')).click()
        #输入账号信息
        ObjectMap.getElement(self.driver, "id",
                             self.pp.getOptionValue('Cloud_Account',
                                                    '账号')).send_keys(username)
        ObjectMap.getElement(self.driver, "id",
                             self.pp.getOptionValue('Cloud_Account',
                                                    '密码')).send_keys(pwd)
        ObjectMap.getElement(self.driver, "id",
                             self.pp.getOptionValue('Cloud_Account',
                                                    '服务器')).send_keys(server)
        ObjectMap.getElement(self.driver, "id",
                             self.pp.getOptionValue('YMS_Account',
                                                    '登录')).click()
Ejemplo n.º 5
0
    def login_YMS(self, username, pwd, server, outbound):
        ObjectMap.getElement(self.driver, "id",
                             self.pp.getOptionValue('启动页选项',
                                                    'YMS服务器')).click()
        #输入账号信息
        ObjectMap.getElement(self.driver, "id",
                             self.pp.getOptionValue('YMS_Account',
                                                    '账号')).send_keys(username)
        ObjectMap.getElement(self.driver, "id",
                             self.pp.getOptionValue('YMS_Account',
                                                    '密码')).send_keys(pwd)
        ObjectMap.getElement(self.driver, "id",
                             self.pp.getOptionValue('YMS_Account',
                                                    '服务器')).send_keys(server)

        #判断Outbound是否为空,不为空时如果Outbound编辑框超时,点击高级设置,展开Outbound编辑框

        try:
            ObjectMap.getElement(
                self.driver, "id",
                self.pp.getOptionValue('YMS_Account',
                                       'outbound')).send_keys(outbound)
        except Exception as e:
            # print(e)
            ObjectMap.getElement(self.driver, "id",
                                 self.pp.getOptionValue('YMS_Account',
                                                        '高级设置')).click()
            obj = ObjectMap.getElement(
                self.driver, "id",
                self.pp.getOptionValue('YMS_Account', 'outbound'))
            if outbound != ' ':
                obj.send_keys(outbound)
            else:
                obj.clear()
        #点击登录
        ObjectMap.getElement(self.driver, "id",
                             self.pp.getOptionValue('YMS_Account',
                                                    '登录')).click()
Ejemplo n.º 6
0
def execute_test_cases(test_data_file_path):
    clear_all_executed_info(test_data_file_path)
    test_data_wb = ParseExcel(test_data_file_path)
    test_data_wb.set_sheet_by_name(test_case_sheet)
    col_cells = test_data_wb.get_col(test_case_is_executed_col_no)
    success_step_num = 0
    for id, i in enumerate(range(1, len(col_cells))):
        print(id + 2, col_cells[i].value)
        if col_cells[i].value.lower() == "y":
            test_step_sheet = test_data_wb.get_cell_value(id + 2, 3)
            print(test_step_sheet)
            test_data_wb.set_sheet_by_name(test_step_sheet)
            max_step_row_no = test_data_wb.get_max_row()
            for i in range(2, max_step_row_no + 1):
                step_row = test_data_wb.get_row(i)
                action = step_row[test_step_action_col_no - 1].value
                locate_method = step_row[test_step_locate_type_col_no -
                                         1].value
                locate_expression = step_row[test_step_locate_expression_col_no
                                             - 1].value
                if action: action = action.strip()
                if locate_method: locate_method = locate_method.strip()
                if locate_expression:
                    locate_expression = locate_expression.strip()
                if locate_expression is not None and "Page." in locate_expression:
                    locate_method, locate_expression = ObjectMap(
                        object_map_file_path
                    ).get_locatemethod_and_locateexpression(
                        locate_method, locate_expression)
                value = step_row[test_step_value_col_no - 1].value
                print(action, locate_method, locate_expression, value)
                #eval("open_browser('ie')")
                if  action is not None and locate_method is None \
                        and locate_expression is None and value is not None:
                    command = "%s('%s')" % (action, value)
                elif action is not None and locate_method is not None \
                        and locate_expression is not None and value is not None:
                    command = "%s('%s','%s','%s')" % (action, locate_method,
                                                      locate_expression, value)
                elif action is not None and locate_method is not None \
                     and locate_expression is not None and value is None:
                    command = "%s('%s','%s')" % (action, locate_method,
                                                 locate_expression)
                elif action is not None and locate_method is None \
                     and locate_expression is None and value is None:
                    command = "%s()" % (action)
                print(command)
                try:
                    return_value = eval(command)
                    test_data_wb.write_cell(i,
                                            test_step_executed_result_col_no,
                                            "pass")
                    success_step_num += 1
                    if "capture_pic" in command:
                        test_data_wb.write_cell(
                            i, test_step_executed_capture_pic_path_col_no,
                            return_value)
                except AssertionError as e:
                    info(command + "\n" + "断言失败:\n" + traceback.format_exc())
                    test_data_wb.write_cell(i,
                                            test_step_executed_result_col_no,
                                            "fail")
                    pic_path = capture_pic()
                    test_data_wb.write_cell(
                        i, test_step_executed_capture_pic_path_col_no,
                        pic_path)
                    test_data_wb.write_cell(
                        i, test_step_executed_exception_info_col_no,
                        traceback.format_exc())

                except Exception as e:
                    capture_pic()
                    info(command + "\n" + e + "\n" + traceback.format_exc())
                    test_data_wb.write_cell(i,
                                            test_step_executed_result_col_no,
                                            "fail")
                    test_data_wb.write_cell(
                        i, test_step_executed_capture_pic_path_col_no,
                        pic_path)
                    test_data_wb.write_cell(
                        i, test_step_executed_exception_info_col_no,
                        traceback.format_exc())
                test_data_wb.write_cell(i, test_step_executed_time_col_no,
                                        get_current_datetime())
            if success_step_num == max_step_row_no - 1:
                test_data_wb.set_sheet_by_name(test_case_sheet)
                test_data_wb.write_cell(id + 2,
                                        test_case_executed_result_col_no,
                                        "pass")
            else:
                test_data_wb.set_sheet_by_name(test_case_sheet)
                test_data_wb.write_cell(id + 2,
                                        test_case_executed_result_col_no,
                                        "fail")
            test_data_wb.write_cell(id + 2, test_case_executed_time_col_no,
                                    get_current_datetime())