From 55c23d444be862e1d4a78b36718d0189d1259f79 Mon Sep 17 00:00:00 2001 From: Natalie Bunduwongse Date: Mon, 11 Nov 2024 11:48:50 +1300 Subject: [PATCH] test: fix windows ui test --- sample/Tests/test/test.py | 2 +- sample/Tests/test/test_windows.py | 4 ++-- sample/Tests/test_windows.ps1 | 11 +++++++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/sample/Tests/test/test.py b/sample/Tests/test/test.py index 2d4f98ed..43a50456 100644 --- a/sample/Tests/test/test.py +++ b/sample/Tests/test/test.py @@ -154,7 +154,7 @@ def test_3_zkevm_functions(self): self.altdriver.find_object(By.NAME, "GetBalanceButton").tap() time.sleep(2) output = self.altdriver.find_object(By.NAME, "Output") - self.assertEqual("Balance:\nHex: 0x0\nDec: 0", output.get_text()) + self.assertRegex(output.get_text(), r"Balance:\nHex: 0x[0-9a-fA-F]+\nDec: \d+") # Go back to authenticated scene self.altdriver.find_object(By.NAME, "CancelButton").tap() diff --git a/sample/Tests/test/test_windows.py b/sample/Tests/test/test_windows.py index 4c66046e..9aad24be 100644 --- a/sample/Tests/test/test_windows.py +++ b/sample/Tests/test/test_windows.py @@ -39,7 +39,7 @@ def test_2_device_code_connect_imx(self): # Get address without having to click Connect to IMX button self.altdriver.find_object(By.NAME, "GetAddressBtn").tap() - self.assertEqual("0x9cb14f273de4a8c3d8e9b4c5decbb53519dfa7bd", output.get_text()) + self.assertEqual("0x7dd423aeaccfbdd3a043bb8583085c7d97032de9", output.get_text()) def test_3_device_code_relogin(self): # Relogin @@ -73,4 +73,4 @@ def test_4_device_code_reconnect(self): # Get address without having to click Connect to IMX button self.altdriver.find_object(By.NAME, "GetAddressBtn").tap() - self.assertEqual("0x9cb14f273de4a8c3d8e9b4c5decbb53519dfa7bd", output.get_text()) + self.assertEqual("0x7dd423aeaccfbdd3a043bb8583085c7d97032de9", output.get_text()) diff --git a/sample/Tests/test_windows.ps1 b/sample/Tests/test_windows.ps1 index e023f590..50fdaf50 100644 --- a/sample/Tests/test_windows.ps1 +++ b/sample/Tests/test_windows.ps1 @@ -56,7 +56,18 @@ function Login { ) # Start Chrome for remote debugging Write-Output "Starting Chrome..." + $chromePath = "C:\Program Files\Google\Chrome\Application\chrome.exe" + + if (-not (Test-Path $chromePath)) { + $chromePath = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" + } + + if (-not (Test-Path $chromePath)) { + Write-Output "Chrome executable not found." + exit + } + Start-Process -FilePath $chromePath -ArgumentList "--remote-debugging-port=9222" # Run Python script for login