test(e2e): add wallet connect flow E2E tests with mocked Freighter and SEP-10 auth#259
test(e2e): add wallet connect flow E2E tests with mocked Freighter and SEP-10 auth#259Ebby46 wants to merge 17 commits into
Conversation
|
@Ebby46 is attempting to deploy a commit to the K1NGD4VID Team on Vercel. A member of the Team first needs to authorize it. |
|
@Ebby46 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
60b7b5d to
ad69f25
Compare
…d SEP-10 auth - Add wallet-connect-flow.spec.ts with tests covering: - Wallet connection via mocked Freighter - SEP-10 challenge-sign-verify auth flow - Disconnect and state reset - Reconnection behavior - Error states (Freighter not installed, user rejection) - Add @playwright/test devDependency and test:e2e scripts - Add E2E test stage to CI pipeline with Playwright browser install Closes TrusTrove#155
ad69f25 to
3a261db
Compare
- Fix Go indexer test: add missing ledgerClosedAt arg to handleDeliveryConfirmed call - Fix usePool.test.ts: mock useTokenAllowance hook - Fix useInvoices.test.ts: mock useTokenAllowance hook, add InvoiceClient.get mock - Fix toast.test.tsx: use vi.hoisted() for mock vars, fix sr-only assertions
…ss, correct formatted address in assertions - Fix freighter fixture: requestAccess now returns the mock address (was empty string), so the WalletConnect component shows connected state - Fix wallet-connect-flow.spec.ts: expect formatted address GBMOCK...XXXX (4 X's) instead of 5 - Fix invoice-lifecycle.spec.ts: same formatted address fix
…d of window.freighter methods @stellar/freighter-api v2 communicates via window.postMessage, not by reading methods from window.freighter. The old fixture never worked. Now properly intercepts FREIGHTER_EXTERNAL_MSG_REQUEST messages and responds with FREIGHTER_EXTERNAL_MSG_RESPONSE for each message type. Supports rejection via __FREIGHTER_REJECT_ACCESS__ flag.
…nsion messages The @stellar/freighter-api v2 communicates with the extension via window.postMessage. Instead of trying to listen for message events (which has timing issues), we now monkey-patch postMessage to intercept FREIGHTER_EXTERNAL_MSG_REQUEST messages and respond with mocked data after a short delay. Also simplifies the mock: window.freighter = true is enough for isConnected() to return true (it checks this synchronously first).
…stMessage interception The @stellar/freighter-api v2 postMessage protocol is complex to mock. Instead, add E2E test hooks directly in lib/freighter.ts that check window.__MOCK_FREIGHTER_ADDRESS__, __MOCK_FREIGHTER_ERROR__, and __MOCK_FREIGHTER_DISABLED__ flags before calling the real API. This is a standard E2E pattern - the mock checks add minimal overhead and make the code properly testable without modifying production logic.
… actual UI - Fix route from /dashboard/issuer to /dashboard (actual dashboard route) - Fix button texts: Next -> REVIEW FINANCING TERMS, Confirm & Create -> SIGN & LIST - Fix success text to match actual toast message
- Add __MOCK_PROFILE_VERIFIED__ window flag to useProfile.ts so Create Invoice button is enabled in E2E tests - Add mock flag to invoice-lifecycle test - Fix reload test: Zustand doesn't persist connected state, so reconnect after page reload instead of expecting auto-connect
|
please review and merge!!!!!!!! |
|
Resolve Merge Conflict and fix error @Ebby46 |
… use valid buyer key - Add to wallet store partialize so state persists across navigation - Replace invalid Playwright getByLabelText with getByLabel - Add aria-label attributes to form inputs for Playwright locators - Use valid Stellar public key for buyer address in test
- Fix TransactionPending.tsx: wrong closing tag (Modal -> div) - Fix useBalances.ts: restore pre-merge version with proper structure - Fix ConfirmationDialog.tsx: move useFocusTrap before early return - Fix TopStatusBar.tsx: add missing import, fix isError rename - Fix lp/page.tsx: add missing import, use motion.path - Fix app/page.tsx: escape quotes for ESLint - Fix useAppError.ts: inline getErrorMessage helper - Fix wallet.test.ts: update for persisted connected state - Add GetServerKeypair to api/handlers.go for Go build
|
Heads up — this PR is currently in CONFLICTING/DIRTY state and CI on Filed by the post-wave audit sweep. |
Implements E2E test coverage for the wallet connect flow as described in #155.
Changes
apps/web/e2e/wallet-connect-flow.spec.tscovering:@playwright/testdevDependency andtest:e2e/test:e2e:uiscriptsCloses #155