Commit 6aebc3c1 by linguangwei

添加删除白板功能

parent a5ffd83f
......@@ -4,9 +4,11 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="00f4febb-36b6-426d-bfe6-b023876a617e" name="Default Changelist" comment="添加时间轴case">
<list default="true" id="00f4febb-36b6-426d-bfe6-b023876a617e" name="Default Changelist" comment="review">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" 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/pageobject/basepage.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/pageobject/basepage.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pageobject/whiteboardpage.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/pageobject/whiteboardpage.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/testcase/test_WhiteBoardPage.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/testcase/test_WhiteBoardPage.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
......@@ -173,29 +175,24 @@
<recent name="C:\Users\Administrator\PycharmProjects\xm-uitest-live" />
</key>
</component>
<component name="RunManager" selected="Python tests.pytest for test_MainBarPage.TestMainPage.test_SelectToday">
<configuration name="demo" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
<component name="RunManager" selected="Python tests.pytest for test_WhiteBoardPage.TestLivePage.testDeleteWhiteBoardr">
<configuration name="pytest for test_MainBarPage.TestMainPage.test_SelectLastMonth" type="tests" factoryName="py.test" temporary="true" nameIsGenerated="true">
<module name="xm-uitest-live" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<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="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/demo.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<option name="_new_keywords" value="&quot;&quot;" />
<option name="_new_parameters" value="&quot;&quot;" />
<option name="_new_additionalArguments" value="&quot;&quot;" />
<option name="_new_target" value="&quot;test_MainBarPage.TestMainPage.test_SelectLastMonth&quot;" />
<option name="_new_targetType" value="&quot;PYTHON&quot;" />
<method v="2" />
</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_SelectOtherDay" type="tests" factoryName="py.test" temporary="true" nameIsGenerated="true">
<module name="xm-uitest-live" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
......@@ -207,11 +204,11 @@
<option name="_new_keywords" value="&quot;&quot;" />
<option name="_new_parameters" 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_SelectOtherDay&quot;" />
<option name="_new_targetType" value="&quot;PYTHON&quot;" />
<method v="2" />
</configuration>
<configuration name="pytest for test_MainBarPage.TestMainPage.test_SelectLastMonth" type="tests" factoryName="py.test" temporary="true" nameIsGenerated="true">
<configuration name="pytest for test_MainBarPage.TestMainPage.test_SelectToday" type="tests" factoryName="py.test" temporary="true" nameIsGenerated="true">
<module name="xm-uitest-live" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
......@@ -223,11 +220,11 @@
<option name="_new_keywords" value="&quot;&quot;" />
<option name="_new_parameters" value="&quot;&quot;" />
<option name="_new_additionalArguments" value="&quot;&quot;" />
<option name="_new_target" value="&quot;test_MainBarPage.TestMainPage.test_SelectLastMonth&quot;" />
<option name="_new_target" value="&quot;test_MainBarPage.TestMainPage.test_SelectToday&quot;" />
<option name="_new_targetType" value="&quot;PYTHON&quot;" />
<method v="2" />
</configuration>
<configuration name="pytest for test_MainBarPage.TestMainPage.test_SelectOtherDay" type="tests" factoryName="py.test" temporary="true" nameIsGenerated="true">
<configuration name="pytest for test_WhiteBoardPage.TestLivePage" type="tests" factoryName="py.test" temporary="true" nameIsGenerated="true">
<module name="xm-uitest-live" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
......@@ -239,11 +236,11 @@
<option name="_new_keywords" value="&quot;&quot;" />
<option name="_new_parameters" value="&quot;&quot;" />
<option name="_new_additionalArguments" value="&quot;&quot;" />
<option name="_new_target" value="&quot;test_MainBarPage.TestMainPage.test_SelectOtherDay&quot;" />
<option name="_new_target" value="&quot;test_WhiteBoardPage.TestLivePage&quot;" />
<option name="_new_targetType" value="&quot;PYTHON&quot;" />
<method v="2" />
</configuration>
<configuration name="pytest for test_MainBarPage.TestMainPage.test_SelectToday" type="tests" factoryName="py.test" temporary="true" nameIsGenerated="true">
<configuration name="pytest for test_WhiteBoardPage.TestLivePage.testDeleteWhiteBoardr" type="tests" factoryName="py.test" temporary="true" nameIsGenerated="true">
<module name="xm-uitest-live" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
......@@ -255,17 +252,17 @@
<option name="_new_keywords" value="&quot;&quot;" />
<option name="_new_parameters" value="&quot;&quot;" />
<option name="_new_additionalArguments" value="&quot;&quot;" />
<option name="_new_target" value="&quot;test_MainBarPage.TestMainPage.test_SelectToday&quot;" />
<option name="_new_target" value="&quot;test_WhiteBoardPage.TestLivePage.testDeleteWhiteBoardr&quot;" />
<option name="_new_targetType" value="&quot;PYTHON&quot;" />
<method v="2" />
</configuration>
<recent_temporary>
<list>
<item itemvalue="Python tests.pytest for test_WhiteBoardPage.TestLivePage.testDeleteWhiteBoardr" />
<item itemvalue="Python tests.pytest for test_WhiteBoardPage.TestLivePage" />
<item itemvalue="Python tests.pytest for test_MainBarPage.TestMainPage.test_SelectToday" />
<item itemvalue="Python tests.pytest for test_MainBarPage.TestMainPage.test_SelectOtherDay" />
<item itemvalue="Python tests.pytest for test_MainBarPage.TestMainPage.test_SelectLastMonth" />
<item itemvalue="Python tests.pytest for test_MainBarPage.TestMainPage.test_IfTrueSelectedDay" />
<item itemvalue="Python.demo" />
</list>
</recent_temporary>
</component>
......@@ -533,7 +530,14 @@
<option name="project" value="LOCAL" />
<updated>1626676712122</updated>
</task>
<option name="localTasksCounter" value="36" />
<task id="LOCAL-00036" summary="review">
<created>1626685366746</created>
<option name="number" value="00036" />
<option name="presentableId" value="LOCAL-00036" />
<option name="project" value="LOCAL" />
<updated>1626685366746</updated>
</task>
<option name="localTasksCounter" value="37" />
<servers />
</component>
<component name="TestHistory">
......@@ -651,9 +655,9 @@
<MESSAGE value="请求头添加enterpriseId,并且设置各个请求头参数为变量,在config.ini中设置" />
<MESSAGE value="增加白板的测试用例-7个" />
<MESSAGE value="发送钉钉测试报告,本机作为服务器" />
<MESSAGE value="review" />
<MESSAGE value="添加时间轴case" />
<option name="LAST_COMMIT_MESSAGE" value="添加时间轴case" />
<MESSAGE value="review" />
<option name="LAST_COMMIT_MESSAGE" value="review" />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/server.log" />
......
......@@ -192,3 +192,7 @@ class Page(object):
# 鼠标移动(x,y)个像素后点击
def mouse_move(self, x, y):
ActionChains(self.driver).move_by_offset(xoffset=x, yoffset=y).click().perform()
# 鼠标悬停直至元素出现
def mouse_stop_until_ele_show(self, ele):
ActionChains(self.driver).move_to_element(ele).perform()
......@@ -33,6 +33,13 @@ class WhiteBoardPage(MainPage):
wenben_text = (By.XPATH, """//textarea[@class="editable-textarea my-textarea"]""")
# 文本位置
wenben_location = (By.XPATH, "//div[@class='textarea-container']")
# 删除白板按钮
delete_white_board = (By.XPATH, "//span[@class='icon iconfont delete']")
# 白板名称元素定位
white_board_ele = (By.XPATH, "//div[@class='item active']")
# 删除白板确认窗口
confirm_delete_btn = (By.XPATH, "//span[text()='确定']")
# "进入直播间"按钮 format里面的参数还是要继续修改,先创建课程,再通过课程名称来查看进入直播间按钮
in_live_btn = (By.XPATH, """//div[text()={}]/..//button[@class="ant-btn ant-btn-primary"]""".format("测试新增直播课"))
......@@ -78,14 +85,28 @@ class WhiteBoardPage(MainPage):
def click_eraser(self):
self.click(self.xiangpica)
# 点击输入文本
def input_wenben(self, text):
self.input_text(self.wenben_text, text=text)
# 鼠标移动至100,100坐标
def move_get_wenben(self):
self.mouse_move(100, 100)
# 获取iframe内的文本坐标
def wenben_location_ele(self):
# 不加*会报错
return self.find_element(self.wenben_location)
# 点击删除白板按钮
def click_delete_white_board(self):
self.click(self.delete_white_board)
# 鼠标悬停
def mouse_of_white_board(self):
self.mouse_stop_until_ele_show(self.find_element(self.white_board_ele))
# 二次确认删除白板
def click_confirm_del_btn(self):
self.click(self.confirm_delete_btn)
......@@ -59,6 +59,7 @@ class TestLivePage(object):
assert 10 < result
@pytest.mark.run(order=2)
# @pytest.mark.skip()
@allure.title("测试白板功能-文本输入")
def testWhiteBoardText(self):
self.White_Board_page.sleep(1)
......@@ -163,7 +164,7 @@ class TestLivePage(object):
print(result)
assert 10 < result
@pytest.mark.run(order=-1)
@pytest.mark.run(order=-2)
# @pytest.mark.skip()
@allure.title("测试白板功能-橡皮擦")
def testWhiteBoardEraser(self):
......@@ -184,6 +185,32 @@ class TestLivePage(object):
print(result)
assert 10 < result
@pytest.mark.run(order=-1)
# @pytest.mark.skip()
@allure.title("测试白板功能-删除白板")
def testDeleteWhiteBoardr(self):
self.White_Board_page.sleep(1)
self.White_Board_page.switch_to_current()
self.White_Board_page.mouse_of_white_board()
before_del_white_board = screenshot_path(sys._getframe().f_code.co_name) + "/" + year_to_minute() + '.png'
self.White_Board_page.save_screenshot(before_del_white_board)
get_allure_screenshots(before_del_white_board, "点击删除白板前截图")
self.White_Board_page.sleep(2)
self.White_Board_page.click_delete_white_board()
self.White_Board_page.sleep(2)
self.White_Board_page.change_window(self.White_Board_page.confirm_delete_btn)
self.White_Board_page.sleep(2)
self.White_Board_page.click_confirm_del_btn()
self.White_Board_page.sleep(1)
self.White_Board_page.change_window(self.White_Board_page.add_white_board)
self.White_Board_page.sleep(1)
after_del_white_board = screenshot_path(sys._getframe().f_code.co_name) + "/" + year_to_minute() + '.png'
self.White_Board_page.save_screenshot(after_del_white_board)
get_allure_screenshots(after_del_white_board, "点击删除白板后截图")
result = compare_pictures(before_del_white_board, after_del_white_board)
print(result)
assert 10000 < result
if __name__ == '__main__':
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