Skip to content

Commit f10b66e

Browse files
committed
push
1 parent 833b5a7 commit f10b66e

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

commands/playwright.js

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ module.exports = {
4646
return mainWindow;
4747
},
4848
metamaskWindow() {
49+
log(`[metamaskWindow] Returning metamaskWindow: ${metamaskWindow ? 'defined' : 'undefined'}`);
50+
if (metamaskWindow) {
51+
log(`[metamaskWindow] metamaskWindow URL: ${metamaskWindow.url()}`);
52+
}
4953
return metamaskWindow;
5054
},
5155
metamaskNotificationWindow() {
@@ -173,9 +177,14 @@ module.exports = {
173177
} else if (
174178
pageUrl.includes(`chrome-extension://${metamaskExtensionId}/home.html`)
175179
) {
176-
metamaskWindow = page;
177-
metamaskWindowAssigned = true;
178-
log(`[assignWindows] MetaMask window assigned: ${pageUrl}`);
180+
// 优先选择onboarding页面,如果没有onboarding则选择普通home页面
181+
if (pageUrl.includes('#onboarding') || !metamaskWindowAssigned) {
182+
metamaskWindow = page;
183+
metamaskWindowAssigned = true;
184+
log(`[assignWindows] MetaMask window assigned: ${pageUrl}`);
185+
} else {
186+
log(`[assignWindows] MetaMask window already assigned, skipping: ${pageUrl}`);
187+
}
179188
} else if (
180189
pageUrl.includes(
181190
`chrome-extension://${metamaskExtensionId}/notification.html`,
@@ -207,6 +216,12 @@ module.exports = {
207216
log(`[assignWindows] WARNING: MetaMask window not found! Looking for: chrome-extension://${metamaskExtensionId}/home.html`);
208217
}
209218

219+
// 最终检查
220+
log(`[assignWindows] Final metamaskWindow status: ${metamaskWindow ? 'ASSIGNED' : 'NOT ASSIGNED'}`);
221+
if (metamaskWindow) {
222+
log(`[assignWindows] Final metamaskWindow URL: ${metamaskWindow.url()}`);
223+
}
224+
210225
return true;
211226
} catch (error) {
212227
log(`[assignWindows] ERROR: ${error.message}`);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@gracefnr/synpress",
3-
"version": "1.0.25",
3+
"version": "1.0.26",
44
"packageManager": "pnpm@9.1.3",
55
"description": "Synpress is e2e testing framework based around Cypress.io & playwright with included MetaMask support. Test your dapps with ease.",
66
"keywords": [

0 commit comments

Comments
 (0)