From 0468105f049918f9fa4d4f91b966552ae7531614 Mon Sep 17 00:00:00 2001 From: qicoffee Date: Tue, 24 Sep 2024 15:23:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=B8=80=E6=9D=A1=E7=94=A8?= =?UTF-8?q?=E4=BE=8B=EF=BC=8C=E7=94=A8=E4=BA=8E=E6=A3=80=E6=9F=A5=E7=94=BB?= =?UTF-8?q?=E6=9D=BF=E7=9A=84=E5=90=AF=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- case/assert_res/test_dde_1271055.png | Bin 0 -> 1077 bytes case/test_dde_1271055.py | 56 ++++++++++++++++++++++++++ dde.csv | 4 ++ method/dde_method.py | 4 +- method/deepin_draw_method.py | 27 +++++++++++++ method/image_res/deepin_draw_icon.png | Bin 0 -> 778 bytes 6 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 case/assert_res/test_dde_1271055.png create mode 100644 case/test_dde_1271055.py create mode 100644 method/deepin_draw_method.py create mode 100644 method/image_res/deepin_draw_icon.png diff --git a/case/assert_res/test_dde_1271055.png b/case/assert_res/test_dde_1271055.png new file mode 100644 index 0000000000000000000000000000000000000000..268a773a11bd5760f915c5298d448a3c54dcc678 GIT binary patch literal 1077 zcmV-51j_q~P)iv@lu5ne_HhW|fbzxwgKXg@$Naex*muI$ZzWnV! z0|NuYzqeOUoMF**Q|D#;`RwrS7urRorPe|)_x}HKYg^NlXD+32uHtWZO?X&dOc!%i36sje&uI;s3iEr}n>;&uPx`S71YN!hh`G&&}m^IqRSN!Ib&; z^V#uL_1#;~zxnP z{r~;x;}2TCIld|!&rU7d{lzT6UR#j)-@8kTH{SYm^Xf;t_ySJ_9!&cg7!Y9~WZ;=; zz`(%3!0_kAmZr1&*qDXYMTM0e(!8Wtku>~y^6vaMl{uM4A2;{3{o>;K_~3_`7#SG;eSLW4`qk^7EaLJqbp%-$82){DaP_mejw~l5Ru{m) zuLnC;tYY^q^4q_W$Jye+syS!k(@X@JvBeG(BO{Voj7-do3=9lR92^|~zCXKka^tG) z8y<0)o2b1yv2)G|1_lO(?~gC-dT-j>5vaw5(*^(DonPN~RI#kuhHcA!1|~s^7`LnS zlP7#g%y5?F#ukPc;NQ!0dv{&`$*-gp5NLRCt8`ATtr#>5{eOSx{gF$`id-lfkjsNV zZ_cfouva*{%1;LtV~l)SNflnq>-us!Hy?TU6_QGR-#R*f?y6-+-$3*Bzpu}3T)+0@ z7c&zR0|S$|p=)fkkDsNIC?`=xJ|YYrA6&oVn?ZhosxWG}u!@`HwDE75x99e|Ul#J* z3=E87=B}wpnm@0~UF8*FI>Nxf#4RTA^|zp7gsBh{0|Nt6Q2l*$dg+1}@C5k%(UU*I z7*2ra%fEmAB9{lZ*G`yt?A>3C?EC-kKP16Fx7JOWeeM%xF8}}k|L-enb7o%rfROw5 v{@BunEsuVoDnl+42L=q{+IiFkBgzE;W5!5(sXdw=00000NkvXXu0mjfj2t+M literal 0 HcmV?d00001 diff --git a/case/test_dde_1271055.py b/case/test_dde_1271055.py new file mode 100644 index 0000000..fe16915 --- /dev/null +++ b/case/test_dde_1271055.py @@ -0,0 +1,56 @@ +from time import sleep +import pylinuxauto +import pytest +from nocmd import Cmd + +from case.base_case import BaseCase +from method.dde_method import DdeMethod + + +class TestDdeCase(BaseCase): + def test_dde_1271055_1(self, clear_process_1): + """启动器打开画板""" + euler = DdeMethod() + euler.dde_method_open_software_by_launcher("huaban") + sleep(5) + self.assert_process_status(True, "deepin-draw") + + def test_dde_1271055_2(self, clear_process_2): + """桌面打开画板""" + euler = DdeMethod() + euler.dde_dock_method_click_launcher_btn_by_attr() + euler.dde_launcher_method_click_search_box_by_attr() + pylinuxauto.input("huaban") + euler.base_method_right_click_by_ocr("画板") + pylinuxauto.select_menu(2) + DdeMethod().base_method_kill_process_by_cmd("dde-launcher") + sleep(2) + euler.base_method_double_click_by_img("deepin_draw_icon.png") + sleep(5) + self.assert_process_status(True, "deepin-draw") + DdeMethod().base_method_kill_process_by_cmd("deepin-draw") + sleep(3) + euler.base_method_right_click_by_img("deepin_draw_icon.png") + pylinuxauto.select_menu(1) + sleep(5) + self.assert_process_status(True, "deepin-draw") + + def test_dde_1271055_3(self, clear_process_1): + """终端打开画板""" + Cmd.run("deepin-draw &") + sleep(3) + self.assert_process_status(True, "deepin-draw") + + @pytest.fixture + def clear_process_1(self): + """清理环境""" + yield + DdeMethod().base_method_kill_process_by_cmd("deepin-draw") + + @pytest.fixture + def clear_process_2(self): + """清理环境""" + yield + DdeMethod().base_method_kill_process_by_cmd("deepin-draw") + DdeMethod().base_method_click_by_img("deepin_draw_icon.png") + pylinuxauto.delete() diff --git a/dde.csv b/dde.csv index 878dc76..a3dcff3 100644 --- a/dde.csv +++ b/dde.csv @@ -10,6 +10,10 @@ 1271035,,, 1271037,,, 1271041,,, +1271055,,, +1271057,,, +1271059,,, +1271061,,, 1271073,,, 1271075,,, 1271077,,, diff --git a/method/dde_method.py b/method/dde_method.py index 5c74799..c3f9022 100644 --- a/method/dde_method.py +++ b/method/dde_method.py @@ -24,6 +24,7 @@ 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_font_manager_method import DdeFontManagerMethod +from method.deepin_draw_method import DeepinDrawMethod @log @@ -37,6 +38,7 @@ class DdeMethod( DdeDeviceManagerMethod, DeepinLogViewerMethod, DdeTerminalMethod, + DeepinDrawMethod, ): """应用方法主类""" @@ -341,4 +343,4 @@ class DdeMethod( if __name__ == "__main__": sleep(3) - pylinuxauto.find_element_by_attr_path("/deepin-terminal/DTitlebarDWindowOptionButton").click() + pylinuxauto.find_element_by_attr_path("/dde-file-manager/主目录").click() diff --git a/method/deepin_draw_method.py b/method/deepin_draw_method.py new file mode 100644 index 0000000..7293221 --- /dev/null +++ b/method/deepin_draw_method.py @@ -0,0 +1,27 @@ +from time import sleep +from funnylog2.config import config as funnylog2_config + +funnylog2_config.CLASS_NAME_ENDSWITH = ["Method"] +import pylinuxauto +from method.base_method import BaseMethod + + +class DeepinDrawMethod(BaseMethod): + def deepin_draw_method_click_by_attr(self, path): + """在画板中通过元素点击""" + pylinuxauto.find_element_by_attr_path(f"/deepin-draw/{path}").click() + + def deepin_draw_method_click_option_btn_by_attr(self): + """在画板中通过元素点击右上角菜单按钮""" + self.deepin_draw_method_click_by_attr("DTitlebarDWindowOptionButton") + + def deepin_draw_method_quit_by_menu(self): + """通过菜单选项退出画板应用""" + self.deepin_draw_method_click_option_btn_by_attr() + sleep(1) + pylinuxauto.reverse_select_menu(1) + sleep(2) + + def deepin_draw_method_click_rectangle_tool_btn_by_attr(self): + """通过元素在画板中点击矩形工具按钮""" + self.deepin_draw_method_click_by_attr("Rectangle tool button") diff --git a/method/image_res/deepin_draw_icon.png b/method/image_res/deepin_draw_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..29ab250654074d1c246286a749f0e5001ede0a7a GIT binary patch literal 778 zcmV+l1NHogP)5l)Y~hM;M3S`Pv!p-rn8%SbRVNvWx&B;aG$!5(Owx zx*#efDkS zqeJ%JgPT{|7p^zOxiAdB?ZWlY%Go_tKQ^W+q)uC1FiVn^c);N@~-mPFb^4@PtsLR27zt}g<3M9%dDBo|J!cduk z!PMY}#Im)bb-{VGH{ZO}J;{Kf0QW<~tQ>a`iuE371O|(>Fl?8`qCNYrZ5lfgh#ATq zbKJ-T5v$<<%hthQFc{*~Tb|eFs=K$m#BMa^MnY(hlrST)PG*n(q4x$(|&+fRVn5k4MgFTr3HH5z|h!Wi#42kk&P7(yZrS(zYWU!2d6{56wKbO<3ev+n5o zs7LR=4yIiB12UyzhaZlQRJ{D>hf^1;PA3h5pk`12K!d?x%hJja%`J#G%Vg52lPIsK zhWE5xk^L7}4*nRmTCHtAgsogDCB|P~vG?8>GaL?A`x_rVGU5DKqljY?MNzZa6hhQw z`gM^_VCT>N^5qHq)$07*qo IM6N<$f>2X$n*aa+ literal 0 HcmV?d00001 -- Gitee