Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

authored by

Paul Frazee and committed by
GitHub
54f424d0 a90566d8

+101 -19
+2 -2
__e2e__/tests/curate-lists.test.ts
··· 64 64 await element(by.text('Edit list details')).tap() 65 65 await expect(element(by.id('createOrEditListModal'))).toBeVisible() 66 66 await element(by.id('changeAvatarBtn')).tap() 67 - await element(by.text('Library')).tap() 67 + await element(by.text('Upload from Library')).tap() 68 68 await sleep(3e3) 69 69 await element(by.id('saveBtn')).tap() 70 70 await expect(element(by.id('createOrEditListModal'))).not.toBeVisible() ··· 81 81 await element(by.text('Edit list details')).tap() 82 82 await expect(element(by.id('createOrEditListModal'))).toBeVisible() 83 83 await element(by.id('changeAvatarBtn')).tap() 84 - await element(by.text('Remove')).tap() 84 + await element(by.text('Remove Avatar')).tap() 85 85 await element(by.id('saveBtn')).tap() 86 86 await expect(element(by.id('createOrEditListModal'))).not.toBeVisible() 87 87 await expect(element(by.id('userAvatarFallback'))).toExist()
+1 -1
__e2e__/tests/home-screen.test.ts
··· 17 17 18 18 it('Can go to feeds page using feeds button in tab bar', async () => { 19 19 await element(by.id('homeScreenFeedTabs-Feeds ✨')).tap() 20 - await expect(element(by.text('Discover new feeds'))).toBeVisible() 20 + await expect(element(by.text('Discover New Feeds'))).toBeVisible() 21 21 }) 22 22 23 23 it('Feeds button disappears after pinning a feed', async () => {
__e2e__/tests/invites-and-text-verification.test.ts __e2e__/tests/invites-and-text-verification.test.skip.ts
+4 -4
__e2e__/tests/profile-screen.test.ts
··· 70 70 await element(by.id('profileHeaderEditProfileButton')).tap() 71 71 await expect(element(by.id('editProfileModal'))).toBeVisible() 72 72 await element(by.id('changeBannerBtn')).tap() 73 - await element(by.text('Library')).tap() 73 + await element(by.text('Upload from Library')).tap() 74 74 await sleep(3e3) 75 75 await element(by.id('changeAvatarBtn')).tap() 76 - await element(by.text('Library')).tap() 76 + await element(by.text('Upload from Library')).tap() 77 77 await sleep(3e3) 78 78 await element(by.id('editProfileSaveBtn')).tap() 79 79 await expect(element(by.id('editProfileModal'))).not.toBeVisible() ··· 87 87 await element(by.id('profileHeaderEditProfileButton')).tap() 88 88 await expect(element(by.id('editProfileModal'))).toBeVisible() 89 89 await element(by.id('changeBannerBtn')).tap() 90 - await element(by.text('Remove')).tap() 90 + await element(by.text('Remove Banner')).tap() 91 91 await element(by.id('changeAvatarBtn')).tap() 92 - await element(by.text('Remove')).tap() 92 + await element(by.text('Remove Avatar')).tap() 93 93 await element(by.id('editProfileSaveBtn')).tap() 94 94 await expect(element(by.id('editProfileModal'))).not.toBeVisible() 95 95 await expect(element(by.id('userBannerFallback'))).toExist()
+7 -5
__e2e__/tests/text-verification.test.ts __e2e__/tests/text-verification.test.skip.ts
··· 12 12 }) 13 13 14 14 it('I can create a new account with text verification', async () => { 15 + console.log('SERVICE IS', service) 15 16 await element(by.id('e2eOpenLoggedOutView')).tap() 16 17 17 18 await element(by.id('createAccountButton')).tap() ··· 28 29 await device.takeScreenshot('4- entered account details') 29 30 await element(by.id('nextBtn')).tap() 30 31 32 + await element(by.id('handleInput')).typeText('text-verification-test') 33 + await device.takeScreenshot('5- entered handle') 34 + await element(by.id('nextBtn')).tap() 35 + 31 36 await element(by.id('phoneInput')).typeText('8042221111') 32 37 await element(by.id('requestCodeBtn')).tap() 33 - await device.takeScreenshot('5- requested code') 38 + await device.takeScreenshot('6- requested code') 34 39 35 40 await element(by.id('codeInput')).typeText('000000') 36 - await device.takeScreenshot('6- entered code') 41 + await device.takeScreenshot('7- entered code') 37 42 await element(by.id('nextBtn')).tap() 38 - 39 - await element(by.id('handleInput')).typeText('text-verification-test') 40 - await device.takeScreenshot('7- entered handle') 41 43 42 44 await element(by.id('nextBtn')).tap() 43 45
+33 -3
jest/test-pds.ts
··· 72 72 const phoneParams = phoneRequired 73 73 ? { 74 74 phoneVerificationRequired: true, 75 + phoneVerificationProvider: 'twilio', 75 76 twilioAccountSid: 'ACXXXXXXX', 76 77 twilioAuthToken: 'AUTH', 77 78 twilioServiceSid: 'VAXXXXXXXX', ··· 94 95 plc: {port: port2}, 95 96 }) 96 97 mockTwilio(testNet.pds) 98 + 99 + // add the test mod authority 100 + if (!phoneRequired) { 101 + const agent = new BskyAgent({service: pdsUrl}) 102 + const res = await agent.api.com.atproto.server.createAccount({ 103 + email: 'mod-authority@test.com', 104 + handle: 'mod-authority.test', 105 + password: 'hunter2', 106 + }) 107 + agent.api.setHeader('Authorization', `Bearer ${res.data.accessJwt}`) 108 + await agent.api.app.bsky.actor.profile.create( 109 + {repo: res.data.did}, 110 + { 111 + displayName: 'Dev-env Moderation', 112 + description: `The pretend version of mod.bsky.app`, 113 + }, 114 + ) 115 + 116 + await agent.api.app.bsky.labeler.service.create( 117 + {repo: res.data.did, rkey: 'self'}, 118 + { 119 + policies: { 120 + labelValues: ['!hide', '!warn'], 121 + labelValueDefinitions: [], 122 + }, 123 + createdAt: new Date().toISOString(), 124 + }, 125 + ) 126 + } 97 127 98 128 const pic = fs.readFileSync( 99 129 path.join(__dirname, '..', 'assets', 'default-avatar.png'), ··· 455 485 } 456 486 457 487 export const mockTwilio = (pds: TestPds) => { 458 - if (!pds.ctx.twilio) return 488 + if (!pds.ctx.phoneVerifier) return 459 489 460 - pds.ctx.twilio.sendCode = async (_number: string) => { 490 + pds.ctx.phoneVerifier.sendCode = async (_number: string) => { 461 491 // do nothing 462 492 } 463 493 464 - pds.ctx.twilio.verifyCode = async (_number: string, code: string) => { 494 + pds.ctx.phoneVerifier.verifyCode = async (_number: string, code: string) => { 465 495 return code === '000000' 466 496 } 467 497 }
+1 -2
src/lib/media/picker.e2e.tsx
··· 3 3 import {CropperOptions} from './types' 4 4 import {compressIfNeeded} from './manip' 5 5 6 - let _imageCounter = 0 7 6 async function getFile() { 8 7 let files = await RNFS.readDir( 9 8 RNFS.LibraryDirectoryPath.split('/') ··· 12 11 .join('/'), 13 12 ) 14 13 files = files.filter(file => file.path.endsWith('.JPG')) 15 - const file = files[_imageCounter++ % files.length] 14 + const file = files[0] 16 15 return await compressIfNeeded({ 17 16 path: file.path, 18 17 mime: 'image/jpeg',
+45
src/view/com/composer/useExternalLinkFetch.e2e.ts
··· 1 + import {useState, useEffect} from 'react' 2 + import * as apilib from 'lib/api/index' 3 + import {getLinkMeta} from 'lib/link-meta/link-meta' 4 + import {ComposerOpts} from 'state/shell/composer' 5 + import {getAgent} from '#/state/session' 6 + 7 + export function useExternalLinkFetch({}: { 8 + setQuote: (opts: ComposerOpts['quote']) => void 9 + }) { 10 + const [extLink, setExtLink] = useState<apilib.ExternalEmbedDraft | undefined>( 11 + undefined, 12 + ) 13 + 14 + useEffect(() => { 15 + let aborted = false 16 + const cleanup = () => { 17 + aborted = true 18 + } 19 + if (!extLink) { 20 + return cleanup 21 + } 22 + if (!extLink.meta) { 23 + getLinkMeta(getAgent(), extLink.uri).then(meta => { 24 + if (aborted) { 25 + return 26 + } 27 + setExtLink({ 28 + uri: extLink.uri, 29 + isLoading: !!meta.image, 30 + meta, 31 + }) 32 + }) 33 + return cleanup 34 + } 35 + if (extLink.isLoading) { 36 + setExtLink({ 37 + ...extLink, 38 + isLoading: false, // done 39 + }) 40 + } 41 + return cleanup 42 + }, [extLink]) 43 + 44 + return {extLink, setExtLink} 45 + }
+4 -1
src/view/com/util/UserAvatar.tsx
··· 298 298 <Menu.Root> 299 299 <Menu.Trigger label={_(msg`Edit avatar`)}> 300 300 {({props}) => ( 301 - <TouchableOpacity {...props} activeOpacity={0.8}> 301 + <TouchableOpacity 302 + {...props} 303 + activeOpacity={0.8} 304 + testID="changeAvatarBtn"> 302 305 {avatar ? ( 303 306 <HighPriorityImage 304 307 testID="userAvatarImage"
+4 -1
src/view/com/util/UserBanner.tsx
··· 84 84 <Menu.Root> 85 85 <Menu.Trigger label={_(msg`Edit avatar`)}> 86 86 {({props}) => ( 87 - <TouchableOpacity {...props} activeOpacity={0.8}> 87 + <TouchableOpacity 88 + {...props} 89 + activeOpacity={0.8} 90 + testID="changeBannerBtn"> 88 91 {banner ? ( 89 92 <Image 90 93 testID="userBannerImage"