From 9d4c243ba9644f5244de9a05a960143f75b037b0 Mon Sep 17 00:00:00 2001 From: digiwand <20778143+digiwand@users.noreply.github.com> Date: Mon, 9 Sep 2024 14:00:46 +0400 Subject: [PATCH] fix:test:e2e: add alert metrics to maliciouis-signatures --- .../signatures/malicious-signatures.spec.ts | 20 +++++++++++++++++++ .../signatures/signature-helpers.ts | 10 ++++++++++ 2 files changed, 30 insertions(+) diff --git a/test/e2e/tests/confirmations/signatures/malicious-signatures.spec.ts b/test/e2e/tests/confirmations/signatures/malicious-signatures.spec.ts index 290af3a147ad..7e4568d326f0 100644 --- a/test/e2e/tests/confirmations/signatures/malicious-signatures.spec.ts +++ b/test/e2e/tests/confirmations/signatures/malicious-signatures.spec.ts @@ -68,6 +68,16 @@ describe('Malicious Confirmation Signature - Bad Domain @no-mmi', function (this 'sign_in_with_ethereum', ], location: 'confirmation', + expectedProps: { + alert_action_clicked: [], + alert_key_clicked: [], + alert_resolved: [], + alert_resolved_count: 0, + alert_triggered: ['requestFrom'], + alert_triggered_count: 1, + alert_visualized: [], + alert_visualized_count: 0, + }, }); }, mockSignatureRejected, @@ -105,6 +115,16 @@ describe('Malicious Confirmation Signature - Bad Domain @no-mmi', function (this 'sign_in_with_ethereum', ], location: 'alert_friction_modal', + expectedProps: { + alert_action_clicked: [], + alert_key_clicked: [], + alert_resolved: [], + alert_resolved_count: 0, + alert_triggered: ['requestFrom'], + alert_triggered_count: 1, + alert_visualized: ['requestFrom'], + alert_visualized_count: 1, + }, }); }, mockSignatureRejected, diff --git a/test/e2e/tests/confirmations/signatures/signature-helpers.ts b/test/e2e/tests/confirmations/signatures/signature-helpers.ts index 61c2c845c9a5..6bb8f4ee0b75 100644 --- a/test/e2e/tests/confirmations/signatures/signature-helpers.ts +++ b/test/e2e/tests/confirmations/signatures/signature-helpers.ts @@ -27,6 +27,7 @@ type AssertSignatureMetricsOptions = { primaryType?: string; uiCustomizations?: string[]; location?: string; + expectedProps?: Record; }; type SignatureEventProperty = { @@ -43,6 +44,13 @@ type SignatureEventProperty = { location?: string; }; +/** + * Generates expected signature metric properties + * + * @param signatureType + * @param primaryType + * @param uiCustomizations + */ function getSignatureEventProperty( signatureType: string, primaryType: string, @@ -113,6 +121,7 @@ export async function assertSignatureRejectedMetrics({ primaryType = '', uiCustomizations = ['redesigned_confirmation'], location, + expectedProps = {}, }: AssertSignatureMetricsOptions) { const events = await getEventPayloads(driver, mockedEndpoints); const signatureEventProperty = getSignatureEventProperty( @@ -128,6 +137,7 @@ export async function assertSignatureRejectedMetrics({ { ...signatureEventProperty, location, + ...expectedProps, }, 'Signature Rejected event properties do not match', );