* Add logged out e2e ctrl, fix login test

* Fix log handling via env vars in expo

* Fix create account test

* Upgrade dev-env

* Fix home screen tests

* Fix composer tests

* Fix curate-lists tests, split in two

* Fix invite codes test

* Fix curate-lists tests

* Give up on mergefeed test

* Fix mod lists

* Fix app view url

* Fix profile tests

* Fix profile test with hack

* Keep using globals

* Fix two more

* Fix thread view

* Better skip for merge feed

* Revert debug code
This commit is contained in:
Eric Bailey 2023-12-05 14:50:56 -06:00 committed by GitHub
parent ed5a97d0fa
commit 5f553c29df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 1600 additions and 234 deletions

View file

@ -1,4 +1,4 @@
export const IS_TEST = process.env.NODE_ENV === 'test'
export const IS_TEST = process.env.EXPO_PUBLIC_ENV === 'test'
export const IS_DEV = __DEV__
export const IS_PROD = !IS_DEV
export const LOG_DEBUG = process.env.EXPO_PUBLIC_LOG_DEBUG || ''

View file

@ -61,6 +61,7 @@ export interface CreateOrEditListModal {
export interface UserAddRemoveListsModal {
name: 'user-add-remove-lists'
subject: string
handle: string
displayName: string
onAdd?: (listUri: string) => void
onRemove?: (listUri: string) => void

View file

@ -170,6 +170,7 @@ export function FeedSourceCardLoaded({
{showSaveBtn && feed.type === 'feed' && (
<View>
<Pressable
testID={`feed-${feed.displayName}-toggleSave`}
disabled={isSavePending || isPinPending || isRemovePending}
accessibilityRole="button"
accessibilityLabel={

View file

@ -132,6 +132,7 @@ export function ListMembers({
name: 'user-add-remove-lists',
subject: profile.did,
displayName: profile.displayName || profile.handle,
handle: profile.handle,
})
},
[openModal],

View file

@ -28,11 +28,13 @@ export const snapPoints = ['fullscreen']
export function Component({
subject,
handle,
displayName,
onAdd,
onRemove,
}: {
subject: string
handle: string
displayName: string
onAdd?: (listUri: string) => void
onRemove?: (listUri: string) => void
@ -60,6 +62,7 @@ export function Component({
list={list}
memberships={memberships}
subject={subject}
handle={handle}
onAdd={onAdd}
onRemove={onRemove}
/>
@ -87,6 +90,7 @@ function ListItem({
list,
memberships,
subject,
handle,
onAdd,
onRemove,
}: {
@ -94,6 +98,7 @@ function ListItem({
list: GraphDefs.ListView
memberships: ListMembersip[] | undefined
subject: string
handle: string
onAdd?: (listUri: string) => void
onRemove?: (listUri: string) => void
}) {
@ -182,7 +187,7 @@ function ListItem({
<ActivityIndicator />
) : (
<Button
testID={`user-${subject}-addBtn`}
testID={`user-${handle}-addBtn`}
type="default"
label={membership === false ? _(msg`Add`) : _(msg`Remove`)}
onPress={onToggleMembership}

View file

@ -375,7 +375,10 @@ let PostThreadItemLoaded = ({
style={styles.expandedInfoItem}
href={repostsHref}
title={repostsTitle}>
<Text testID="repostCount" type="lg" style={pal.textLight}>
<Text
testID="repostCount-expanded"
type="lg"
style={pal.textLight}>
<Text type="xl-bold" style={pal.text}>
{formatCount(post.repostCount)}
</Text>{' '}
@ -390,7 +393,10 @@ let PostThreadItemLoaded = ({
style={styles.expandedInfoItem}
href={likesHref}
title={likesTitle}>
<Text testID="likeCount" type="lg" style={pal.textLight}>
<Text
testID="likeCount-expanded"
type="lg"
style={pal.textLight}>
<Text type="xl-bold" style={pal.text}>
{formatCount(post.likeCount)}
</Text>{' '}

View file

@ -217,6 +217,7 @@ let ProfileHeaderLoaded = ({
openModal({
name: 'user-add-remove-lists',
subject: profile.did,
handle: profile.handle,
displayName: profile.displayName || profile.handle,
onAdd: invalidateProfileQuery,
onRemove: invalidateProfileQuery,

View file

@ -5,6 +5,7 @@ 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
@ -19,6 +20,7 @@ export function TestCtrls() {
const {logout, login} = useSessionApi()
const {openModal} = useModalControls()
const {mutate: setFeedViewPref} = useSetFeedViewPreferencesMutation()
const {setShowLoggedOut} = useLoggedOutViewControls()
const onPressSignInAlice = async () => {
await login({
service: 'http://localhost:3000',
@ -95,6 +97,12 @@ export function TestCtrls() {
accessibilityRole="button"
style={BTN}
/>
<Pressable
testID="e2eOpenLoggedOutView"
onPress={() => setShowLoggedOut(true)}
accessibilityRole="button"
style={BTN}
/>
</View>
)
}

View file

@ -7,6 +7,7 @@ import {colors} from 'lib/styles'
import {useTheme} from 'lib/ThemeContext'
import {usePalette} from 'lib/hooks/usePalette'
import {useAnimatedValue} from 'lib/hooks/useAnimatedValue'
import {IS_TEST} from '#/env'
const TIMEOUT = 4e3
@ -14,6 +15,7 @@ export function show(
message: string,
_icon: FontAwesomeProps['icon'] = 'check',
) {
if (IS_TEST) return
const item = new RootSiblings(<Toast message={message} />)
setTimeout(() => {
item.destroy()

View file

@ -42,6 +42,7 @@ export function SearchResultCard({
return (
<Link
testID={`searchAutoCompleteResult-${profile.handle}`}
href={makeProfileLink(profile)}
title={profile.handle}
asAnchor