Commit 466f225a by linguangwei

review

parent 43bf0444
...@@ -4,11 +4,12 @@ ...@@ -4,11 +4,12 @@
<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="allure添加截图"> <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$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/testcase/test_LivePage.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/testcase/test_LivePage.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.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/testcase/test_LoginPage.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/testcase/test_LoginPage.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/testcase/test_LoginPage.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/testcase/test_LoginPage.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/testcase/test_MainPage.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/testcase/test_MainPage.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> </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" />
...@@ -159,7 +160,7 @@ ...@@ -159,7 +160,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.main"> <component name="RunManager" selected="Python tests.pytest for test_WhiteBoardPage.TestLivePage.testWhiteBoard">
<configuration name="main" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true"> <configuration name="main" 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="" />
...@@ -182,7 +183,7 @@ ...@@ -182,7 +183,7 @@
<option name="INPUT_FILE" value="" /> <option name="INPUT_FILE" value="" />
<method v="2" /> <method v="2" />
</configuration> </configuration>
<configuration name="pytest for src.testcase.test_LoginPage.TestLoginPage.testLogin" type="tests" factoryName="py.test" temporary="true" nameIsGenerated="true"> <configuration name="pytest for test_LoginPage.TestLoginPage.testLogin" 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" />
...@@ -194,11 +195,11 @@ ...@@ -194,11 +195,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;src.testcase.test_LoginPage.TestLoginPage.testLogin&quot;" /> <option name="_new_target" value="&quot;test_LoginPage.TestLoginPage.testLogin&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_LoginPage.TestLoginPage.testLogin" type="tests" factoryName="py.test" temporary="true" nameIsGenerated="true"> <configuration name="pytest for test_WhiteBoardPage.TestLivePage.testWhiteBoard" 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" />
...@@ -210,7 +211,7 @@ ...@@ -210,7 +211,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_LoginPage.TestLoginPage.testLogin&quot;" /> <option name="_new_target" value="&quot;test_WhiteBoardPage.TestLivePage.testWhiteBoard&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>
...@@ -248,11 +249,11 @@ ...@@ -248,11 +249,11 @@
</configuration> </configuration>
<recent_temporary> <recent_temporary>
<list> <list>
<item itemvalue="Python tests.pytest for test_WhiteBoardPage.TestLivePage.testWhiteBoard" />
<item itemvalue="Python.main" /> <item itemvalue="Python.main" />
<item itemvalue="Python tests.pytest for test_LoginPage.TestLoginPage.testLogin" /> <item itemvalue="Python tests.pytest for test_LoginPage.TestLoginPage.testLogin" />
<item itemvalue="Python tests.pytest in test_LoginPage.py" /> <item itemvalue="Python tests.pytest in test_LoginPage.py" />
<item itemvalue="Python tests.pytest in test_MainPage.py" /> <item itemvalue="Python tests.pytest in test_MainPage.py" />
<item itemvalue="Python tests.pytest for src.testcase.test_LoginPage.TestLoginPage.testLogin" />
</list> </list>
</recent_temporary> </recent_temporary>
</component> </component>
...@@ -387,7 +388,14 @@ ...@@ -387,7 +388,14 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1624420681115</updated> <updated>1624420681115</updated>
</task> </task>
<option name="localTasksCounter" value="17" /> <task id="LOCAL-00017" summary="review">
<created>1624426645130</created>
<option name="number" value="00017" />
<option name="presentableId" value="LOCAL-00017" />
<option name="project" value="LOCAL" />
<updated>1624426645130</updated>
</task>
<option name="localTasksCounter" value="18" />
<servers /> <servers />
</component> </component>
<component name="TestHistory"> <component name="TestHistory">
...@@ -495,9 +503,9 @@ ...@@ -495,9 +503,9 @@
<MESSAGE value="添加转换窗口方法" /> <MESSAGE value="添加转换窗口方法" />
<MESSAGE value="添加测试白板的page和testcase" /> <MESSAGE value="添加测试白板的page和testcase" />
<MESSAGE value="修改为pytest框架" /> <MESSAGE value="修改为pytest框架" />
<MESSAGE value="review" />
<MESSAGE value="allure添加截图" /> <MESSAGE value="allure添加截图" />
<option name="LAST_COMMIT_MESSAGE" value="allure添加截图" /> <MESSAGE value="review" />
<option name="LAST_COMMIT_MESSAGE" value="review" />
</component> </component>
<component name="editorHistoryManager"> <component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/server.log" /> <entry file="file://$PROJECT_DIR$/server.log" />
......
...@@ -5,7 +5,7 @@ from src.framework import common ...@@ -5,7 +5,7 @@ from src.framework import common
if __name__ == '__main__': if __name__ == '__main__':
htmlPath = "./report/AI-XM_Report{}.html".format(common.year_to_minute()) htmlPath = "./report/AI-XM_Report{}.html".format(common.year_to_minute())
pytest.main(["-v", '--alluredir={}'.format(htmlPath), './src/testcase/test_WhiteBoardPage.py', "--durations=0"]) pytest.main(["-v", '--alluredir={}'.format(htmlPath), './src/testcase/test_WhiteBoardPage', "--durations=0"])
os.system('allure generate {} -o ./report/output --clean'.format(htmlPath)) os.system('allure generate {} -o ./report/output --clean'.format(htmlPath))
# # 定义报告输出路径 # # 定义报告输出路径
......
...@@ -60,7 +60,6 @@ def get_allure_screenshots(screenshot_path, describe): ...@@ -60,7 +60,6 @@ def get_allure_screenshots(screenshot_path, describe):
with open(screenshot_path, "rb") as f: with open(screenshot_path, "rb") as f:
context = f.read() context = f.read()
allure.attach(context, describe, allure.attachment_type.PNG) allure.attach(context, describe, allure.attachment_type.PNG)
allure.attach()
# 小麦接口相关 # 小麦接口相关
......
...@@ -8,24 +8,21 @@ from config import readConfig ...@@ -8,24 +8,21 @@ from config import readConfig
class TestLoginPage(object): class TestLoginPage(object):
logger = Logger('login page').getlog() @pytest.fixture(scope="function")
account = readConfig.test_account() def before_test_case(self):
password = readConfig.test_password() self.logger = Logger('login page').getlog()
cloud_class_location = readConfig.test_location() self.account = readConfig.test_account()
self.password = readConfig.test_password()
def setup_class(self): cloud_class_location = readConfig.test_location()
# 指定客户端的本地路径,在/config/config.ini配置 # 指定客户端的本地路径,在/config/config.ini配置
self.driver = get_app_driver(self.cloud_class_location) self.driver = get_app_driver(cloud_class_location)
yield self.driver
def teardown_class(self):
self.driver.quit() self.driver.quit()
@allure.title("测试登录") @allure.title("测试登录")
@pytest.fixture() @pytest.mark.usefixtures("before_test_case")
def testLogin(self): def testLogin(self):
login_page = LoginPage(driver=self.driver) login_page = LoginPage(driver=self.driver)
login_page.sleep(15)
allure.attach('在fixture前置操作里面添加一个附件txt', 'fixture前置附件', allure.attachment_type.PNG)
login_page.click_phone_login() login_page.click_phone_login()
login_page.input_account(account=self.account) login_page.input_account(account=self.account)
login_page.input_password(password=self.password) login_page.input_password(password=self.password)
......
...@@ -17,29 +17,27 @@ import sys ...@@ -17,29 +17,27 @@ import sys
class TestLivePage(object): class TestLivePage(object):
logger = Logger('live page').getlog() @pytest.fixture(scope="function")
cloud_class_location = readConfig.test_location() def before_test_case(self):
time.sleep(15) self.logger = Logger('live page').getlog()
live_course_name = create_a_live(start_time=25, start_time2=1) cloud_class_location = readConfig.test_location()
driver = get_app_driver(cloud_class_location) time.sleep(15)
White_Board_page = WhiteBoardPage(driver=driver) live_course_name = create_a_live(start_time=25, start_time2=1)
# 这里停15s是因为setUP里创建直播间获取token登录了一次,限制两次登录需间隔15s self.driver = get_app_driver(cloud_class_location)
White_Board_page.sleep(15) self.White_Board_page = WhiteBoardPage(driver=self.driver)
White_Board_page.login() # 这里停15s是因为setUP里创建直播间获取token登录了一次,限制两次登录需间隔15s
White_Board_page.sleep(2) self.White_Board_page.sleep(15)
White_Board_page.click_in_live_btn(live_course_name[0]) self.White_Board_page.login()
White_Board_page.sleep(5) self.White_Board_page.sleep(2)
White_Board_page.change_window(White_Board_page.camera_btn) self.White_Board_page.click_in_live_btn(live_course_name[0])
White_Board_page.sleep(5) self.White_Board_page.sleep(5)
self.White_Board_page.change_window(self.White_Board_page.camera_btn)
def setup_class(self): self.White_Board_page.sleep(5)
# 指定客户端的本地路径,在/config/config.ini配置 yield self.driver
pass
def teardown_class(self):
self.driver.quit() self.driver.quit()
@allure.title("测试白板功能-文本输入") @allure.title("测试白板功能-文本输入")
@pytest.mark.usefixtures("before_test_case")
def testWhiteBoard(self): def testWhiteBoard(self):
self.White_Board_page.click_white_board() self.White_Board_page.click_white_board()
self.White_Board_page.sleep(2) self.White_Board_page.sleep(2)
......
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