Skip to content

Commit 4ab33eb

Browse files
committed
fix: send transaction with confirmation hash, e2e tests
1 parent d17cd0a commit 4ab33eb

File tree

10 files changed

+37
-12
lines changed

10 files changed

+37
-12
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,6 @@ sample/Assets/Vuplex*
107107

108108
__pycache__/
109109
*.pyc
110-
.pytest_cache/
110+
.pytest_cache/
111+
112+
xcuserdata/

sample/Assets/Scripts/Passport/ZkEvm/ZkEvmSendTransaction/ZkEvmSendTransactionScript.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ private async UniTaskVoid SendTransactionAsync()
7070
if (ConfirmToggle != null && ConfirmToggle.isOn)
7171
{
7272
TransactionReceiptResponse response = await SampleAppManager.PassportInstance.ZkEvmSendTransactionWithConfirmation(request);
73-
ShowOutput($"Transaction hash: {response.transactionHash}\nStatus: {GetTransactionStatusString(response.status)}");
73+
ShowOutput($"Transaction hash: {response.hash}\nStatus: {GetTransactionStatusString(response.status)}");
7474
}
7575
else
7676
{

sample/Tests/test/test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ def test_2_imx_functions(self):
9393

9494
# Connect to IMX
9595
self.altdriver.find_object(By.NAME, "ConnectBtn").tap()
96+
time.sleep(5)
9697
text = output.get_text()
9798
print(f"ConnectBtn output: {text}")
9899
self.assertEqual("Connected to IMX", text)

sample/Tests/test/test_android.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ def test_6_pkce_relogin(self):
142142

143143
# Click Connect to IMX button
144144
self.altdriver.find_object(By.NAME, "ConnectBtn").tap()
145+
time.sleep(5)
145146
self.assertEqual("Connected to IMX", output.get_text())
146147

147148
self.altdriver.stop()

sample/Tests/test/test_mac.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ def test_6_device_code_relogin(self):
185185

186186
# Click Connect to IMX button
187187
self.altdriver.find_object(By.NAME, "ConnectBtn").tap()
188+
time.sleep(5)
188189
self.assertEqual("Connected to IMX", output.get_text())
189190

190191
self.altdriver.stop()

sample/Tests/test/test_windows.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ def test_6_relogin(self):
128128

129129
# Click Connect to IMX button
130130
self.get_altdriver().find_object(By.NAME, "ConnectBtn").tap()
131+
time.sleep(5)
131132
self.assertEqual("Connected to IMX", output.get_text())
132133

133134
def test_7_reconnect_device_code_connect_imx(self):

sample/Tests/test/test_windows_helpers.py

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,29 @@ def login(use_pkce: bool):
5757
# Get all window handles
5858
all_windows = driver.window_handles
5959

60-
print("Find the new window")
61-
new_window = [window for window in all_windows if window != driver.current_window_handle][0]
60+
print(f"Found {len(all_windows)} new windows to check: {all_windows}")
61+
62+
# Find the window with email input
63+
target_window = None
64+
for window in all_windows:
65+
try:
66+
print(f"Checking window: {window}")
67+
driver.switch_to.window(window)
68+
driver.find_element(By.ID, ':r1:')
69+
target_window = window
70+
print(f"Found email input in window: {window}")
71+
break
72+
except:
73+
print(f"Email input not found in window: {window}, trying next...")
74+
continue
75+
76+
if not target_window:
77+
print("Could not find email input field in any window!")
78+
driver.quit()
79+
return
6280

63-
print("Switch to the new window")
64-
driver.switch_to.window(new_window)
81+
print("Switch to the target window")
82+
driver.switch_to.window(target_window)
6583

6684
wait = WebDriverWait(driver, 60)
6785

@@ -133,8 +151,9 @@ def bring_sample_app_to_foreground():
133151

134152
command = [
135153
"powershell.exe",
136-
"-Command",
137-
f"Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process; & '{powershell_script_path}' -appName '{product_name}'"
154+
"-ExecutionPolicy", "Bypass",
155+
"-File", powershell_script_path,
156+
"-appName", product_name
138157
]
139158

140159
subprocess.run(command, check=True)

src/Packages/Passport/Runtime/Scripts/Private/Model/Response/TransactionReceiptResponse.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public class TransactionReceiptResponse
3434

3535
public string to;
3636

37-
public string transactionHash;
37+
public string hash;
3838

3939
public string transactionIndex;
4040

src/Packages/Passport/Runtime/Scripts/Private/PassportImpl.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -753,8 +753,8 @@ public async UniTask<string> ZkEvmSendTransaction(TransactionRequest request)
753753

754754
public async UniTask<TransactionReceiptResponse> ZkEvmSendTransactionWithConfirmation(TransactionRequest request)
755755
{
756-
string json = SerialiseTransactionRequest(request);
757-
string callResponse = await communicationsManager.Call(PassportFunction.ZK_EVM.SEND_TRANSACTION_WITH_CONFIRMATION, json);
756+
var json = SerialiseTransactionRequest(request);
757+
var callResponse = await communicationsManager.Call(PassportFunction.ZK_EVM.SEND_TRANSACTION_WITH_CONFIRMATION, json);
758758
return callResponse.OptDeserializeObject<TransactionReceiptResponse>();
759759
}
760760

src/Packages/Passport/Samples~/SamplesScenesScripts/Scripts/Passport/ZkEvm/ZkEvmSendTransaction/ZkEvmSendTransactionScript.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ private async UniTaskVoid SendTransactionAsync()
7070
if (ConfirmToggle != null && ConfirmToggle.isOn)
7171
{
7272
TransactionReceiptResponse response = await SampleAppManager.PassportInstance.ZkEvmSendTransactionWithConfirmation(request);
73-
ShowOutput($"Transaction hash: {response.transactionHash}\nStatus: {GetTransactionStatusString(response.status)}");
73+
ShowOutput($"Transaction hash: {response.hash}\nStatus: {GetTransactionStatusString(response.status)}");
7474
}
7575
else
7676
{

0 commit comments

Comments
 (0)