Update home-screen tests related to feeds
parent
34759798eb
commit
3fbac466ac
|
@ -4,7 +4,7 @@ import {openApp, loginAsAlice, createServer} from '../util'
|
||||||
|
|
||||||
describe('Home screen', () => {
|
describe('Home screen', () => {
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
await createServer('?users&follows&posts')
|
await createServer('?users&follows&posts&feeds')
|
||||||
await openApp({permissions: {notifications: 'YES'}})
|
await openApp({permissions: {notifications: 'YES'}})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -13,6 +13,23 @@ describe('Home screen', () => {
|
||||||
await element(by.id('homeScreenFeedTabs-Following')).tap()
|
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 () => {
|
it('Can like posts', async () => {
|
||||||
const carlaPosts = by.id('feedItem-by-carla.test')
|
const carlaPosts = by.id('feedItem-by-carla.test')
|
||||||
await expect(
|
await expect(
|
||||||
|
@ -65,14 +82,14 @@ describe('Home screen', () => {
|
||||||
|
|
||||||
it('Can swipe between feeds', async () => {
|
it('Can swipe between feeds', async () => {
|
||||||
await element(by.id('homeScreen')).swipe('left', 'fast', 0.75)
|
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 element(by.id('homeScreen')).swipe('right', 'fast', 0.75)
|
||||||
await expect(element(by.id('followingFeedPage'))).toBeVisible()
|
await expect(element(by.id('followingFeedPage'))).toBeVisible()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Can tap between feeds', async () => {
|
it('Can tap between feeds', async () => {
|
||||||
await element(by.id("homeScreenFeedTabs-What's hot")).tap()
|
await element(by.id('homeScreenFeedTabs-alice-favs')).tap()
|
||||||
await expect(element(by.id('whatshotFeedPage'))).toBeVisible()
|
await expect(element(by.id('customFeedPage'))).toBeVisible()
|
||||||
await element(by.id('homeScreenFeedTabs-Following')).tap()
|
await element(by.id('homeScreenFeedTabs-Following')).tap()
|
||||||
await expect(element(by.id('followingFeedPage'))).toBeVisible()
|
await expect(element(by.id('followingFeedPage'))).toBeVisible()
|
||||||
})
|
})
|
||||||
|
|
|
@ -108,6 +108,7 @@ export const PagerWithHeader = React.forwardRef<PagerRef, PagerWithHeaderProps>(
|
||||||
pointerEvents: isHeaderReady ? 'auto' : 'none',
|
pointerEvents: isHeaderReady ? 'auto' : 'none',
|
||||||
}}>
|
}}>
|
||||||
<TabBar
|
<TabBar
|
||||||
|
testID={testID}
|
||||||
items={items}
|
items={items}
|
||||||
selectedPage={currentPage}
|
selectedPage={currentPage}
|
||||||
onSelect={props.onSelect}
|
onSelect={props.onSelect}
|
||||||
|
@ -127,6 +128,7 @@ export const PagerWithHeader = React.forwardRef<PagerRef, PagerWithHeaderProps>(
|
||||||
isMobile,
|
isMobile,
|
||||||
onTabBarLayout,
|
onTabBarLayout,
|
||||||
onHeaderOnlyLayout,
|
onHeaderOnlyLayout,
|
||||||
|
testID,
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -68,6 +68,7 @@ export function TabBar({
|
||||||
return (
|
return (
|
||||||
<View testID={testID} style={[pal.view, styles.outer]}>
|
<View testID={testID} style={[pal.view, styles.outer]}>
|
||||||
<DraggableScrollView
|
<DraggableScrollView
|
||||||
|
testID={`${testID}-selector`}
|
||||||
horizontal={true}
|
horizontal={true}
|
||||||
showsHorizontalScrollIndicator={false}
|
showsHorizontalScrollIndicator={false}
|
||||||
ref={scrollElRef}
|
ref={scrollElRef}
|
||||||
|
@ -76,6 +77,7 @@ export function TabBar({
|
||||||
const selected = i === selectedPage
|
const selected = i === selectedPage
|
||||||
return (
|
return (
|
||||||
<PressableWithHover
|
<PressableWithHover
|
||||||
|
testID={`${testID}-selector-${i}`}
|
||||||
key={item}
|
key={item}
|
||||||
onLayout={e => onItemLayout(e, i)}
|
onLayout={e => onItemLayout(e, i)}
|
||||||
style={[styles.item, selected && indicatorStyle]}
|
style={[styles.item, selected && indicatorStyle]}
|
||||||
|
|
|
@ -267,6 +267,7 @@ function ProfileScreenLoaded({
|
||||||
screenDescription="profile"
|
screenDescription="profile"
|
||||||
moderation={moderation.account}>
|
moderation={moderation.account}>
|
||||||
<PagerWithHeader
|
<PagerWithHeader
|
||||||
|
testID="profilePager"
|
||||||
isHeaderReady={true}
|
isHeaderReady={true}
|
||||||
items={sectionTitles}
|
items={sectionTitles}
|
||||||
onPageSelected={onPageSelected}
|
onPageSelected={onPageSelected}
|
||||||
|
|
|
@ -353,6 +353,7 @@ export function ProfileFeedScreenInner({
|
||||||
style={styles.btn}
|
style={styles.btn}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
|
testID={isPinned ? 'unpinBtn' : 'pinBtn'}
|
||||||
disabled={isPinPending || isUnpinPending}
|
disabled={isPinPending || isUnpinPending}
|
||||||
type={isPinned ? 'default' : 'inverted'}
|
type={isPinned ? 'default' : 'inverted'}
|
||||||
label={isPinned ? 'Unpin' : 'Pin to home'}
|
label={isPinned ? 'Unpin' : 'Pin to home'}
|
||||||
|
|
Loading…
Reference in New Issue