Skip to content

Commit 0247941

Browse files
Merge branch 'main' into fix/20982-update-send-nft-flow-to-use-correct-chainid
2 parents 5526316 + 34a01a9 commit 0247941

File tree

229 files changed

+4989
-2123
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

229 files changed

+4989
-2123
lines changed

.cursor/BUGBOT.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,18 @@ Automated test quality enforcement and bug detection for MetaMask Mobile React N
66

77
## Execution Protocol
88

9-
### 1. Initial Setup
9+
### 1. Initial Setup - Unit Tests
1010

1111
- **ALWAYS** load and reference [unit testing guidelines](rules/unit-testing-guidelines.mdc)
1212
- Verify test file naming pattern: `*.test.{ts,tsx,js,jsx}`
1313
- Check for proper Jest/React Native Testing Library imports
1414

15-
Use the rules in the[unit testing guidelines](rules/unit-testing-guidelines.mdc) to enforce the test quality and bug detection.
15+
Use the rules in the [unit testing guidelines](rules/unit-testing-guidelines.mdc) to enforce the test quality and bug detection.
16+
17+
### 2. Initial Setup - E2E Tests
18+
19+
- **ALWAYS** load and reference [e2e-testing-guidelines](rules/e2e-testing-guidelines.mdc)
20+
- Verify test file naming pattern: `e2e/specs/**/*.spec.{js,ts}`
21+
- Check for proper imports and framework utilities from `e2e/framework/index.ts`
22+
23+
Use the rules in the [e2e-testing-guidelines](rules/e2e-testing-guidelines.mdc) to enforce the test quality and bug detection.

e2e/.cursor/rules/e2e-testing-guidelines.mdc renamed to .cursor/rules/e2e-testing-guidelines.mdc

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,17 @@ alwaysApply: true
2323
- Include multiple behaviors with 'and' in a single test name
2424
- Use vague or generic names
2525

26-
## Test Organization
26+
## Test Organization - MANDATORY
2727

2828
- Organize tests into folders based on features and scenarios
2929
- Each feature team should own one or more folders of tests
3030
- Follow the same organization pattern as the extension team for consistency
3131
- Place tests in logical feature directories:
3232
```
33-
e2e/tests/tokens/import/import-erc1155.spec.js
34-
e2e/tests/settings/clear-activity.spec.js
35-
e2e/tests/ppom/ppom-blockaid-alert-erc20-approval.spec.js
33+
e2e/specs/<feature-name>/<e2e-test-name.spec.ts>
34+
e2e/specs/tokens/import/import-erc1155.spec.ts
35+
e2e/specs/settings/clear-activity.spec.ts
36+
e2e/specs/ppom/ppom-blockaid-alert-erc20-approval.spec.ts
3637
```
3738

3839
## Framework Architecture
@@ -161,7 +162,7 @@ export default new LoginPage();
161162
});
162163
```
163164

164-
### Framework Imports
165+
### Framework Imports - MANDATORY
165166
- ALWAYS import framework utilities from `e2e/framework/index.ts`, not from individual utility files
166167
- Use the centralized framework exports for consistency and maintainability
167168

@@ -189,7 +190,7 @@ await Gestures.tap(processingButton, {
189190
});
190191
```
191192

192-
### Prohibited Patterns in Test Specs
193+
### Prohibited Patterns in Test Specs - MANDATORY
193194
The following patterns are prohibited in test specs:
194195

195196
1. **Direct Element Selection**
@@ -273,7 +274,7 @@ async tapOpenAllTabsButton(): Promise<void> {
273274
}
274275
```
275276

276-
## Code Review Checklist
277+
## Code Review Checklist - MANDATORY
277278

278279
Before submitting E2E tests, ensure:
279280

.github/guidelines/LABELING_GUIDELINES.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ The check can be bypassed when necessary, either by setting the changelog entry
1919

2020
Any label can be manually added on demand depending on the PR's content. For instance, the label **QA passed** will indicate that a thorough manual testing has been performed and the PR is ready to be merged. In addition, following labels have some specific use cases.
2121

22-
### Run Flask Android E2E tests
23-
24-
- **run-android-flask-e2e-smoke**: The Android Flask E2E smoke tests jobs will run in the given PR. They also run on schedule on main branch.
25-
2622
### Bypass Quality Gates
2723

2824
Using any of these labels should be exceptional in case of CI friction and urgencies. Please use them reasonably and verify new changes and regressions manually.

.github/workflows/ci.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,8 @@ jobs:
257257
repository: ${{ github.repository }}
258258
post-comment: 'true'
259259

260+
# Main E2E tests
261+
260262
build-android-apks:
261263
name: 'Build Android APKs'
262264
if: ${{ github.event_name != 'merge_group' && needs.needs_e2e_build.outputs.android_changed == 'true' }}
@@ -314,6 +316,34 @@ jobs:
314316
changed_files: ${{ needs.needs_e2e_build.outputs.changed_files }}
315317
secrets: inherit
316318

319+
# Flask E2E tests
320+
321+
build-android-flask-apks:
322+
name: 'Build Android Flask APKs'
323+
if: ${{ github.event_name != 'merge_group' && needs.needs_e2e_build.outputs.android_changed == 'true' }}
324+
permissions:
325+
contents: read
326+
id-token: write
327+
needs: [needs_e2e_build]
328+
uses: ./.github/workflows/build-android-e2e.yml
329+
with:
330+
build_type: 'flask'
331+
metamask_environment: 'e2e'
332+
keystore_target: 'flask'
333+
secrets: inherit
334+
335+
e2e-smoke-tests-android-flask:
336+
name: 'Android Flask E2E Smoke Tests'
337+
if: ${{ github.event_name != 'merge_group' && needs.needs_e2e_build.outputs.android_changed == 'true' }}
338+
permissions:
339+
contents: read
340+
id-token: write
341+
needs: [needs_e2e_build, build-android-flask-apks]
342+
uses: ./.github/workflows/run-e2e-smoke-tests-android-flask.yml
343+
with:
344+
changed_files: ${{ needs.needs_e2e_build.outputs.changed_files }}
345+
secrets: inherit
346+
317347
js-bundle-size-check:
318348
runs-on: ubuntu-latest
319349
steps:
@@ -334,6 +364,8 @@ jobs:
334364

335365
- name: Generate iOS bundle
336366
run: yarn gen-bundle:ios
367+
env:
368+
NODE_OPTIONS: --max_old_space_size=8192
337369

338370
- name: Check bundle size
339371
run: ./scripts/js-bundle-stats.sh ios/main.jsbundle 52
@@ -499,6 +531,7 @@ jobs:
499531
- needs_e2e_build
500532
- e2e-smoke-tests-android
501533
- e2e-smoke-tests-ios
534+
- e2e-smoke-tests-android-flask
502535
steps:
503536
- run: |
504537
# Check if all non-E2E jobs passed
@@ -517,6 +550,10 @@ jobs:
517550
echo "iOS E2E tests failed"
518551
exit 1
519552
fi
553+
if [[ "${{ needs.e2e-smoke-tests-android-flask.result }}" == "failure" ]]; then
554+
echo "Android Flask E2E tests failed"
555+
exit 1
556+
fi
520557
fi
521558
522559
echo "All required jobs passed"

.github/workflows/run-e2e-smoke-tests-android-flask.yml

Lines changed: 12 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,41 @@
11
name: Android Flask E2E Smoke Tests
22

33
on:
4-
pull_request:
5-
types: [labeled, opened, synchronize]
6-
schedule:
7-
# Run the full suite every 3 hours
8-
# This helps to identy the flaky and failed tests on main branch
9-
- cron: '0 */3 * * *'
4+
workflow_call:
5+
inputs:
6+
changed_files:
7+
description: 'Changed files'
8+
required: false
9+
type: string
10+
default: ''
1011

11-
concurrency:
12-
group: ${{ github.workflow }}-${{ github.ref }}
13-
cancel-in-progress: ${{ !(contains(github.ref, 'refs/heads/main') || contains(github.ref, 'refs/heads/stable')) }}
12+
permissions:
13+
contents: read
14+
id-token: write
1415

1516
jobs:
16-
needs_e2e_build:
17-
name: 'Detect Mobile Build Changes'
18-
# Execution rules:
19-
# - schedule: always run
20-
# - merge_group: never run
21-
# - pull_request: run only if PR has 'run-android-flask-e2e-smoke' label
22-
if: ${{ github.event_name != 'merge_group' && (github.event_name == 'schedule' || (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'run-android-flask-e2e-smoke') && github.event.pull_request.merged == false)) }}
23-
uses: ./.github/workflows/needs-e2e-build.yml
24-
25-
build-android-flask-apps:
26-
name: 'Build Android Flask Apps'
27-
# Execution rules:
28-
# - schedule: always run
29-
# - merge_group: never run
30-
# - pull_request: run only if PR has 'run-android-flask-e2e-smoke' label AND android_changed == 'true'
31-
if: ${{ github.event_name != 'merge_group' && ( github.event_name == 'schedule' || ( github.event_name == 'pull_request' && needs.needs_e2e_build.outputs.android_changed == 'true' && contains(github.event.pull_request.labels.*.name, 'run-android-flask-e2e-smoke') ) ) }}
32-
permissions:
33-
contents: read
34-
id-token: write
35-
needs: [needs_e2e_build]
36-
uses: ./.github/workflows/build-android-e2e.yml
37-
with:
38-
build_type: 'flask'
39-
metamask_environment: 'e2e'
40-
keystore_target: 'flask'
41-
secrets: inherit
42-
4317
flask-android-smoke:
4418
strategy:
4519
matrix:
4620
split: [1, 2, 3]
4721
fail-fast: false
48-
needs: [build-android-flask-apps]
4922
uses: ./.github/workflows/run-e2e-workflow.yml
5023
with:
5124
test-suite-name: flask-android-smoke-${{ matrix.split }}
5225
platform: android
5326
test_suite_tag: 'FlaskBuildTests'
5427
split_number: ${{ matrix.split }}
5528
total_splits: 3
29+
changed_files: ${{ inputs.changed_files }}
5630
build_type: 'flask'
57-
metamask_environment: 'e2e'
5831
secrets: inherit
5932

6033
report-android-smoke-tests:
6134
name: Report Android Smoke Tests
6235
runs-on: ubuntu-latest
63-
if: ${{ !cancelled() && needs.flask-android-smoke.result != 'skipped' }}
36+
if: ${{ !cancelled() }}
6437
needs:
6538
- flask-android-smoke
66-
6739
steps:
6840
- name: Checkout
6941
uses: actions/checkout@v4

app/component-library/components-temp/MultichainAccounts/MultichainAddWalletActions/MultichainAddWalletActions.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { SafeAreaView } from 'react-native';
44
import { useNavigation } from '@react-navigation/native';
55

66
// External dependencies.
7-
import BottomSheetHeader from '../../../../component-library/components/BottomSheets/BottomSheetHeader';
87
import { IconName } from '@metamask/design-system-react-native';
98
import ActionListItem from '../../ActionListItem';
109
import { strings } from '../../../../../locales/i18n';
@@ -88,9 +87,6 @@ const MultichainAddWalletActions = ({
8887
return (
8988
<SafeAreaView>
9089
<Fragment>
91-
<BottomSheetHeader>
92-
{strings('multichain_accounts.add_wallet')}
93-
</BottomSheetHeader>
9490
{actionConfigs.map(
9591
(config) =>
9692
config.isVisible && (

app/component-library/components-temp/MultichainAccounts/MultichainAddWalletActions/__snapshots__/MultichainAddWalletActions.test.tsx.snap

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -313,46 +313,6 @@ exports[`MultichainAddWalletActions renders correctly 1`] = `
313313
}
314314
>
315315
<RCTSafeAreaView>
316-
<View
317-
style={
318-
[
319-
{
320-
"backgroundColor": "#ffffff",
321-
"flexDirection": "row",
322-
"gap": 16,
323-
"padding": 16,
324-
},
325-
false,
326-
]
327-
}
328-
testID="header"
329-
>
330-
<View
331-
style={
332-
{
333-
"alignItems": "center",
334-
"flex": 1,
335-
}
336-
}
337-
>
338-
<Text
339-
accessibilityRole="text"
340-
style={
341-
{
342-
"color": "#121314",
343-
"fontFamily": "Geist Bold",
344-
"fontSize": 16,
345-
"letterSpacing": 0,
346-
"lineHeight": 24,
347-
"textAlign": "center",
348-
}
349-
}
350-
testID="header-title"
351-
>
352-
Add wallet
353-
</Text>
354-
</View>
355-
</View>
356316
<View
357317
accessibilityState={
358318
{

app/components/Nav/App/App.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,15 @@ const RootModalFlow = (props: RootModalFlowProps) => (
416416
<Stack.Screen
417417
name={Routes.SHEET.ACCOUNT_SELECTOR}
418418
component={AccountSelector}
419+
options={{
420+
cardStyle: { backgroundColor: importedColors.transparent },
421+
cardStyleInterpolator: () => ({
422+
overlayStyle: {
423+
opacity: 0,
424+
},
425+
}),
426+
detachPreviousScreen: false,
427+
}}
419428
/>
420429
<Stack.Screen
421430
name={Routes.SHEET.ADDRESS_SELECTOR}

app/components/Nav/Main/MainNavigator.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,9 @@ import {
100100
PerpsScreenStack,
101101
PerpsModalStack,
102102
PerpsTutorialCarousel,
103-
selectPerpsEnabledFlag,
104103
} from '../../UI/Perps';
105-
import {
106-
PredictScreenStack,
107-
PredictModalStack,
108-
selectPredictEnabledFlag,
109-
} from '../../UI/Predict';
104+
import { PredictScreenStack, PredictModalStack } from '../../UI/Predict';
105+
import { useFeatureFlag, FeatureFlagNames } from '../../hooks/useFeatureFlag';
110106
import { selectAssetsTrendingTokensEnabled } from '../../../selectors/featureFlagController/assetsTrendingTokens';
111107
import PerpsPositionTransactionView from '../../UI/Perps/Views/PerpsTransactionsView/PerpsPositionTransactionView';
112108
import PerpsOrderTransactionView from '../../UI/Perps/Views/PerpsTransactionsView/PerpsOrderTransactionView';
@@ -921,11 +917,15 @@ const SampleFeatureFlow = () => (
921917

922918
const MainNavigator = () => {
923919
// Get feature flag state for conditional Perps screen registration
924-
const perpsEnabledFlag = useSelector(selectPerpsEnabledFlag);
920+
const perpsEnabledFlag = useFeatureFlag(
921+
FeatureFlagNames.perpsPerpTradingEnabled,
922+
);
925923
const isEvmSelected = useSelector(selectIsEvmNetworkSelected);
926924
const isPerpsEnabled = useMemo(() => perpsEnabledFlag, [perpsEnabledFlag]);
927925
// Get feature flag state for conditional Predict screen registration
928-
const predictEnabledFlag = useSelector(selectPredictEnabledFlag);
926+
const predictEnabledFlag = useFeatureFlag(
927+
FeatureFlagNames.predictTradingEnabled,
928+
);
929929
const isPredictEnabled = useMemo(
930930
() => predictEnabledFlag,
931931
[predictEnabledFlag],

app/components/UI/AssetOverview/AssetOverview.tsx

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ import {
6262
} from '../../../util/analytics/actionButtonTracking';
6363
import { selectSelectedAccountGroup } from '../../../selectors/multichainAccounts/accountTreeController';
6464
import { selectSelectedInternalAccountByScope } from '../../../selectors/multichainAccounts/accounts';
65-
import { useRampNavigation, RampMode } from '../Ramp/hooks/useRampNavigation';
66-
import { RampType as AggregatorRampType } from '../Ramp/Aggregator/types';
65+
import { useRampNavigation } from '../Ramp/hooks/useRampNavigation';
6766
import { TokenI } from '../Tokens/types';
6867
import AssetDetailsActions from '../../../components/Views/AssetDetails/AssetDetailsActions';
6968
import {
@@ -87,7 +86,7 @@ import { formatChainIdToCaip } from '@metamask/bridge-controller';
8786
import { InitSendLocation } from '../../Views/confirmations/constants/send';
8887
import { useSendNavigation } from '../../Views/confirmations/hooks/useSendNavigation';
8988
import { selectMultichainAccountsState2Enabled } from '../../../selectors/featureFlagController/multichainAccounts';
90-
import parseRampIntent from '../Ramp/Aggregator/utils/parseRampIntent';
89+
import parseRampIntent from '../Ramp/utils/parseRampIntent';
9190
///: BEGIN:ONLY_INCLUDE_IF(tron)
9291
import TronEnergyBandwidthDetail from './TronEnergyBandwidthDetail/TronEnergyBandwidthDetail';
9392
///: END:ONLY_INCLUDE_IF
@@ -169,7 +168,7 @@ const AssetOverview: React.FC<AssetOverviewProps> = ({
169168
///: END:ONLY_INCLUDE_IF
170169

171170
const currentAddress = asset.address as Hex;
172-
const { goToRamps } = useRampNavigation();
171+
const { goToBuy } = useRampNavigation();
173172

174173
const { data: prices = [], isLoading } = useTokenHistoricalPrices({
175174
asset,
@@ -339,13 +338,7 @@ const AssetOverview: React.FC<AssetOverviewProps> = ({
339338
assetId = undefined;
340339
}
341340

342-
goToRamps({
343-
mode: RampMode.AGGREGATOR,
344-
params: {
345-
rampType: AggregatorRampType.BUY,
346-
intent: assetId ? { assetId } : undefined,
347-
},
348-
});
341+
goToBuy({ assetId });
349342

350343
trackEvent(
351344
createEventBuilder(MetaMetricsEvents.BUY_BUTTON_CLICKED)

0 commit comments

Comments
 (0)