From 943ae9dc191aee912e25fe8dfe0b29ff2855f6dc Mon Sep 17 00:00:00 2001 From: Curtis David Date: Thu, 14 May 2026 12:16:50 -0400 Subject: [PATCH 1/4] test: fix unmatched mocked polymarket mocks --- .../mock-responses/defaults/polymarket-apis.ts | 17 +++++++++++++++++ .../mock-responses/trending-api-mocks.ts | 5 +++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/tests/api-mocking/mock-responses/defaults/polymarket-apis.ts b/tests/api-mocking/mock-responses/defaults/polymarket-apis.ts index f16e490e344..c9dfe605915 100644 --- a/tests/api-mocking/mock-responses/defaults/polymarket-apis.ts +++ b/tests/api-mocking/mock-responses/defaults/polymarket-apis.ts @@ -38,6 +38,23 @@ export const POLYMARKET_API_MOCKS = { responseCode: 200, response: { events: [] }, }, + { + urlEndpoint: /^https:\/\/gamma-api\.polymarket\.com\/events\/\d+(\?.*)?$/, + responseCode: 200, + response: { + id: '1', + slug: 'mock-prediction-event', + title: 'Mock prediction event', + description: 'E2E mock event', + icon: 'https://polymarket.com/icon.png', + closed: false, + series: [], + markets: [], + tags: [], + liquidity: 0, + volume: 0, + }, + }, // gamma-api: markets list { urlEndpoint: /^https:\/\/gamma-api\.polymarket\.com\/markets(\?.*)?$/, diff --git a/tests/api-mocking/mock-responses/trending-api-mocks.ts b/tests/api-mocking/mock-responses/trending-api-mocks.ts index 71d54eb4229..cccbd116323 100644 --- a/tests/api-mocking/mock-responses/trending-api-mocks.ts +++ b/tests/api-mocking/mock-responses/trending-api-mocks.ts @@ -164,8 +164,9 @@ export const TRENDING_API_MOCKS: MockEventsObject = { { // Event details fetched when user taps a prediction row in the trending feed. // Returns the same Bitcoin event payload as /events/pagination so the detail - // screen renders without crashing. - urlEndpoint: /https:\/\/gamma-api\.polymarket\.com\/events\/1(\?.*)?$/, + // screen renders without crashing. Matches any numeric event id (highlights, + // prefetch) — not only id "1". + urlEndpoint: /https:\/\/gamma-api\.polymarket\.com\/events\/\d+(\?.*)?$/, responseCode: 200, response: { id: '1', From 9a501a5e69cba2e4d00c796c8bb734e7a1ae6093 Mon Sep 17 00:00:00 2001 From: Curtis David Date: Thu, 14 May 2026 17:43:48 -0400 Subject: [PATCH 2/4] added static device id to onboarding fixture to account for always showing the onboarding interest questionaire. --- tests/flows/wallet.flow.ts | 3 +- .../fixtures/json/onboarding-fixture.json | 4 +- .../OnboardingInterestQuestionnaireView.ts | 66 +++++++++++++++++++ 3 files changed, 71 insertions(+), 2 deletions(-) create mode 100644 tests/page-objects/Onboarding/OnboardingInterestQuestionnaireView.ts diff --git a/tests/flows/wallet.flow.ts b/tests/flows/wallet.flow.ts index e6a7a53ff90..bb907771edc 100644 --- a/tests/flows/wallet.flow.ts +++ b/tests/flows/wallet.flow.ts @@ -40,7 +40,7 @@ import PlaywrightUtilities from '../framework/PlaywrightUtilities'; import AccountListBottomSheet from '../page-objects/wallet/AccountListBottomSheet'; import MetaMetricsOptInView from '../page-objects/Onboarding/MetaMetricsOptInView'; import PredictModalView from '../page-objects/Predict/PredictModalView'; - +import OnboardingInterestQuestionnaireView from '../page-objects/Onboarding/OnboardingInterestQuestionnaireView'; const logger = createLogger({ name: 'WalletFlow', }); @@ -341,6 +341,7 @@ export const CreateNewWallet = async ({ await MetaMetricsOptInView.tapAgreeButton(); await device.disableSynchronization(); // Detox is hanging after wallet creation + await OnboardingInterestQuestionnaireView.tapContinueButton(); await Assertions.expectElementToBeVisible(OnboardingSuccessView.container, { description: 'Onboarding Success View should be visible', diff --git a/tests/framework/fixtures/json/onboarding-fixture.json b/tests/framework/fixtures/json/onboarding-fixture.json index 995fc13ee26..1acca867b3b 100644 --- a/tests/framework/fixtures/json/onboarding-fixture.json +++ b/tests/framework/fixtures/json/onboarding-fixture.json @@ -1,3 +1,5 @@ { - "asyncState": {} + "asyncState": { + "@MetaMask:AnalyticsId": "00000000-0000-4000-8000-000000000000" + } } diff --git a/tests/page-objects/Onboarding/OnboardingInterestQuestionnaireView.ts b/tests/page-objects/Onboarding/OnboardingInterestQuestionnaireView.ts new file mode 100644 index 00000000000..7f32ba51570 --- /dev/null +++ b/tests/page-objects/Onboarding/OnboardingInterestQuestionnaireView.ts @@ -0,0 +1,66 @@ +import { OnboardingInterestQuestionnaireTestIds } from '../../../app/components/Views/OnboardingInterestQuestionnaire/OnboardingInterestQuestionnaire.testIds'; +import Matchers from '../../framework/Matchers'; +import { + encapsulated, + EncapsulatedElementType, +} from '../../framework/EncapsulatedElement'; +import PlaywrightMatchers from '../../framework/PlaywrightMatchers'; +import UnifiedGestures from '../../framework/UnifiedGestures'; + +type InterestOptionId = + | 'buy_and_sell_crypto' + | 'consolidate_wallets' + | 'advanced_trades' + | 'predict_sports_events' + | 'crypto_as_money' + | 'connect_apps_sites'; + +class OnboardingInterestQuestionnaireView { + get container(): EncapsulatedElementType { + return encapsulated({ + detox: () => + Matchers.getElementByID(OnboardingInterestQuestionnaireTestIds.SCREEN), + appium: () => + PlaywrightMatchers.getElementById( + OnboardingInterestQuestionnaireTestIds.SCREEN, + { exact: true }, + ), + }); + } + + get continueButton(): EncapsulatedElementType { + return encapsulated({ + detox: () => + Matchers.getElementByID( + OnboardingInterestQuestionnaireTestIds.CONTINUE_BUTTON, + ), + appium: () => + PlaywrightMatchers.getElementById( + OnboardingInterestQuestionnaireTestIds.CONTINUE_BUTTON, + { exact: true }, + ), + }); + } + + getOptionById(id: InterestOptionId): EncapsulatedElementType { + const testID = `${OnboardingInterestQuestionnaireTestIds.OPTION_PREFIX}${id}`; + return encapsulated({ + detox: () => Matchers.getElementByID(testID), + appium: () => PlaywrightMatchers.getElementById(testID, { exact: true }), + }); + } + + async tapContinueButton(): Promise { + await UnifiedGestures.waitAndTap(this.continueButton, { + description: 'Onboarding Interest Questionnaire Continue Button', + }); + } + + async tapOption(id: InterestOptionId): Promise { + await UnifiedGestures.waitAndTap(this.getOptionById(id), { + description: `Onboarding Interest Questionnaire Option: ${id}`, + }); + } +} + +export default new OnboardingInterestQuestionnaireView(); From 502e0c3902bcd48e20c0a57d98a8d03cac203d77 Mon Sep 17 00:00:00 2001 From: Curtis David Date: Thu, 14 May 2026 18:13:53 -0400 Subject: [PATCH 3/4] fix logic --- tests/flows/wallet.flow.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/flows/wallet.flow.ts b/tests/flows/wallet.flow.ts index bb907771edc..b571eb8a134 100644 --- a/tests/flows/wallet.flow.ts +++ b/tests/flows/wallet.flow.ts @@ -341,7 +341,10 @@ export const CreateNewWallet = async ({ await MetaMetricsOptInView.tapAgreeButton(); await device.disableSynchronization(); // Detox is hanging after wallet creation - await OnboardingInterestQuestionnaireView.tapContinueButton(); + + if (optInToMetrics) { + await OnboardingInterestQuestionnaireView.tapContinueButton(); + } await Assertions.expectElementToBeVisible(OnboardingSuccessView.container, { description: 'Onboarding Success View should be visible', From 91267e42a4b1934596d931f52b61b036d9ef0b0b Mon Sep 17 00:00:00 2001 From: Curtis David Date: Thu, 14 May 2026 18:27:09 -0400 Subject: [PATCH 4/4] account for import wallet flow as well --- tests/flows/wallet.flow.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/flows/wallet.flow.ts b/tests/flows/wallet.flow.ts index b571eb8a134..554e6c83e9e 100644 --- a/tests/flows/wallet.flow.ts +++ b/tests/flows/wallet.flow.ts @@ -231,6 +231,9 @@ export const importWalletWithRecoveryPhrase = async ({ await MetaMetricsOptInView.tapAgreeButton(); } + if (optInToMetrics) { + await OnboardingInterestQuestionnaireView.tapContinueButton(); + } //'Should dismiss Enable device Notifications checks alert' await Assertions.expectElementToBeVisible(OnboardingSuccessView.container, { description: 'Onboarding Success View should be visible',