Bluesky app fork with some witchin' additions 💫

Add better onboard testing (#4007)

authored by

Paul Frazee and committed by
GitHub
107760d5 fd704bfd

+71 -1
+31
__e2e__/flows/onboarding-old.yml
··· 1 + # Remove this test when the old onboarding is deprecated 2 + appId: xyz.blueskyweb.app 3 + --- 4 + - runScript: 5 + file: ../setupServer.js 6 + env: 7 + SERVER_PATH: "?users" 8 + - runFlow: 9 + file: ../setupApp.yml 10 + - tapOn: 11 + id: "e2eSignInAlice" 12 + - tapOn: 13 + id: "e2eStartLongboarding" 14 + - tapOn: "Continue to next step" 15 + - tapOn: "Continue to the next step without following any accounts" 16 + - tapOn: Show replies in Following feed 17 + - tapOn: Show quote-posts in Following feed 18 + - tapOn: Show re-posts in Following feed 19 + - tapOn: Show replies in Following feed 20 + - waitForAnimationToEnd 21 + - tapOn: Continue to next step 22 + - waitForAnimationToEnd 23 + - tapOn: "Continue to the next step" 24 + - waitForAnimationToEnd 25 + - tapOn: Continue to next step 26 + - waitForAnimationToEnd 27 + - tapOn: Continue to next step 28 + - waitForAnimationToEnd 29 + - tapOn: "Complete onboarding and start using your account" 30 + - waitForAnimationToEnd 31 + - assertVisible: Following
+22
src/lib/statsig/statsig.tsx
··· 130 130 return gate 131 131 } 132 132 133 + /** 134 + * Debugging tool to override a gate. USE ONLY IN E2E TESTS! 135 + */ 136 + export function useDangerousSetGate(): ( 137 + gateName: Gate, 138 + value: boolean, 139 + ) => void { 140 + const cache = React.useContext(GateCache) 141 + if (!cache) { 142 + throw Error( 143 + 'useDangerousSetGate() cannot be called outside StatsigProvider.', 144 + ) 145 + } 146 + const dangerousSetGate = React.useCallback( 147 + (gateName: Gate, value: boolean) => { 148 + cache.set(gateName, value) 149 + }, 150 + [cache], 151 + ) 152 + return dangerousSetGate 153 + } 154 + 133 155 function toStatsigUser(did: string | undefined): StatsigUser { 134 156 let userID: string | undefined 135 157 if (did) {
+18 -1
src/view/com/testing/TestCtrls.e2e.tsx
··· 2 2 import {LogBox, Pressable, View} from 'react-native' 3 3 import {useQueryClient} from '@tanstack/react-query' 4 4 5 + import {useDangerousSetGate} from '#/lib/statsig/statsig' 5 6 import {useModalControls} from '#/state/modals' 6 7 import {useSessionApi} from '#/state/session' 7 8 import {useLoggedOutViewControls} from '#/state/shell/logged-out' ··· 24 25 const {openModal} = useModalControls() 25 26 const onboardingDispatch = useOnboardingDispatch() 26 27 const {setShowLoggedOut} = useLoggedOutViewControls() 28 + const setGate = useDangerousSetGate() 27 29 const onPressSignInAlice = async () => { 28 30 await login( 29 31 { ··· 108 110 /> 109 111 <Pressable 110 112 testID="e2eStartOnboarding" 111 - onPress={() => onboardingDispatch({type: 'start'})} 113 + onPress={() => { 114 + // TODO remove when experiment is over 115 + setGate('reduced_onboarding_and_home_algo', true) 116 + onboardingDispatch({type: 'start'}) 117 + }} 118 + accessibilityRole="button" 119 + style={BTN} 120 + /> 121 + {/* TODO remove this entire control when experiment is over */} 122 + <Pressable 123 + testID="e2eStartLongboarding" 124 + onPress={() => { 125 + // TODO remove when experiment is over 126 + setGate('reduced_onboarding_and_home_algo', false) 127 + onboardingDispatch({type: 'start'}) 128 + }} 112 129 accessibilityRole="button" 113 130 style={BTN} 114 131 />