import React from 'react' import {Pressable, View} from 'react-native' import {navigate} from '../../../Navigation' import {useModalControls} from '#/state/modals' import {useQueryClient} from '@tanstack/react-query' import {useSessionApi} from '#/state/session' import {useSetFeedViewPreferencesMutation} from '#/state/queries/preferences' import {useLoggedOutViewControls} from '#/state/shell/logged-out' /** * This utility component is only included in the test simulator * build. It gives some quick triggers which help improve the pace * of the tests dramatically. */ const BTN = {height: 1, width: 1, backgroundColor: 'red'} export function TestCtrls() { const queryClient = useQueryClient() const {logout, login} = useSessionApi() const {openModal} = useModalControls() const {mutate: setFeedViewPref} = useSetFeedViewPreferencesMutation() const {setShowLoggedOut} = useLoggedOutViewControls() const onPressSignInAlice = async () => { await login( { service: 'http://localhost:3000', identifier: 'alice.test', password: 'hunter2', }, 'LoginForm', ) } const onPressSignInBob = async () => { await login( { service: 'http://localhost:3000', identifier: 'bob.test', password: 'hunter2', }, 'LoginForm', ) } return ( logout('Settings')} accessibilityRole="button" style={BTN} /> navigate('Home')} accessibilityRole="button" style={BTN} /> navigate('Settings')} accessibilityRole="button" style={BTN} /> navigate('Moderation')} accessibilityRole="button" style={BTN} /> navigate('Lists')} accessibilityRole="button" style={BTN} /> setFeedViewPref({lab_mergeFeedEnabled: true})} accessibilityRole="button" style={BTN} /> queryClient.invalidateQueries({queryKey: ['post-feed']})} accessibilityRole="button" style={BTN} /> openModal({name: 'invite-codes'})} accessibilityRole="button" style={BTN} /> setShowLoggedOut(true)} accessibilityRole="button" style={BTN} /> ) }