test(e2e): add wallet connect flow E2E tests with mocked Freighter and SEP-10 auth#259
Open
Ebby46 wants to merge 17 commits into
Open
test(e2e): add wallet connect flow E2E tests with mocked Freighter and SEP-10 auth#259Ebby46 wants to merge 17 commits into
Ebby46 wants to merge 17 commits into
Conversation
Contributor
|
@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
Author
|
please review and merge!!!!!!!! |
Contributor
|
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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