|
| 1 | +import { OnboardingInterestQuestionnaireTestIds } from '../../../app/components/Views/OnboardingInterestQuestionnaire/OnboardingInterestQuestionnaire.testIds'; |
| 2 | +import Matchers from '../../framework/Matchers'; |
| 3 | +import { |
| 4 | + encapsulated, |
| 5 | + EncapsulatedElementType, |
| 6 | +} from '../../framework/EncapsulatedElement'; |
| 7 | +import PlaywrightMatchers from '../../framework/PlaywrightMatchers'; |
| 8 | +import UnifiedGestures from '../../framework/UnifiedGestures'; |
| 9 | + |
| 10 | +type InterestOptionId = |
| 11 | + | 'buy_and_sell_crypto' |
| 12 | + | 'consolidate_wallets' |
| 13 | + | 'advanced_trades' |
| 14 | + | 'predict_sports_events' |
| 15 | + | 'crypto_as_money' |
| 16 | + | 'connect_apps_sites'; |
| 17 | + |
| 18 | +class OnboardingInterestQuestionnaireView { |
| 19 | + get container(): EncapsulatedElementType { |
| 20 | + return encapsulated({ |
| 21 | + detox: () => |
| 22 | + Matchers.getElementByID(OnboardingInterestQuestionnaireTestIds.SCREEN), |
| 23 | + appium: () => |
| 24 | + PlaywrightMatchers.getElementById( |
| 25 | + OnboardingInterestQuestionnaireTestIds.SCREEN, |
| 26 | + { exact: true }, |
| 27 | + ), |
| 28 | + }); |
| 29 | + } |
| 30 | + |
| 31 | + get continueButton(): EncapsulatedElementType { |
| 32 | + return encapsulated({ |
| 33 | + detox: () => |
| 34 | + Matchers.getElementByID( |
| 35 | + OnboardingInterestQuestionnaireTestIds.CONTINUE_BUTTON, |
| 36 | + ), |
| 37 | + appium: () => |
| 38 | + PlaywrightMatchers.getElementById( |
| 39 | + OnboardingInterestQuestionnaireTestIds.CONTINUE_BUTTON, |
| 40 | + { exact: true }, |
| 41 | + ), |
| 42 | + }); |
| 43 | + } |
| 44 | + |
| 45 | + getOptionById(id: InterestOptionId): EncapsulatedElementType { |
| 46 | + const testID = `${OnboardingInterestQuestionnaireTestIds.OPTION_PREFIX}${id}`; |
| 47 | + return encapsulated({ |
| 48 | + detox: () => Matchers.getElementByID(testID), |
| 49 | + appium: () => PlaywrightMatchers.getElementById(testID, { exact: true }), |
| 50 | + }); |
| 51 | + } |
| 52 | + |
| 53 | + async tapContinueButton(): Promise<void> { |
| 54 | + await UnifiedGestures.waitAndTap(this.continueButton, { |
| 55 | + description: 'Onboarding Interest Questionnaire Continue Button', |
| 56 | + }); |
| 57 | + } |
| 58 | + |
| 59 | + async tapOption(id: InterestOptionId): Promise<void> { |
| 60 | + await UnifiedGestures.waitAndTap(this.getOptionById(id), { |
| 61 | + description: `Onboarding Interest Questionnaire Option: ${id}`, |
| 62 | + }); |
| 63 | + } |
| 64 | +} |
| 65 | + |
| 66 | +export default new OnboardingInterestQuestionnaireView(); |
0 commit comments