Various e2e test fixes (#3284)
* Just use the first picture every time * Add missing testIDs * Various test fixes * Use simplified link fetcher for e2e * Disable tests for now-n * Update test-env creation
This commit is contained in:
parent
a90566d864
commit
54f424d047
10 changed files with 104 additions and 22 deletions
|
@ -3,7 +3,6 @@ import RNFS from 'react-native-fs'
|
|||
import {CropperOptions} from './types'
|
||||
import {compressIfNeeded} from './manip'
|
||||
|
||||
let _imageCounter = 0
|
||||
async function getFile() {
|
||||
let files = await RNFS.readDir(
|
||||
RNFS.LibraryDirectoryPath.split('/')
|
||||
|
@ -12,7 +11,7 @@ async function getFile() {
|
|||
.join('/'),
|
||||
)
|
||||
files = files.filter(file => file.path.endsWith('.JPG'))
|
||||
const file = files[_imageCounter++ % files.length]
|
||||
const file = files[0]
|
||||
return await compressIfNeeded({
|
||||
path: file.path,
|
||||
mime: 'image/jpeg',
|
||||
|
|
45
src/view/com/composer/useExternalLinkFetch.e2e.ts
Normal file
45
src/view/com/composer/useExternalLinkFetch.e2e.ts
Normal file
|
@ -0,0 +1,45 @@
|
|||
import {useState, useEffect} from 'react'
|
||||
import * as apilib from 'lib/api/index'
|
||||
import {getLinkMeta} from 'lib/link-meta/link-meta'
|
||||
import {ComposerOpts} from 'state/shell/composer'
|
||||
import {getAgent} from '#/state/session'
|
||||
|
||||
export function useExternalLinkFetch({}: {
|
||||
setQuote: (opts: ComposerOpts['quote']) => void
|
||||
}) {
|
||||
const [extLink, setExtLink] = useState<apilib.ExternalEmbedDraft | undefined>(
|
||||
undefined,
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
let aborted = false
|
||||
const cleanup = () => {
|
||||
aborted = true
|
||||
}
|
||||
if (!extLink) {
|
||||
return cleanup
|
||||
}
|
||||
if (!extLink.meta) {
|
||||
getLinkMeta(getAgent(), extLink.uri).then(meta => {
|
||||
if (aborted) {
|
||||
return
|
||||
}
|
||||
setExtLink({
|
||||
uri: extLink.uri,
|
||||
isLoading: !!meta.image,
|
||||
meta,
|
||||
})
|
||||
})
|
||||
return cleanup
|
||||
}
|
||||
if (extLink.isLoading) {
|
||||
setExtLink({
|
||||
...extLink,
|
||||
isLoading: false, // done
|
||||
})
|
||||
}
|
||||
return cleanup
|
||||
}, [extLink])
|
||||
|
||||
return {extLink, setExtLink}
|
||||
}
|
|
@ -298,7 +298,10 @@ let EditableUserAvatar = ({
|
|||
<Menu.Root>
|
||||
<Menu.Trigger label={_(msg`Edit avatar`)}>
|
||||
{({props}) => (
|
||||
<TouchableOpacity {...props} activeOpacity={0.8}>
|
||||
<TouchableOpacity
|
||||
{...props}
|
||||
activeOpacity={0.8}
|
||||
testID="changeAvatarBtn">
|
||||
{avatar ? (
|
||||
<HighPriorityImage
|
||||
testID="userAvatarImage"
|
||||
|
|
|
@ -84,7 +84,10 @@ export function UserBanner({
|
|||
<Menu.Root>
|
||||
<Menu.Trigger label={_(msg`Edit avatar`)}>
|
||||
{({props}) => (
|
||||
<TouchableOpacity {...props} activeOpacity={0.8}>
|
||||
<TouchableOpacity
|
||||
{...props}
|
||||
activeOpacity={0.8}
|
||||
testID="changeBannerBtn">
|
||||
{banner ? (
|
||||
<Image
|
||||
testID="userBannerImage"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue