Skip to content

Commit 00237ae

Browse files
Merge pull request #660 from immutable/chore/update-game-bridge-2.12.6-minimal
chore: update game bridge to 2.12.6
2 parents 2497790 + 36a14a2 commit 00237ae

4 files changed

Lines changed: 232 additions & 307 deletions

File tree

sample/Tests/test/test_android.py

Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,6 @@ def test_2_other_functions(self):
106106
def test_3_passport_functions(self):
107107
self.test_1_passport_functions()
108108

109-
def test_4_imx_functions(self):
110-
self.test_2_imx_functions()
111-
112109
def test_5_zkevm_functions(self):
113110
self.test_3_zkevm_functions()
114111

@@ -140,11 +137,6 @@ def test_6_pkce_relogin(self):
140137
output = self.altdriver.find_object(By.NAME, "Output")
141138
self.assertTrue(len(output.get_text()) > 50)
142139

143-
# Click Connect to IMX button
144-
self.altdriver.find_object(By.NAME, "ConnectBtn").tap()
145-
time.sleep(5)
146-
self.assertEqual("Connected to IMX", output.get_text())
147-
148140
self.altdriver.stop()
149141

150142
def test_7_pkce_reconnect(self):
@@ -187,46 +179,4 @@ def test_7_pkce_reconnect(self):
187179
time.sleep(5)
188180
print("Logged out")
189181

190-
self.altdriver.stop()
191-
192-
def test_8_pkce_connect_imx(self):
193-
self.close_and_open_app()
194-
195-
# Restart AltTester
196-
self.altdriver.stop()
197-
self.altdriver = AltDriver()
198-
time.sleep(5)
199-
200-
# Select use PKCE auth
201-
self.altdriver.find_object(By.NAME, "PKCE").tap()
202-
# Wait for unauthenticated screen
203-
self.altdriver.wait_for_current_scene_to_be("UnauthenticatedScene")
204-
205-
# Connect IMX
206-
print("Logging in and connecting to IMX...")
207-
self.altdriver.wait_for_object(By.NAME, "ConnectBtn").tap()
208-
209-
self.login()
210-
211-
# Wait for authenticated screen
212-
self.altdriver.wait_for_current_scene_to_be("AuthenticatedScene")
213-
print("Logged in and connected to IMX")
214-
215-
# Get access token
216-
self.altdriver.find_object(By.NAME, "GetAccessTokenBtn").tap()
217-
output = self.altdriver.find_object(By.NAME, "Output")
218-
self.assertTrue(len(output.get_text()) > 50)
219-
220-
# Get address without having to click Connect to IMX button
221-
self.altdriver.find_object(By.NAME, "GetAddressBtn").tap()
222-
self.assertEqual(TestConfig.WALLET_ADDRESS, output.get_text())
223-
224-
# Logout
225-
print("Logging out...")
226-
self.altdriver.find_object(By.NAME, "LogoutBtn").tap()
227-
time.sleep(5)
228-
229-
# Wait for authenticated screen
230-
self.altdriver.wait_for_current_scene_to_be("UnauthenticatedScene")
231-
time.sleep(5)
232-
print("Logged out")
182+
self.altdriver.stop()

sample/Tests/test/test_mac.py

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import sys
22
import time
3+
import unittest
34
import os
45
import subprocess
56
from pathlib import Path
@@ -173,6 +174,7 @@ def logout(cls):
173174
bring_sample_app_to_foreground()
174175
cls.altdriver.find_object(By.NAME, "LogoutBtn").tap()
175176
time.sleep(5)
177+
bring_sample_app_to_foreground() # Bring app back to foreground after browser processes logout
176178
cls.altdriver.wait_for_current_scene_to_be("UnauthenticatedScene")
177179
time.sleep(2)
178180
cls.stop_browser()
@@ -229,9 +231,6 @@ def test_2_other_functions(self):
229231
def test_3_passport_functions(self):
230232
self.test_1_passport_functions()
231233

232-
def test_4_imx_functions(self):
233-
self.test_2_imx_functions()
234-
235234
def test_5_zkevm_functions(self):
236235
self.test_3_zkevm_functions()
237236

@@ -261,11 +260,6 @@ def test_6_relogin(self):
261260
output = self.altdriver.find_object(By.NAME, "Output")
262261
self.assertTrue(len(output.get_text()) > 50)
263262

264-
# Click Connect to IMX button
265-
self.altdriver.find_object(By.NAME, "ConnectBtn").tap()
266-
time.sleep(5)
267-
self.assertEqual("Connected to IMX", output.get_text())
268-
269263
self.altdriver.stop()
270264

271265
def test_7_reconnect_connect_imx(self):
@@ -300,28 +294,3 @@ def test_7_reconnect_connect_imx(self):
300294

301295
# Logout
302296
self.logout()
303-
304-
# Connect IMX
305-
time.sleep(5)
306-
print("Logging in and connecting to IMX...")
307-
self.launch_browser()
308-
bring_sample_app_to_foreground()
309-
self.altdriver.wait_for_object(By.NAME, "ConnectBtn").tap()
310-
self.login()
311-
312-
self.altdriver.wait_for_current_scene_to_be("AuthenticatedScene")
313-
314-
self.stop_browser()
315-
print("Logged in and connected to IMX")
316-
317-
# Get access token
318-
self.altdriver.find_object(By.NAME, "GetAccessTokenBtn").tap()
319-
output = self.altdriver.find_object(By.NAME, "Output")
320-
self.assertTrue(len(output.get_text()) > 50)
321-
322-
# Get address without having to click Connect to IMX button
323-
self.altdriver.find_object(By.NAME, "GetAddressBtn").tap()
324-
self.assertEqual(TestConfig.WALLET_ADDRESS, output.get_text())
325-
326-
# Logout
327-
self.logout()

sample/Tests/test/test_windows.py

Lines changed: 9 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"""
99

1010
import time
11+
import unittest
1112

1213
from alttester import *
1314

@@ -197,14 +198,6 @@ def test_3_passport_functions(self):
197198
print("COMPLETED TEST: test_3_passport_functions")
198199
print("=" * 60)
199200

200-
def test_4_imx_functions(self):
201-
print("=" * 60)
202-
print("STARTING TEST: test_4_imx_functions")
203-
print("=" * 60)
204-
self.test_2_imx_functions()
205-
print("COMPLETED TEST: test_4_imx_functions")
206-
print("=" * 60)
207-
208201
def test_5_zkevm_functions(self):
209202
print("=" * 60)
210203
print("STARTING TEST: test_5_zkevm_functions")
@@ -231,11 +224,6 @@ def test_6_relogin(self):
231224
self.get_altdriver().find_object(By.NAME, "GetAccessTokenBtn").tap()
232225
output = self.get_altdriver().find_object(By.NAME, "Output")
233226
self.assertTrue(len(output.get_text()) > 50)
234-
235-
# Click Connect to IMX button
236-
self.get_altdriver().find_object(By.NAME, "ConnectBtn").tap()
237-
time.sleep(5)
238-
self.assertEqual("Connected to IMX", output.get_text())
239227

240228
print("COMPLETED TEST: test_6_relogin")
241229
print("=" * 60)
@@ -256,11 +244,14 @@ def test_7_reconnect_connect_imx(self):
256244

257245
# Get access token
258246
self.get_altdriver().find_object(By.NAME, "GetAccessTokenBtn").tap()
247+
time.sleep(2) # Give Unity time to fetch and display the access token
259248
output = self.get_altdriver().find_object(By.NAME, "Output")
260249
self.assertTrue(len(output.get_text()) > 50)
261250

262251
# Get address without having to click Connect to IMX button
263252
self.get_altdriver().find_object(By.NAME, "GetAddressBtn").tap()
253+
time.sleep(2) # Give Unity time to fetch and display the address
254+
output = self.get_altdriver().find_object(By.NAME, "Output") # Re-fetch output after address is loaded
264255
self.assertEqual(TestConfig.WALLET_ADDRESS, output.get_text())
265256

266257
# Logout
@@ -272,63 +263,17 @@ def test_7_reconnect_connect_imx(self):
272263
# Use controlled browser logout instead of waiting for scene change
273264
logout_with_controlled_browser()
274265

266+
# Bring Unity app to foreground immediately so it can receive the logout callback
267+
bring_sample_app_to_foreground()
268+
275269
# Give Unity time to process the logout callback
276270
time.sleep(5)
277-
bring_sample_app_to_foreground()
278271

279-
# Wait for authenticated screen
272+
# Wait for unauthenticated screen
280273
self.get_altdriver().wait_for_current_scene_to_be("UnauthenticatedScene")
281274

282275
stop_browser()
283276
print("Logged out")
284277

285278
print("COMPLETED TEST: test_7_reconnect_connect_imx")
286-
print("=" * 60)
287-
288-
def test_8_connect_imx(self):
289-
print("=" * 60)
290-
print("STARTING TEST: test_8_connect_imx")
291-
print("=" * 60)
292-
# Ensure clean state regardless of previous tests
293-
self.restart_app_and_altdriver()
294-
295-
# Wait for initial scene
296-
self.get_altdriver().wait_for_current_scene_to_be("UnauthenticatedScene")
297-
298-
# Connect IMX
299-
print("Logging in and connecting to IMX...")
300-
launch_browser()
301-
bring_sample_app_to_foreground()
302-
self.get_altdriver().wait_for_object(By.NAME, "ConnectBtn").tap()
303-
login()
304-
bring_sample_app_to_foreground()
305-
306-
# Wait for authenticated screen
307-
self.get_altdriver().wait_for_current_scene_to_be("AuthenticatedScene")
308-
print("Logged in and connected to IMX")
309-
stop_browser()
310-
311-
# Get access token
312-
self.get_altdriver().find_object(By.NAME, "GetAccessTokenBtn").tap()
313-
output = self.get_altdriver().find_object(By.NAME, "Output")
314-
self.assertTrue(len(output.get_text()) > 50)
315-
316-
# Get address without having to click Connect to IMX button
317-
self.get_altdriver().find_object(By.NAME, "GetAddressBtn").tap()
318-
self.assertEqual(TestConfig.WALLET_ADDRESS, output.get_text())
319-
320-
# Logout
321-
launch_browser()
322-
bring_sample_app_to_foreground()
323-
print("Logging out...")
324-
self.get_altdriver().find_object(By.NAME, "LogoutBtn").tap()
325-
logout_with_controlled_browser()
326-
time.sleep(5)
327-
bring_sample_app_to_foreground()
328-
329-
# Wait for authenticated screen
330-
self.get_altdriver().wait_for_current_scene_to_be("UnauthenticatedScene")
331-
stop_browser()
332-
print("Logged out")
333-
print("COMPLETED TEST: test_8_connect_imx")
334-
print("=" * 60)
279+
print("=" * 60)

src/Packages/Passport/Runtime/Resources/index.html

Lines changed: 220 additions & 159 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)