diff --git a/case/test_dde_1271123.py b/case/test_dde_1271123.py new file mode 100644 index 0000000000000000000000000000000000000000..c5196cd5187a9995eb82a15d495c52449e2d9224 --- /dev/null +++ b/case/test_dde_1271123.py @@ -0,0 +1,24 @@ +from youqu3.gui import pylinuxauto +from case.base_case import BaseCase +from method.dde_method import DdeMethod +from youqu3 import sleep + + +class TestDdeCase(BaseCase): + def test_dde_1271123(self): + """检查系统是否默认安装Firefox浏览器,并且语言为中文""" + DdeMethod().dde_dock_method_click_launcher_btn_by_attr() + sleep(2) + DdeMethod().dde_launcher_method_click_search_box_by_attr() + pylinuxauto.input_message("firefox") + sleep(2) + self.assert_ocr_exist("Firefox") + pylinuxauto.enter() + sleep(6) + DdeMethod().dde_browser_method_click_menu_icon_by_img() + self.assert_ocr_exist("退出") + + def teardown_method(self): + """关闭Firefox浏览器""" + DdeMethod().dde_browser_method_click_close_btn_by_attr() + sleep(2) diff --git a/method/dde_browser_method.py b/method/dde_browser_method.py new file mode 100644 index 0000000000000000000000000000000000000000..83f3e1de7aadc763462e5020cca7cf93baedb4bd --- /dev/null +++ b/method/dde_browser_method.py @@ -0,0 +1,20 @@ +from time import sleep +from funnylog2.config import config as funnylog2_config + +funnylog2_config.CLASS_NAME_ENDSWITH = ["Method"] +from youqu3 import log +from youqu3.gui import pylinuxauto +from config import config +from method.base_method import BaseMethod +from method.dde_dock_method import DdeDockMethod + + +class DdeBrowserMethod(BaseMethod): + def dde_browser_method_click_by_attr(self, path): + pylinuxauto.find_element_by_attr_path(f"/Firefox/{path}").click() + + def dde_browser_method_click_menu_icon_by_img(self): + self.dde_method_click_by_img("firefox_menu_icon.png") + + def dde_browser_method_click_close_btn_by_attr(self): + self.dde_method_click_by_img("firefox_close_btn.png") diff --git a/method/dde_method.py b/method/dde_method.py index 071a40e7a7d79859f4fa675e8df04e463491c0c2..81787ed23506d141ec8943d2dcda285a07cdd7c4 100644 --- a/method/dde_method.py +++ b/method/dde_method.py @@ -17,10 +17,11 @@ from youqu3.gui import pylinuxauto from method.dde_dock_method import DdeDockMethod from method.dde_control_center_method import DdeControlCenterMethod from method.dde_launcher_method import DdeLauncherMethod +from method.dde_browser_method import DdeBrowserMethod @log -class DdeMethod(DdeDockMethod, DdeControlCenterMethod, DdeLauncherMethod): +class DdeMethod(DdeDockMethod, DdeControlCenterMethod, DdeLauncherMethod, DdeBrowserMethod): """应用方法主类""" def dde_method_open_software_by_launcher(self, text): diff --git a/method/image_res/firefox_close_btn.png b/method/image_res/firefox_close_btn.png new file mode 100644 index 0000000000000000000000000000000000000000..6e767e3c0c0dca0bee786521e4936143d8713793 Binary files /dev/null and b/method/image_res/firefox_close_btn.png differ diff --git a/method/image_res/firefox_menu_icon.png b/method/image_res/firefox_menu_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..8e23a8493ed0c5576e5f10de2132a7ddcdf742e3 Binary files /dev/null and b/method/image_res/firefox_menu_icon.png differ