#!/usr/bin/env python # -*- coding: utf-8 -*- import time from Public.basepage import BasePage from Public.decorator import * from Demo.Page import login import unittest import json from Public.filetools import read_file from Demo import dm_config log = Log() pkg_name = json.loads(read_file(dm_config.info_path))['package'] apkpath = json.loads(read_file(dm_config.info_path))['apk_path'] class apk_install(unittest.TestCase, BasePage): @classmethod @setupclass def setUpClass(cls): cls.d.app_stop_all() @classmethod @teardownclass def tearDownClass(cls): cls.d.app_stop("com.github.android_app_bootstrap") @setup def setUp(self): self.startscreenrecord()
#!/usr/bin/env python # -*- coding: utf-8 -*- # from Public.basepage import BasePage # from uiautomator2 import UiObjectNotFoundError from Public.decorator import * from Public.log import Log from Demo import dm_config import json from Public.filetools import read_file package = json.loads(read_file(dm_config.info_path))['package'] log = Log() class baidu_page(BasePage): @teststep def set_text(self, text="西湖"): log.i('搜索栏输入%s' % text) self.d(resourceId="index-kw", className="android.widget.EditText").set_text(text) @teststep def click_search_btn(self): log.i('点击百度一下搜索按钮') self.d(text=u"百度一下", className="android.widget.Button").click()