about summary refs log tree commit diff
path: root/src/view/com/testing/TestCtrls.e2e.tsx
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2023-09-20 19:47:56 -0700
committerGitHub <noreply@github.com>2023-09-20 19:47:56 -0700
commit5a945c2024855b89dfb99f81a2c4d226bb39dc32 (patch)
tree3a42e8e8d79c281606c2b7d9bff9380df596d8c7 /src/view/com/testing/TestCtrls.e2e.tsx
parent68dd3210d11bf8a15c319768d3e338c629a69d4b (diff)
downloadvoidsky-5a945c2024855b89dfb99f81a2c4d226bb39dc32.tar.zst
Prefilter the mergefeed to ensure a better mix of following and custom feeds (#1498)
* Prefilter the mergefeed to ensure a better mix of following and custom feeds

* Test suite improvements & tests for the mergefeed (#1499)

* Disable invite codes test for now

* Update test sim to latest iphone

* Introduce TestCtrls driver

* Add mergefeed tests
Diffstat (limited to 'src/view/com/testing/TestCtrls.e2e.tsx')
-rw-r--r--src/view/com/testing/TestCtrls.e2e.tsx76
1 files changed, 76 insertions, 0 deletions
diff --git a/src/view/com/testing/TestCtrls.e2e.tsx b/src/view/com/testing/TestCtrls.e2e.tsx
new file mode 100644
index 000000000..019c7a508
--- /dev/null
+++ b/src/view/com/testing/TestCtrls.e2e.tsx
@@ -0,0 +1,76 @@
+import React from 'react'
+import {Pressable, View} from 'react-native'
+import {useStores} from 'state/index'
+import {navigate} from '../../../Navigation'
+
+/**
+ * This utility component is only included in the test simulator
+ * build. It gives some quick triggers which help improve the pace
+ * of the tests dramatically.
+ */
+
+const BTN = {height: 1, width: 1, backgroundColor: 'red'}
+
+export function TestCtrls() {
+  const store = useStores()
+  const onPressSignInAlice = async () => {
+    await store.session.login({
+      service: 'http://localhost:3000',
+      identifier: 'alice.test',
+      password: 'hunter2',
+    })
+  }
+  const onPressSignInBob = async () => {
+    await store.session.login({
+      service: 'http://localhost:3000',
+      identifier: 'bob.test',
+      password: 'hunter2',
+    })
+  }
+  return (
+    <View style={{position: 'absolute', top: 100, right: 0, zIndex: 100}}>
+      <Pressable
+        testID="e2eSignInAlice"
+        onPress={onPressSignInAlice}
+        accessibilityRole="button"
+        style={BTN}
+      />
+      <Pressable
+        testID="e2eSignInBob"
+        onPress={onPressSignInBob}
+        accessibilityRole="button"
+        style={BTN}
+      />
+      <Pressable
+        testID="e2eGotoHome"
+        onPress={() => navigate('Home')}
+        accessibilityRole="button"
+        style={BTN}
+      />
+      <Pressable
+        testID="e2eGotoSettings"
+        onPress={() => navigate('Settings')}
+        accessibilityRole="button"
+        style={BTN}
+      />
+      <Pressable
+        testID="e2eGotoModeration"
+        onPress={() => navigate('Moderation')}
+        accessibilityRole="button"
+        style={BTN}
+      />
+      <Pressable
+        testID="e2eToggleMergefeed"
+        onPress={() => store.preferences.toggleHomeFeedMergeFeedEnabled()}
+        accessibilityRole="button"
+        style={BTN}
+      />
+      <Pressable
+        testID="e2eRefreshHome"
+        onPress={() => store.me.mainFeed.refresh()}
+        accessibilityRole="button"
+        style={BTN}
+      />
+    </View>
+  )
+}