Skip to content

Commit 89406a0

Browse files
authored
Merge branch 'main' into feat/android-16kb-requirement
2 parents 09ecc74 + ef84315 commit 89406a0

41 files changed

Lines changed: 1803 additions & 112 deletions

File tree

Some content is hidden

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

.github/actions/smart-e2e-selection/action.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ inputs:
2727
required: false
2828
default: 'false'
2929
base-ref:
30-
description: 'PR base branch ref passed to the AI analysis script for diff comparison. When release/*, AI selection is skipped and the full E2E suite is selected.'
30+
description: 'PR base branch ref passed to the AI analysis script for diff comparison. When release/* or stable, AI selection is skipped and the full E2E suite is selected.'
3131
required: false
3232
default: ''
3333
outputs:
@@ -57,15 +57,15 @@ runs:
5757
echo "⏭️ SKIP=true due to 'skip-smart-e2e-selection' label on PR"
5858
fi
5959
60-
- name: Check release target branch (full E2E, no AI selection)
60+
- name: Check release or stable target branch (full E2E, no AI selection)
6161
id: check-release-target
6262
shell: bash
6363
run: |
6464
echo "SKIP=false" >> "$GITHUB_OUTPUT"
6565
BASE='${{ inputs.base-ref }}'
66-
if [[ -n "$BASE" && "$BASE" == release/* ]]; then
66+
if [[ -n "$BASE" && ( "$BASE" == release/* || "$BASE" == "stable" ) ]]; then
6767
echo "SKIP=true" >> "$GITHUB_OUTPUT"
68-
echo "⏭️ Base branch is release/* — skipping AI E2E selection; full E2E suite will run"
68+
echo "⏭️ Base branch is release/* or stable — skipping AI E2E selection; full E2E suite will run"
6969
fi
7070
7171
- name: Checkout for PR analysis
@@ -142,9 +142,9 @@ runs:
142142
echo "SKIP_REASON=skip-smart-e2e-selection label found" >> "$GITHUB_OUTPUT"
143143
echo "ai_confidence=100" >> "$GITHUB_OUTPUT"
144144
elif [[ "${{ steps.check-release-target.outputs.SKIP }}" == "true" ]]; then
145-
echo "⏭️ Skipping AI analysis - PR targets a release branch (release/*)"
145+
echo "⏭️ Skipping AI analysis - PR targets a release or stable branch"
146146
echo "SKIPPED=true" >> "$GITHUB_OUTPUT"
147-
echo "SKIP_REASON=PR targets a release branch (release/*)" >> "$GITHUB_OUTPUT"
147+
echo "SKIP_REASON=PR targets a release or stable branch (release/* or stable)" >> "$GITHUB_OUTPUT"
148148
echo "ai_confidence=100" >> "$GITHUB_OUTPUT"
149149
else
150150
echo "✅ Running AI analysis for PR #$PR_NUMBER"

.github/guidelines/E2E_DECISION_TREE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Flakiness detection is applied to modified E2E test files in PRs:
5656

5757
## Release branches
5858

59-
PRs to release branches (cherry-picked from main) are exempt from the following:
59+
PRs to release branches (cherry-picks from main to release/\* branches and PRs to stable branch) are exempt from the following:
6060

6161
- Label `pr-not-ready-for-e2e` is not applied
6262
- Smart AI E2E selection is skipped - all E2E suites are run (if changes are not ignorable-only, e.g. only docs)

.github/workflows/auto-label-not-ready-for-e2e.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
types: [opened]
88
branches-ignore:
99
- 'release/**'
10+
- 'stable'
1011

1112
jobs:
1213
add-label:

app/components/UI/Card/Views/CardAuthentication/CardAuthentication.test.tsx

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,20 @@ jest.mock('../../../../../core/Engine', () => ({
2424
},
2525
}));
2626

27+
const mockNavigationServiceNavigate = jest.fn();
28+
const mockNavigationServiceGoBack = jest.fn();
29+
jest.mock('../../../../../core/NavigationService', () => ({
30+
__esModule: true,
31+
default: {
32+
get navigation() {
33+
return {
34+
navigate: mockNavigationServiceNavigate,
35+
goBack: mockNavigationServiceGoBack,
36+
};
37+
},
38+
},
39+
}));
40+
2741
const mockNavigate = jest.fn();
2842
const mockGoBack = jest.fn();
2943
const mockReset = jest.fn();
@@ -442,6 +456,35 @@ describe('CardAuthentication Component', () => {
442456
});
443457
});
444458

459+
it('pops Card.ROOT off the root navigator on successful login when postAuthRedirect is set (no inner Card-stack reset, no cross-stack navigate)', async () => {
460+
mockRouteParams = {
461+
postAuthRedirect: {
462+
screen: Routes.MONEY.ROOT,
463+
params: { screen: Routes.MONEY.HOME },
464+
},
465+
};
466+
mockSubmitMutateAsync.mockResolvedValue({ done: true });
467+
render();
468+
const emailInput = screen.getByTestId('email-field');
469+
const passwordInput = screen.getByTestId('password-field');
470+
const loginButton = screen.getByTestId(
471+
CardAuthenticationSelectors.VERIFY_ACCOUNT_BUTTON,
472+
);
473+
474+
fireEvent.changeText(emailInput, 'test@example.com');
475+
fireEvent.changeText(passwordInput, 'password123');
476+
fireEvent.press(loginButton);
477+
478+
await waitFor(() => {
479+
expect(mockNavigationServiceGoBack).toHaveBeenCalledTimes(1);
480+
});
481+
// The origin (e.g. the Money tab) lives below Card.ROOT in the outer
482+
// navigator — popping reveals it without touching its own state or
483+
// doing a cross-stack navigate.
484+
expect(mockNavigationServiceNavigate).not.toHaveBeenCalled();
485+
expect(mockReset).not.toHaveBeenCalled();
486+
});
487+
445488
it('does not navigate when login error exists', () => {
446489
mockUseCardAuth.mockReturnValue(
447490
makeDefaultHookReturn({

app/components/UI/Card/Views/CardAuthentication/CardAuthentication.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import { selectCardUserLocation } from '../../../../../selectors/cardController'
3030
import { CardMessageBoxType, type CardLocation } from '../../types';
3131
import { CardActions, CardScreens } from '../../util/metrics';
3232
import OnboardingStep from '../../components/Onboarding/OnboardingStep';
33+
import NavigationService from '../../../../../core/NavigationService';
3334
import { useTailwind } from '@metamask/design-system-twrnc-preset';
3435
import { countryCodeToFlag } from '../../util/countryCodeToFlag';
3536

@@ -41,7 +42,12 @@ const autoComplete = Platform.select<TextInputProps['autoComplete']>({
4142

4243
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
4344
type CardAuthenticationParams = {
44-
CardAuthentication: { showAuthPrompt?: boolean } | undefined;
45+
CardAuthentication:
46+
| {
47+
showAuthPrompt?: boolean;
48+
postAuthRedirect?: { screen: string; params?: object };
49+
}
50+
| undefined;
4551
};
4652

4753
const CardAuthentication = () => {
@@ -51,6 +57,7 @@ const CardAuthentication = () => {
5157
const route =
5258
useRoute<RouteProp<CardAuthenticationParams, 'CardAuthentication'>>();
5359
const showAuthPrompt = route.params?.showAuthPrompt ?? false;
60+
const postAuthRedirect = route.params?.postAuthRedirect;
5461
const [email, setEmail] = useState('');
5562
const [password, setPassword] = useState('');
5663
const [isPasswordVisible, setIsPasswordVisible] = useState(false);
@@ -207,6 +214,11 @@ const CardAuthentication = () => {
207214
return;
208215
}
209216

217+
if (postAuthRedirect) {
218+
NavigationService.navigation?.goBack();
219+
return;
220+
}
221+
210222
// Successful login — navigate to home
211223
navigation.reset({
212224
index: 0,
@@ -228,6 +240,7 @@ const CardAuthentication = () => {
228240
dispatch,
229241
trackEvent,
230242
createEventBuilder,
243+
postAuthRedirect,
231244
],
232245
);
233246

0 commit comments

Comments
 (0)