diff --git a/__e2e__/flows/onboarding-old.yml b/__e2e__/flows/onboarding-old.yml new file mode 100644 index 0000000000..dae24bb1c4 --- /dev/null +++ b/__e2e__/flows/onboarding-old.yml @@ -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 \ No newline at end of file diff --git a/src/lib/statsig/statsig.tsx b/src/lib/statsig/statsig.tsx index 2e3fdfd5cb..3b649f88d8 100644 --- a/src/lib/statsig/statsig.tsx +++ b/src/lib/statsig/statsig.tsx @@ -130,6 +130,28 @@ export function useGate(): (gateName: Gate) => boolean { 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 { let userID: string | undefined if (did) { diff --git a/src/view/com/testing/TestCtrls.e2e.tsx b/src/view/com/testing/TestCtrls.e2e.tsx index 135b7dee61..fbad86f6a9 100644 --- a/src/view/com/testing/TestCtrls.e2e.tsx +++ b/src/view/com/testing/TestCtrls.e2e.tsx @@ -2,6 +2,7 @@ import React from 'react' import {LogBox, Pressable, View} from 'react-native' import {useQueryClient} from '@tanstack/react-query' +import {useDangerousSetGate} from '#/lib/statsig/statsig' import {useModalControls} from '#/state/modals' import {useSessionApi} from '#/state/session' import {useLoggedOutViewControls} from '#/state/shell/logged-out' @@ -24,6 +25,7 @@ export function TestCtrls() { const {openModal} = useModalControls() const onboardingDispatch = useOnboardingDispatch() const {setShowLoggedOut} = useLoggedOutViewControls() + const setGate = useDangerousSetGate() const onPressSignInAlice = async () => { await login( { @@ -108,7 +110,22 @@ export function TestCtrls() { /> 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 */} + { + // TODO remove when experiment is over + setGate('reduced_onboarding_and_home_algo', false) + onboardingDispatch({type: 'start'}) + }} accessibilityRole="button" style={BTN} />