Skip to content

Commit 133952a

Browse files
committed
test: update windows test to use brave
1 parent 65acf7f commit 133952a

File tree

2 files changed

+28
-29
lines changed

2 files changed

+28
-29
lines changed

sample/Tests/test/test_windows.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from alttester import *
44

55
from test import TestConfig, UnityTest
6-
from test_windows_helpers import login, open_sample_app, launch_chrome, bring_sample_app_to_foreground, stop_chrome, stop_sample_app
6+
from test_windows_helpers import login, open_sample_app, launch_browser, bring_sample_app_to_foreground, stop_browser, stop_sample_app
77

88
class WindowsTest(UnityTest):
99

@@ -31,19 +31,19 @@ def test_1_device_code_login(self):
3131

3232
# Login
3333
print("Logging in...")
34-
launch_chrome()
34+
launch_browser()
3535
bring_sample_app_to_foreground()
3636
login_button.tap()
3737
login()
3838
bring_sample_app_to_foreground()
3939

4040
# Wait for authenticated screen
4141
self.altdriver.wait_for_current_scene_to_be("AuthenticatedScene")
42-
stop_chrome()
42+
stop_browser()
4343
print("Logged in")
4444
return
4545
except Exception as err:
46-
stop_chrome()
46+
stop_browser()
4747

4848
if attempt == 0:
4949
# Reset app
@@ -58,15 +58,15 @@ def test_1_device_code_login(self):
5858

5959
# Logout
6060
print("Logging out...")
61-
launch_chrome()
61+
launch_browser()
6262
bring_sample_app_to_foreground()
6363
self.altdriver.find_object(By.NAME, "LogoutBtn").tap()
6464
time.sleep(5)
6565
bring_sample_app_to_foreground()
6666

6767
# Wait for unauthenticated screen
6868
self.altdriver.wait_for_current_scene_to_be("UnauthenticatedScene")
69-
stop_chrome()
69+
stop_browser()
7070
print("Logged out and successfully reset app")
7171

7272
time.sleep(5)
@@ -143,20 +143,20 @@ def test_7_reconnect_device_code_connect_imx(self):
143143

144144
# Logout
145145
print("Logging out...")
146-
launch_chrome()
146+
launch_browser()
147147
bring_sample_app_to_foreground()
148148
self.altdriver.find_object(By.NAME, "LogoutBtn").tap()
149149
time.sleep(5)
150150
bring_sample_app_to_foreground()
151151

152152
# Wait for authenticated screen
153153
self.altdriver.wait_for_current_scene_to_be("UnauthenticatedScene")
154-
stop_chrome()
154+
stop_browser()
155155
print("Logged out")
156156

157157
# Connect IMX
158158
print("Logging in and connecting to IMX...")
159-
launch_chrome()
159+
launch_browser()
160160
bring_sample_app_to_foreground()
161161
self.altdriver.wait_for_object(By.NAME, "ConnectBtn").tap()
162162
login()
@@ -165,7 +165,7 @@ def test_7_reconnect_device_code_connect_imx(self):
165165
# Wait for authenticated screen
166166
self.altdriver.wait_for_current_scene_to_be("AuthenticatedScene")
167167
print("Logged in and connected to IMX")
168-
stop_chrome()
168+
stop_browser()
169169

170170
# Get access token
171171
self.altdriver.find_object(By.NAME, "GetAccessTokenBtn").tap()
@@ -177,7 +177,7 @@ def test_7_reconnect_device_code_connect_imx(self):
177177
self.assertEqual(TestConfig.WALLET_ADDRESS, output.get_text())
178178

179179
# Logout
180-
launch_chrome()
180+
launch_browser()
181181
bring_sample_app_to_foreground()
182182
print("Logging out...")
183183
self.altdriver.find_object(By.NAME, "LogoutBtn").tap()
@@ -186,5 +186,5 @@ def test_7_reconnect_device_code_connect_imx(self):
186186

187187
# Wait for authenticated screen
188188
self.altdriver.wait_for_current_scene_to_be("UnauthenticatedScene")
189-
stop_chrome()
189+
stop_browser()
190190
print("Logged out")

sample/Tests/test/test_windows_helpers.py

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -114,44 +114,43 @@ def bring_sample_app_to_foreground():
114114
subprocess.run(command, check=True)
115115
time.sleep(10)
116116

117-
def launch_chrome():
118-
print("Starting Chrome...")
119-
chrome_paths = [
120-
r"C:\Program Files\Google\Chrome\Application\chrome.exe",
121-
r"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
117+
def launch_browser():
118+
print("Starting Brave...")
119+
browser_paths = [
120+
r"C:\Program Files\BraveSoftware\Brave-Browser\Application\brave.exe"
122121
]
123122

124-
chrome_path = None
125-
for path in chrome_paths:
123+
browser_path = None
124+
for path in browser_paths:
126125
if os.path.exists(path):
127-
chrome_path = path
126+
browser_path = path
128127
break
129128

130-
if not chrome_path:
131-
print("Chrome executable not found.")
129+
if not browser_path:
130+
print("Brave executable not found.")
132131
exit(1)
133132

134133
subprocess.run([
135134
"powershell.exe",
136135
"-Command",
137-
f"Start-Process -FilePath '{chrome_path}' -ArgumentList '--remote-debugging-port=9222'"
136+
f"Start-Process -FilePath '{browser_path}' -ArgumentList '--remote-debugging-port=9222'"
138137
], check=True)
139138

140139
time.sleep(5)
141140

142-
def stop_chrome():
143-
print("Stopping Chrome...")
141+
def stop_browser():
142+
print("Stopping Brave...")
144143
powershell_command = """
145-
$process = Get-Process -Name "chrome" -ErrorAction SilentlyContinue
144+
$process = Get-Process -Name "brave" -ErrorAction SilentlyContinue
146145
if ($process) {
147146
$process | ForEach-Object {
148147
Stop-Process -Id $_.Id -Force -ErrorAction SilentlyContinue
149148
}
150-
Write-Output "All Chrome processes have been closed."
149+
Write-Output "All Brave processes have been closed."
151150
} else {
152-
Write-Output "Chrome is not running."
151+
Write-Output "Brave is not running."
153152
}
154153
"""
155154
subprocess.run(["powershell.exe", "-Command", powershell_command], check=True)
156155
time.sleep(5)
157-
print("Stopped Chrome.")
156+
print("Stopped Brave")

0 commit comments

Comments
 (0)