E2E 🟢 (#2092)
* 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:
parent
ed5a97d0fa
commit
5f553c29df
29 changed files with 1600 additions and 234 deletions
|
@ -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 || ''
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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={
|
||||
|
|
|
@ -132,6 +132,7 @@ export function ListMembers({
|
|||
name: 'user-add-remove-lists',
|
||||
subject: profile.did,
|
||||
displayName: profile.displayName || profile.handle,
|
||||
handle: profile.handle,
|
||||
})
|
||||
},
|
||||
[openModal],
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -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>{' '}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -42,6 +42,7 @@ export function SearchResultCard({
|
|||
|
||||
return (
|
||||
<Link
|
||||
testID={`searchAutoCompleteResult-${profile.handle}`}
|
||||
href={makeProfileLink(profile)}
|
||||
title={profile.handle}
|
||||
asAnchor
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue