Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xm-uitest-sow
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xiamai-test
xm-uitest-sow
Commits
5f70970d
Commit
5f70970d
authored
Jul 09, 2021
by
linguangwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
发送钉钉测试报告,本机作为服务器
parent
00c96043
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
112 additions
and
39 deletions
+112
-39
.idea/workspace.xml
+51
-29
main.py
+4
-1
src/framework/dingTalk.py
+43
-0
src/pageobject/whiteboardpage.py
+4
-4
src/testcase/test_WhiteBoardPage.py
+10
-5
No files found.
.idea/workspace.xml
View file @
5f70970d
This diff is collapsed.
Click to expand it.
main.py
View file @
5f70970d
import
pytest
import
os
from
src.framework
import
dingTalk
from
src.framework
import
common
if
__name__
==
'__main__'
:
htmlPath
=
"./report/AI-XM_Report{}.html"
.
format
(
common
.
year_to_minute
())
pytest
.
main
([
"-v"
,
'--alluredir={}'
.
format
(
htmlPath
),
'./src/testcase/test_WhiteBoardPage.py'
,
"--durations=0"
])
os
.
system
(
'allure generate {} -o ./report/output --clean'
.
format
(
htmlPath
))
# os.system('allure open report/output')
dingTalk
.
alert
()
os
.
system
(
"python -m http.server 63342 -d ./report/output"
)
# # 定义报告输出路径
# htmlPath = "./report/AI-XM_Report{}.html".format(common.year_to_minute())
...
...
@@ -17,4 +21,3 @@ if __name__ == '__main__':
# description='描述'
# )
# runner.run(testunit)
src/framework/dingTalk.py
0 → 100644
View file @
5f70970d
import
time
import
requests
import
json
def
alert
():
# 获取当前日期
tile
=
time
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
url
=
"https://oapi.dingtalk.com/robot/send"
querystring
=
{
"access_token"
:
"8f7f39c8872c67f25ddadcfd95f86a69593a1e060cf69dc92b5981827d401383"
}
# 钉钉机器人url里面的token值
data
=
{
"msgtype"
:
"markdown"
,
# 发送类型:text/markdown
"markdown"
:
{
"title"
:
"uitest报告"
,
# 需要和机器人设置的关键字相对于 否则不会推送到消息
"text"
:
"### 代码质量检测报告
\n\n
**项目名称:**测试markdown样式项目
\n\n
**项目地址:**[点击跳转详情](http://10.0.1.109:63342/index.html)
\n\n
**检测分支:** master
\n\n
**bug数量:**3
\n\n
**相关人员:**@测试
\n\n
**播报时间:**
%
s"
%
tile
,
"at"
:
{
"atMobiles"
:
[
""
# 如果需要@某人,这里写他的手机号 这块暂时没有触发 还在研究
],
"isAtAll"
:
0
# 如果需要@所有人,这些写1
}
}
}
json_str
=
json
.
dumps
(
data
)
# 需要将类型转换为json类型
headers
=
{
'content-type'
:
"application/json"
}
response
=
requests
.
request
(
"POST"
,
url
,
data
=
json_str
,
headers
=
headers
,
params
=
querystring
)
print
(
response
)
print
(
response
.
text
)
if
__name__
==
'__main__'
:
alert
()
"https://oapi.dingtalk.com/robot/send?access_token=8f7f39c8872c67f25ddadcfd95f86a69593a1e060cf69dc92b5981827d401383"
src/pageobject/whiteboardpage.py
View file @
5f70970d
...
...
@@ -62,19 +62,19 @@ class WhiteBoardPage(MainPage):
def
click_wenben
(
self
):
self
.
click
(
self
.
wenben
)
# 直线
#
点击
直线
def
click_line
(
self
):
self
.
click
(
self
.
zhixian
)
# 形状
#
点击
形状
def
click_block
(
self
):
self
.
click
(
self
.
xingzhuang
)
# 移动
#
点击
移动
def
click_move
(
self
):
self
.
click
(
self
.
yidong
)
# 橡皮擦
#
点击
橡皮擦
def
click_eraser
(
self
):
self
.
click
(
self
.
xiangpica
)
...
...
src/testcase/test_WhiteBoardPage.py
View file @
5f70970d
...
...
@@ -35,12 +35,10 @@ class TestLivePage(object):
self
.
White_Board_page
.
sleep
(
5
)
self
.
White_Board_page
.
change_window
(
self
.
White_Board_page
.
camera_btn
)
self
.
White_Board_page
.
sleep
(
5
)
@pytest.yield_fixture
(
scope
=
"module"
,
autouse
=
True
)
def
after_test
(
self
):
yield
self
.
driver
self
.
driver
.
quit
()
@pytest.mark.run
(
order
=
1
)
@allure.title
(
"测试白板功能-新增白板"
)
def
testAddAndOpenWhiteBoard
(
self
):
self
.
White_Board_page
.
click_white_board
()
...
...
@@ -60,6 +58,7 @@ class TestLivePage(object):
print
(
result
)
assert
10
<
result
@pytest.mark.run
(
order
=
2
)
@allure.title
(
"测试白板功能-文本输入"
)
def
testWhiteBoardText
(
self
):
self
.
White_Board_page
.
sleep
(
1
)
...
...
@@ -84,6 +83,7 @@ class TestLivePage(object):
print
(
result
)
assert
10
<
result
# @pytest.mark.skip()
@allure.title
(
"测试白板功能-画笔"
)
def
testWhiteBoardPen
(
self
):
self
.
White_Board_page
.
sleep
(
1
)
...
...
@@ -103,11 +103,12 @@ class TestLivePage(object):
print
(
result
)
assert
10
<
result
# @pytest.mark.skip()
@allure.title
(
"测试白板功能-直线"
)
def
testWhiteBoardLine
(
self
):
self
.
White_Board_page
.
sleep
(
1
)
self
.
White_Board_page
.
switch_to_current
()
self
.
White_Board_page
.
click_
zhixian
()
self
.
White_Board_page
.
click_
line
()
self
.
White_Board_page
.
switch_to_iframe
(
"webview"
)
before_drap_zhixian
=
screenshot_path
(
sys
.
_getframe
()
.
f_code
.
co_name
)
+
"/"
+
year_to_minute
()
+
'.png'
self
.
White_Board_page
.
save_screenshot
(
before_drap_zhixian
)
...
...
@@ -122,6 +123,7 @@ class TestLivePage(object):
print
(
result
)
assert
10
<
result
# @pytest.mark.skip()
@allure.title
(
"测试白板功能-形状"
)
def
testWhiteBoardBlock
(
self
):
self
.
White_Board_page
.
sleep
(
1
)
...
...
@@ -141,6 +143,7 @@ class TestLivePage(object):
print
(
result
)
assert
10
<
result
# @pytest.mark.skip()
@allure.title
(
"测试白板功能-移动"
)
def
testWhiteBoardMove
(
self
):
self
.
White_Board_page
.
sleep
(
1
)
...
...
@@ -160,8 +163,10 @@ class TestLivePage(object):
print
(
result
)
assert
10
<
result
@pytest.mark.run
(
order
=-
1
)
# @pytest.mark.skip()
@allure.title
(
"测试白板功能-橡皮擦"
)
def
testWhiteBoard
Block
(
self
):
def
testWhiteBoard
Eraser
(
self
):
self
.
White_Board_page
.
sleep
(
1
)
self
.
White_Board_page
.
switch_to_current
()
self
.
White_Board_page
.
click_eraser
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment