diff --git a/__e2e__/tests/curate-lists.test.ts b/__e2e__/tests/curate-lists.test.ts index f188b154..2c44fa5d 100644 --- a/__e2e__/tests/curate-lists.test.ts +++ b/__e2e__/tests/curate-lists.test.ts @@ -64,7 +64,7 @@ describe('Curate lists', () => { await element(by.text('Edit list details')).tap() await expect(element(by.id('createOrEditListModal'))).toBeVisible() await element(by.id('changeAvatarBtn')).tap() - await element(by.text('Library')).tap() + await element(by.text('Upload from Library')).tap() await sleep(3e3) await element(by.id('saveBtn')).tap() await expect(element(by.id('createOrEditListModal'))).not.toBeVisible() @@ -81,7 +81,7 @@ describe('Curate lists', () => { await element(by.text('Edit list details')).tap() await expect(element(by.id('createOrEditListModal'))).toBeVisible() await element(by.id('changeAvatarBtn')).tap() - await element(by.text('Remove')).tap() + await element(by.text('Remove Avatar')).tap() await element(by.id('saveBtn')).tap() await expect(element(by.id('createOrEditListModal'))).not.toBeVisible() await expect(element(by.id('userAvatarFallback'))).toExist() diff --git a/__e2e__/tests/home-screen.test.ts b/__e2e__/tests/home-screen.test.ts index ce7f1643..a83a34ed 100644 --- a/__e2e__/tests/home-screen.test.ts +++ b/__e2e__/tests/home-screen.test.ts @@ -17,7 +17,7 @@ describe('Home screen', () => { 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() + await expect(element(by.text('Discover New Feeds'))).toBeVisible() }) it('Feeds button disappears after pinning a feed', async () => { diff --git a/__e2e__/tests/invites-and-text-verification.test.ts b/__e2e__/tests/invites-and-text-verification.test.skip.ts similarity index 100% rename from __e2e__/tests/invites-and-text-verification.test.ts rename to __e2e__/tests/invites-and-text-verification.test.skip.ts diff --git a/__e2e__/tests/profile-screen.test.ts b/__e2e__/tests/profile-screen.test.ts index 7ff43642..13d0fa8e 100644 --- a/__e2e__/tests/profile-screen.test.ts +++ b/__e2e__/tests/profile-screen.test.ts @@ -70,10 +70,10 @@ describe('Profile screen', () => { await element(by.id('profileHeaderEditProfileButton')).tap() await expect(element(by.id('editProfileModal'))).toBeVisible() await element(by.id('changeBannerBtn')).tap() - await element(by.text('Library')).tap() + await element(by.text('Upload from Library')).tap() await sleep(3e3) await element(by.id('changeAvatarBtn')).tap() - await element(by.text('Library')).tap() + await element(by.text('Upload from Library')).tap() await sleep(3e3) await element(by.id('editProfileSaveBtn')).tap() await expect(element(by.id('editProfileModal'))).not.toBeVisible() @@ -87,9 +87,9 @@ describe('Profile screen', () => { await element(by.id('profileHeaderEditProfileButton')).tap() await expect(element(by.id('editProfileModal'))).toBeVisible() await element(by.id('changeBannerBtn')).tap() - await element(by.text('Remove')).tap() + await element(by.text('Remove Banner')).tap() await element(by.id('changeAvatarBtn')).tap() - await element(by.text('Remove')).tap() + await element(by.text('Remove Avatar')).tap() await element(by.id('editProfileSaveBtn')).tap() await expect(element(by.id('editProfileModal'))).not.toBeVisible() await expect(element(by.id('userBannerFallback'))).toExist() diff --git a/__e2e__/tests/text-verification.test.ts b/__e2e__/tests/text-verification.test.skip.ts similarity index 93% rename from __e2e__/tests/text-verification.test.ts rename to __e2e__/tests/text-verification.test.skip.ts index 79b14aec..bd19e66b 100644 --- a/__e2e__/tests/text-verification.test.ts +++ b/__e2e__/tests/text-verification.test.skip.ts @@ -12,6 +12,7 @@ describe('Create account', () => { }) it('I can create a new account with text verification', async () => { + console.log('SERVICE IS', service) await element(by.id('e2eOpenLoggedOutView')).tap() await element(by.id('createAccountButton')).tap() @@ -28,16 +29,17 @@ describe('Create account', () => { await device.takeScreenshot('4- entered account details') await element(by.id('nextBtn')).tap() - await element(by.id('phoneInput')).typeText('8042221111') - await element(by.id('requestCodeBtn')).tap() - await device.takeScreenshot('5- requested code') - - await element(by.id('codeInput')).typeText('000000') - await device.takeScreenshot('6- entered code') + await element(by.id('handleInput')).typeText('text-verification-test') + await device.takeScreenshot('5- entered handle') await element(by.id('nextBtn')).tap() - await element(by.id('handleInput')).typeText('text-verification-test') - await device.takeScreenshot('7- entered handle') + await element(by.id('phoneInput')).typeText('8042221111') + await element(by.id('requestCodeBtn')).tap() + await device.takeScreenshot('6- requested code') + + await element(by.id('codeInput')).typeText('000000') + await device.takeScreenshot('7- entered code') + await element(by.id('nextBtn')).tap() await element(by.id('nextBtn')).tap() diff --git a/jest/test-pds.ts b/jest/test-pds.ts index 51d96439..b70a9abf 100644 --- a/jest/test-pds.ts +++ b/jest/test-pds.ts @@ -72,6 +72,7 @@ export async function createServer( const phoneParams = phoneRequired ? { phoneVerificationRequired: true, + phoneVerificationProvider: 'twilio', twilioAccountSid: 'ACXXXXXXX', twilioAuthToken: 'AUTH', twilioServiceSid: 'VAXXXXXXXX', @@ -95,6 +96,35 @@ export async function createServer( }) mockTwilio(testNet.pds) + // add the test mod authority + if (!phoneRequired) { + const agent = new BskyAgent({service: pdsUrl}) + const res = await agent.api.com.atproto.server.createAccount({ + email: 'mod-authority@test.com', + handle: 'mod-authority.test', + password: 'hunter2', + }) + agent.api.setHeader('Authorization', `Bearer ${res.data.accessJwt}`) + await agent.api.app.bsky.actor.profile.create( + {repo: res.data.did}, + { + displayName: 'Dev-env Moderation', + description: `The pretend version of mod.bsky.app`, + }, + ) + + await agent.api.app.bsky.labeler.service.create( + {repo: res.data.did, rkey: 'self'}, + { + policies: { + labelValues: ['!hide', '!warn'], + labelValueDefinitions: [], + }, + createdAt: new Date().toISOString(), + }, + ) + } + const pic = fs.readFileSync( path.join(__dirname, '..', 'assets', 'default-avatar.png'), ) @@ -455,13 +485,13 @@ async function getPort(start = 3000) { } export const mockTwilio = (pds: TestPds) => { - if (!pds.ctx.twilio) return + if (!pds.ctx.phoneVerifier) return - pds.ctx.twilio.sendCode = async (_number: string) => { + pds.ctx.phoneVerifier.sendCode = async (_number: string) => { // do nothing } - pds.ctx.twilio.verifyCode = async (_number: string, code: string) => { + pds.ctx.phoneVerifier.verifyCode = async (_number: string, code: string) => { return code === '000000' } } diff --git a/src/lib/media/picker.e2e.tsx b/src/lib/media/picker.e2e.tsx index d7b60804..31702ab2 100644 --- a/src/lib/media/picker.e2e.tsx +++ b/src/lib/media/picker.e2e.tsx @@ -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', diff --git a/src/view/com/composer/useExternalLinkFetch.e2e.ts b/src/view/com/composer/useExternalLinkFetch.e2e.ts new file mode 100644 index 00000000..ccf619db --- /dev/null +++ b/src/view/com/composer/useExternalLinkFetch.e2e.ts @@ -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( + 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} +} diff --git a/src/view/com/util/UserAvatar.tsx b/src/view/com/util/UserAvatar.tsx index 8656c3f5..4beedbd5 100644 --- a/src/view/com/util/UserAvatar.tsx +++ b/src/view/com/util/UserAvatar.tsx @@ -298,7 +298,10 @@ let EditableUserAvatar = ({ {({props}) => ( - + {avatar ? ( {({props}) => ( - + {banner ? (