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
985cda35
Commit
985cda35
authored
Aug 04, 2021
by
linguangwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加三个case:检测设备/检查更新/退出登录
parent
55370257
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
124 additions
and
1 deletions
+124
-1
src/framework/common.py
+5
-1
src/pageobject/mainsidebarpage.py
+64
-0
src/testcase/test_MainSideBarPage.py
+55
-0
No files found.
src/framework/common.py
View file @
985cda35
...
@@ -21,7 +21,11 @@ def year_to_minute():
...
@@ -21,7 +21,11 @@ def year_to_minute():
def
month_day
():
def
month_day
():
return
time
.
localtime
()
.
tm_mday
today_day
=
time
.
localtime
()
.
tm_mday
if
today_day
<
10
:
return
"0"
+
str
(
today_day
)
else
:
return
today_day
def
month_not_today
(
para
):
def
month_not_today
(
para
):
...
...
src/pageobject/mainsidebarpage.py
0 → 100644
View file @
985cda35
from
src.pageobject.basepage
import
Page
from
selenium.webdriver.common.by
import
By
# 主页面-侧边bar
class
MainSideBarPage
(
Page
):
# 元素集
# 设置按钮
set_btn
=
(
By
.
XPATH
,
"//div[@class='setting']//span[1]"
)
# 检测设备按钮
test_equipment_btn
=
(
By
.
XPATH
,
"//span[text()='设备检测']"
)
# 检查更新按钮
check_update_btn
=
(
By
.
XPATH
,
"//span[text()='检查更新']"
)
# 退出登录按钮
logout_btn
=
(
By
.
XPATH
,
"//span[text()='退出登录']"
)
# 帮助按钮
help_btn
=
(
By
.
XPATH
,
"//div[@class='setting']//span[2]"
)
# 切换窗口元素
# 设备检测标题
test_equipment_title
=
(
By
.
XPATH
,
"//div[text()='设备检测']"
)
# 关闭检测设备窗口
close_equipment_window
=
(
By
.
XPATH
,
"//span[text()='完 成']"
)
# 测试扬声器按钮窗口
test_speaker_btn
=
(
By
.
XPATH
,
"//button[@class='ant-btn speakerBtn']"
)
# 检查更新为最新版本时
check_update_word
=
(
By
.
XPATH
,
"//span[text()='好']"
)
# 检查更新为非最新版本时
# 校验元素
# 退出登录后的元素
login_title
=
(
By
.
XPATH
,
"//div[text()='小麦企学院(讲师版)']"
)
def
__init__
(
self
,
driver
):
Page
.
__init__
(
self
,
driver
)
# 点击设置按钮
def
click_set_btn
(
self
):
self
.
click
(
self
.
set_btn
)
# 点击检测设备按钮
def
click_test_equipment_btn
(
self
):
self
.
click
(
self
.
test_equipment_btn
)
# 点击关闭检测设备窗口
def
click_close_equipment_window
(
self
):
self
.
click
(
self
.
close_equipment_window
)
# 点击检查更新按钮
def
click_check_update_btn
(
self
):
self
.
click
(
self
.
check_update_btn
)
# 点击关闭检查更新窗口
def
click_close_update_window
(
self
):
self
.
click
(
self
.
check_update_word
)
# 点击退出登录按钮
def
click_logout_btn
(
self
):
self
.
click
(
self
.
logout_btn
)
# 点击帮助按钮
def
click_help_btn
(
self
):
self
.
click
(
self
.
help_btn
)
src/testcase/test_MainSideBarPage.py
0 → 100644
View file @
985cda35
import
allure
import
pytest
from
src.framework.logger
import
Logger
from
src.pageobject.mainsidebarpage
import
MainSideBarPage
from
src.framework.appDriver
import
get_app_driver
from
config
import
readConfig
class
TestMainPage
(
object
):
cloud_class_location
=
readConfig
.
test_location
()
driver
=
get_app_driver
(
cloud_class_location
)
Main_Side_Bar_Page
=
MainSideBarPage
(
driver
=
driver
)
sleep_time
=
1
@pytest.fixture
(
scope
=
"module"
,
autouse
=
True
)
def
before_test
(
self
):
self
.
logger
=
Logger
(
'main side bar page'
)
.
getlog
()
self
.
Main_Side_Bar_Page
.
login
()
self
.
Main_Side_Bar_Page
.
sleep
(
self
.
sleep_time
)
yield
self
.
driver
self
.
driver
.
quit
()
@allure.title
(
"测试设备检测"
)
@allure.description
(
"如果测试当前用例的时候存在其他客户端浏览器,可能会测试不通过"
)
@pytest.mark.run
(
order
=
1
)
def
testEquipment
(
self
):
self
.
Main_Side_Bar_Page
.
click_set_btn
()
self
.
Main_Side_Bar_Page
.
sleep
(
self
.
sleep_time
)
self
.
Main_Side_Bar_Page
.
click_test_equipment_btn
()
self
.
Main_Side_Bar_Page
.
change_window
(
self
.
Main_Side_Bar_Page
.
test_equipment_title
)
assert
self
.
Main_Side_Bar_Page
.
ifElementExist
(
self
.
Main_Side_Bar_Page
.
test_equipment_title
)
self
.
Main_Side_Bar_Page
.
click_close_equipment_window
()
@allure.title
(
"测试检查更新"
)
@pytest.mark.run
(
order
=
2
)
def
testCheckUpdate
(
self
):
self
.
Main_Side_Bar_Page
.
change_window
(
self
.
Main_Side_Bar_Page
.
check_update_btn
)
self
.
Main_Side_Bar_Page
.
click_check_update_btn
()
self
.
Main_Side_Bar_Page
.
sleep
(
self
.
sleep_time
)
assert
self
.
Main_Side_Bar_Page
.
ifElementExist
(
self
.
Main_Side_Bar_Page
.
check_update_word
)
self
.
Main_Side_Bar_Page
.
sleep
(
self
.
sleep_time
)
self
.
Main_Side_Bar_Page
.
click_close_update_window
()
@allure.title
(
"测试退出登录"
)
@pytest.mark.run
(
order
=
3
)
def
testLogout
(
self
):
self
.
Main_Side_Bar_Page
.
click_set_btn
()
self
.
Main_Side_Bar_Page
.
click_logout_btn
()
assert
self
.
Main_Side_Bar_Page
.
ifElementExist
(
self
.
Main_Side_Bar_Page
.
login_title
)
if
__name__
==
'__main__'
:
pytest
.
main
([
"-v"
])
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