diff --git a/lib/__init__.py b/lib/__init__.py index a3ad049..e69de29 100644 --- a/lib/__init__.py +++ b/lib/__init__.py @@ -1,58 +0,0 @@ -# encoding: utf-8 -""" - __auth__: 孟德功 - __require__: 所有事件二次封装 - __version__: 无要求 -""" - - -class Event: - def __init__(self, media=None): - self.media = media - - def click(self, type, button_name): - self.media(type, button_name).click() - - def set_text_name(self, local, text): - self.media(name=local).set_text(text) - - def set_text_xpath(self, local, text): - self.media(xpath=local).set_text(text) - - def wait(self, timeout=20.0): - import time - time.sleep(timeout) - - def close(self): - self.media.close() - - def deactivate(self, timeout=5.0): - self.media.deactivate(timeout) - - def tap(self, x, y): - self.media.tap(x=x, y=y) - - def double_tap(self, x, y): - self.media.double_tap(x, y) - - def swipe(self, x1, y1, x2, y2, time=0.5): - self.media.swipe(x1, y1, x2, y2, time) - - def swipe_left(self): - self.media.swipe_left() - - def swipe_right(self): - self.media.swipe_right() - - def swipe_up(self): - self.media.swipe_up() - - def swipe_down(self): - self.media.swipe_down() - - def tap_hold(self, x, y, time=1.0): - self.media.tap_hold(x=x, y=y, time=time) - - # def - - # self.media.wait(timeout) diff --git a/lib/__init__.pyc b/lib/__init__.pyc index a92fc34..668c90e 100644 Binary files a/lib/__init__.pyc and b/lib/__init__.pyc differ diff --git a/lib/dingding.py b/lib/dingding.py index 4815167..1605e38 100644 --- a/lib/dingding.py +++ b/lib/dingding.py @@ -22,8 +22,8 @@ def __init__(self, content=None): self.data_text = dict() self.data_text['msgtype'] = 'text' - self.data_text['text'] = {'content': self.content} - self.data_text['at'] = {'isAtall': True} + self.data_text['text'] = {'content': str(self.content).replace('"','').replace(',','')} + self.data_text['at'] = {'isAtall': False} def main(self): text_json = json.dumps(self.data_text) diff --git a/lib/dingding.pyc b/lib/dingding.pyc index c058644..22b331d 100644 Binary files a/lib/dingding.pyc and b/lib/dingding.pyc differ diff --git a/lib/running.py b/lib/running.py index 0a8e111..f643cc3 100644 --- a/lib/running.py +++ b/lib/running.py @@ -79,8 +79,9 @@ def screening(self, case): return False except Exception: self.flag_err = 1 - raise ValueError('请检查 module:%s case:%s is_run:%s is_warning:%s' + print ('请检查 module:%s case:%s is_run:%s is_warning:%s' % (self.module, self.case, self.is_run, self.is_warning)) + pass def case_event(self, case): try: @@ -478,15 +479,15 @@ def get_path(self): def data(self, type, operate): data = dict() - data['type'] = type - data['module'] = self.module - data['case'] = self.case - data['operate'] = operate + data['告警类型'] = type + data['监控模块'] = self.module + data['监控case'] = self.case + data['告警事件'] = operate if self.flag_assert == 1 and self.flag_warn == 0: - data['err_info'] = str(self.assert_info) + data['告警信息'] = str(self.assert_info) elif self.flag_assert == 0 and self.flag_warn == 1: - data['err_info'] = str(self.err_info) - data['alarm_time'] = time.strftime('%Y.%m.%d %H:%M:%S ') + data['告警信息'] = str(self.err_info) + data['告警时间'] = time.strftime('%Y.%m.%d %H:%M:%S ') import json return json.dumps(data, indent=1, sort_keys=False, ensure_ascii=False) diff --git a/lib/running.pyc b/lib/running.pyc index 7bd69a5..78b8bcb 100644 Binary files a/lib/running.pyc and b/lib/running.pyc differ diff --git a/lib/setting.py b/lib/setting.py index 235429c..45badae 100644 --- a/lib/setting.py +++ b/lib/setting.py @@ -7,7 +7,7 @@ """ FILES = ['group', 'login'] # 选择所要执行/AT-wda/case中的文件名 -BUNDLE_ID = 'com.blued.international' # App bundle id +BUNDLE_ID = 'com.*************' # App bundle id PRINT = True # 打印case运行日志 @@ -15,8 +15,8 @@ ALERT = [u'不再提醒', 'OK', u'知道了', 'Allow', u'允许', u'稍后', u'好'] # 处理不知何时就会突然弹出的警告框,可以根据业务拓展 -WDA_PATH = '/Users/degongmeng/Documents/Macaca/WebDriverAgent/WebDriverAgent.xcodeproj' # WebDriverAgent.xcodeproj 的绝对路径 +WDA_PATH = '/Users/*******/Documents/Macaca/WebDriverAgent/WebDriverAgent.xcodeproj' # WebDriverAgent.xcodeproj 的绝对路径 -DD_TOKEN = '*********************************************' # 钉钉的token(在钉钉pc版中可以获取机器人的token) +DD_TOKEN = '********************************************' # 钉钉的token(在钉钉pc版中可以获取机器人的token) ELEM_TIMEOUT = 20 # 获取元素最大等待时长 diff --git a/lib/setting.pyc b/lib/setting.pyc index 1a7a7d2..167e58e 100644 Binary files a/lib/setting.pyc and b/lib/setting.pyc differ