Add better onboard testing (#4007)
parent
fd704bfd44
commit
107760d551
|
@ -0,0 +1,31 @@
|
||||||
|
# Remove this test when the old onboarding is deprecated
|
||||||
|
appId: xyz.blueskyweb.app
|
||||||
|
---
|
||||||
|
- runScript:
|
||||||
|
file: ../setupServer.js
|
||||||
|
env:
|
||||||
|
SERVER_PATH: "?users"
|
||||||
|
- runFlow:
|
||||||
|
file: ../setupApp.yml
|
||||||
|
- tapOn:
|
||||||
|
id: "e2eSignInAlice"
|
||||||
|
- tapOn:
|
||||||
|
id: "e2eStartLongboarding"
|
||||||
|
- tapOn: "Continue to next step"
|
||||||
|
- tapOn: "Continue to the next step without following any accounts"
|
||||||
|
- tapOn: Show replies in Following feed
|
||||||
|
- tapOn: Show quote-posts in Following feed
|
||||||
|
- tapOn: Show re-posts in Following feed
|
||||||
|
- tapOn: Show replies in Following feed
|
||||||
|
- waitForAnimationToEnd
|
||||||
|
- tapOn: Continue to next step
|
||||||
|
- waitForAnimationToEnd
|
||||||
|
- tapOn: "Continue to the next step"
|
||||||
|
- waitForAnimationToEnd
|
||||||
|
- tapOn: Continue to next step
|
||||||
|
- waitForAnimationToEnd
|
||||||
|
- tapOn: Continue to next step
|
||||||
|
- waitForAnimationToEnd
|
||||||
|
- tapOn: "Complete onboarding and start using your account"
|
||||||
|
- waitForAnimationToEnd
|
||||||
|
- assertVisible: Following
|
|
@ -130,6 +130,28 @@ export function useGate(): (gateName: Gate) => boolean {
|
||||||
return gate
|
return gate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Debugging tool to override a gate. USE ONLY IN E2E TESTS!
|
||||||
|
*/
|
||||||
|
export function useDangerousSetGate(): (
|
||||||
|
gateName: Gate,
|
||||||
|
value: boolean,
|
||||||
|
) => void {
|
||||||
|
const cache = React.useContext(GateCache)
|
||||||
|
if (!cache) {
|
||||||
|
throw Error(
|
||||||
|
'useDangerousSetGate() cannot be called outside StatsigProvider.',
|
||||||
|
)
|
||||||
|
}
|
||||||
|
const dangerousSetGate = React.useCallback(
|
||||||
|
(gateName: Gate, value: boolean) => {
|
||||||
|
cache.set(gateName, value)
|
||||||
|
},
|
||||||
|
[cache],
|
||||||
|
)
|
||||||
|
return dangerousSetGate
|
||||||
|
}
|
||||||
|
|
||||||
function toStatsigUser(did: string | undefined): StatsigUser {
|
function toStatsigUser(did: string | undefined): StatsigUser {
|
||||||
let userID: string | undefined
|
let userID: string | undefined
|
||||||
if (did) {
|
if (did) {
|
||||||
|
|
|
@ -2,6 +2,7 @@ import React from 'react'
|
||||||
import {LogBox, Pressable, View} from 'react-native'
|
import {LogBox, Pressable, View} from 'react-native'
|
||||||
import {useQueryClient} from '@tanstack/react-query'
|
import {useQueryClient} from '@tanstack/react-query'
|
||||||
|
|
||||||
|
import {useDangerousSetGate} from '#/lib/statsig/statsig'
|
||||||
import {useModalControls} from '#/state/modals'
|
import {useModalControls} from '#/state/modals'
|
||||||
import {useSessionApi} from '#/state/session'
|
import {useSessionApi} from '#/state/session'
|
||||||
import {useLoggedOutViewControls} from '#/state/shell/logged-out'
|
import {useLoggedOutViewControls} from '#/state/shell/logged-out'
|
||||||
|
@ -24,6 +25,7 @@ export function TestCtrls() {
|
||||||
const {openModal} = useModalControls()
|
const {openModal} = useModalControls()
|
||||||
const onboardingDispatch = useOnboardingDispatch()
|
const onboardingDispatch = useOnboardingDispatch()
|
||||||
const {setShowLoggedOut} = useLoggedOutViewControls()
|
const {setShowLoggedOut} = useLoggedOutViewControls()
|
||||||
|
const setGate = useDangerousSetGate()
|
||||||
const onPressSignInAlice = async () => {
|
const onPressSignInAlice = async () => {
|
||||||
await login(
|
await login(
|
||||||
{
|
{
|
||||||
|
@ -108,7 +110,22 @@ export function TestCtrls() {
|
||||||
/>
|
/>
|
||||||
<Pressable
|
<Pressable
|
||||||
testID="e2eStartOnboarding"
|
testID="e2eStartOnboarding"
|
||||||
onPress={() => onboardingDispatch({type: 'start'})}
|
onPress={() => {
|
||||||
|
// TODO remove when experiment is over
|
||||||
|
setGate('reduced_onboarding_and_home_algo', true)
|
||||||
|
onboardingDispatch({type: 'start'})
|
||||||
|
}}
|
||||||
|
accessibilityRole="button"
|
||||||
|
style={BTN}
|
||||||
|
/>
|
||||||
|
{/* TODO remove this entire control when experiment is over */}
|
||||||
|
<Pressable
|
||||||
|
testID="e2eStartLongboarding"
|
||||||
|
onPress={() => {
|
||||||
|
// TODO remove when experiment is over
|
||||||
|
setGate('reduced_onboarding_and_home_algo', false)
|
||||||
|
onboardingDispatch({type: 'start'})
|
||||||
|
}}
|
||||||
accessibilityRole="button"
|
accessibilityRole="button"
|
||||||
style={BTN}
|
style={BTN}
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in New Issue