Commit f4bd3e1c by linguangwei

添加时间轴case

parent 4afd9523
...@@ -4,13 +4,10 @@ ...@@ -4,13 +4,10 @@
<option name="autoReloadType" value="SELECTIVE" /> <option name="autoReloadType" value="SELECTIVE" />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="00f4febb-36b6-426d-bfe6-b023876a617e" name="Default Changelist" comment="review"> <list default="true" id="00f4febb-36b6-426d-bfe6-b023876a617e" name="Default Changelist" comment="添加时间轴case">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/config/config.ini" beforeDir="false" afterPath="$PROJECT_DIR$/config/config.ini" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/pageobject/mainbarpage.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/pageobject/mainbarpage.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/config/readConfig.py" beforeDir="false" afterPath="$PROJECT_DIR$/config/readConfig.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/testcase/test_MainBarPage.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/testcase/test_MainBarPage.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/framework/common.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/framework/common.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pageobject/basepage.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/pageobject/basepage.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/testcase/test_MainPage.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/testcase/test_MainPage.py" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
...@@ -168,7 +165,7 @@ ...@@ -168,7 +165,7 @@
<recent name="C:\Users\Administrator\PycharmProjects\xm-uitest-live" /> <recent name="C:\Users\Administrator\PycharmProjects\xm-uitest-live" />
</key> </key>
</component> </component>
<component name="RunManager" selected="Python tests.pytest for test_MainBarPage.TestMainPage.test_SelectOtherDay"> <component name="RunManager" selected="Python tests.pytest for test_MainBarPage.TestMainPage.test_SelectLastMonth">
<configuration name="demo" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true"> <configuration name="demo" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
<module name="xm-uitest-live" /> <module name="xm-uitest-live" />
<option name="INTERPRETER_OPTIONS" value="" /> <option name="INTERPRETER_OPTIONS" value="" />
...@@ -190,28 +187,23 @@ ...@@ -190,28 +187,23 @@
<option name="INPUT_FILE" value="" /> <option name="INPUT_FILE" value="" />
<method v="2" /> <method v="2" />
</configuration> </configuration>
<configuration name="main" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true"> <configuration name="pytest for test_MainBarPage.TestMainPage" type="tests" factoryName="py.test" temporary="true" nameIsGenerated="true">
<module name="xm-uitest-live" /> <module name="xm-uitest-live" />
<option name="INTERPRETER_OPTIONS" value="" /> <option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" /> <option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" /> <option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/testcase" />
<option name="IS_MODULE_SDK" value="true" /> <option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/main.py" /> <option name="_new_keywords" value="&quot;&quot;" />
<option name="PARAMETERS" value="" /> <option name="_new_parameters" value="&quot;&quot;" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="_new_additionalArguments" value="&quot;&quot;" />
<option name="EMULATE_TERMINAL" value="false" /> <option name="_new_target" value="&quot;test_MainBarPage.TestMainPage&quot;" />
<option name="MODULE_MODE" value="false" /> <option name="_new_targetType" value="&quot;PYTHON&quot;" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" /> <method v="2" />
</configuration> </configuration>
<configuration name="pytest for test_MainBarPage.TestMainPage" type="tests" factoryName="py.test" temporary="true" nameIsGenerated="true"> <configuration name="pytest for test_MainBarPage.TestMainPage.test_IfTrueSelectedDay" type="tests" factoryName="py.test" temporary="true" nameIsGenerated="true">
<module name="xm-uitest-live" /> <module name="xm-uitest-live" />
<option name="INTERPRETER_OPTIONS" value="" /> <option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" /> <option name="PARENT_ENVS" value="true" />
...@@ -223,11 +215,11 @@ ...@@ -223,11 +215,11 @@
<option name="_new_keywords" value="&quot;&quot;" /> <option name="_new_keywords" value="&quot;&quot;" />
<option name="_new_parameters" value="&quot;&quot;" /> <option name="_new_parameters" value="&quot;&quot;" />
<option name="_new_additionalArguments" value="&quot;&quot;" /> <option name="_new_additionalArguments" value="&quot;&quot;" />
<option name="_new_target" value="&quot;test_MainBarPage.TestMainPage&quot;" /> <option name="_new_target" value="&quot;test_MainBarPage.TestMainPage.test_IfTrueSelectedDay&quot;" />
<option name="_new_targetType" value="&quot;PYTHON&quot;" /> <option name="_new_targetType" value="&quot;PYTHON&quot;" />
<method v="2" /> <method v="2" />
</configuration> </configuration>
<configuration name="pytest for test_MainBarPage.TestMainPage.test_IfTrueSelectedDay" type="tests" factoryName="py.test" temporary="true" nameIsGenerated="true"> <configuration name="pytest for test_MainBarPage.TestMainPage.test_SelectLastMonth" type="tests" factoryName="py.test" temporary="true" nameIsGenerated="true">
<module name="xm-uitest-live" /> <module name="xm-uitest-live" />
<option name="INTERPRETER_OPTIONS" value="" /> <option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" /> <option name="PARENT_ENVS" value="true" />
...@@ -239,7 +231,7 @@ ...@@ -239,7 +231,7 @@
<option name="_new_keywords" value="&quot;&quot;" /> <option name="_new_keywords" value="&quot;&quot;" />
<option name="_new_parameters" value="&quot;&quot;" /> <option name="_new_parameters" value="&quot;&quot;" />
<option name="_new_additionalArguments" value="&quot;&quot;" /> <option name="_new_additionalArguments" value="&quot;&quot;" />
<option name="_new_target" value="&quot;test_MainBarPage.TestMainPage.test_IfTrueSelectedDay&quot;" /> <option name="_new_target" value="&quot;test_MainBarPage.TestMainPage.test_SelectLastMonth&quot;" />
<option name="_new_targetType" value="&quot;PYTHON&quot;" /> <option name="_new_targetType" value="&quot;PYTHON&quot;" />
<method v="2" /> <method v="2" />
</configuration> </configuration>
...@@ -261,11 +253,11 @@ ...@@ -261,11 +253,11 @@
</configuration> </configuration>
<recent_temporary> <recent_temporary>
<list> <list>
<item itemvalue="Python tests.pytest for test_MainBarPage.TestMainPage.test_SelectLastMonth" />
<item itemvalue="Python tests.pytest for test_MainBarPage.TestMainPage.test_SelectOtherDay" /> <item itemvalue="Python tests.pytest for test_MainBarPage.TestMainPage.test_SelectOtherDay" />
<item itemvalue="Python tests.pytest for test_MainBarPage.TestMainPage.test_IfTrueSelectedDay" /> <item itemvalue="Python tests.pytest for test_MainBarPage.TestMainPage.test_IfTrueSelectedDay" />
<item itemvalue="Python.demo" /> <item itemvalue="Python.demo" />
<item itemvalue="Python tests.pytest for test_MainBarPage.TestMainPage" /> <item itemvalue="Python tests.pytest for test_MainBarPage.TestMainPage" />
<item itemvalue="Python.main" />
</list> </list>
</recent_temporary> </recent_temporary>
</component> </component>
...@@ -505,7 +497,21 @@ ...@@ -505,7 +497,21 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1626328922261</updated> <updated>1626328922261</updated>
</task> </task>
<option name="localTasksCounter" value="32" /> <task id="LOCAL-00032" summary="添加时间轴case">
<created>1626665483451</created>
<option name="number" value="00032" />
<option name="presentableId" value="LOCAL-00032" />
<option name="project" value="LOCAL" />
<updated>1626665483451</updated>
</task>
<task id="LOCAL-00033" summary="添加时间轴case">
<created>1626665531521</created>
<option name="number" value="00033" />
<option name="presentableId" value="LOCAL-00033" />
<option name="project" value="LOCAL" />
<updated>1626665531521</updated>
</task>
<option name="localTasksCounter" value="34" />
<servers /> <servers />
</component> </component>
<component name="TestHistory"> <component name="TestHistory">
...@@ -624,7 +630,8 @@ ...@@ -624,7 +630,8 @@
<MESSAGE value="增加白板的测试用例-7个" /> <MESSAGE value="增加白板的测试用例-7个" />
<MESSAGE value="发送钉钉测试报告,本机作为服务器" /> <MESSAGE value="发送钉钉测试报告,本机作为服务器" />
<MESSAGE value="review" /> <MESSAGE value="review" />
<option name="LAST_COMMIT_MESSAGE" value="review" /> <MESSAGE value="添加时间轴case" />
<option name="LAST_COMMIT_MESSAGE" value="添加时间轴case" />
</component> </component>
<component name="editorHistoryManager"> <component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/server.log" /> <entry file="file://$PROJECT_DIR$/server.log" />
......
...@@ -16,6 +16,16 @@ class MainBarPage(Page): ...@@ -16,6 +16,16 @@ class MainBarPage(Page):
last_week = (By.XPATH, "//div[@class='calendar_Time_week']/div[1]/span[@class='icon iconfont']") 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']") next_week = (By.XPATH, "//div[@class='calendar_Time_week']/div[3]/span[@class='icon iconfont']")
# 月份选择前内容
month_text = (By.XPATH, "//div[@class='month']")
# 月份选择后内容
other_month_text = (By.XPATH, "//div[@class='month ant-popover-open']")
# 选择月份
month_btn = (By.XPATH, "//div[@class='month']/span[@class='icon iconfont']")
# 上个月
last_month = (By.XPATH, "//div[@class='calendar_top']/span[@class='icon iconfont'][1]")
# 下个月
next_month = (By.XPATH, "//div[@class='calendar_top']/span[@class='icon iconfont'][2]")
def __init__(self, driver): def __init__(self, driver):
Page.__init__(self, driver) Page.__init__(self, driver)
...@@ -39,3 +49,23 @@ class MainBarPage(Page): ...@@ -39,3 +49,23 @@ class MainBarPage(Page):
# 点击下周 # 点击下周
def click_next_week(self): def click_next_week(self):
self.click(self.next_week) self.click(self.next_week)
# 点击月份
def click_month_btn(self):
self.click(self.month_btn)
# 点击上个月
def click_last_month(self):
self.click(self.last_month)
# 点击下个月
def click_next_month(self):
self.click(self.next_month)
# 返回当前月份文本
def get_month_text(self):
return self.get_text(self.month_text)
# 返回选择后月份文本
def get_other_month_text(self):
return self.get_text(self.other_month_text)
...@@ -48,17 +48,35 @@ class TestMainPage(object): ...@@ -48,17 +48,35 @@ class TestMainPage(object):
assert self.main_bar_page.month_day_text() == first_day assert self.main_bar_page.month_day_text() == first_day
@allure.title("点击上周") @allure.title("点击上周")
def test_SelectOtherDay(self): def test_SelectLastWeek(self):
first_day = month_not_today(-7).strftime("%d") first_day = month_not_today(-7).strftime("%d")
self.main_bar_page.click_last_week() self.main_bar_page.click_last_week()
assert self.main_bar_page.month_day_text() == first_day assert self.main_bar_page.month_day_text() == first_day
@allure.title("点击下周") @allure.title("点击下周")
def test_SelectOtherDay(self): def test_SelectNextWeek(self):
first_day = month_not_today(7).strftime("%d") first_day = month_not_today(7).strftime("%d")
self.main_bar_page.click_next_week() self.main_bar_page.click_next_week()
assert self.main_bar_page.month_day_text() == first_day assert self.main_bar_page.month_day_text() == first_day
@allure.title("点击上个月")
def test_SelectLastMonth(self):
this_month = self.main_bar_page.get_month_text()
self.main_bar_page.click_month_btn()
self.main_bar_page.sleep(self.sleep_time)
self.main_bar_page.click_last_month()
last_month = self.main_bar_page.get_other_month_text()
assert this_month != last_month
@allure.title("点击下个月")
def test_SelectNextMonth(self):
this_month = self.main_bar_page.get_month_text()
self.main_bar_page.click_month_btn()
self.main_bar_page.sleep(self.sleep_time)
self.main_bar_page.click_next_month()
next_month = self.main_bar_page.get_other_month_text()
assert this_month != next_month
if __name__ == '__main__': if __name__ == '__main__':
pytest.main(["-v"]) pytest.main(["-v"])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment