From e41b441987685aa36f6cb5e3a9b9959c8e8726d6 Mon Sep 17 00:00:00 2001 From: Vladimir Druzhinin <128374224+StateOf-Vlado@users.noreply.github.com> Date: Thu, 10 Aug 2023 08:58:50 +0200 Subject: [PATCH] test(Onboarding) Skip closing test app (#11837) - Closing all app instances by port for local run and by process name for CI - Threshold for emoji hash decreased in image comparison - Verification point for cropped user icon added --- configs/__init__.py | 4 ++ configs/_local.py.ci | 1 - configs/_local.py.default | 1 - conftest.py | 2 + driver/aut.py | 7 +- driver/server.py | 22 +++++-- .../jpeg_onboarding.png | Bin 0 -> 1814 bytes .../test_generate_new_keys/jpeg_profile.png | Bin 0 -> 1973 bytes .../mac/user_image_profile.png | Bin 2782 -> 0 bytes .../test_generate_new_keys/png_onboarding.png | Bin 0 -> 2612 bytes .../test_generate_new_keys/png_profile.png | Bin 0 -> 3218 bytes .../user_image_onboarding.png | Bin 2451 -> 0 bytes .../user_image_profile.png | Bin 2506 -> 0 bytes scripts/utils/local_system.py | 60 ++++++++++++++++-- tests/test_onboarding.py | 39 +++++++----- 15 files changed, 107 insertions(+), 29 deletions(-) create mode 100644 ext/vp/test_onboarding/test_generate_new_keys/jpeg_onboarding.png create mode 100644 ext/vp/test_onboarding/test_generate_new_keys/jpeg_profile.png delete mode 100644 ext/vp/test_onboarding/test_generate_new_keys/mac/user_image_profile.png create mode 100644 ext/vp/test_onboarding/test_generate_new_keys/png_onboarding.png create mode 100644 ext/vp/test_onboarding/test_generate_new_keys/png_profile.png delete mode 100644 ext/vp/test_onboarding/test_generate_new_keys/user_image_onboarding.png delete mode 100644 ext/vp/test_onboarding/test_generate_new_keys/user_image_profile.png diff --git a/configs/__init__.py b/configs/__init__.py index f68fc55..df885a5 100644 --- a/configs/__init__.py +++ b/configs/__init__.py @@ -19,3 +19,7 @@ if APP_DIR is None: if system.IS_WIN and 'bin' not in APP_DIR: exit('Please use launcher from "bin" folder in "APP_DIR"') APP_DIR = SystemPath(APP_DIR) + +# Application will be stuck after the first test execution if set to False +# We need to investigate more time on it. +ATTACH_MODE = True diff --git a/configs/_local.py.ci b/configs/_local.py.ci index d201742..af3374a 100644 --- a/configs/_local.py.ci +++ b/configs/_local.py.ci @@ -1,5 +1,4 @@ import os LOCAL_RUN = False -ATTACH_MODE = False APP_DIR = os.getenv('APP_DIR') diff --git a/configs/_local.py.default b/configs/_local.py.default index 04950e9..13b3a3e 100644 --- a/configs/_local.py.default +++ b/configs/_local.py.default @@ -1,3 +1,2 @@ LOCAL_RUN = True -ATTACH_MODE = True APP_DIR = None diff --git a/conftest.py b/conftest.py index 17bb526..14fa7af 100644 --- a/conftest.py +++ b/conftest.py @@ -6,6 +6,7 @@ import pytest from PIL import ImageGrab import configs +import driver from driver.aut import AUT from scripts.utils.system_path import SystemPath from tests.fixtures.path import generate_test_info @@ -58,6 +59,7 @@ def pytest_exception_interact(node): name='Screenshot on fail', body=screenshot.read_bytes(), attachment_type=allure.attachment_type.PNG) + driver.context.detach() AUT().stop() except Exception as ex: _logger.debug(ex) diff --git a/driver/aut.py b/driver/aut.py index 96c19d3..521d58b 100644 --- a/driver/aut.py +++ b/driver/aut.py @@ -49,8 +49,11 @@ class AUT: return self @allure.step('Close application by process name') - def stop(self, verify: bool = True): - local_system.kill_process_by_name(self.process_name, verify=verify) + def stop(self): + if configs.LOCAL_RUN: + local_system.kill_process_by_port(self.port) + else: + local_system.kill_process_by_name(self.process_name) @allure.step("Start application") def launch(self, *args) -> 'AUT': diff --git a/driver/server.py b/driver/server.py index 9d8dbc9..a5eb84c 100644 --- a/driver/server.py +++ b/driver/server.py @@ -1,3 +1,5 @@ +import logging +import time import typing import configs.testpath @@ -5,6 +7,8 @@ from scripts.utils import local_system _PROCESS_NAME = '_squishserver' +_logger = logging.getLogger(__name__) + class SquishServer: @@ -22,19 +26,27 @@ class SquishServer: cmd = [ f'"{self.path}"', '--configfile', str(self.config), - '--verbose', f'--host={self.host}', f'--port={self.port}', ] local_system.execute(cmd) try: local_system.wait_for_started(_PROCESS_NAME) - except AssertionError: + except AssertionError as err: + _logger.info(err) local_system.execute(cmd, check=True) - @classmethod - def stop(cls, attempt: int = 2): - local_system.kill_process_by_name(_PROCESS_NAME, verify=False) + def stop(self, attempt: int = 2): + local_system.run([self.path, '--stop']) + try: + local_system.wait_for_close(_PROCESS_NAME, 2) + except AssertionError as err: + _logger.debug(err) + if attempt: + time.sleep(1) + self.stop(attempt-1) + else: + raise err # https://doc-snapshots.qt.io/squish/cli-squishserver.html def configuring(self, action: str, options: typing.Union[int, str, list]): diff --git a/ext/vp/test_onboarding/test_generate_new_keys/jpeg_onboarding.png b/ext/vp/test_onboarding/test_generate_new_keys/jpeg_onboarding.png new file mode 100644 index 0000000000000000000000000000000000000000..156de157d14e20ec6319805053530c5059fa6f59 GIT binary patch literal 1814 zcmeAS@N?(olHy`uVBq!ia0vp^dLYcf1SD_V-jl$<`X= zpW~?YovWNB>`PeL^p}zM8yvU&J-hyGX1;~&gLB;X*q3w9O1Pl$(Z7b@McHuDkG5rR z4}JT8eC|1xGWVFM`R+`;Ygz8HBs;xdt88o-_CU=f)y89C zO?gd*3%`d7x#!-^;7yVb`qk>17yB}2*4e`=L^e)xNY-{VKRDyUZ>`S7+w!)sZRFSd zdq`>fx)QUq&k{qrB0LvtoVs9kg3pWEsYe2%&7+!cv`?u^oERN$H9PIIftKqUl?yk# zF8CU#ec9*rXvJFTwT^F`z4mW7u~vJo@8(L0sY+o&89Ayi)Fgzf;#CW;T& zyEu=v+za=V*;=~Tw4>JJrMTG6(xsa-&G;7w9q~d0!xI5h@w1)Sd=YD}Y_jnC)sJ8W z$Ko);sqAmh1)vSbov*~0s7qB(M0dh%USlWWU#|{E*6iP#vE^9Zs@c;QZAgv0Wis~{ zB%sR<0}a?$RnYNnduj2ajnbjpbzBoqZ`zV+^|d)@htiFg-(K7QeG$ID?)BOE^;da+ z)XVm_m*21bu45Pdfw%JgpIjSXg$ThTlUW|y?5}zqmi1O${(st^R}(c_MIFIX{)&cr zpED(9RX;1A|3~bzlGB0I{(S;L4`j6%RYjPJddNc{%45 z+u8!xed`M*Kal#U!nI5C*}c1`eydnzzxw9V93g1VsV8VIa7h;wozs`!yweYi?@GtS z#jY358a&H;S}QbvYw2pyZ%R)tf)ickEZx6Isq*qEV2p1sU2M`ZSL5ywPL)G0bI!Cb zH{1BxLQ4@_?!Bmg;`0_8h=PNnSaRpzsFa!dpbIVcifY_gJv&fjC9r&W zW7FqV;5siHSb&`8I2`3pK`L614} z_C2gE?RjTk^J6Jf$6Yst)922eKmBEf@8v~>zIOk9D6g5KvBu*Oo6zdagZ%MTAMfp* z|M%_Y^V14NSd&zl96so%Fmj~Kc_#n&$=2(2e{Mam|KC1AAZFtC`~OwLxSFz$bX71p zCd`^PJ%6u|{3HMR|1WQpE@C*C%yiJJ<9{!Mhvc%C-|kwkzrXkMb^E`P##0Z89;_F< z<5KhZ+uZB+e_kBke(%rG#qPFd!ZFHvb7lG8@A-bt&~DO?S$h@~xOSvRyU6MC95(;c z{7ORpR`)YYUd4TG4ua>mX?)Fy`*dg8`zbdgclkUnR_Hjca$$$kk@AUoi5Y%-zaKxm zaA$^}NuI!?n;b92#CGbQKmBG#kre9@uYJou&Umn!b7{Q9tl;;5KNeI}TC5AKmFOrdYO#7hS2mUmA%JVW|tU)ir7mQS+CqO1*Wq^W0Y{PLN-&z6n`OW(l-lB cUGr7GmS^ji#gpX4f%P4Or>mdKI;Vst0C(AOV*mgE literal 0 HcmV?d00001 diff --git a/ext/vp/test_onboarding/test_generate_new_keys/jpeg_profile.png b/ext/vp/test_onboarding/test_generate_new_keys/jpeg_profile.png new file mode 100644 index 0000000000000000000000000000000000000000..6b8b411ffca8eede1c711e4c03f3aa5dfc309038 GIT binary patch literal 1973 zcmeAS@N?(olHy`uVBq!ia0vp^Mj*_=1SBWM%0FXZV6X9XaSVyzoO>{Swd&2-;}6fj z-@Ym=^!cIf3p+Xt?;Vd8T(A1x;pEgO%fhd}To<=C-yuZc4|DOWlC$eB?_O196vx^u zz|!0_y(@u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@5q2T=tCc0f zlr7E>CzJ`#|FO+)`a9hsCJDnTtO@u>RNb1T@_RkiwO}Z>x_>{s-*smIRa3T6zHbe) zfBg}^*{)oNzExi#-R&z2f?JVgp+P}) zG#FqX*JM=pp0LpJ_li2S!__v!K_K(RS!$p|n`oSzG^t7(*%==DP-diB_rRZLqw6HR z4(?IPQjXPTK3MSewW=Aeuiui24FY&HXR4Hxn}o#OZT$45y=wQFRV}ktRnY2_Gwbe& z+UWqO6@>4H2iJaE?A|?G>+IX9K({b8p-{mZ;2s?fas!5aYI*X>$YxSt6*dHdApg`3 zYZHl)idPMj)=X(D=2mQl8%S$I;M~=|#`8RPNhxR(lzP_VT;Y8mjB*NthQl2HBfbfB zUndQ6@QPgwO-sSf7xcxz?$`V_1cNaM=YeI=GzaYI!q@-cWu|xtBd3#lHLg4a*Q#+97k3#=E+2}65p9!O zE90m{IGNOHCzFhbM%}lRj;B9kk}d^HRo6fANfU;F!$W#vJT3nsJ*J@C^C$n#>Q&kwBpvHV_fev`Z^N%bUnr4z zt?d{n5~G0#QZQ=|QM?a98Nee-C zjCl-9dxyHJ2kRiGrJw>RA-Kms7g$^hKq;WL%)Kr**l2;tkk-OoEvY6#{TQfT@riK! z@pF>2hKuK}sz`WWv^AiEoTLulEhldCPf1MyF)hr<7pS)43hi`RjUjX#7#Q=^DaaZK z#@SQApzgx|8vvwaF338V;pAc)b#i;OEZ-5|OlX1;FogYH+yujGuNg4porOX&MDh~2 sAi;t{0ha&%>J?CEnv_}>b^m|@W+D7TpZ0cZ1T2LJ#7 diff --git a/ext/vp/test_onboarding/test_generate_new_keys/png_onboarding.png b/ext/vp/test_onboarding/test_generate_new_keys/png_onboarding.png new file mode 100644 index 0000000000000000000000000000000000000000..6f75463cdcc5feecd307b5caa0715069679c92b4 GIT binary patch literal 2612 zcmbtWcTm&G9uF}H1d*7RAnhcC4hj-l=mA4S6bvo$0HrCt7|9$U)d&(Ipx_{nPJ)Vn z5jYep1f+NtN+^OTL_kbXIHZ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EnPBo9gd;v88yYCs+Ntl%7tKL~INF zq-5d|QMMN(Q&lJ)f#7uRH+wpqt_^{-)YW`OhD!X$@4RBy(Iqb;3@ifMH@2E{W~ArqPiRF1&iN zC@hfQ<2Wv99E^>1*Nj6#$)=j}eKX=$@L_J3GOF*^Lwc>upUoPu>>! z^*8clh&bwO!UKGo-nh$IwCW#u5G{GYP^7+I1R7F2b1E+u0&H{BOL8&y98c&oYVcb) zDQl^0r5grJKZq>^tRhjm=sfW&uw1Y_@T*(5R^0eOqc&B3AmL4Ri(YgofEyKp78a}F zds!C&*xZV$n2 yZu~&*P*I4M5l$om4}}Hcr+s2CwR6KL3^t%(jd*e~<0bR6#ezX$)k=}(5B>&9sl$Q* diff --git a/ext/vp/test_onboarding/test_generate_new_keys/user_image_profile.png b/ext/vp/test_onboarding/test_generate_new_keys/user_image_profile.png deleted file mode 100644 index 7be1907cfd95820905b6c1b4b7e60bc97f4b5dc5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2506 zcmZuzc|4Ts9=8-@NsOY9GT!XRzLhY!6Elq6Sdv86!&p-%ODM|NXQ+(nL^|$aCN!2| zsL`>+$i8G4OqM8=BW2gzH|Kory`Rs$f4uMe$Majhzwh_^JkN`Bu(LWOEF;Xr!*d9Q zL^y$8-5(Ex4}9ajPR{f22;otP^Dgc}b${4oUcTq?dX>AzSa?LFrm{{;4GWeugjB?mCHEA5FJ4E4|v0?M09Br__d+kMgA1PIP4Ypw!Y7ZV< zL_O5<9@$!3!0O=-umWIzM<F>AFkP=a{9pWJvBZf!0yQ?dS+~&f$^>oOu zrg2~qmH?o$UxYO;?np`8>hA3=6|Z+Y8oN1tuOl+w&qR+GmC+8<>xi7o?XLC0&^jWI ze6#0l-2<6WzQeXVeC|(pfOT~b01M?OG~ltXBppdwyR#-Mmpb3khVC3TgCNOjVu%!F zxe_5kz?}Oj{L`fgCb%?K6L`h~6NyATuL|`UF)G?2oowEgG3Sl_!c_jRg*^NCy>HxG zw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aA4dQ{e#r?jO; zvjP$l>Q;7I&_FWJO7iOmLW<>WkB2rMyOy*h3kzSNiSM-z?}RfiNaa7 zL3C7^SYf8?NUDV^LfyaL(JQaqp&%mNAMN34?ctZwl^?U%Mr4h>52Bqu?r`uTE@)13 zI5qpiZ=FiIM`cL;QF#t0^p97NMN*%oxpoylZB%l8qCI`&O+odu{OV4~ebuF5oF292 z%|NJ)Zn1DJbfD9#OyopgJ|$Ss`3be>g9X7PNcSQ}TG&IPBLBQqjIBU=%HQ2}&MHE0 zYW#XOQtA5jGlf``fJ?F~OolEJ^JJD7Wq=J()2AKxLPiPNT2dA*6x2)Z>wYM!WWw>{ zcGOJOH`c0_fe2Vmsk3r#Td$^7%}>lEwSH@a;*BSo*UmXt{<8<2`r7cR2b1Y77e~qcnPN(4$sNDzW_JH){OuF diff --git a/scripts/utils/local_system.py b/scripts/utils/local_system.py index ff0f402..3b50efa 100644 --- a/scripts/utils/local_system.py +++ b/scripts/utils/local_system.py @@ -33,6 +33,35 @@ def find_process_by_name(process_name: str): return processes +@allure.step('Find process by pid') +def find_process_by_pid(pid): + for proc in psutil.process_iter(): + try: + if proc.pid == pid: + return process_info( + proc.pid, + proc.name(), + datetime.fromtimestamp(proc.create_time()).strftime("%H:%M:%S.%f") + ) + except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess): + pass + + +@allure.step('Find process by port') +def find_process_by_port(port: int): + for proc in psutil.process_iter(): + try: + for conns in proc.connections(kind='inet'): + if conns.laddr.port == port: + return process_info( + proc.pid, + proc.name(), + datetime.fromtimestamp(proc.create_time()).strftime("%H:%M:%S.%f") + ) + except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess): + pass + + @allure.step('Kill process by name') def kill_process_by_name(process_name: str, verify: bool = True, timeout_sec: int = 10): _logger.info(f'Closing process: {process_name}') @@ -46,8 +75,22 @@ def kill_process_by_name(process_name: str, verify: bool = True, timeout_sec: in wait_for_close(process_name, timeout_sec) +@allure.step('Kill process by PID') +def kill_process_by_pid(pid, verify: bool = True, timeout_sec: int = 10): + os.kill(pid, signal.SIGILL if IS_WIN else signal.SIGKILL) + if verify: + wait_for_close(pid=pid, timeout_sec=timeout_sec) + + +@allure.step('Kill process by port') +def kill_process_by_port(port: int): + proc = find_process_by_port(port) + if proc is not None and proc.pid: + kill_process_by_pid(proc.pid) + + @allure.step('Wait for process start') -def wait_for_started(process_name: str, timeout_sec: int = configs.timeouts.PROCESS_TIMEOUT_SEC): +def wait_for_started(process_name: str = None, timeout_sec: int = configs.timeouts.PROCESS_TIMEOUT_SEC): started_at = time.monotonic() while True: process = find_process_by_name(process_name) @@ -60,11 +103,19 @@ def wait_for_started(process_name: str, timeout_sec: int = configs.timeouts.PROC @allure.step('Wait for process close') -def wait_for_close(process_name: str, timeout_sec: int = configs.timeouts.PROCESS_TIMEOUT_SEC): +def wait_for_close(process_name: str = None, timeout_sec: int = configs.timeouts.PROCESS_TIMEOUT_SEC, pid=None): started_at = time.monotonic() while True: - if not find_process_by_name(process_name): - break + if process_name is not None: + process = find_process_by_name(process_name) + if not process: + break + elif pid is not None: + process = find_process_by_pid(pid) + if process is None: + break + else: + raise RuntimeError('Set process name or PID to find process') time.sleep(1) assert time.monotonic() - started_at < timeout_sec, f'Close process error: {process_name}' _logger.info(f'Process closed: {process_name}') @@ -112,3 +163,4 @@ def run( process = subprocess.run(command, shell=shell, stderr=stderr, stdout=stdout, timeout=timeout_sec) if check and process.returncode != 0: raise subprocess.CalledProcessError(process.returncode, command, process.stdout, process.stderr) + _logger.debug(f'stdout: {process.stdout}') diff --git a/tests/test_onboarding.py b/tests/test_onboarding.py index 0fe0ab8..6850efa 100755 --- a/tests/test_onboarding.py +++ b/tests/test_onboarding.py @@ -1,4 +1,5 @@ import logging + import allure import pytest from allure import step @@ -18,13 +19,15 @@ pytestmark = allure.suite("Onboarding") @allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703421', 'Generate new keys') @pytest.mark.case(703421) -@pytest.mark.parametrize('user_name, password, user_image', [ - pytest.param('Test-User _1', '*P@ssw0rd*', None), - pytest.param('_1Test-User', '*P@ssw0rd*', 'tv_signal.jpeg', marks=pytest.mark.smoke), - pytest.param('Test-User', '*P@ssw0rd*', 'tv_signal.png'), +@pytest.mark.parametrize('user_name, password, user_image, zoom, shift', [ + pytest.param('Test-User _1', '*P@ssw0rd*', None, None, None), + pytest.param('Test-User', '*P@ssw0rd*', 'tv_signal.png', 5, shift_image(0, 0, 0, 0)), + pytest.param('_1Test-User', '*P@ssw0rd*', 'tv_signal.jpeg', 5, shift_image(0, 1000, 1000, 0), + marks=pytest.mark.smoke), ]) -def test_generate_new_keys(main_window, user_name, password, user_image: str): +def test_generate_new_keys(main_window, user_name, password, user_image: str, zoom, shift): with step('Open Generate new keys view'): + if configs.system.IS_MAC: AllowNotificationsView().wait_until_appears().allow() BeforeStartedPopUp().get_started() @@ -32,17 +35,17 @@ def test_generate_new_keys(main_window, user_name, password, user_image: str): keys_screen = wellcome_screen.get_keys() with step(f'Setup profile with name: {user_name} and image: {user_image}'): + profile_view = keys_screen.generate_new_keys() profile_view.set_display_name(user_name) if user_image is not None: profile_picture_popup = profile_view.set_user_image(configs.testpath.TEST_FILES / user_image) - profile_picture_popup.make_profile_picture(zoom=5, shift=shift_image(0, 200, 200, 0)) + profile_picture_popup.make_profile_picture(zoom=zoom, shift=shift) assert not profile_view.error_message - with step('Open Profile details view'): - details_view = profile_view.next() + with step('Open Profile details view and verify user info'): - with step('Verify Profile details'): + details_view = profile_view.next() if user_image is None: assert not details_view.is_user_image_background_white() assert driver.waitFor( @@ -52,14 +55,15 @@ def test_generate_new_keys(main_window, user_name, password, user_image: str): else: image.compare( details_view.cropped_profile_image, - configs.testpath.TEST_VP / f'user_image_onboarding.png', + f'{user_image.split(".")[1]}_onboarding.png', + threshold=0.9 ) - chat_key = details_view.chat_key emoji_hash = details_view.emoji_hash assert details_view.is_identicon_ring_visible - with step('Finalize onboarding and prepare main screen'): + with step('Finalize onboarding and open main screen'): + create_password_view = details_view.next() assert not create_password_view.is_create_password_button_enabled confirm_password_view = create_password_view.create_password(password) @@ -69,7 +73,8 @@ def test_generate_new_keys(main_window, user_name, password, user_image: str): SplashScreen().wait_until_appears().wait_until_hidden() WelcomeStatusPopup().confirm() - with step('Open User Canvas and verify profile'): + with step('Open User Canvas and verify user info'): + user_canvas = main_window.left_panel.open_user_canvas() assert user_canvas.user_name == user_name if user_image is None: @@ -78,11 +83,12 @@ def test_generate_new_keys(main_window, user_name, password, user_image: str): configs.timeouts.UI_LOAD_TIMEOUT_MSEC ) - with step('Open Profile popup and verify profile'): + with step('Open Profile popup and verify user info'): + profile_popup = user_canvas.open_profile_popup() assert profile_popup.user_name == user_name assert profile_popup.chat_key == chat_key - assert profile_popup.emoji_hash.compare(emoji_hash.view) + assert profile_popup.emoji_hash.compare(emoji_hash.view, threshold=0.9) if user_image is None: assert driver.waitFor( lambda: profile_popup.is_user_image_contains(user_name[:2]), @@ -91,5 +97,6 @@ def test_generate_new_keys(main_window, user_name, password, user_image: str): else: image.compare( profile_popup.cropped_profile_image, - 'user_image_profile.png', + f'{user_image.split(".")[1]}_profile.png', + threshold=0.9 )