Skip to content

Commit b3eb98e

Browse files
committed
Merge branch 'main' into add-justification-field-to-revocation-details
2 parents 6d26c72 + af6e63c commit b3eb98e

File tree

16 files changed

+101
-41
lines changed

16 files changed

+101
-41
lines changed

.github/workflows/run-benchmarks.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ env:
1313
COMMANDS: |
1414
{
1515
standardHome: 'yarn tsx test/e2e/benchmarks/benchmark.ts --out test-artifacts/benchmarks/benchmark-{0}-{1}-standardHome.json --retries 2',
16-
powerUserHome: 'yarn tsx test/e2e/benchmarks/benchmark.ts --persona powerUser --browserLoads 4 --pageLoads 4 --out test-artifacts/benchmarks/benchmark-{0}-{1}-powerUserHome.json --retries 2',
16+
powerUserHome: 'yarn tsx test/e2e/benchmarks/benchmark.ts --persona powerUser --browserLoads 10 --pageLoads 10 --out test-artifacts/benchmarks/benchmark-{0}-{1}-powerUserHome.json --retries 2',
1717
userActions: 'yarn tsx test/e2e/benchmarks/user-actions-benchmark.ts --out test-artifacts/benchmarks/benchmark-{0}-{1}-userActions.json --retries 2',
1818
}
1919
@@ -22,6 +22,11 @@ jobs:
2222
if: ${{ github.event_name != 'merge_group' }} # Skip this job for the Merge Queue
2323
runs-on: ubuntu-22.04
2424
timeout-minutes: 30
25+
container:
26+
image: ghcr.io/metamask/metamask-extension-e2e-image:v24.11.0
27+
credentials:
28+
username: ${{ github.actor }}
29+
password: ${{ secrets.GITHUB_TOKEN }}
2530
strategy:
2631
fail-fast: false
2732
matrix:
@@ -31,7 +36,7 @@ jobs:
3136
name: ${{ matrix.browser }}-${{ matrix.buildType }}-${{ matrix.pageType }}
3237
env:
3338
SELENIUM_BROWSER: ${{ matrix.browser }}
34-
HEADLESS: true
39+
HEADLESS: false
3540
ARTIFACT_NAME: build-test-${{ matrix.buildType }}
3641
OUTPUT_NAME: benchmark-${{ matrix.browser }}-${{ matrix.buildType }}-${{ matrix.pageType }}.json
3742
INFURA_PROJECT_ID: ${{ secrets.INFURA_PROJECT_ID }}
@@ -63,6 +68,13 @@ jobs:
6368
github-token: ${{ secrets.GITHUB_TOKEN }} # This is required when downloading artifacts from a different repository or from a different workflow run.
6469
run-id: ${{ inputs.builds-from-run }} # Download from whatever run the identify-builds job said.
6570

71+
- name: Configure Xvfb
72+
run: Xvfb -ac :99 -screen 0 1280x1024x16 &
73+
74+
# TODO: Pre-install this in the container image
75+
- name: Install AWS CLI (needed in the container)
76+
run: sudo apt-get install python3-pip && sudo pip install awscli --break-system-packages
77+
6678
- name: Run the benchmark
6779
# Choose a benchmark command from env.COMMANDS
6880
# Then replace the {0} placeholder with the browser, and the {1} placeholder with the buildType

app/scripts/controller-init/snaps/execution-service-init.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ describe('ExecutionServiceInit', () => {
6969
messenger: expect.any(Object),
7070
offscreenPromise: expect.any(Promise),
7171
setupSnapProvider: expect.any(Function),
72-
pingTimeout: process.env.IN_TEST ? 60000 : 5000, // see https://github.com/MetaMask/metamask-extension/issues/36935
7372
});
7473
});
7574
});

app/scripts/controller-init/snaps/execution-service-init.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ export const ExecutionServiceInit: ControllerInitFunction<
5656
messenger: controllerMessenger,
5757
setupSnapProvider,
5858
offscreenPromise,
59-
pingTimeout: process.env.IN_TEST ? 60000 : 5000, // see https://github.com/MetaMask/metamask-extension/issues/36935
6059
}),
6160
};
6261
}
@@ -71,7 +70,6 @@ export const ExecutionServiceInit: ControllerInitFunction<
7170
messenger: controllerMessenger,
7271
iframeUrl: new URL(iframeUrl),
7372
setupSnapProvider,
74-
pingTimeout: process.env.IN_TEST ? 60000 : 5000, // see https://github.com/MetaMask/metamask-extension/issues/36935
7573
}),
7674
};
7775
};

ui/components/app/alert-system/alert-modal/alert-modal.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,13 +207,16 @@ function AlertDetails({
207207
}) {
208208
const t = useI18nContext();
209209
const severityStyle = getSeverityStyle(selectedAlert.severity);
210+
const alertDetailsBackgroundColor =
211+
selectedAlert.alertDetailsBackgroundColor ?? severityStyle.background;
212+
210213
return (
211214
<Box
212215
key={selectedAlert.key}
213216
display={Display.InlineBlock}
214217
padding={customDetails ? 0 : 2}
215218
width={BlockSize.Full}
216-
backgroundColor={customDetails ? undefined : severityStyle.background}
219+
backgroundColor={customDetails ? undefined : alertDetailsBackgroundColor}
217220
borderRadius={BorderRadius.SM}
218221
>
219222
{customDetails ?? (

ui/components/app/shield-entry-modal/index.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
@include design-system.screen-sm-max {
99
font-size: 2rem;
10-
margin-top: 16px;
1110
}
1211
}
1312

ui/components/app/shield-entry-modal/shield-entry-modal.test.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@ describe('Shield Entry Modal', () => {
6767

6868
const closeButton = getByTestId('shield-entry-modal-close-button');
6969
fireEvent.click(closeButton);
70-
expect(setShowShieldEntryModalOnceSpy).toHaveBeenCalledWith(false);
70+
expect(setShowShieldEntryModalOnceSpy).toHaveBeenCalledWith({
71+
show: false,
72+
hasUserInteractedWithModal: true,
73+
});
7174
});
7275

7376
it('should call onGetStarted when the get started button is clicked', async () => {
@@ -78,7 +81,10 @@ describe('Shield Entry Modal', () => {
7881
);
7982

8083
fireEvent.click(getStartedButton);
81-
expect(setShowShieldEntryModalOnceSpy).toHaveBeenCalledWith(false);
84+
expect(setShowShieldEntryModalOnceSpy).toHaveBeenCalledWith({
85+
show: false,
86+
hasUserInteractedWithModal: true,
87+
});
8288
await waitFor(() => {
8389
expect(mockUseNavigate).toHaveBeenCalledWith({
8490
pathname: SHIELD_PLAN_ROUTE,
@@ -110,7 +116,10 @@ describe('Shield Entry Modal', () => {
110116
event: SubscriptionUserEvent.ShieldEntryModalViewed,
111117
cohort: mockState.appState.shieldEntryModal.triggeringCohort,
112118
});
113-
expect(setShowShieldEntryModalOnceSpy).toHaveBeenCalledWith(false);
119+
expect(setShowShieldEntryModalOnceSpy).toHaveBeenCalledWith({
120+
show: false,
121+
hasUserInteractedWithModal: true,
122+
});
114123
});
115124
});
116125
});

ui/components/app/shield-entry-modal/shield-entry-modal.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,12 @@ const ShieldEntryModal = ({
131131
);
132132
}
133133

134-
dispatch(setShowShieldEntryModalOnce(false));
134+
dispatch(
135+
setShowShieldEntryModalOnce({
136+
show: false,
137+
hasUserInteractedWithModal: true,
138+
}),
139+
);
135140
};
136141

137142
const handleOnGetStarted = () => {
@@ -195,14 +200,13 @@ const ShieldEntryModal = ({
195200
display={Display.Flex}
196201
alignItems={AlignItems.center}
197202
flexDirection={FlexDirection.Column}
198-
gap={3}
199203
paddingTop={4}
200204
height={BlockSize.Full}
201205
>
202206
<Text
203207
fontFamily={FontFamily.Hero}
204208
fontWeight={FontWeight.Regular}
205-
className="shield-entry-modal__title text-center text-accent04-light"
209+
className="shield-entry-modal__title text-center text-accent04-light mb-3"
206210
>
207211
{modalType === MODAL_TYPE.A
208212
? t('shieldEntryModalTitleA')
@@ -211,7 +215,7 @@ const ShieldEntryModal = ({
211215
<Text
212216
variant={TextVariant.BodyMd}
213217
fontWeight={FontWeight.Medium}
214-
className="text-center"
218+
className="text-center text-accent04-light"
215219
>
216220
{modalType === MODAL_TYPE.A
217221
? t('shieldEntryModalSubtitleA', ['$10,000'])
@@ -228,6 +232,7 @@ const ShieldEntryModal = ({
228232
<ModalFooter
229233
display={Display.Flex}
230234
flexDirection={FlexDirection.Column}
235+
paddingTop={0}
231236
className="shield-entry-modal__footer"
232237
>
233238
<Button

ui/contexts/shield/shield-subscription.tsx

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,11 @@ export const ShieldSubscriptionProvider: React.FC = ({ children }) => {
150150
}
151151

152152
if (isShieldSubscriptionActive) {
153-
dispatch(setShowShieldEntryModalOnce(false));
153+
dispatch(
154+
setShowShieldEntryModalOnce({
155+
show: false,
156+
}),
157+
);
154158
return;
155159
}
156160

@@ -213,14 +217,16 @@ export const ShieldSubscriptionProvider: React.FC = ({ children }) => {
213217
return;
214218
}
215219

216-
const shouldSubmitUserEvents = true; // submits `shield_entry_modal_viewed` event
217220
dispatch(
218-
setShowShieldEntryModalOnce(
219-
true,
220-
shouldSubmitUserEvents,
221-
entrypointCohort,
221+
setShowShieldEntryModalOnce({
222+
show: true,
223+
shouldSubmitEvents: true, // submits `shield_entry_modal_viewed` event
224+
triggeringCohort: entrypointCohort,
222225
modalType,
223-
),
226+
// we will show the modal but we won't update the background state yet,
227+
// we will only update after the user has interacted with the modal
228+
shouldUpdateBackgroundState: false,
229+
}),
224230
);
225231
return;
226232
}
@@ -236,14 +242,16 @@ export const ShieldSubscriptionProvider: React.FC = ({ children }) => {
236242
modalType,
237243
);
238244
if (selectedCohort?.cohort === COHORT_NAMES.WALLET_HOME) {
239-
const shouldSubmitUserEvents = true; // submits `shield_entry_modal_viewed` event to subscription backend
240245
dispatch(
241-
setShowShieldEntryModalOnce(
242-
true,
243-
shouldSubmitUserEvents,
244-
selectedCohort.cohort,
246+
setShowShieldEntryModalOnce({
247+
show: true,
248+
shouldSubmitEvents: true, // submits `shield_entry_modal_viewed` event to subscription backend
249+
triggeringCohort: selectedCohort.cohort,
245250
modalType,
246-
),
251+
// we will show the modal but we won't update the background state yet,
252+
// we will only update after the user has interacted with the modal
253+
shouldUpdateBackgroundState: false,
254+
}),
247255
);
248256
}
249257
}

ui/ducks/app/app.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ type AppState = {
139139
shouldSubmitEvents: boolean;
140140
modalType?: ModalType;
141141
triggeringCohort?: string;
142+
/**
143+
* Whether the user has interacted with the modal.
144+
*/
145+
hasUserInteractedWithModal?: boolean;
142146
};
143147
};
144148

@@ -797,7 +801,7 @@ export default function reduceApp(
797801
showSupportDataConsentModal: action.payload,
798802
};
799803

800-
case actionConstants.SET_SHOW_SHIELD_ENTRY_MODAL_ONCE:
804+
case actionConstants.SET_SHIELD_ENTRY_MODAL_STATUS:
801805
return {
802806
...appState,
803807
shieldEntryModal: {

ui/ducks/confirm-alerts/confirm-alerts.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ export type Alert = {
115115
*/
116116
showArrow?: boolean;
117117

118+
/**
119+
* The background color of the alert details.
120+
*/
121+
alertDetailsBackgroundColor?: BackgroundColor;
122+
118123
/**
119124
* The custom button text for acknowledging the alert in modal.
120125
*/

0 commit comments

Comments
 (0)