Fix curate-lists tests

This commit is contained in:
Eric Bailey
2023-12-04 16:32:08 -06:00
parent e2041d0372
commit a7301a2ac6
6 changed files with 21 additions and 12 deletions
+11 -11
View File
@@ -4,7 +4,7 @@ import {describe, beforeAll, it} from '@jest/globals'
import {expect} from 'detox' import {expect} from 'detox'
import {openApp, loginAsAlice, loginAsBob, createServer, sleep} from '../util' import {openApp, loginAsAlice, loginAsBob, createServer, sleep} from '../util'
describe.skip('Curate lists', () => { describe('Curate lists', () => {
beforeAll(async () => { beforeAll(async () => {
await createServer('?users&follows&posts') await createServer('?users&follows&posts')
await openApp({ await openApp({
@@ -165,15 +165,15 @@ describe('Curate lists 2', () => {
await expect(element(by.id('user-bob.test'))).toBeVisible() await expect(element(by.id('user-bob.test'))).toBeVisible()
await element(by.id('user-bob.test-editBtn')).tap() await element(by.id('user-bob.test-editBtn')).tap()
await expect(element(by.id('userAddRemoveListsModal'))).toBeVisible() await expect(element(by.id('userAddRemoveListsModal'))).toBeVisible()
await element(by.id('toggleBtn-Good Ppl')).tap() await element(by.id('user-bob.test-addBtn')).tap()
await element(by.id('saveBtn')).tap() await element(by.id('doneBtn')).tap()
await expect(element(by.id('userAddRemoveListsModal'))).not.toBeVisible() await expect(element(by.id('userAddRemoveListsModal'))).not.toBeVisible()
}) })
it('Shows the curatelist on my profile', async () => { it('Shows the curatelist on my profile', async () => {
await element(by.id('bottomBarProfileBtn')).tap() await element(by.id('bottomBarProfileBtn')).tap()
await element(by.id('selector')).swipe('left') await element(by.id('profilePager-selector')).swipe('left')
await element(by.id('selector-4')).tap() await element(by.id('profilePager-selector-5')).tap()
await element(by.id('list-Good Ppl')).tap() await element(by.id('list-Good Ppl')).tap()
}) })
@@ -186,15 +186,15 @@ describe('Curate lists 2', () => {
await element(by.id('profileHeaderDropdownBtn')).tap() await element(by.id('profileHeaderDropdownBtn')).tap()
await element(by.text('Add to Lists')).tap() await element(by.text('Add to Lists')).tap()
await expect(element(by.id('userAddRemoveListsModal'))).toBeVisible() await expect(element(by.id('userAddRemoveListsModal'))).toBeVisible()
await element(by.id('toggleBtn-Good Ppl')).tap() await element(by.id('user-bob.test-addBtn')).tap()
await element(by.id('saveBtn')).tap() await element(by.id('doneBtn')).tap()
await expect(element(by.id('userAddRemoveListsModal'))).not.toBeVisible() await expect(element(by.id('userAddRemoveListsModal'))).not.toBeVisible()
await element(by.id('profileHeaderDropdownBtn')).tap() await element(by.id('profileHeaderDropdownBtn')).tap()
await element(by.text('Add to Lists')).tap() await element(by.text('Add to Lists')).tap()
await expect(element(by.id('userAddRemoveListsModal'))).toBeVisible() await expect(element(by.id('userAddRemoveListsModal'))).toBeVisible()
await element(by.id('toggleBtn-Good Ppl')).tap() await element(by.id('user-bob.test-addBtn')).tap()
await element(by.id('saveBtn')).tap() await element(by.id('doneBtn')).tap()
await expect(element(by.id('userAddRemoveListsModal'))).not.toBeVisible() await expect(element(by.id('userAddRemoveListsModal'))).not.toBeVisible()
}) })
@@ -205,8 +205,8 @@ describe('Curate lists 2', () => {
await element(by.id('bottomBarSearchBtn')).tap() await element(by.id('bottomBarSearchBtn')).tap()
await element(by.id('searchTextInput')).typeText('alice') await element(by.id('searchTextInput')).typeText('alice')
await element(by.id('searchAutoCompleteResult-alice.test')).tap() await element(by.id('searchAutoCompleteResult-alice.test')).tap()
await element(by.id('selector')).swipe('left') await element(by.id('profilePager-selector')).swipe('left')
await element(by.id('selector-3')).tap() await element(by.id('profilePager-selector-3')).tap()
await element(by.id('list-Good Ppl')).tap() await element(by.id('list-Good Ppl')).tap()
await element(by.id('headerDropdownBtn')).tap() await element(by.id('headerDropdownBtn')).tap()
await element(by.text('Report List')).tap() await element(by.text('Report List')).tap()
+1
View File
@@ -61,6 +61,7 @@ export interface CreateOrEditListModal {
export interface UserAddRemoveListsModal { export interface UserAddRemoveListsModal {
name: 'user-add-remove-lists' name: 'user-add-remove-lists'
subject: string subject: string
handle: string
displayName: string displayName: string
onAdd?: (listUri: string) => void onAdd?: (listUri: string) => void
onRemove?: (listUri: string) => void onRemove?: (listUri: string) => void
+1
View File
@@ -132,6 +132,7 @@ export function ListMembers({
name: 'user-add-remove-lists', name: 'user-add-remove-lists',
subject: profile.did, subject: profile.did,
displayName: profile.displayName || profile.handle, displayName: profile.displayName || profile.handle,
handle: profile.handle,
}) })
}, },
[openModal], [openModal],
+6 -1
View File
@@ -28,11 +28,13 @@ export const snapPoints = ['fullscreen']
export function Component({ export function Component({
subject, subject,
handle,
displayName, displayName,
onAdd, onAdd,
onRemove, onRemove,
}: { }: {
subject: string subject: string
handle: string
displayName: string displayName: string
onAdd?: (listUri: string) => void onAdd?: (listUri: string) => void
onRemove?: (listUri: string) => void onRemove?: (listUri: string) => void
@@ -60,6 +62,7 @@ export function Component({
list={list} list={list}
memberships={memberships} memberships={memberships}
subject={subject} subject={subject}
handle={handle}
onAdd={onAdd} onAdd={onAdd}
onRemove={onRemove} onRemove={onRemove}
/> />
@@ -87,6 +90,7 @@ function ListItem({
list, list,
memberships, memberships,
subject, subject,
handle,
onAdd, onAdd,
onRemove, onRemove,
}: { }: {
@@ -94,6 +98,7 @@ function ListItem({
list: GraphDefs.ListView list: GraphDefs.ListView
memberships: ListMembersip[] | undefined memberships: ListMembersip[] | undefined
subject: string subject: string
handle: string
onAdd?: (listUri: string) => void onAdd?: (listUri: string) => void
onRemove?: (listUri: string) => void onRemove?: (listUri: string) => void
}) { }) {
@@ -182,7 +187,7 @@ function ListItem({
<ActivityIndicator /> <ActivityIndicator />
) : ( ) : (
<Button <Button
testID={`user-${subject}-addBtn`} testID={`user-${handle}-addBtn`}
type="default" type="default"
label={membership === false ? _(msg`Add`) : _(msg`Remove`)} label={membership === false ? _(msg`Add`) : _(msg`Remove`)}
onPress={onToggleMembership} onPress={onToggleMembership}
+1
View File
@@ -217,6 +217,7 @@ let ProfileHeaderLoaded = ({
openModal({ openModal({
name: 'user-add-remove-lists', name: 'user-add-remove-lists',
subject: profile.did, subject: profile.did,
handle: profile.handle,
displayName: profile.displayName || profile.handle, displayName: profile.displayName || profile.handle,
onAdd: invalidateProfileQuery, onAdd: invalidateProfileQuery,
onRemove: invalidateProfileQuery, onRemove: invalidateProfileQuery,
+1
View File
@@ -42,6 +42,7 @@ export function SearchResultCard({
return ( return (
<Link <Link
testID={`searchAutoCompleteResult-${profile.handle}`}
href={makeProfileLink(profile)} href={makeProfileLink(profile)}
title={profile.handle} title={profile.handle}
asAnchor asAnchor