Skip to content

Commit

Permalink
fix: use CPV with e2e tests after komenci sunset (#3139)
Browse files Browse the repository at this point in the history
Komenci has been shut down and the onboarding pincode screen checks for
it's uptime before navigating to the phone verification screen. This is
not necessary with CPV, this PR adds this logic.

Update test id's - rather than update the tests i updated the test id of
the component :/ didn't think it mattered to much

Run CI, test manually

Create a new account, you should see phone verification in the
onboarding flow

n/a

Y

Co-authored-by: Charlie Andrews <charlie.andrews@valoraapp.com>
  • Loading branch information
kathaypacific and cajubelt committed Nov 22, 2022
1 parent 26b7a4a commit 9858e39
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 21 deletions.
4 changes: 2 additions & 2 deletions e2e/src/Rewards.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ describe('Given Rewards', () => {
await waitForElementId('ConsumerIncentives/CTA')
await element(by.id('ConsumerIncentives/CTA')).tap()
await enterPinUiIfNecessary()
await waitForElementId('VerificationEducationHeader')
await expect(element(by.id('VerificationEducationHeader'))).toBeVisible()
await waitForElementId('PhoneVerificationHeader')
await expect(element(by.id('PhoneVerificationHeader'))).toBeVisible()
})

it(':ios: Then should navigate back to consumer incentives', async () => {
Expand Down
4 changes: 2 additions & 2 deletions e2e/src/usecases/NewAccountOnboarding.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ export default NewAccountOnboarding = () => {
await enterPinUi()

// Skip Phone Number verification
await element(by.id('VerificationEducationSkipHeader')).tap()
await element(by.id('VerificationSkipDialog/PrimaryAction')).tap()
await element(by.id('PhoneVerificationSkipHeader')).tap()
await element(by.id('PhoneVerificationSkipDialog/PrimaryAction')).tap()

// Arrived to Home screen
await expect(element(by.id('SendOrRequestBar'))).toBeVisible()
Expand Down
12 changes: 6 additions & 6 deletions e2e/src/usecases/NewAccountPhoneVerification.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,21 +169,21 @@ export default NewAccountPhoneVerification = () => {
await expect(element(by.text('Connect your phone number'))).toBeVisible()
let skipAttributes = await element(by.text('Skip')).getAttributes()
jestExpect(skipAttributes.enabled).toBe(true)
await waitForElementId('doINeedToConfirm')
await waitForElementId('PhoneVerificationLearnMore')

// Tap 'Do I need to connect?' button
await element(by.id('doINeedToConfirm')).tap()
await element(by.id('PhoneVerificationLearnMore')).tap()

// Assert modal action is visible
await waitForElementId('VerificationLearnMoreDialog/PrimaryAction')
await waitForElementId('PhoneVerificationLearnMoreDialog/PrimaryAction')

// Assert able to dismiss modal and skip
await element(by.text('Dismiss')).tap()
await element(by.text('Skip')).tap()

// Assert VerificationSkipDialog modal actions are visible
await waitForElementId('VerificationSkipDialog/PrimaryAction')
await waitForElementId('VerificationSkipDialog/SecondaryAction')
// Assert PhoneVerificationSkipDialog modal actions are visible
await waitForElementId('PhoneVerificationSkipDialog/PrimaryAction')
await waitForElementId('PhoneVerificationSkipDialog/SecondaryAction')

// Assert Back button is enabled
let goBackButtonAttributes = await element(by.text('Go Back')).getAttributes()
Expand Down
6 changes: 3 additions & 3 deletions e2e/src/usecases/RestoreAccountOnboarding.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ export default RestoreAccountOnboarding = () => {
})

it('Verify Education', async () => {
await waitForElementId('VerificationEducationSkipHeader')
await waitForElementId('PhoneVerificationSkipHeader')

// skip
await element(by.id('VerificationEducationSkipHeader')).tap()
await element(by.id('PhoneVerificationSkipHeader')).tap()
// confirmation popup skip
await element(by.id('VerificationSkipDialog/PrimaryAction')).tap()
await element(by.id('PhoneVerificationSkipDialog/PrimaryAction')).tap()
})

it('Wallet Home', async () => {
Expand Down
8 changes: 4 additions & 4 deletions e2e/src/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,12 @@ export async function quickOnboarding(mnemonic = SAMPLE_BACKUP_KEY) {
} catch {}

// Verify Education
await waitForElementId('VerificationEducationSkipHeader')
await waitForElementId('PhoneVerificationSkipHeader')
// Skip
await element(by.id('VerificationEducationSkipHeader')).tap()
await element(by.id('PhoneVerificationSkipHeader')).tap()
// Confirmation popup skip
await waitForElementId('VerificationSkipDialog/PrimaryAction')
await element(by.id('VerificationSkipDialog/PrimaryAction')).tap()
await waitForElementId('PhoneVerificationSkipDialog/PrimaryAction')
await element(by.id('PhoneVerificationSkipDialog/PrimaryAction')).tap()

// Assert on Wallet Home Screen
await expect(element(by.id('SendOrRequestBar'))).toBeVisible()
Expand Down
2 changes: 1 addition & 1 deletion src/firebase/remoteConfigValuesDefaults.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ export const REMOTE_CONFIG_VALUES_DEFAULTS: Omit<
maxSwapSlippagePercentage: 2,
inviteMethod: InviteMethodType.Escrow,
showGuidedOnboardingCopy: false,
centralPhoneVerificationEnabled: false,
centralPhoneVerificationEnabled: true,
networkTimeoutSeconds: 30,
}
2 changes: 1 addition & 1 deletion src/firebase/remoteConfigValuesDefaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ export const REMOTE_CONFIG_VALUES_DEFAULTS: Omit<
maxSwapSlippagePercentage: 2,
inviteMethod: InviteMethodType.Escrow,
showGuidedOnboardingCopy: false,
centralPhoneVerificationEnabled: false,
centralPhoneVerificationEnabled: true,
networkTimeoutSeconds: 30,
}
5 changes: 4 additions & 1 deletion src/pincode/PincodeSet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { OnboardingEvents, SettingsEvents } from 'src/analytics/Events'
import ValoraAnalytics from 'src/analytics/ValoraAnalytics'
import {
biometryEnabledSelector,
centralPhoneVerificationEnabledSelector,
registrationStepsSelector,
showGuidedOnboardingSelector,
skipVerificationSelector,
Expand Down Expand Up @@ -46,6 +47,7 @@ interface StateProps {
biometryEnabled: boolean
skipVerification: boolean
showGuidedOnboarding: boolean
centralPhoneVerificationEnabled: boolean
}

interface DispatchProps {
Expand Down Expand Up @@ -77,6 +79,7 @@ function mapStateToProps(state: RootState): StateProps {
biometryEnabled: biometryEnabledSelector(state),
skipVerification: skipVerificationSelector(state),
showGuidedOnboarding: showGuidedOnboardingSelector(state),
centralPhoneVerificationEnabled: centralPhoneVerificationEnabledSelector(state),
}
}

Expand Down Expand Up @@ -163,7 +166,7 @@ export class PincodeSet extends React.Component<Props, State> {
navigate(Screens.ImportWallet)
} else if (
this.props.hideVerification ||
!this.props.route.params?.komenciAvailable ||
(!this.props.route.params?.komenciAvailable && !this.props.centralPhoneVerificationEnabled) ||
this.props.skipVerification
) {
this.props.initializeAccount()
Expand Down
2 changes: 1 addition & 1 deletion src/redux/store.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ describe('store state', () => {
"celoEducationUri": null,
"celoEuroEnabled": true,
"celoWithdrawalEnabledInExchange": true,
"centralPhoneVerificationEnabled": false,
"centralPhoneVerificationEnabled": true,
"coinbasePayEnabled": false,
"createAccountCopyTestType": "ACCOUNT",
"fiatConnectCashInEnabled": false,
Expand Down

0 comments on commit 9858e39

Please sign in to comment.