Commit 98698624 by linguangwei

review

parent 9652f10d
...@@ -34,8 +34,8 @@ def test_password(): ...@@ -34,8 +34,8 @@ def test_password():
return config.get("account", "password") return config.get("account", "password")
def test_header(): def test_header(header_name):
return_test = config.get("header_require", "lgw-b") return_test = config.get("header_require", header_name)
return json.loads(return_test) return json.loads(return_test)
......
import pytest import pytest
import os import os
import time
from src.framework import dingTalk from src.framework import dingTalk
from src.framework import common 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_LiveCameraPage.py', "--durations=0"]) pytest.main(["-v", '--alluredir={}'.format(htmlPath), './src/testcase/', "--durations=0"])
os.system('allure generate {} -o ./report/output --clean'.format(htmlPath)) os.system('allure generate {} -o ./report/output --clean'.format(htmlPath))
# os.system('allure open report/output') # os.system('allure open report/output')
time.sleep(5)
dingTalk.alert() dingTalk.alert()
os.system("python -m http.server 63342 -d ./report/output") os.system("python -m http.server 63342 -d ./report/output")
......
...@@ -101,9 +101,9 @@ def get_token(): ...@@ -101,9 +101,9 @@ def get_token():
# 创建一个直播课,返回课程id和课程名称 # 创建一个直播课,返回课程id和课程名称
def create_a_live(start_time, start_time2=None): def create_a_live(start_time, start_time2=None, header_name="lgw-b"):
xmtoken = get_token() xmtoken = get_token()
basic_imforation = readConfig.test_header() basic_imforation = readConfig.test_header(header_name=header_name)
userId = basic_imforation['userId'] userId = basic_imforation['userId']
storeId = basic_imforation['storeId'] storeId = basic_imforation['storeId']
storeUserId = basic_imforation['storeUserId'] storeUserId = basic_imforation['storeUserId']
......
...@@ -151,6 +151,7 @@ class Page(object): ...@@ -151,6 +151,7 @@ class Page(object):
def login(self): def login(self):
driver = self.driver driver = self.driver
sleep(15)
login_page = Page(driver=driver) login_page = Page(driver=driver)
# 手机号登录按钮 # 手机号登录按钮
phone_login = (By.ID, "rc-tabs-0-tab-2") phone_login = (By.ID, "rc-tabs-0-tab-2")
...@@ -199,6 +200,10 @@ class Page(object): ...@@ -199,6 +200,10 @@ class Page(object):
def mouse_stop_until_ele_show(self, *ele): def mouse_stop_until_ele_show(self, *ele):
if len(ele) == 2: if len(ele) == 2:
ActionChains(self.driver).move_to_element(ele[0]).perform() ActionChains(self.driver).move_to_element(ele[0]).perform()
WebDriverWait(self.driver, 10).until(EC.element_to_be_clickable(ele[1])) try:
WebDriverWait(self.driver, 10).until(EC.element_to_be_clickable(ele[1]))
except Exception as e:
print(e.args)
pass
else: else:
ActionChains(self.driver).move_to_element(ele).perform() ActionChains(self.driver).move_to_element(ele).perform()
...@@ -50,6 +50,7 @@ class LiveCameraPage(MainPage): ...@@ -50,6 +50,7 @@ class LiveCameraPage(MainPage):
def test_mouse_on_camera(self): def test_mouse_on_camera(self):
for self.i in self.list: for self.i in self.list:
self.sleep(1) self.sleep(1)
self.mouse_stop_until_ele_show(self.find_element(self.i)) self.ifElementExist(self.i)
self.mouse_stop_until_ele_show(self.find_element(self.i), self.camera_image)
print(self.i) print(self.i)
...@@ -75,8 +75,8 @@ class TestLivePage(object): ...@@ -75,8 +75,8 @@ class TestLivePage(object):
before_open_camera_image = screenshot_path(sys._getframe().f_code.co_name) + "/" + year_to_minute() + '.png' before_open_camera_image = screenshot_path(sys._getframe().f_code.co_name) + "/" + year_to_minute() + '.png'
self.Live_Camera_Page.save_screenshot(before_open_camera_image) self.Live_Camera_Page.save_screenshot(before_open_camera_image)
get_allure_screenshots(before_open_camera_image, "开启摄像头镜像前截图") get_allure_screenshots(before_open_camera_image, "开启摄像头镜像前截图")
self.Live_Camera_Page.mouse_on_camera() # self.Live_Camera_Page.mouse_on_camera()
# self.Live_Camera_Page.test_mouse_on_camera() self.Live_Camera_Page.test_mouse_on_camera()
self.Live_Camera_Page.sleep(2) self.Live_Camera_Page.sleep(2)
self.Live_Camera_Page.click_camera_image() self.Live_Camera_Page.click_camera_image()
after_open_camera_image = screenshot_path(sys._getframe().f_code.co_name) + "/" + year_to_minute() + '.png' after_open_camera_image = screenshot_path(sys._getframe().f_code.co_name) + "/" + year_to_minute() + '.png'
......
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