Commit 466f225a by linguangwei

review

parent 43bf0444
......@@ -4,11 +4,12 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<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$/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_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>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
......@@ -159,7 +160,7 @@
<recent name="C:\Users\Administrator\PycharmProjects\xm-uitest-live" />
</key>
</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">
<module name="xm-uitest-live" />
<option name="INTERPRETER_OPTIONS" value="" />
......@@ -182,7 +183,7 @@
<option name="INPUT_FILE" value="" />
<method v="2" />
</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" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
......@@ -194,11 +195,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;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;" />
<method v="2" />
</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" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
......@@ -210,7 +211,7 @@
<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_LoginPage.TestLoginPage.testLogin&quot;" />
<option name="_new_target" value="&quot;test_WhiteBoardPage.TestLivePage.testWhiteBoard&quot;" />
<option name="_new_targetType" value="&quot;PYTHON&quot;" />
<method v="2" />
</configuration>
......@@ -248,11 +249,11 @@
</configuration>
<recent_temporary>
<list>
<item itemvalue="Python tests.pytest for test_WhiteBoardPage.TestLivePage.testWhiteBoard" />
<item itemvalue="Python.main" />
<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_MainPage.py" />
<item itemvalue="Python tests.pytest for src.testcase.test_LoginPage.TestLoginPage.testLogin" />
</list>
</recent_temporary>
</component>
......@@ -387,7 +388,14 @@
<option name="project" value="LOCAL" />
<updated>1624420681115</updated>
</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 />
</component>
<component name="TestHistory">
......@@ -495,9 +503,9 @@
<MESSAGE value="添加转换窗口方法" />
<MESSAGE value="添加测试白板的page和testcase" />
<MESSAGE value="修改为pytest框架" />
<MESSAGE value="review" />
<MESSAGE value="allure添加截图" />
<option name="LAST_COMMIT_MESSAGE" value="allure添加截图" />
<MESSAGE value="review" />
<option name="LAST_COMMIT_MESSAGE" value="review" />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/server.log" />
......
......@@ -5,7 +5,7 @@ from src.framework import common
if __name__ == '__main__':
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))
# # 定义报告输出路径
......
......@@ -60,7 +60,6 @@ def get_allure_screenshots(screenshot_path, describe):
with open(screenshot_path, "rb") as f:
context = f.read()
allure.attach(context, describe, allure.attachment_type.PNG)
allure.attach()
# 小麦接口相关
......
......@@ -8,24 +8,21 @@ from config import readConfig
class TestLoginPage(object):
logger = Logger('login page').getlog()
account = readConfig.test_account()
password = readConfig.test_password()
@pytest.fixture(scope="function")
def before_test_case(self):
self.logger = Logger('login page').getlog()
self.account = readConfig.test_account()
self.password = readConfig.test_password()
cloud_class_location = readConfig.test_location()
def setup_class(self):
# 指定客户端的本地路径,在/config/config.ini配置
self.driver = get_app_driver(self.cloud_class_location)
def teardown_class(self):
self.driver = get_app_driver(cloud_class_location)
yield self.driver
self.driver.quit()
@allure.title("测试登录")
@pytest.fixture()
@pytest.mark.usefixtures("before_test_case")
def testLogin(self):
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.input_account(account=self.account)
login_page.input_password(password=self.password)
......
......@@ -17,29 +17,27 @@ import sys
class TestLivePage(object):
logger = Logger('live page').getlog()
@pytest.fixture(scope="function")
def before_test_case(self):
self.logger = Logger('live page').getlog()
cloud_class_location = readConfig.test_location()
time.sleep(15)
live_course_name = create_a_live(start_time=25, start_time2=1)
driver = get_app_driver(cloud_class_location)
White_Board_page = WhiteBoardPage(driver=driver)
self.driver = get_app_driver(cloud_class_location)
self.White_Board_page = WhiteBoardPage(driver=self.driver)
# 这里停15s是因为setUP里创建直播间获取token登录了一次,限制两次登录需间隔15s
White_Board_page.sleep(15)
White_Board_page.login()
White_Board_page.sleep(2)
White_Board_page.click_in_live_btn(live_course_name[0])
White_Board_page.sleep(5)
White_Board_page.change_window(White_Board_page.camera_btn)
White_Board_page.sleep(5)
def setup_class(self):
# 指定客户端的本地路径,在/config/config.ini配置
pass
def teardown_class(self):
self.White_Board_page.sleep(15)
self.White_Board_page.login()
self.White_Board_page.sleep(2)
self.White_Board_page.click_in_live_btn(live_course_name[0])
self.White_Board_page.sleep(5)
self.White_Board_page.change_window(self.White_Board_page.camera_btn)
self.White_Board_page.sleep(5)
yield self.driver
self.driver.quit()
@allure.title("测试白板功能-文本输入")
@pytest.mark.usefixtures("before_test_case")
def testWhiteBoard(self):
self.White_Board_page.click_white_board()
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