test: Add swap quote selector component view tests#27767
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
d45652d to
014f254
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Three issues corrected:
- Add `setGlobalDevModeChecks({ inputStabilityCheck: 'never' })` in
beforeAll to suppress the reselect false-positive thrown by
selectBridgeAppState (which spreads controller slices into a new object
on every call and is app code we cannot change).
- Add missing `trade` field to makeEvmQuote factory; calcRelayerFee
destructures { quote, trade } from the quote response and crashes when
trade is absent.
- Replace the post-render dispatch spy with a store state assertion.
useDispatch() captures store.dispatch at mount time, so a spy set up
after render is never called. Reading selectSelectedQuoteRequestId from
the store after the press is the correct pattern.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
Neither file modifies any production app code, E2E test files (Detox), shared components, controllers, navigation, or any other runtime logic. The changes are entirely isolated to the Jest/component-view test layer. No E2E test tags are needed since no app behavior has changed and no Detox test infrastructure was modified. Running E2E tests would provide no additional validation value for these purely additive test file changes. Performance Test Selection: |
|
racitores
left a comment
There was a problem hiding this comment.
Some comments about cv test rules to follow
| engine: { | ||
| backgroundState: { | ||
| BridgeController: { | ||
| quotes: [quote], | ||
| recommendedQuote: quote, | ||
| quotesLastFetched: now, | ||
| quotesLoadingStatus: 'SUCCEEDED', | ||
| quotesRefreshCount: 0, | ||
| quoteFetchError: null, |
There was a problem hiding this comment.
this is reused on all tests with differences. Maybe can be moved under a preset?
| // selectBridgeAppState spreads multiple controller slices into a new object on every call, | ||
| // which causes reselect's inputStabilityCheck to throw a false positive in tests. | ||
| beforeAll(() => { | ||
| setGlobalDevModeChecks({ inputStabilityCheck: 'never' }); |
There was a problem hiding this comment.
this needs to be restored afterAll
| }); | ||
| }); | ||
|
|
||
| it('shows provider name and total cost label when quotes are available', async () => { |
There was a problem hiding this comment.
we should avoid this type of tests without actions or a few more actions. We should avoid render tests. Give it a though to see if some tests can be modify to be a more user oriented test
There was a problem hiding this comment.
BTW, can we try to include a negative test, like if we have no quotes or something similar that could break the ui?
| } as unknown as Record<string, unknown>, | ||
| }); | ||
|
|
||
| expect(await findByText(strings('bridge.lowest_cost'))).toBeOnTheScreen(); |
There was a problem hiding this comment.
all consts should be moved to the testIds files. Feel fee to expand them in the app if needed for testing




Description
Changelog
CHANGELOG entry:
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Low Risk
Low risk: adds new component-view tests and a test renderer helper without changing production logic.
Overview
Adds component-view tests for
QuoteSelectorViewcovering the info text, loading placeholders, and loaded quote-row rendering (provider name, Total Cost label, destination token symbol, and the Lowest cost recommended badge).Introduces a dedicated
renderQuoteSelectorViewtest helper that builds the Bridge preset state (optionally deterministic fiat + state overrides) and renders the screen viarenderComponentViewScreen.Written by Cursor Bugbot for commit 014f254. This will update automatically on new commits. Configure here.