From 3fbac466ac8554fcb690fccbe0053a5be07801d7 Mon Sep 17 00:00:00 2001 From: Cooper Edmunds Date: Wed, 29 Nov 2023 19:28:35 -0500 Subject: [PATCH] Update home-screen tests related to feeds --- __e2e__/tests/home-screen.test.ts | 25 +++++++++++++++++++++---- src/view/com/pager/PagerWithHeader.tsx | 2 ++ src/view/com/pager/TabBar.tsx | 2 ++ src/view/screens/Profile.tsx | 1 + src/view/screens/ProfileFeed.tsx | 1 + 5 files changed, 27 insertions(+), 4 deletions(-) diff --git a/__e2e__/tests/home-screen.test.ts b/__e2e__/tests/home-screen.test.ts index 7647b55c..b6cd1919 100644 --- a/__e2e__/tests/home-screen.test.ts +++ b/__e2e__/tests/home-screen.test.ts @@ -4,7 +4,7 @@ import {openApp, loginAsAlice, createServer} from '../util' describe('Home screen', () => { beforeAll(async () => { - await createServer('?users&follows&posts') + await createServer('?users&follows&posts&feeds') await openApp({permissions: {notifications: 'YES'}}) }) @@ -13,6 +13,23 @@ describe('Home screen', () => { await element(by.id('homeScreenFeedTabs-Following')).tap() }) + it('Can go to feeds page using feeds button in tab bar', async () => { + await element(by.id('homeScreenFeedTabs-Feeds ✨')).tap() + await expect(element(by.text('Discover new feeds'))).toBeVisible() + }) + + it('Feeds button disappears after pinning a feed', async () => { + await element(by.id('bottomBarProfileBtn')).tap() + await element(by.id('profilePager-selector')).swipe('left') + await element(by.id('profilePager-selector-4')).tap() + await element(by.id('feed-alice-favs')).tap() + await element(by.id('pinBtn')).tap() + await element(by.id('bottomBarHomeBtn')).tap() + await expect( + element(by.id('homeScreenFeedTabs-Feeds ✨')), + ).not.toBeVisible() + }) + it('Can like posts', async () => { const carlaPosts = by.id('feedItem-by-carla.test') await expect( @@ -65,14 +82,14 @@ describe('Home screen', () => { it('Can swipe between feeds', async () => { await element(by.id('homeScreen')).swipe('left', 'fast', 0.75) - await expect(element(by.id('whatshotFeedPage'))).toBeVisible() + await expect(element(by.id('customFeedPage'))).toBeVisible() await element(by.id('homeScreen')).swipe('right', 'fast', 0.75) await expect(element(by.id('followingFeedPage'))).toBeVisible() }) it('Can tap between feeds', async () => { - await element(by.id("homeScreenFeedTabs-What's hot")).tap() - await expect(element(by.id('whatshotFeedPage'))).toBeVisible() + await element(by.id('homeScreenFeedTabs-alice-favs')).tap() + await expect(element(by.id('customFeedPage'))).toBeVisible() await element(by.id('homeScreenFeedTabs-Following')).tap() await expect(element(by.id('followingFeedPage'))).toBeVisible() }) diff --git a/src/view/com/pager/PagerWithHeader.tsx b/src/view/com/pager/PagerWithHeader.tsx index 3d2a3c55..2c7640c4 100644 --- a/src/view/com/pager/PagerWithHeader.tsx +++ b/src/view/com/pager/PagerWithHeader.tsx @@ -108,6 +108,7 @@ export const PagerWithHeader = React.forwardRef( pointerEvents: isHeaderReady ? 'auto' : 'none', }}> ( isMobile, onTabBarLayout, onHeaderOnlyLayout, + testID, ], ) diff --git a/src/view/com/pager/TabBar.tsx b/src/view/com/pager/TabBar.tsx index 0e08b22d..c3a95c5c 100644 --- a/src/view/com/pager/TabBar.tsx +++ b/src/view/com/pager/TabBar.tsx @@ -68,6 +68,7 @@ export function TabBar({ return ( onItemLayout(e, i)} style={[styles.item, selected && indicatorStyle]} diff --git a/src/view/screens/Profile.tsx b/src/view/screens/Profile.tsx index 7ddcf17a..35efe3a0 100644 --- a/src/view/screens/Profile.tsx +++ b/src/view/screens/Profile.tsx @@ -267,6 +267,7 @@ function ProfileScreenLoaded({ screenDescription="profile" moderation={moderation.account}>