fix: fix: wallet connector panel not rendering at standard viewports — blocks all user funnels (#1156)
Root cause: the test wallet provider's eth_accounts and getProviderState always returned the account address regardless of connection state. This caused wagmi to auto-connect via EIP-6963 provider discovery, skipping the 'disconnected' status entirely. As a result, .connect-button--disconnected never rendered and .connectors-element was never shown. Changes: - wallet-provider: eth_accounts returns [] when not connected (EIP-1193 compliant) - wallet-provider: getProviderState returns empty accounts when not connected - All wallet connection helpers: handle auto-reconnect case, increase timeout for wagmi to settle into disconnected state (5s → 10s) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
f2e7369ec5
commit
db9e99f4c0
5 changed files with 117 additions and 88 deletions
|
|
@ -138,27 +138,39 @@ export interface TestReport {
|
|||
*/
|
||||
export async function connectWallet(page: Page): Promise<void> {
|
||||
console.log('[HELPER] Connecting wallet...');
|
||||
|
||||
|
||||
// Wait for Vue app to mount (increased timeout for post-chain-reset scenarios)
|
||||
const navbarTitle = page.locator('.navbar-title').first();
|
||||
await navbarTitle.waitFor({ state: 'visible', timeout: 60_000 });
|
||||
|
||||
|
||||
// Trigger resize event for mobile detection; connectButton.isVisible below waits for layout
|
||||
await page.evaluate(() => {
|
||||
window.dispatchEvent(new Event('resize'));
|
||||
});
|
||||
|
||||
// Try desktop Connect button first
|
||||
// Wait for wagmi to settle — the connect button or connected display must appear.
|
||||
// After the wallet-provider fix, eth_accounts returns [] when not connected,
|
||||
// so wagmi should land on 'disconnected' status and render the connect button.
|
||||
const connectButton = page.locator('.connect-button--disconnected').first();
|
||||
|
||||
if (await connectButton.isVisible({ timeout: 5_000 })) {
|
||||
console.log('[HELPER] Found desktop Connect button');
|
||||
await connectButton.click();
|
||||
// Wait for the connector panel to open — .connectors-element appearing is the observable event
|
||||
const injectedConnector = page.locator('.connectors-element').first();
|
||||
await injectedConnector.waitFor({ state: 'visible', timeout: 10_000 });
|
||||
console.log('[HELPER] Clicking wallet connector...');
|
||||
await injectedConnector.click();
|
||||
const connectedButton = page.locator('.connect-button--connected').first();
|
||||
|
||||
// Wait for either the disconnect button (normal case) or connected button (auto-reconnect)
|
||||
const desktopButton = page.locator('.connect-button--disconnected, .connect-button--connected').first();
|
||||
|
||||
if (await desktopButton.isVisible({ timeout: 10_000 })) {
|
||||
if (await connectedButton.isVisible({ timeout: 500 }).catch(() => false)) {
|
||||
// Wallet already connected (e.g. wagmi reconnected from storage) — skip connect flow
|
||||
console.log('[HELPER] Wallet already connected (auto-reconnect)');
|
||||
} else {
|
||||
// Desktop connect button found — click to open connector panel
|
||||
console.log('[HELPER] Found desktop Connect button');
|
||||
await connectButton.click();
|
||||
// Wait for the connector panel to open — .connectors-element appearing is the observable event
|
||||
const injectedConnector = page.locator('.connectors-element').first();
|
||||
await injectedConnector.waitFor({ state: 'visible', timeout: 10_000 });
|
||||
console.log('[HELPER] Clicking wallet connector...');
|
||||
await injectedConnector.click();
|
||||
}
|
||||
} else {
|
||||
// Try mobile fallback
|
||||
const mobileLoginIcon = page.locator('.navbar-end svg').first();
|
||||
|
|
@ -170,7 +182,7 @@ export async function connectWallet(page: Page): Promise<void> {
|
|||
await injectedConnector.click();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Verify wallet is connected
|
||||
const walletDisplay = page.getByText(/0x[a-fA-F0-9]{4}/i).first();
|
||||
await walletDisplay.waitFor({ state: 'visible', timeout: 15_000 });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue