about summary refs log tree commit diff
path: root/__e2e__
diff options
context:
space:
mode:
Diffstat (limited to '__e2e__')
-rw-r--r--__e2e__/mock-server.ts219
-rw-r--r--__e2e__/tests/home-screen.test.ts6
-rw-r--r--__e2e__/tests/mute-lists.test.ts31
-rw-r--r--__e2e__/tests/profile-screen.test.ts28
-rw-r--r--__e2e__/tests/self-labeling.test.ts34
-rw-r--r--__e2e__/tests/thread-screen.test.ts12
6 files changed, 267 insertions, 63 deletions
diff --git a/__e2e__/mock-server.ts b/__e2e__/mock-server.ts
index f553fc686..44d33bc32 100644
--- a/__e2e__/mock-server.ts
+++ b/__e2e__/mock-server.ts
@@ -53,6 +53,10 @@ async function main() {
             await server.mocker.users[user].agent.post({text: 'Post'})
           }
         }
+        if ('feeds' in url.query) {
+          console.log('Generating mock feed')
+          await server.mocker.createFeed('alice')
+        }
         if ('thread' in url.query) {
           console.log('Generating mock posts')
           const res = await server.mocker.users.bob.agent.post({
@@ -75,26 +79,35 @@ async function main() {
           )
 
           for (const user of [
-            'csam-account',
-            'csam-profile',
-            'csam-posts',
+            'dmca-account',
+            'dmca-profile',
+            'dmca-posts',
             'porn-account',
             'porn-profile',
             'porn-posts',
             'nudity-account',
             'nudity-profile',
             'nudity-posts',
+            'scam-account',
+            'scam-profile',
+            'scam-posts',
             'unknown-account',
             'unknown-profile',
             'unknown-posts',
-            'always-filter-account',
-            'always-filter-profile',
-            'always-filter-posts',
-            'always-warn-account',
-            'always-warn-profile',
-            'always-warn-posts',
+            'hide-account',
+            'hide-profile',
+            'hide-posts',
+            'no-promote-account',
+            'no-promote-profile',
+            'no-promote-posts',
+            'warn-account',
+            'warn-profile',
+            'warn-posts',
             'muted-account',
             'muted-by-list-account',
+            'blocking-account',
+            'blockedby-account',
+            'mutual-block-account',
           ]) {
             await server.mocker.createUser(user)
             await server.mocker.follow('alice', user)
@@ -108,25 +121,25 @@ async function main() {
             await server.mocker.like(user, anchorPost)
           }
 
-          await server.mocker.labelAccount('csam', 'csam-account')
-          await server.mocker.labelProfile('csam', 'csam-profile')
+          await server.mocker.labelAccount('dmca-violation', 'dmca-account')
+          await server.mocker.labelProfile('dmca-violation', 'dmca-profile')
           await server.mocker.labelPost(
-            'csam',
-            await server.mocker.createPost('csam-posts', 'csam post'),
+            'dmca-violation',
+            await server.mocker.createPost('dmca-posts', 'dmca post'),
           )
           await server.mocker.labelPost(
-            'csam',
+            'dmca-violation',
             await server.mocker.createQuotePost(
-              'csam-posts',
-              'csam quote post',
+              'dmca-posts',
+              'dmca quote post',
               anchorPost,
             ),
           )
           await server.mocker.labelPost(
-            'csam',
+            'dmca-violation',
             await server.mocker.createReply(
-              'csam-posts',
-              'csam reply',
+              'dmca-posts',
+              'dmca reply',
               anchorPost,
             ),
           )
@@ -135,7 +148,7 @@ async function main() {
           await server.mocker.labelProfile('porn', 'porn-profile')
           await server.mocker.labelPost(
             'porn',
-            await server.mocker.createPost('porn-posts', 'porn post'),
+            await server.mocker.createImagePost('porn-posts', 'porn post'),
           )
           await server.mocker.labelPost(
             'porn',
@@ -158,7 +171,7 @@ async function main() {
           await server.mocker.labelProfile('nudity', 'nudity-profile')
           await server.mocker.labelPost(
             'nudity',
-            await server.mocker.createPost('nudity-posts', 'nudity post'),
+            await server.mocker.createImagePost('nudity-posts', 'nudity post'),
           )
           await server.mocker.labelPost(
             'nudity',
@@ -177,6 +190,29 @@ async function main() {
             ),
           )
 
+          await server.mocker.labelAccount('scam', 'scam-account')
+          await server.mocker.labelProfile('scam', 'scam-profile')
+          await server.mocker.labelPost(
+            'scam',
+            await server.mocker.createPost('scam-posts', 'scam post'),
+          )
+          await server.mocker.labelPost(
+            'scam',
+            await server.mocker.createQuotePost(
+              'scam-posts',
+              'scam quote post',
+              anchorPost,
+            ),
+          )
+          await server.mocker.labelPost(
+            'scam',
+            await server.mocker.createReply(
+              'scam-posts',
+              'scam reply',
+              anchorPost,
+            ),
+          )
+
           await server.mocker.labelAccount(
             'not-a-real-label',
             'unknown-account',
@@ -206,54 +242,74 @@ async function main() {
             ),
           )
 
-          await server.mocker.labelAccount('!filter', 'always-filter-account')
-          await server.mocker.labelProfile('!filter', 'always-filter-profile')
+          await server.mocker.labelAccount('!hide', 'hide-account')
+          await server.mocker.labelProfile('!hide', 'hide-profile')
+          await server.mocker.labelPost(
+            '!hide',
+            await server.mocker.createPost('hide-posts', 'hide post'),
+          )
+          await server.mocker.labelPost(
+            '!hide',
+            await server.mocker.createQuotePost(
+              'hide-posts',
+              'hide quote post',
+              anchorPost,
+            ),
+          )
+          await server.mocker.labelPost(
+            '!hide',
+            await server.mocker.createReply(
+              'hide-posts',
+              'hide reply',
+              anchorPost,
+            ),
+          )
+
+          await server.mocker.labelAccount('!no-promote', 'no-promote-account')
+          await server.mocker.labelProfile('!no-promote', 'no-promote-profile')
           await server.mocker.labelPost(
-            '!filter',
+            '!no-promote',
             await server.mocker.createPost(
-              'always-filter-posts',
-              'always-filter post',
+              'no-promote-posts',
+              'no-promote post',
             ),
           )
           await server.mocker.labelPost(
-            '!filter',
+            '!no-promote',
             await server.mocker.createQuotePost(
-              'always-filter-posts',
-              'always-filter quote post',
+              'no-promote-posts',
+              'no-promote quote post',
               anchorPost,
             ),
           )
           await server.mocker.labelPost(
-            '!filter',
+            '!no-promote',
             await server.mocker.createReply(
-              'always-filter-posts',
-              'always-filter reply',
+              'no-promote-posts',
+              'no-promote reply',
               anchorPost,
             ),
           )
 
-          await server.mocker.labelAccount('!warn', 'always-warn-account')
-          await server.mocker.labelProfile('!warn', 'always-warn-profile')
+          await server.mocker.labelAccount('!warn', 'warn-account')
+          await server.mocker.labelProfile('!warn', 'warn-profile')
           await server.mocker.labelPost(
             '!warn',
-            await server.mocker.createPost(
-              'always-warn-posts',
-              'always-warn post',
-            ),
+            await server.mocker.createPost('warn-posts', 'warn post'),
           )
           await server.mocker.labelPost(
             '!warn',
             await server.mocker.createQuotePost(
-              'always-warn-posts',
-              'always-warn quote post',
+              'warn-posts',
+              'warn quote post',
               anchorPost,
             ),
           )
           await server.mocker.labelPost(
             '!warn',
             await server.mocker.createReply(
-              'always-warn-posts',
-              'always-warn reply',
+              'warn-posts',
+              'warn reply',
               anchorPost,
             ),
           )
@@ -291,6 +347,85 @@ async function main() {
             'account reply',
             anchorPost,
           )
+
+          await server.mocker.createPost('blocking-account', 'blocking post')
+          await server.mocker.createQuotePost(
+            'blocking-account',
+            'blocking quote post',
+            anchorPost,
+          )
+          await server.mocker.createReply(
+            'blocking-account',
+            'blocking reply',
+            anchorPost,
+          )
+          await server.mocker.users.alice.agent.app.bsky.graph.block.create(
+            {
+              repo: server.mocker.users.alice.did,
+            },
+            {
+              subject: server.mocker.users['blocking-account'].did,
+              createdAt: new Date().toISOString(),
+            },
+          )
+
+          await server.mocker.createPost('blockedby-account', 'blockedby post')
+          await server.mocker.createQuotePost(
+            'blockedby-account',
+            'blockedby quote post',
+            anchorPost,
+          )
+          await server.mocker.createReply(
+            'blockedby-account',
+            'blockedby reply',
+            anchorPost,
+          )
+          await server.mocker.users[
+            'blockedby-account'
+          ].agent.app.bsky.graph.block.create(
+            {
+              repo: server.mocker.users['blockedby-account'].did,
+            },
+            {
+              subject: server.mocker.users.alice.did,
+              createdAt: new Date().toISOString(),
+            },
+          )
+
+          await server.mocker.createPost(
+            'mutual-block-account',
+            'mutual-block post',
+          )
+          await server.mocker.createQuotePost(
+            'mutual-block-account',
+            'mutual-block quote post',
+            anchorPost,
+          )
+          await server.mocker.createReply(
+            'mutual-block-account',
+            'mutual-block reply',
+            anchorPost,
+          )
+          await server.mocker.users.alice.agent.app.bsky.graph.block.create(
+            {
+              repo: server.mocker.users.alice.did,
+            },
+            {
+              subject: server.mocker.users['mutual-block-account'].did,
+              createdAt: new Date().toISOString(),
+            },
+          )
+          await server.mocker.users[
+            'mutual-block-account'
+          ].agent.app.bsky.graph.block.create(
+            {
+              repo: server.mocker.users['mutual-block-account'].did,
+            },
+            {
+              subject: server.mocker.users.alice.did,
+              createdAt: new Date().toISOString(),
+            },
+          )
         }
       }
       console.log('Ready')
diff --git a/__e2e__/tests/home-screen.test.ts b/__e2e__/tests/home-screen.test.ts
index d0eeb6703..7bad3c19a 100644
--- a/__e2e__/tests/home-screen.test.ts
+++ b/__e2e__/tests/home-screen.test.ts
@@ -56,12 +56,12 @@ describe('Home screen', () => {
       .atIndex(0)
       .tap()
     await element(by.text('Report post')).tap()
-    await expect(element(by.id('reportPostModal'))).toBeVisible()
+    await expect(element(by.id('reportModal'))).toBeVisible()
     await element(
-      by.id('reportPostRadios-com.atproto.moderation.defs#reasonSpam'),
+      by.id('reportReasonRadios-com.atproto.moderation.defs#reasonSpam'),
     ).tap()
     await element(by.id('sendReportBtn')).tap()
-    await expect(element(by.id('reportPostModal'))).not.toBeVisible()
+    await expect(element(by.id('reportModal'))).not.toBeVisible()
   })
 
   it('Can swipe between feeds', async () => {
diff --git a/__e2e__/tests/mute-lists.test.ts b/__e2e__/tests/mute-lists.test.ts
index 8d3b15b1f..870e7ced2 100644
--- a/__e2e__/tests/mute-lists.test.ts
+++ b/__e2e__/tests/mute-lists.test.ts
@@ -114,7 +114,7 @@ describe('Mute lists', () => {
 
   it('Shows the mutelist on my profile', async () => {
     await element(by.id('bottomBarProfileBtn')).tap()
-    await element(by.id('selector-2')).tap()
+    await element(by.id('selector-3')).tap()
     await element(by.id('list-Bad Ppl')).tap()
   })
 
@@ -138,4 +138,33 @@ describe('Mute lists', () => {
     await element(by.id('saveBtn')).tap()
     await expect(element(by.id('listAddRemoveUserModal'))).not.toBeVisible()
   })
+
+  it('Can report a mute list', async () => {
+    await element(by.id('bottomBarHomeBtn')).tap()
+    // Last test leaves us in the list view so we are going back 1 screen to the lists list screen
+    await element(by.id('viewHeaderDrawerBtn')).tap()
+    // then to the moderation screen
+    await element(by.id('viewHeaderDrawerBtn')).tap()
+    // then to the home screen
+    await element(by.id('viewHeaderDrawerBtn')).tap()
+    // then open the drawer to go to settings
+    await element(by.id('viewHeaderDrawerBtn')).tap()
+    await element(by.id('menuItemButton-Settings')).tap()
+    await element(by.id('signOutBtn')).tap()
+    await expect(element(by.id('signInButton'))).toBeVisible()
+    await login(service, 'bob.test', 'hunter2')
+    await element(by.id('bottomBarSearchBtn')).tap()
+    await element(by.id('searchTextInput')).typeText('alice')
+    await element(by.id('searchAutoCompleteResult-alice.test')).tap()
+    await element(by.id('selector-3')).tap()
+    await element(by.id('list-Bad Ppl')).tap()
+    await element(by.id('reportListBtn')).tap()
+    await expect(element(by.id('reportModal'))).toBeVisible()
+    await expect(element(by.text('Report List'))).toBeVisible()
+    await element(
+      by.id('reportReasonRadios-com.atproto.moderation.defs#reasonRude'),
+    ).tap()
+    await element(by.id('sendReportBtn')).tap()
+    await expect(element(by.id('reportModal'))).not.toBeVisible()
+  })
 })
diff --git a/__e2e__/tests/profile-screen.test.ts b/__e2e__/tests/profile-screen.test.ts
index 6c6d6db9c..da7980094 100644
--- a/__e2e__/tests/profile-screen.test.ts
+++ b/__e2e__/tests/profile-screen.test.ts
@@ -5,7 +5,7 @@ import {openApp, login, createServer, sleep} from '../util'
 describe('Profile screen', () => {
   let service: string
   beforeAll(async () => {
-    service = await createServer('?users&posts')
+    service = await createServer('?users&posts&feeds')
     await openApp({
       permissions: {notifications: 'YES', medialibrary: 'YES', photos: 'YES'},
     })
@@ -17,6 +17,12 @@ describe('Profile screen', () => {
     await element(by.id('bottomBarProfileBtn')).tap()
   })
 
+  it('Can see feeds', async () => {
+    await element(by.id('selector-3')).tap()
+    await expect(element(by.id('feed-alices feed'))).toBeVisible()
+    await element(by.id('selector-0')).tap()
+  })
+
   it('Open and close edit profile modal', async () => {
     await element(by.id('profileHeaderEditProfileButton')).tap()
     await expect(element(by.id('editProfileModal'))).toBeVisible()
@@ -53,7 +59,7 @@ describe('Profile screen', () => {
     await expect(element(by.id('profileHeaderDisplayName'))).toHaveText(
       'alice.test',
     )
-    await expect(element(by.id('profileHeaderDescription'))).toHaveText('')
+    await expect(element(by.id('profileHeaderDescription'))).not.toExist()
   })
 
   it('Set avi and banner via the edit profile modal', async () => {
@@ -107,24 +113,24 @@ describe('Profile screen', () => {
   })
 
   it('Can mute/unmute another user', async () => {
-    await expect(element(by.id('profileHeaderMutedNotice'))).not.toExist()
+    await expect(element(by.id('profileHeaderAlert'))).not.toExist()
     await element(by.id('profileHeaderDropdownBtn')).tap()
     await element(by.text('Mute Account')).tap()
-    await expect(element(by.id('profileHeaderMutedNotice'))).toBeVisible()
+    await expect(element(by.id('profileHeaderAlert'))).toBeVisible()
     await element(by.id('profileHeaderDropdownBtn')).tap()
     await element(by.text('Unmute Account')).tap()
-    await expect(element(by.id('profileHeaderMutedNotice'))).not.toExist()
+    await expect(element(by.id('profileHeaderAlert'))).not.toExist()
   })
 
   it('Can report another user', async () => {
     await element(by.id('profileHeaderDropdownBtn')).tap()
     await element(by.text('Report Account')).tap()
-    await expect(element(by.id('reportAccountModal'))).toBeVisible()
+    await expect(element(by.id('reportModal'))).toBeVisible()
     await element(
-      by.id('reportAccountRadios-com.atproto.moderation.defs#reasonSpam'),
+      by.id('reportReasonRadios-com.atproto.moderation.defs#reasonSpam'),
     ).tap()
     await element(by.id('sendReportBtn')).tap()
-    await expect(element(by.id('reportAccountModal'))).not.toBeVisible()
+    await expect(element(by.id('reportModal'))).not.toBeVisible()
   })
 
   it('Can like posts', async () => {
@@ -167,11 +173,11 @@ describe('Profile screen', () => {
     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('reportPostModal'))).toBeVisible()
+    await expect(element(by.id('reportModal'))).toBeVisible()
     await element(
-      by.id('reportPostRadios-com.atproto.moderation.defs#reasonSpam'),
+      by.id('reportReasonRadios-com.atproto.moderation.defs#reasonSpam'),
     ).tap()
     await element(by.id('sendReportBtn')).tap()
-    await expect(element(by.id('reportPostModal'))).not.toBeVisible()
+    await expect(element(by.id('reportModal'))).not.toBeVisible()
   })
 })
diff --git a/__e2e__/tests/self-labeling.test.ts b/__e2e__/tests/self-labeling.test.ts
new file mode 100644
index 000000000..70164cb85
--- /dev/null
+++ b/__e2e__/tests/self-labeling.test.ts
@@ -0,0 +1,34 @@
+/* eslint-env detox/detox */
+
+import {openApp, login, createServer, sleep} from '../util'
+
+describe('Self-labeling', () => {
+  let service: string
+  beforeAll(async () => {
+    service = await createServer('?users')
+    await openApp({
+      permissions: {notifications: 'YES', medialibrary: 'YES', photos: 'YES'},
+    })
+  })
+
+  it('Login', async () => {
+    await login(service, 'alice', 'hunter2')
+    await element(by.id('homeScreenFeedTabs-Following')).tap()
+  })
+
+  it('Post an image with the porn label', async () => {
+    await element(by.id('composeFAB')).tap()
+    await element(by.id('composerTextInput')).typeText('Post with an image')
+    await element(by.id('openGalleryBtn')).tap()
+    await sleep(1e3)
+    await element(by.id('labelsBtn')).tap()
+    await element(by.id('pornLabelBtn')).tap()
+    await element(by.id('confirmBtn')).tap()
+    await element(by.id('composerPublishBtn')).tap()
+    await expect(element(by.id('composeFAB'))).toBeVisible()
+    const posts = by.id('feedItem-by-alice.test')
+    await expect(
+      element(by.id('contentHider-embed').withAncestor(posts)).atIndex(0),
+    ).toExist()
+  })
+})
diff --git a/__e2e__/tests/thread-screen.test.ts b/__e2e__/tests/thread-screen.test.ts
index 081282a36..0964988e9 100644
--- a/__e2e__/tests/thread-screen.test.ts
+++ b/__e2e__/tests/thread-screen.test.ts
@@ -105,23 +105,23 @@ describe('Thread screen', () => {
     const post = by.id('postThreadItem-by-bob.test')
     await element(by.id('postDropdownBtn').withAncestor(post)).atIndex(0).tap()
     await element(by.text('Report post')).tap()
-    await expect(element(by.id('reportPostModal'))).toBeVisible()
+    await expect(element(by.id('reportModal'))).toBeVisible()
     await element(
-      by.id('reportPostRadios-com.atproto.moderation.defs#reasonSpam'),
+      by.id('reportReasonRadios-com.atproto.moderation.defs#reasonSpam'),
     ).tap()
     await element(by.id('sendReportBtn')).tap()
-    await expect(element(by.id('reportPostModal'))).not.toBeVisible()
+    await expect(element(by.id('reportModal'))).not.toBeVisible()
   })
 
   it('Can report a reply post', async () => {
     const post = by.id('postThreadItem-by-carla.test')
     await element(by.id('postDropdownBtn').withAncestor(post)).atIndex(0).tap()
     await element(by.text('Report post')).tap()
-    await expect(element(by.id('reportPostModal'))).toBeVisible()
+    await expect(element(by.id('reportModal'))).toBeVisible()
     await element(
-      by.id('reportPostRadios-com.atproto.moderation.defs#reasonSpam'),
+      by.id('reportReasonRadios-com.atproto.moderation.defs#reasonSpam'),
     ).tap()
     await element(by.id('sendReportBtn')).tap()
-    await expect(element(by.id('reportPostModal'))).not.toBeVisible()
+    await expect(element(by.id('reportModal'))).not.toBeVisible()
   })
 })