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
4afd9523
Commit
4afd9523
authored
Jul 19, 2021
by
linguangwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加时间轴case
parent
19ead183
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
105 additions
and
0 deletions
+105
-0
src/pageobject/mainbarpage.py
+41
-0
src/testcase/test_MainBarPage.py
+64
-0
No files found.
src/pageobject/mainbarpage.py
0 → 100644
View file @
4afd9523
from
src.pageobject.basepage
import
Page
from
selenium.webdriver.common.by
import
By
# 主页面-时间bar
class
MainBarPage
(
Page
):
# 元素集
# 未选择的日期
day_unselected
=
(
By
.
XPATH
,
"//div[@class='day']"
)
# 已被选择的日期-星期
day_selected_week
=
(
By
.
XPATH
,
"//div[@class='day selected']/p[1]"
)
# 已被选择的日期-月份日期
day_selected_month
=
(
By
.
XPATH
,
"//div[@class='day selected']/p[2]"
)
# 上周
last_week
=
(
By
.
XPATH
,
"//div[@class='calendar_Time_week']/div[1]/span[@class='icon iconfont']"
)
# 下周
next_week
=
(
By
.
XPATH
,
"//div[@class='calendar_Time_week']/div[3]/span[@class='icon iconfont']"
)
def
__init__
(
self
,
driver
):
Page
.
__init__
(
self
,
driver
)
# 获取选择日期的星期几
def
week_day_text
(
self
):
return
self
.
get_text
(
self
.
day_selected_week
)
# 获取选择日期的月份-日期
def
month_day_text
(
self
):
return
self
.
get_text
(
self
.
day_selected_month
)
# 点击相邻日期
def
click_other_day
(
self
):
self
.
click
(
self
.
day_unselected
)
# 点击上周
def
click_last_week
(
self
):
self
.
click
(
self
.
last_week
)
# 点击下周
def
click_next_week
(
self
):
self
.
click
(
self
.
next_week
)
src/testcase/test_MainBarPage.py
0 → 100644
View file @
4afd9523
import
time
import
allure
import
pytest
from
src.framework.logger
import
Logger
from
src.framework.common
import
week_day
,
month_day
,
month_not_today
from
src.pageobject.mainbarpage
import
MainBarPage
from
src.framework.appDriver
import
get_app_driver
from
config
import
readConfig
class
TestMainPage
(
object
):
@pytest.fixture
(
scope
=
"module"
,
autouse
=
True
)
def
before_test
(
self
):
print
(
"before_test"
)
self
.
logger
=
Logger
(
'main bar page'
)
.
getlog
()
self
.
cloud_class_location
=
readConfig
.
test_location
()
return
self
.
cloud_class_location
@pytest.fixture
(
scope
=
"function"
,
autouse
=
True
)
def
before_test_case
(
self
,
before_test
):
print
(
"before_test_case"
)
# 指定客户端的本地路径,在/config/config.ini配置
self
.
cloud_class_location
=
before_test
self
.
sleep_time
=
2
self
.
driver
=
get_app_driver
(
self
.
cloud_class_location
)
self
.
main_bar_page
=
MainBarPage
(
driver
=
self
.
driver
)
self
.
main_bar_page
.
login
()
yield
self
.
driver
self
.
driver
.
quit
()
@allure.title
(
"校验今日选择日期是否正确"
)
@pytest.mark.run
(
order
=
1
)
def
test_IfTrueSelectedDay
(
self
):
self
.
main_bar_page
.
sleep
(
self
.
sleep_time
)
assert
self
.
main_bar_page
.
month_day_text
()
==
str
(
month_day
())
assert
self
.
main_bar_page
.
week_day_text
()
==
readConfig
.
test_day_exchange
()[
str
(
week_day
())]
@allure.title
(
"点击已选择相邻第一个的未选择日期"
)
def
test_SelectOtherDay
(
self
):
if
week_day
()
!=
6
:
first_day
=
month_not_today
(
-
week_day
()
-
1
)
.
strftime
(
"
%
d"
)
else
:
first_day
=
month_not_today
()
.
strftime
(
"
%
d"
)
self
.
main_bar_page
.
click_other_day
()
assert
self
.
main_bar_page
.
month_day_text
()
==
first_day
@allure.title
(
"点击上周"
)
def
test_SelectOtherDay
(
self
):
first_day
=
month_not_today
(
-
7
)
.
strftime
(
"
%
d"
)
self
.
main_bar_page
.
click_last_week
()
assert
self
.
main_bar_page
.
month_day_text
()
==
first_day
@allure.title
(
"点击下周"
)
def
test_SelectOtherDay
(
self
):
first_day
=
month_not_today
(
7
)
.
strftime
(
"
%
d"
)
self
.
main_bar_page
.
click_next_week
()
assert
self
.
main_bar_page
.
month_day_text
()
==
first_day
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