예제 #1
0
    def __init__(self, driver):
        self.login_button_locator = None
        self.user_name_locator = None
        self.password_locator = None
        self.long_task_locator = None

        BasePage.__init__(self, driver)
        self.driver = driver
        if self.is_run_ios():
            self.xml_file = __file__[:__file__.rfind(".")] + "IOS.xml"
        else:
            self.xml_file = __file__[:__file__.rfind(".")] + "Android.xml"

        try:
            self.initial_element()
        except ParseXmlErrorException:
            screenshot_file = GlobalVar.get_case_name() + "_" + str(
                time.time()) + "_screenshot.png"
            self.driver.save_screenshot(GlobalVar.get_screenshot_path() +
                                        screenshot_file)
            print("错误截图:")
            print('<img src="' + GlobalVar.get_screenshot_path() +
                  screenshot_file + '" width="800px" />')
            run_info_log(u'XML解析失败.', GlobalVar.get_log_file())
            raise
    def __init__(self, driver):
        self.inner_locator = None
        self.outside_locator = None
        self.back_locator = None
        self.complete_btn_locator = None

        BasePage.__init__(self, driver, __file__)
        self.driver = driver
        if self.is_run_ios():
            self.xml_file = __file__[:__file__.rfind(".")] + "IOS.xml"
        else:
            self.xml_file = __file__[:__file__.rfind(".")] + "Android.xml"

        try:
            self.initial_element()
        except Exception:
            screenshot_file = GlobalVar.get_case_name() + "_" + str(
                time.time()) + "_screenshot.png"
            self.driver.save_screenshot(GlobalVar.get_screenshot_path() +
                                        screenshot_file)
            print("错误截图:")
            print('<img src="' + GlobalVar.get_screenshot_path() +
                  screenshot_file + '" width="800px" />')
            run_info_log(u'XML解析失败.', GlobalVar.get_log_file())
            raise
예제 #3
0
    def __init__(self, driver):
        BasePage.__init__(self, driver, __file__)
        self.driver = driver
        self.supplier_locator = None
        self.needs_locator = None
        self.needs_unit_locator = None
        self.invoice_number_locator = None
        self.destination_locator = None
        self.ship_date_locator = None
        self.upload_file_locator = None
        self.confirm_locator = None
        self.upDelivery_order_locator = None
        self.completeBtn_locator = None
        self.confirm_time_locator = None

        if self.is_run_ios():
            self.xml_file = __file__[:__file__.rfind(".")] + "IOS.xml"
        else:
            self.xml_file = __file__[:__file__.rfind(".")] + "Android.xml"

        try:
            self.initial_element()
        except Exception:
            screenshot_file = GlobalVarClass.get_case_name() + "_" + str(
                time.time()) + "_screenshot.png"
            self.driver.save_screenshot(GlobalVarClass.get_screenshot_path() +
                                        screenshot_file)
            print("错误截图:")
            print('<img src="' + GlobalVarClass.get_screenshot_path() +
                  screenshot_file + '" width="800px" />')
            run_info_log(u'XML解析失败.', GlobalVarClass.get_log_file())
            raise
예제 #4
0
    def __init__(self, driver):
        BasePage.__init__(self, driver, __file__)
        self.driver = driver
        self.purchase_order_locator = None
        self.supplier_locator = None
        self.needs_locator = None
        self.purchase_goods_locator = None
        self.choose_goods_locator = None
        self.add_goodsBtn_locator = None
        self.confirm_goods_locator = None
        self.address_locator = None
        self.detail_address_locator = None
        self.confirm_address_locator = None
        self.order_locator = None
        self.purchase_order_confirm_locator = None
        self.purchase_order_complete_locator = None

        if self.is_run_ios():
            self.xml_file = __file__[:__file__.rfind(".")] + "IOS.xml"
        else:
            self.xml_file = __file__[:__file__.rfind(".")] + "Android.xml"
        try:
            self.initial_element()
        except Exception:
            screenshot_file = GlobalVarClass.get_case_name() + "_" + str(time.time()) + "_screenshot.png"
            self.driver.save_screenshot(GlobalVarClass.get_screenshot_path() + screenshot_file)
            print("错误截图:")
            print('<img src="' + GlobalVarClass.get_screenshot_path() + screenshot_file + '" width="800px" />')
            run_info_log(u'XML解析失败.', GlobalVarClass.get_log_file())
            raise
예제 #5
0
    def __init__(self, driver):
        BasePage.__init__(self, driver, __file__)
        self.driver = driver
        self.choose_warehouse_locator = None
        self.choose_warehouse_confirmBtn_locator = None
        self.enter_station_name_locator = None
        self.choose_type_locator = None
        self.next_locator = None
        self.completed_look_locator = None
        self.nextAdd_locator = None

        if self.is_run_ios():
            self.xml_file = __file__[:__file__.rfind(".")] + "IOS.xml"
        else:
            self.xml_file = __file__[:__file__.rfind(".")] + "Android.xml"
        try:
            self.initial_element()
        except Exception:
            screenshot_file = GlobalVarClass.get_case_name() + "_" + str(
                time.time()) + "_screenshot.png"
            self.driver.save_screenshot(GlobalVarClass.get_screenshot_path() +
                                        screenshot_file)
            print("错误截图:")
            print('<img src="' + GlobalVarClass.get_screenshot_path() +
                  screenshot_file + '" width="800px" />')
            run_info_log(u'XML解析失败.', GlobalVarClass.get_log_file())
            raise
    def __init__(self, driver):
        BasePage.__init__(self, driver, __file__)
        self.driver = driver
        self.template_name_locator = None
        self.supplier_unit_locator = None
        self.supplier_unit_one_locator = None
        self.needs_unit_locator = None
        self.needs_unit_one_locator = None
        self.service_type_locator = None
        self.promotions_service_locator = None
        self.promotions_warehousing_locator = None
        self.promotions_trans_locator = None
        self.promotions_availability_locator = None
        self.promotion_type_locator = None
        self.total_amount_locator = None
        self.total_amount_Discount_locator = None
        self.total_amount_minus_locator = None
        self.total_quantity_discount_locator = None
        self.single_product_delivery_locator = None
        self.packing_total_amount_locator = None
        self.trans_total_amount_locator = None
        self.throughput_total_amount_locator = None
        self.promotion_date_locator = None
        self.superposition_template_locator = None
        self.template_desc_locator = None
        self.promotion_type_locator = None
        self.full_money_locator = None
        self.minus_money_locator = None
        self.picking_hs_day_locator = None
        self.picking_hs_week_locator = None
        self.picking_hs_month_locator = None
        self.picking_hs_year_locator = None
        self.picking_satisfy_amount_locator = None
        self.picking_reward_locator = None
        self.trans_total_amount_locator = None
        self.confirm_locator = None
        self.completeBtn_locator = None
        self.next_stepBtn_locator = None
        self.set_promotion_template_locator = None
        self.s_completeBtn_locator = None
        self.turn_complete_locator = None
        if self.is_run_ios():
            self.xml_file = __file__[:__file__.rfind(".")] + "IOS.xml"
        else:
            self.xml_file = __file__[:__file__.rfind(".")] + "Android.xml"
        try:
            self.initial_element()
        except Exception:

            screenshot_file = GlobalVarClass.get_case_name() + "_" + str(
                time.time()) + "_screenshot.png"
            self.driver.save_screenshot(GlobalVarClass.get_screenshot_path() +
                                        screenshot_file)
            print("错误截图:")
            print('<img src="' + GlobalVarClass.get_screenshot_path() +
                  screenshot_file + '" width="800px" />')
            run_info_log(u'XML解析失败.', GlobalVarClass.get_log_file())
            raise
예제 #7
0
    def run(self, result=None):
        """
        每个case运行之前的前置操作
        """
        GlobalVarClass.set_case_platform(sys.platform)
        if sys.platform == "darwin":
            GlobalVarClass.set_platform("ios")
        else:
            GlobalVarClass.set_platform("android")
        case_name = str(self._testMethodName)
        GlobalVarClass.set_case_name(case_name)
        case_doc = str(self._testMethodDoc).lstrip("\n").lstrip(" ").rstrip(
            " ").rstrip("\n")
        log_file = case_name + "_" + GlobalVarClass.get_now_time()
        GlobalVarClass.set_log_file(log_file)
        msg = "run case:" + case_name + "(" + case_doc + ")"
        run_info_log(msg, GlobalVarClass.get_log_file())
        # super(BaseTestCase, self).run(result)

        orig_result = result
        if result is None:
            result = self.defaultTestResult()
            startTestRun = getattr(result, 'startTestRun', None)
            if startTestRun is not None:
                startTestRun()

        self._resultForDoCleanups = result
        result.startTest(self)

        testMethod = getattr(self, self._testMethodName)
        if (getattr(self.__class__, "__unittest_skip__", False)
                or getattr(testMethod, "__unittest_skip__", False)):
            # If the class or method was skipped.
            try:
                skip_why = (
                    getattr(self.__class__, '__unittest_skip_why__', '')
                    or getattr(testMethod, '__unittest_skip_why__', ''))
                self._addSkip(result, skip_why)
            finally:
                result.stopTest(self)
            return
        try:
            success = False
            success = self.recursion_run_case(
                testMethod, result, GlobalVarClass.get_case_error_num())
            cleanUpSuccess = self.doCleanups()
            success = success and cleanUpSuccess
            if success:
                result.addSuccess(self)
        finally:
            result.stopTest(self)
            if orig_result is None:
                stopTestRun = getattr(result, 'stopTestRun', None)
                if stopTestRun is not None:
                    stopTestRun()
        pass
예제 #8
0
 def initial_element(self):
     try:
         self.is_loaded()
         self.page_factory()
     except Exception():
         print(u'控件不在当前页面上.')
         screenshot_file = GlobalVarClass.get_case_name() + "_" + str(time.time()) + "_screenshot.png"
         self.driver.save_screenshot(GlobalVarClass.get_screenshot_path() + screenshot_file)
         print("错误截图:")
         print('<img src="' + GlobalVarClass.get_screenshot_path() + screenshot_file + '" width="800px" />')
         run_info_log(u'控件不在当前页面上.', GlobalVarClass.get_log_file())
         raise
     pass
예제 #9
0
 def __init__(self, driver):
     BasePage.__init__(self, driver, __file__)
     self.driver = driver
     try:
         self.initial_element()
     except ParseXmlErrorException:
         print(u'XML解析失败.')
         screenshot_file = GlobalVar.get_case_name() + "_" + str(
             time()) + "_screenshot.png"
         self.driver.save_screenshot(GlobalVar.get_screenshot_path() +
                                     screenshot_file)
         print("错误截图:")
         print('<img src="' + GlobalVar.get_screenshot_path() +
               screenshot_file + '" width="800px" />')
         run_info_log(u'XML解析失败.', GlobalVar.get_log_file())
         raise
예제 #10
0
    def __init__(self, driver):
        self.ds_locator = None
        self.zy_locator = None
        self.fds_locator = None
        self.kj_locator = None
        self.dz_locator = None
        self.sc_locator = None
        self.qs_locator = None
        self.pl_locator = None
        self.chooseTime_locator = None
        self.confirmTimeBtn_locator = None
        self.chooseAddress_locator = None
        self.beijing_locator = None
        self.beijing_city_locator = None
        self.east_city_zone_locator = None
        self.processing_capacity_locator = None
        self.warehouse_locator = None
        self.immediate_release_locator = None
        self.completed_btn_locator = None
        self.continue_locator = None
        self.wc_btn_locator = None
        self.bd_btn_locator = None
        self.pub_warehouseDemand_locator = None

        BasePage.__init__(self, driver, __file__)
        self.driver = driver
        if self.is_run_ios():
            self.xml_file = __file__[:__file__.rfind(".")] + "IOS.xml"
        else:
            self.xml_file = __file__[:__file__.rfind(".")] + "Android.xml"

        try:
            self.initial_element()
        except ParseXmlErrorException:
            print(u'XML解析失败.')
            screenshot_file = GlobalVarClass.get_case_name() + "_" + str(
                time.time()) + "_screenshot.png"
            self.driver.save_screenshot(GlobalVarClass.get_screenshot_path() +
                                        screenshot_file)
            print("错误截图:")
            print('<img src="' + GlobalVarClass.get_screenshot_path() +
                  screenshot_file + '" width="800px" />')
            run_info_log(u'XML解析失败.', GlobalVarClass.get_log_file())
            raise
예제 #11
0
    def __init__(self, driver):
        BasePage.__init__(self, driver, __file__)
        self.driver = driver
        self.select_logistics_brand_locator = None
        self.modify_receipt_information_locator = None
        self.open_order_download_locator = None
        self.non_service_certification_locator = None
        self.distribution_manager_and_supervisor_locator = None
        self.monitor_authorization_locator = None
        self.manager_authorization_locator = None
        self.contract_of_carriage_locator = None
        self.sign_labor_contract_locator = None
        self.sign_warehouse_supply_contract_locator = None
        self.sign_warehouse_demand_contract_locator = None
        self.f5_locator = None
        self.return1_locator = None
        self.CardOne_locator = None
        self.longCard_locator = None
        self.back_locator = None
        self.ware_house_demand_locator = None
        self.long_task_locator = None
        self.RegisterSupplier_locator = None
        self.purchase_orders_locator = None
        self.upload_delivery_order_locator = None
        self.set_promotional_template_locator = None
        self.release_storage_requirement_locator = None
        self.release_supply_locator = None

        try:
            self.initial_element()
        except ParseXmlErrorException:
            print(u'XML解析失败.')
            screenshot_file = GlobalVar.get_case_name() + "_" + str(
                time.time()) + "_screenshot.png"
            self.driver.save_screenshot(GlobalVar.get_screenshot_path() +
                                        screenshot_file)
            print("错误截图:")
            print('<img src="' + GlobalVar.get_screenshot_path() +
                  screenshot_file + '" width="800px" />')
            run_info_log(u'XML解析失败.', GlobalVar.get_log_file())
            raise
예제 #12
0
    def __init__(self, driver):
        BasePage.__init__(self, driver, __file__)
        self.driver = driver
        self.choose_friends_locator = None
        self.name_locator = None
        self.card_id_locator = None
        self.photo_locator = None
        self.nest_step_locator = None
        self.photo_okay_locator = None
        self.photo_done_locator = None
        self.photo_id_front_locator = None
        self.photo_id_back_locator = None
        self.id_photo_next_locator = None
        self.verify_num_locator = None
        self.verify_identify_code_locator = None
        self.verify_get_identify_code_locator = None
        self.verify_set_pwd_locator = None
        self.verify_confirm_pwd_locator = None
        self.verify_next_step_locator = None
        self.wechat_login_locator = None
        self.refresh_locator = None
        self.task_central_locator = None

        if self.is_run_ios():
            self.xml_file = __file__[:__file__.rfind(".")] + "IOS.xml"
        else:
            self.xml_file = __file__[:__file__.rfind(".")] + "Android.xml"

        try:
            self.initial_element()
        except Exception:
            screenshot_file = GlobalVarClass.get_case_name() + "_" + str(
                time.time()) + "_screenshot.png"
            self.driver.save_screenshot(GlobalVarClass.get_screenshot_path() +
                                        screenshot_file)
            print("错误截图:")
            print('<img src="' + GlobalVarClass.get_screenshot_path() +
                  screenshot_file + '" width="800px" />')
            run_info_log(u'XML解析失败.', GlobalVarClass.get_log_file())
            raise
예제 #13
0
    def __init__(self, driver):
        BasePage.__init__(self, driver, __file__)
        self.driver = driver
        self.company_name_locator = None
        self.company_principal_locator = None
        self.mobile_locator = None
        self.single_personName_locator = None
        self.single_person_mobile_locator = None
        self.reconciliation_person_locator = None
        self.reconciliation_personName_locator = None
        self.reconciliation_personMobile_locator = None
        self.pay_locator = None
        self.pay_personName_locator = None
        self.pay_personMobile_locator = None
        self.registerBtn_locator = None
        self.register_supply_locator = None
        self.completed_btn_locator = None
        self.check_people_locator = None
        self.pay_people_locator = None

        if self.is_run_ios():
            self.xml_file = __file__[:__file__.rfind(".")] + "IOS.xml"
        else:
            self.xml_file = __file__[:__file__.rfind(".")] + "Android.xml"
        try:
            self.initial_element()
        except Exception:

            screenshot_file = GlobalVarClass.get_case_name() + "_" + str(
                time.time()) + "_screenshot.png"
            self.driver.save_screenshot(GlobalVarClass.get_screenshot_path() +
                                        screenshot_file)
            print("错误截图:")
            print('<img src="' + GlobalVarClass.get_screenshot_path() +
                  screenshot_file + '" width="800px" />')
            run_info_log(u'XML解析失败.', GlobalVarClass.get_log_file())
            raise