2023-03-31 20:17:26 +02:00
|
|
|
/* eslint-env detox/detox */
|
|
|
|
|
2024-04-10 01:27:39 +02:00
|
|
|
import {beforeAll, describe, it} from '@jest/globals'
|
2023-12-05 21:50:56 +01:00
|
|
|
import {expect} from 'detox'
|
2024-04-10 01:27:39 +02:00
|
|
|
|
|
|
|
import {createServer, loginAsAlice, openApp, sleep} from '../util'
|
2023-03-31 20:17:26 +02:00
|
|
|
|
|
|
|
describe('Profile screen', () => {
|
|
|
|
beforeAll(async () => {
|
2023-09-21 04:47:56 +02:00
|
|
|
await createServer('?users&posts&feeds')
|
2023-03-31 20:17:26 +02:00
|
|
|
await openApp({
|
|
|
|
permissions: {notifications: 'YES', medialibrary: 'YES', photos: 'YES'},
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Login and navigate to my profile', async () => {
|
2023-09-21 04:47:56 +02:00
|
|
|
await loginAsAlice()
|
2023-03-31 20:17:26 +02:00
|
|
|
await element(by.id('bottomBarProfileBtn')).tap()
|
|
|
|
})
|
|
|
|
|
2023-08-15 18:59:49 +02:00
|
|
|
it('Can see feeds', async () => {
|
2023-12-05 21:50:56 +01:00
|
|
|
await element(by.id('profilePager-selector')).swipe('left')
|
|
|
|
await element(by.id('profilePager-selector-4')).tap()
|
2023-09-23 02:49:41 +02:00
|
|
|
await expect(element(by.id('feed-alice-favs'))).toBeVisible()
|
2023-12-05 21:50:56 +01:00
|
|
|
await element(by.id('profilePager-selector')).swipe('right')
|
|
|
|
await element(by.id('profilePager-selector-0')).tap()
|
2023-08-15 18:59:49 +02:00
|
|
|
})
|
|
|
|
|
2023-03-31 20:17:26 +02:00
|
|
|
it('Open and close edit profile modal', async () => {
|
|
|
|
await element(by.id('profileHeaderEditProfileButton')).tap()
|
|
|
|
await expect(element(by.id('editProfileModal'))).toBeVisible()
|
|
|
|
await element(by.id('editProfileCancelBtn')).tap()
|
|
|
|
await expect(element(by.id('editProfileModal'))).not.toBeVisible()
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Edit display name and description via the edit profile modal', async () => {
|
|
|
|
await element(by.id('profileHeaderEditProfileButton')).tap()
|
|
|
|
await expect(element(by.id('editProfileModal'))).toBeVisible()
|
|
|
|
await element(by.id('editProfileDisplayNameInput')).clearText()
|
|
|
|
await element(by.id('editProfileDisplayNameInput')).typeText('Alicia')
|
|
|
|
await element(by.id('editProfileDescriptionInput')).clearText()
|
|
|
|
await element(by.id('editProfileDescriptionInput')).typeText(
|
|
|
|
'One cool hacker',
|
|
|
|
)
|
|
|
|
await element(by.id('editProfileSaveBtn')).tap()
|
|
|
|
await expect(element(by.id('editProfileModal'))).not.toBeVisible()
|
|
|
|
await expect(element(by.id('profileHeaderDisplayName'))).toHaveText(
|
|
|
|
'Alicia',
|
|
|
|
)
|
|
|
|
await expect(element(by.id('profileHeaderDescription'))).toHaveText(
|
|
|
|
'One cool hacker',
|
|
|
|
)
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Remove display name and description via the edit profile modal', async () => {
|
|
|
|
await element(by.id('profileHeaderEditProfileButton')).tap()
|
|
|
|
await expect(element(by.id('editProfileModal'))).toBeVisible()
|
|
|
|
await element(by.id('editProfileDisplayNameInput')).clearText()
|
|
|
|
await element(by.id('editProfileDescriptionInput')).clearText()
|
|
|
|
await element(by.id('editProfileSaveBtn')).tap()
|
|
|
|
await expect(element(by.id('editProfileModal'))).not.toBeVisible()
|
|
|
|
await expect(element(by.id('profileHeaderDisplayName'))).toHaveText(
|
|
|
|
'alice.test',
|
|
|
|
)
|
2023-08-04 07:08:30 +02:00
|
|
|
await expect(element(by.id('profileHeaderDescription'))).not.toExist()
|
2023-03-31 20:17:26 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
it('Set avi and banner via the edit profile modal', async () => {
|
|
|
|
await expect(element(by.id('userBannerFallback'))).toExist()
|
|
|
|
await expect(element(by.id('userAvatarFallback'))).toExist()
|
|
|
|
await element(by.id('profileHeaderEditProfileButton')).tap()
|
|
|
|
await expect(element(by.id('editProfileModal'))).toBeVisible()
|
|
|
|
await element(by.id('changeBannerBtn')).tap()
|
2024-03-20 01:54:40 +01:00
|
|
|
await element(by.text('Upload from Library')).tap()
|
2023-03-31 20:17:26 +02:00
|
|
|
await sleep(3e3)
|
|
|
|
await element(by.id('changeAvatarBtn')).tap()
|
2024-03-20 01:54:40 +01:00
|
|
|
await element(by.text('Upload from Library')).tap()
|
2023-03-31 20:17:26 +02:00
|
|
|
await sleep(3e3)
|
|
|
|
await element(by.id('editProfileSaveBtn')).tap()
|
|
|
|
await expect(element(by.id('editProfileModal'))).not.toBeVisible()
|
|
|
|
await expect(element(by.id('userBannerImage'))).toExist()
|
|
|
|
await expect(element(by.id('userAvatarImage'))).toExist()
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Remove avi and banner via the edit profile modal', async () => {
|
|
|
|
await expect(element(by.id('userBannerImage'))).toExist()
|
|
|
|
await expect(element(by.id('userAvatarImage'))).toExist()
|
|
|
|
await element(by.id('profileHeaderEditProfileButton')).tap()
|
|
|
|
await expect(element(by.id('editProfileModal'))).toBeVisible()
|
|
|
|
await element(by.id('changeBannerBtn')).tap()
|
2024-03-20 01:54:40 +01:00
|
|
|
await element(by.text('Remove Banner')).tap()
|
2023-03-31 20:17:26 +02:00
|
|
|
await element(by.id('changeAvatarBtn')).tap()
|
2024-03-20 01:54:40 +01:00
|
|
|
await element(by.text('Remove Avatar')).tap()
|
2023-03-31 20:17:26 +02:00
|
|
|
await element(by.id('editProfileSaveBtn')).tap()
|
|
|
|
await expect(element(by.id('editProfileModal'))).not.toBeVisible()
|
|
|
|
await expect(element(by.id('userBannerFallback'))).toExist()
|
|
|
|
await expect(element(by.id('userAvatarFallback'))).toExist()
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Navigate to another user profile', async () => {
|
|
|
|
await element(by.id('bottomBarSearchBtn')).tap()
|
|
|
|
// have to wait for the toast to clear
|
|
|
|
await waitFor(element(by.id('searchTextInput')))
|
|
|
|
.toBeVisible()
|
2023-04-13 03:27:55 +02:00
|
|
|
.withTimeout(5000)
|
2023-03-31 20:17:26 +02:00
|
|
|
await element(by.id('searchTextInput')).typeText('bob')
|
|
|
|
await element(by.id('searchAutoCompleteResult-bob.test')).tap()
|
|
|
|
await expect(element(by.id('profileView'))).toBeVisible()
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Can follow/unfollow another user', async () => {
|
|
|
|
await element(by.id('followBtn')).tap()
|
|
|
|
await expect(element(by.id('unfollowBtn'))).toBeVisible()
|
|
|
|
await element(by.id('unfollowBtn')).tap()
|
|
|
|
await expect(element(by.id('followBtn'))).toBeVisible()
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Can mute/unmute another user', async () => {
|
2023-08-04 07:08:30 +02:00
|
|
|
await expect(element(by.id('profileHeaderAlert'))).not.toExist()
|
2023-03-31 20:17:26 +02:00
|
|
|
await element(by.id('profileHeaderDropdownBtn')).tap()
|
2023-07-28 23:00:37 +02:00
|
|
|
await element(by.text('Mute Account')).tap()
|
2023-08-04 07:08:30 +02:00
|
|
|
await expect(element(by.id('profileHeaderAlert'))).toBeVisible()
|
2023-03-31 20:17:26 +02:00
|
|
|
await element(by.id('profileHeaderDropdownBtn')).tap()
|
2023-07-28 23:00:37 +02:00
|
|
|
await element(by.text('Unmute Account')).tap()
|
2023-08-04 07:08:30 +02:00
|
|
|
await expect(element(by.id('profileHeaderAlert'))).not.toExist()
|
2023-03-31 20:17:26 +02:00
|
|
|
})
|
|
|
|
|
2024-04-10 01:27:39 +02:00
|
|
|
// TODO skipping because the test env PDS isnt setup correctly to handle the report -prf
|
|
|
|
// it('Can report another user', async () => {
|
|
|
|
// await element(by.id('profileHeaderDropdownBtn')).tap()
|
|
|
|
// await element(by.text('Report Account')).tap()
|
|
|
|
// await expect(element(by.id('reportModal'))).toBeVisible()
|
|
|
|
// await element(
|
|
|
|
// by.id('reportReasonRadios-com.atproto.moderation.defs#reasonSpam'),
|
|
|
|
// ).tap()
|
|
|
|
// await element(by.id('sendReportBtn')).tap()
|
|
|
|
// await expect(element(by.id('reportModal'))).not.toBeVisible()
|
|
|
|
// })
|
2023-03-31 20:17:26 +02:00
|
|
|
|
|
|
|
it('Can like posts', async () => {
|
2023-12-05 21:50:56 +01:00
|
|
|
await element(by.id('postsFeed-flatlist')).swipe(
|
|
|
|
'down',
|
|
|
|
'slow',
|
|
|
|
1,
|
|
|
|
0.5,
|
|
|
|
0.5,
|
|
|
|
)
|
|
|
|
|
2023-03-31 20:17:26 +02:00
|
|
|
const posts = by.id('feedItem-by-bob.test')
|
|
|
|
await expect(
|
|
|
|
element(by.id('likeCount').withAncestor(posts)).atIndex(0),
|
2024-02-13 03:55:19 +01:00
|
|
|
).not.toExist()
|
2023-03-31 20:17:26 +02:00
|
|
|
await element(by.id('likeBtn').withAncestor(posts)).atIndex(0).tap()
|
|
|
|
await expect(
|
|
|
|
element(by.id('likeCount').withAncestor(posts)).atIndex(0),
|
|
|
|
).toHaveText('1')
|
|
|
|
await element(by.id('likeBtn').withAncestor(posts)).atIndex(0).tap()
|
|
|
|
await expect(
|
|
|
|
element(by.id('likeCount').withAncestor(posts)).atIndex(0),
|
2024-02-13 03:55:19 +01:00
|
|
|
).not.toExist()
|
2023-03-31 20:17:26 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
it('Can repost posts', async () => {
|
|
|
|
const posts = by.id('feedItem-by-bob.test')
|
|
|
|
await expect(
|
|
|
|
element(by.id('repostCount').withAncestor(posts)).atIndex(0),
|
2024-02-13 03:55:19 +01:00
|
|
|
).not.toExist()
|
2023-03-31 20:17:26 +02:00
|
|
|
await element(by.id('repostBtn').withAncestor(posts)).atIndex(0).tap()
|
|
|
|
await expect(element(by.id('repostModal'))).toBeVisible()
|
|
|
|
await element(by.id('repostBtn').withAncestor(by.id('repostModal'))).tap()
|
|
|
|
await expect(element(by.id('repostModal'))).not.toBeVisible()
|
|
|
|
await expect(
|
|
|
|
element(by.id('repostCount').withAncestor(posts)).atIndex(0),
|
|
|
|
).toHaveText('1')
|
|
|
|
await element(by.id('repostBtn').withAncestor(posts)).atIndex(0).tap()
|
|
|
|
await expect(element(by.id('repostModal'))).toBeVisible()
|
|
|
|
await element(by.id('repostBtn').withAncestor(by.id('repostModal'))).tap()
|
|
|
|
await expect(element(by.id('repostModal'))).not.toBeVisible()
|
|
|
|
await expect(
|
|
|
|
element(by.id('repostCount').withAncestor(posts)).atIndex(0),
|
2024-02-13 03:55:19 +01:00
|
|
|
).not.toExist()
|
2023-03-31 20:17:26 +02:00
|
|
|
})
|
|
|
|
|
2024-04-10 01:27:39 +02:00
|
|
|
// TODO skipping because the test env PDS isnt setup correctly to handle the report -prf
|
|
|
|
// it('Can report posts', async () => {
|
|
|
|
// const posts = by.id('feedItem-by-bob.test')
|
|
|
|
// await element(by.id('postDropdownBtn').withAncestor(posts)).atIndex(0).tap()
|
|
|
|
// await element(by.text('Report post')).tap()
|
|
|
|
// await expect(element(by.id('reportModal'))).toBeVisible()
|
|
|
|
// await element(
|
|
|
|
// by.id('reportReasonRadios-com.atproto.moderation.defs#reasonSpam'),
|
|
|
|
// ).tap()
|
|
|
|
// await element(by.id('sendReportBtn')).tap()
|
|
|
|
// await expect(element(by.id('reportModal'))).not.toBeVisible()
|
|
|
|
// })
|
2023-03-31 20:17:26 +02:00
|
|
|
})
|