about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEric Bailey <git@esb.lol>2023-12-05 14:50:56 -0600
committerGitHub <noreply@github.com>2023-12-05 14:50:56 -0600
commit5f553c29dfdac1bf81debe5e28983a9dbe74bd7f (patch)
tree6bfabab5623050aed65cdbb8dcc6474aa8f9d9cb /src
parented5a97d0fab249cab91539f0c4dc7d3084bc59a8 (diff)
downloadvoidsky-5f553c29dfdac1bf81debe5e28983a9dbe74bd7f.tar.zst
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
Diffstat (limited to 'src')
-rw-r--r--src/env.ts2
-rw-r--r--src/state/modals/index.tsx1
-rw-r--r--src/view/com/feeds/FeedSourceCard.tsx1
-rw-r--r--src/view/com/lists/ListMembers.tsx1
-rw-r--r--src/view/com/modals/UserAddRemoveLists.tsx7
-rw-r--r--src/view/com/post-thread/PostThreadItem.tsx10
-rw-r--r--src/view/com/profile/ProfileHeader.tsx1
-rw-r--r--src/view/com/testing/TestCtrls.e2e.tsx8
-rw-r--r--src/view/com/util/Toast.tsx2
-rw-r--r--src/view/shell/desktop/Search.tsx1
10 files changed, 30 insertions, 4 deletions
diff --git a/src/env.ts b/src/env.ts
index 7b255e7ea..fbcc15f57 100644
--- a/src/env.ts
+++ b/src/env.ts
@@ -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 || ''
diff --git a/src/state/modals/index.tsx b/src/state/modals/index.tsx
index 84fea3bad..94d6d9ec5 100644
--- a/src/state/modals/index.tsx
+++ b/src/state/modals/index.tsx
@@ -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
diff --git a/src/view/com/feeds/FeedSourceCard.tsx b/src/view/com/feeds/FeedSourceCard.tsx
index 1f2af069b..460816fc1 100644
--- a/src/view/com/feeds/FeedSourceCard.tsx
+++ b/src/view/com/feeds/FeedSourceCard.tsx
@@ -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={
diff --git a/src/view/com/lists/ListMembers.tsx b/src/view/com/lists/ListMembers.tsx
index e6afb3d3c..b25f3ac48 100644
--- a/src/view/com/lists/ListMembers.tsx
+++ b/src/view/com/lists/ListMembers.tsx
@@ -132,6 +132,7 @@ export function ListMembers({
         name: 'user-add-remove-lists',
         subject: profile.did,
         displayName: profile.displayName || profile.handle,
+        handle: profile.handle,
       })
     },
     [openModal],
diff --git a/src/view/com/modals/UserAddRemoveLists.tsx b/src/view/com/modals/UserAddRemoveLists.tsx
index 8c3dc8bb7..506ce15d0 100644
--- a/src/view/com/modals/UserAddRemoveLists.tsx
+++ b/src/view/com/modals/UserAddRemoveLists.tsx
@@ -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}
diff --git a/src/view/com/post-thread/PostThreadItem.tsx b/src/view/com/post-thread/PostThreadItem.tsx
index 86ea4eb39..c121c7234 100644
--- a/src/view/com/post-thread/PostThreadItem.tsx
+++ b/src/view/com/post-thread/PostThreadItem.tsx
@@ -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>{' '}
diff --git a/src/view/com/profile/ProfileHeader.tsx b/src/view/com/profile/ProfileHeader.tsx
index 39e3e42ec..e006cac7d 100644
--- a/src/view/com/profile/ProfileHeader.tsx
+++ b/src/view/com/profile/ProfileHeader.tsx
@@ -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,
diff --git a/src/view/com/testing/TestCtrls.e2e.tsx b/src/view/com/testing/TestCtrls.e2e.tsx
index 41abc25d3..e1e899488 100644
--- a/src/view/com/testing/TestCtrls.e2e.tsx
+++ b/src/view/com/testing/TestCtrls.e2e.tsx
@@ -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>
   )
 }
diff --git a/src/view/com/util/Toast.tsx b/src/view/com/util/Toast.tsx
index c7134febe..5462505e1 100644
--- a/src/view/com/util/Toast.tsx
+++ b/src/view/com/util/Toast.tsx
@@ -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()
diff --git a/src/view/shell/desktop/Search.tsx b/src/view/shell/desktop/Search.tsx
index f899431b6..6201f828f 100644
--- a/src/view/shell/desktop/Search.tsx
+++ b/src/view/shell/desktop/Search.tsx
@@ -42,6 +42,7 @@ export function SearchResultCard({
 
   return (
     <Link
+      testID={`searchAutoCompleteResult-${profile.handle}`}
       href={makeProfileLink(profile)}
       title={profile.handle}
       asAnchor