Skip to content

Commit 9a501a5

Browse files
committed
added static device id to onboarding fixture to account for always showing the onboarding interest questionaire.
1 parent a56e0cd commit 9a501a5

3 files changed

Lines changed: 71 additions & 2 deletions

File tree

tests/flows/wallet.flow.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import PlaywrightUtilities from '../framework/PlaywrightUtilities';
4040
import AccountListBottomSheet from '../page-objects/wallet/AccountListBottomSheet';
4141
import MetaMetricsOptInView from '../page-objects/Onboarding/MetaMetricsOptInView';
4242
import PredictModalView from '../page-objects/Predict/PredictModalView';
43-
43+
import OnboardingInterestQuestionnaireView from '../page-objects/Onboarding/OnboardingInterestQuestionnaireView';
4444
const logger = createLogger({
4545
name: 'WalletFlow',
4646
});
@@ -341,6 +341,7 @@ export const CreateNewWallet = async ({
341341

342342
await MetaMetricsOptInView.tapAgreeButton();
343343
await device.disableSynchronization(); // Detox is hanging after wallet creation
344+
await OnboardingInterestQuestionnaireView.tapContinueButton();
344345

345346
await Assertions.expectElementToBeVisible(OnboardingSuccessView.container, {
346347
description: 'Onboarding Success View should be visible',
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"asyncState": {}
2+
"asyncState": {
3+
"@MetaMask:AnalyticsId": "00000000-0000-4000-8000-000000000000"
4+
}
35
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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

Comments
 (0)