Prefilter the mergefeed to ensure a better mix of following and custom feeds (#1498)

* Prefilter the mergefeed to ensure a better mix of following and custom feeds

* Test suite improvements & tests for the mergefeed (#1499)

* Disable invite codes test for now

* Update test sim to latest iphone

* Introduce TestCtrls driver

* Add mergefeed tests
This commit is contained in:
Paul Frazee 2023-09-20 19:47:56 -07:00 committed by GitHub
parent 68dd3210d1
commit 5a945c2024
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 518 additions and 164 deletions

View file

@ -35,7 +35,7 @@ export const Component = observer(function ProfilePreviewImpl({
}, [model, screen])
return (
<View style={[pal.view, s.flex1]}>
<View testID="profilePreview" style={[pal.view, s.flex1]}>
<View
style={[
styles.headerWrapper,

View file

@ -67,6 +67,7 @@ export const FeedsTabBar = observer(function FeedsTabBarImpl(
</Text>
<View style={[pal.view]}>
<Link
testID="viewHeaderHomeFeedPrefsBtn"
href="/settings/home-feed"
hitSlop={HITSLOP_10}
accessibilityRole="button"

View file

@ -299,6 +299,7 @@ export const FeedItem = observer(function FeedItemImpl({
{item.richText?.text ? (
<View style={styles.postTextContainer}>
<RichText
testID="postText"
type="post-text"
richText={item.richText}
lineHeight={1.3}

View file

@ -556,6 +556,7 @@ const ProfileHeaderLoaded = observer(function ProfileHeaderLoadedImpl({
{!isDesktop && !hideBackButton && (
<TouchableWithoutFeedback
testID="profileHeaderBackBtn"
onPress={onPressBack}
hitSlop={BACK_HITSLOP}
accessibilityRole="button"

View file

@ -102,6 +102,7 @@ export function HeaderWithInput({
/>
{query ? (
<TouchableOpacity
testID="searchTextInputClearBtn"
onPress={onPressClearQuery}
accessibilityRole="button"
accessibilityLabel="Clear search query"

View file

@ -0,0 +1,76 @@
import React from 'react'
import {Pressable, View} from 'react-native'
import {useStores} from 'state/index'
import {navigate} from '../../../Navigation'
/**
* This utility component is only included in the test simulator
* build. It gives some quick triggers which help improve the pace
* of the tests dramatically.
*/
const BTN = {height: 1, width: 1, backgroundColor: 'red'}
export function TestCtrls() {
const store = useStores()
const onPressSignInAlice = async () => {
await store.session.login({
service: 'http://localhost:3000',
identifier: 'alice.test',
password: 'hunter2',
})
}
const onPressSignInBob = async () => {
await store.session.login({
service: 'http://localhost:3000',
identifier: 'bob.test',
password: 'hunter2',
})
}
return (
<View style={{position: 'absolute', top: 100, right: 0, zIndex: 100}}>
<Pressable
testID="e2eSignInAlice"
onPress={onPressSignInAlice}
accessibilityRole="button"
style={BTN}
/>
<Pressable
testID="e2eSignInBob"
onPress={onPressSignInBob}
accessibilityRole="button"
style={BTN}
/>
<Pressable
testID="e2eGotoHome"
onPress={() => navigate('Home')}
accessibilityRole="button"
style={BTN}
/>
<Pressable
testID="e2eGotoSettings"
onPress={() => navigate('Settings')}
accessibilityRole="button"
style={BTN}
/>
<Pressable
testID="e2eGotoModeration"
onPress={() => navigate('Moderation')}
accessibilityRole="button"
style={BTN}
/>
<Pressable
testID="e2eToggleMergefeed"
onPress={() => store.preferences.toggleHomeFeedMergeFeedEnabled()}
accessibilityRole="button"
style={BTN}
/>
<Pressable
testID="e2eRefreshHome"
onPress={() => store.me.mainFeed.refresh()}
accessibilityRole="button"
style={BTN}
/>
</View>
)
}

View file

@ -0,0 +1,3 @@
export function TestCtrls() {
return null
}

View file

@ -8,6 +8,7 @@ import {colors} from 'lib/styles'
import {TypographyVariant} from 'lib/ThemeContext'
export function ToggleButton({
testID,
type = 'default-light',
label,
isSelected,
@ -15,6 +16,7 @@ export function ToggleButton({
labelType,
onPress,
}: {
testID?: string
type?: ButtonType
label: string
isSelected: boolean
@ -134,7 +136,7 @@ export function ToggleButton({
},
})
return (
<Button type={type} onPress={onPress} style={style}>
<Button testID={testID} type={type} onPress={onPress} style={style}>
<View style={styles.outer}>
<View style={[circleStyle, styles.circle]}>
<View