Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/scripts/known-feature-flag-constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const FILE_SOURCES: Array<{ key: string; file: string; exportName: string }> = [
{ key: 'TRON_REWARDS_FLAG_NAME', file: REWARDS_FILE, exportName: 'TRON_REWARDS_FLAG_NAME' },
{ key: 'SNAPSHOTS_REWARDS_FLAG_NAME', file: REWARDS_FILE, exportName: 'SNAPSHOTS_REWARDS_FLAG_NAME' },
{ key: 'MISSING_ENROLLED_ACCOUNTS_FLAG_NAME', file: REWARDS_FILE, exportName: 'MISSING_ENROLLED_ACCOUNTS_FLAG_NAME' },
{ key: 'ACCOUNT_MENU_FLAG_KEY', file: sel('accountMenu'), exportName: 'ACCOUNT_MENU_FLAG_KEY' },
{ key: 'NETWORK_MANAGEMENT_FLAG_KEY', file: sel('networkManagement'), exportName: 'NETWORK_MANAGEMENT_FLAG_KEY' },
// FEATURE_FLAG_NAME is omitted (non-unique across rwa / gasFeesSponsored); per-file fallback handles it.
{ key: 'OTA_UPDATES_FLAG_NAME', file: sel('otaUpdates'), exportName: 'OTA_UPDATES_FLAG_NAME' },
Expand Down
58 changes: 57 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,23 @@ concurrency:
cancel-in-progress: ${{ !(contains(github.ref, 'refs/heads/main') || contains(github.ref, 'refs/heads/stable')) }}

jobs:
check-skip-merge-queue:
name: Check if pull request can skip merge queue
runs-on: ubuntu-latest
outputs:
skip-merge-queue: ${{ steps.check-skip-merge-queue.outputs.up-to-date }}
steps:
- name: Check pull request merge queue status
id: check-skip-merge-queue
if: github.event_name == 'merge_group'
uses: MetaMask/github-tools/.github/actions/check-skip-merge-queue@v1

check-diff:
name: Check diff
runs-on: macos-latest
if: github.event_name != 'merge_group' || needs.check-skip-merge-queue.outputs.skip-merge-queue != 'true'
needs:
- check-skip-merge-queue
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
Expand Down Expand Up @@ -64,7 +79,11 @@ jobs:
fi

dedupe:
name: Dedupe
runs-on: ubuntu-latest
if: github.event_name != 'merge_group' || needs.check-skip-merge-queue.outputs.skip-merge-queue != 'true'
needs:
- check-skip-merge-queue
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
Expand Down Expand Up @@ -96,7 +115,11 @@ jobs:
fi

git-safe-dependencies:
name: Run `@lavamoat/git-safe-dependencies`
runs-on: ubuntu-latest
if: github.event_name != 'merge_group' || needs.check-skip-merge-queue.outputs.skip-merge-queue != 'true'
needs:
- check-skip-merge-queue
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
Expand All @@ -121,7 +144,11 @@ jobs:
command: yarn git-safe-dependencies

scripts:
name: Run `${{ matrix.scripts }}`
runs-on: ubuntu-latest
if: github.event_name != 'merge_group' || needs.check-skip-merge-queue.outputs.skip-merge-queue != 'true'
needs:
- check-skip-merge-queue
strategy:
matrix:
scripts:
Expand Down Expand Up @@ -160,7 +187,11 @@ jobs:
fi

js-bundle-size-check:
name: JS bundle size check
runs-on: ubuntu-latest
if: github.event_name != 'merge_group' || needs.check-skip-merge-queue.outputs.skip-merge-queue != 'true'
needs:
- check-skip-merge-queue
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Expand Down Expand Up @@ -193,6 +224,7 @@ jobs:
retention-days: 7

ship-js-bundle-size-check:
name: Ship JS bundle size check
runs-on: ubuntu-latest
needs: [js-bundle-size-check]
if: ${{ github.ref == 'refs/heads/main' }}
Expand All @@ -214,6 +246,9 @@ jobs:
check-workflows:
name: Check workflows
runs-on: ubuntu-latest
if: github.event_name != 'merge_group' || needs.check-skip-merge-queue.outputs.skip-merge-queue != 'true'
needs:
- check-skip-merge-queue
steps:
- uses: actions/checkout@v4
- name: Download actionlint
Expand All @@ -225,7 +260,11 @@ jobs:
shell: bash

unit-tests:
name: Unit tests (${{ matrix.shard }})
runs-on: ubuntu-latest
if: github.event_name != 'merge_group' || needs.check-skip-merge-queue.outputs.skip-merge-queue != 'true'
needs:
- check-skip-merge-queue
strategy:
matrix:
shard: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Expand Down Expand Up @@ -384,7 +423,11 @@ jobs:
fi

component-view-tests:
name: Component view tests
runs-on: ubuntu-latest
if: github.event_name != 'merge_group' || needs.check-skip-merge-queue.outputs.skip-merge-queue != 'true'
needs:
- check-skip-merge-queue
strategy:
matrix:
shard: [1, 2]
Expand Down Expand Up @@ -432,7 +475,9 @@ jobs:
smart-e2e-selection:
name: 'Smart E2E Selection'
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.head.repo.fork }}
if: ${{ (github.event_name != 'merge_group' || needs.check-skip-merge-queue.outputs.skip-merge-queue != 'true') && !github.event.pull_request.head.repo.fork }}
needs:
- check-skip-merge-queue
continue-on-error: true
permissions:
contents: read
Expand Down Expand Up @@ -631,6 +676,7 @@ jobs:
run: node .github/scripts/e2e-report-fixture-validation.mjs

sonar-cloud:
name: SonarCloud analysis
runs-on: ubuntu-latest
needs: merge-unit-and-component-view-tests
if: ${{ !cancelled() && github.event_name != 'merge_group' && !github.event.pull_request.head.repo.fork }}
Expand Down Expand Up @@ -675,6 +721,7 @@ jobs:
done

sonar-cloud-quality-gate-status:
name: SonarCloud quality gate status
runs-on: ubuntu-latest
needs: sonar-cloud
if: ${{ !cancelled() && github.event_name != 'merge_group' && !github.event.pull_request.head.repo.fork }}
Expand Down Expand Up @@ -790,14 +837,23 @@ jobs:
if: ${{ !cancelled() }}
runs-on: ubuntu-latest
needs:
- check-skip-merge-queue
- all-jobs-pass
- needs_e2e_build
- e2e-smoke-tests-android
- e2e-smoke-tests-ios
- e2e-smoke-tests-android-flask
- e2e-smoke-tests-ios-flask
env:
SKIPPED: ${{ needs.check-skip-merge-queue.outputs.skip-merge-queue == 'true' }}
steps:
- run: |
# If the merge queue was skipped, consider all jobs as passed
if [[ "$SKIPPED" == "true" ]]; then
echo "Merge queue skipped, considering all jobs as passed"
exit 0
fi

# Check if all non-E2E jobs passed
if [[ "${{ needs.all-jobs-pass.outputs.ALL_JOBS_PASSED }}" != "true" ]]; then
echo "Non-E2E jobs failed"
Expand Down
35 changes: 2 additions & 33 deletions app/component-library/components/Navigation/TabBar/TabBar.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { backgroundState } from '../../../../util/test/initial-root-state';
import TabBar from './TabBar';
import { TabBarIconKey, ExtendedBottomTabDescriptor } from './TabBar.types';
import Routes from '../../../../constants/navigation/Routes';
import { useAccountMenuEnabled } from '../../../../selectors/featureFlagController/accountMenu/useAccountMenuEnabled';

// Minimal descriptor interface for tests - only includes what TabBar component uses
interface TestTabDescriptor {
Expand All @@ -30,14 +29,6 @@ interface TestDescriptors {
[key: string]: TestTabDescriptor;
}

// Mock account menu feature flag hook
jest.mock(
'../../../../selectors/featureFlagController/accountMenu/useAccountMenuEnabled',
() => ({
useAccountMenuEnabled: jest.fn(() => false),
}),
);

// Mock the navigation object with proper typing
const navigation: NavigationHelpers<ParamListBase> = {
navigate: jest.fn(),
Expand Down Expand Up @@ -129,10 +120,7 @@ describe('TabBar', () => {
expect(toJSON()).toMatchSnapshot();
});

it('navigates to the correct screen when a tab is pressed and account menu is disabled', () => {
// Explicitly disable the account menu feature flag for this test
jest.mocked(useAccountMenuEnabled).mockReturnValue(false);

it('navigates to the correct screen when a tab is pressed', () => {
const { getByTestId } = renderWithProvider(
<TabBar
state={state as TabNavigationState<ParamListBase>}
Expand Down Expand Up @@ -168,7 +156,7 @@ describe('TabBar', () => {

fireEvent.press(getByTestId(`tab-bar-item-${TabBarIconKey.Setting}`));
expect(navigation.navigate).toHaveBeenCalledWith(Routes.SETTINGS_VIEW, {
screen: 'Settings',
screen: Routes.ACCOUNTS_MENU_VIEW,
});
});

Expand Down Expand Up @@ -230,23 +218,4 @@ describe('TabBar', () => {
fireEvent.press(getByTestId(`tab-bar-item-${TabBarIconKey.Trending}`));
expect(navigation.navigate).toHaveBeenCalledWith(Routes.TRENDING_VIEW);
});

it('navigates to Accounts Menu when settings tab is pressed and account menu is enabled', () => {
// Enable the account menu feature flag for this test
jest.mocked(useAccountMenuEnabled).mockReturnValue(true);

const { getByTestId } = renderWithProvider(
<TabBar
state={state as TabNavigationState<ParamListBase>}
descriptors={descriptors as Record<string, ExtendedBottomTabDescriptor>}
navigation={navigation}
/>,
{ state: mockInitialState },
);

fireEvent.press(getByTestId(`tab-bar-item-${TabBarIconKey.Setting}`));
expect(navigation.navigate).toHaveBeenCalledWith(Routes.SETTINGS_VIEW, {
screen: Routes.ACCOUNTS_MENU_VIEW,
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import {
LABEL_BY_TAB_BAR_ICON_KEY,
} from './TabBar.constants';
import { selectChainId } from '../../../../selectors/networkController';
import { useAccountMenuEnabled } from '../../../../selectors/featureFlagController/accountMenu/useAccountMenuEnabled';

const FILLED_ICONS: Partial<Record<TabBarIconKey, IconName>> = {
[TabBarIconKey.Wallet]: IconName.HomeFilled,
Expand All @@ -41,7 +40,6 @@ const TabBar = ({ state, descriptors, navigation }: TabBarProps) => {
const { trackEvent, createEventBuilder } = useAnalytics();
const { bottom: bottomInset } = useSafeAreaInsets();
const chainId = useSelector(selectChainId);
const isAccountMenuEnabled = useAccountMenuEnabled();
const tabBarRef = useRef(null);
const previousTabIndexRef = useRef<number>(state.index);
const tw = useTailwind();
Expand Down Expand Up @@ -107,9 +105,7 @@ const TabBar = ({ state, descriptors, navigation }: TabBarProps) => {
break;
case Routes.SETTINGS_VIEW:
navigation.navigate(Routes.SETTINGS_VIEW, {
screen: isAccountMenuEnabled
? Routes.ACCOUNTS_MENU_VIEW
: 'Settings',
screen: Routes.ACCOUNTS_MENU_VIEW,
});
break;
case Routes.TRENDING_VIEW:
Expand Down Expand Up @@ -146,7 +142,6 @@ const TabBar = ({ state, descriptors, navigation }: TabBarProps) => {
trackEvent,
createEventBuilder,
tw,
isAccountMenuEnabled,
],
);

Expand Down
Loading
Loading