From a698990c73ac28a8a1a2cbde30aa484c00908b25 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Wed, 4 Mar 2026 14:23:05 +0200 Subject: [PATCH] get e2e tests working on Android --- __e2e__/flows/login.yml | 5 +++++ __e2e__/setupApp.yml | 22 ++++++++++++++++++---- docs/testing.md | 8 ++++++++ package.json | 2 +- src/view/com/auth/LoggedOut.tsx | 1 + src/view/com/testing/TestCtrls.e2e.tsx | 14 +++++--------- yarn.lock | 8 ++++---- 7 files changed, 42 insertions(+), 18 deletions(-) diff --git a/__e2e__/flows/login.yml b/__e2e__/flows/login.yml index 5ca40224c5..ba6b79ac48 100644 --- a/__e2e__/flows/login.yml +++ b/__e2e__/flows/login.yml @@ -15,6 +15,11 @@ appId: xyz.blueskyweb.app - tapOn: id: "customServerTextInput" - inputText: "http://localhost:3000" +- runFlow: + when: + platform: Android + commands: + - hideKeyboard - tapOn: "Done" - tapOn: id: "loginUsernameInput" diff --git a/__e2e__/setupApp.yml b/__e2e__/setupApp.yml index 8a90b10005..dc784e661f 100644 --- a/__e2e__/setupApp.yml +++ b/__e2e__/setupApp.yml @@ -5,13 +5,27 @@ appId: xyz.blueskyweb.app clearState: true arguments: "-EXDevMenuIsOnboardingFinished": true -- openLink: "exp+bluesky://expo-development-client/?url=http%3A%2F%2Flocalhost%3A8081" - runFlow: when: - visible: 'Open in "Bluesky"' + platform: iOS commands: - - tapOn: Open -- waitForAnimationToEnd + - openLink: "exp+bluesky://expo-development-client/?url=http%3A%2F%2Flocalhost%3A8081" + - runFlow: + when: + visible: 'Open in "Bluesky"' + commands: + - tapOn: Open +- runFlow: + when: + platform: Android + commands: + - tapOn: 'http://localhost:8081' + - runFlow: + label: "Dismiss Expo dev menu" + when: + visible: "Continue" + commands: + - back - tapOn: id: e2eProxyHeaderInput - inputText: ${output.result} diff --git a/docs/testing.md b/docs/testing.md index bba63e44c7..d8931a61e1 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -9,6 +9,14 @@ values. 2. You can write Maestro tests in `/.maestro/flows/` directory by creating a new `.yml` file or by modifying an existing one. 3. You can also use [Maestro Studio](https://maestro.mobile.dev/getting-started/maestro-studio) which automatically generates commands by recording your actions on the app. Therefore, you can create realistic tests without having to manually write any code. Use the `maestro studio` command to start recording your actions. +### Running on Android + +You will need to allow your device access to the port that the mock server is running on. + +``` +adb reverse tcp:3000 tcp:3000 +``` + ### Running Maestro tests - In one tab, run `yarn e2e:mock-server` diff --git a/package.json b/package.json index 3a01a48985..db52763911 100644 --- a/package.json +++ b/package.json @@ -85,7 +85,7 @@ "@braintree/sanitize-url": "^6.0.2", "@bsky.app/alf": "^0.1.7", "@bsky.app/expo-image-crop-tool": "^0.5.0", - "@bsky.app/expo-translate-text": "^0.2.4", + "@bsky.app/expo-translate-text": "^0.2.7", "@bsky.app/react-native-mmkv": "2.12.5", "@discord/bottom-sheet": "bluesky-social/react-native-bottom-sheet", "@emoji-mart/data": "^1.2.1", diff --git a/src/view/com/auth/LoggedOut.tsx b/src/view/com/auth/LoggedOut.tsx index 54bc108d97..41a635b350 100644 --- a/src/view/com/auth/LoggedOut.tsx +++ b/src/view/com/auth/LoggedOut.tsx @@ -57,6 +57,7 @@ export function LoggedOut({onDismiss}: {onDismiss?: () => void}) { const agent = useAgent() useEffect(() => { const actors = accounts.map(acc => acc.did) + if (actors.length === 0) return void queryClient.prefetchQuery({ queryKey: profilesQueryKey(actors), staleTime: STALE.MINUTES.FIVE, diff --git a/src/view/com/testing/TestCtrls.e2e.tsx b/src/view/com/testing/TestCtrls.e2e.tsx index 31e65c64f0..b01651d7b1 100644 --- a/src/view/com/testing/TestCtrls.e2e.tsx +++ b/src/view/com/testing/TestCtrls.e2e.tsx @@ -25,6 +25,7 @@ export function TestCtrls() { const onboardingDispatch = useOnboardingDispatch() const {setShowLoggedOut} = useLoggedOutViewControls() const onPressSignInAlice = async () => { + console.info('[E2E] Signing in as Alice') await login( { service: 'http://localhost:3000', @@ -36,6 +37,7 @@ export function TestCtrls() { setShowLoggedOut(false) } const onPressSignInBob = async () => { + console.info('[E2E] Signing in as Bob') await login( { service: 'http://localhost:3000', @@ -54,6 +56,9 @@ export function TestCtrls() { accessibilityHint="Enter proxy header" testID="e2eProxyHeaderInput" onChangeText={val => setProxyHeader(val as any)} + autoComplete="off" + autoCorrect={false} + autoCapitalize="none" onSubmitEditing={() => { const header = `${proxyHeader}#bsky_appview` BLUESKY_PROXY_HEADER.set(header) @@ -135,15 +140,6 @@ export function TestCtrls() { accessibilityRole="button" style={BTN} /> - {/* TODO remove this entire control when experiment is over */} - { - onboardingDispatch({type: 'start'}) - }} - accessibilityRole="button" - style={BTN} - /> ) } diff --git a/yarn.lock b/yarn.lock index 17221294c4..ae7e850c19 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3731,10 +3731,10 @@ resolved "https://registry.yarnpkg.com/@bsky.app/expo-image-crop-tool/-/expo-image-crop-tool-0.5.0.tgz#4308fbde5c15e6be9122601797bc3d9549c95e31" integrity sha512-gmhQr2HWTRFyPO00fn5OmtiEVtikXusHMrN5Zoq26pu1VZX3zVE+aoc668etTqrvsQcm2Qu8fo96k5F3Wu+6wg== -"@bsky.app/expo-translate-text@^0.2.4": - version "0.2.4" - resolved "https://registry.yarnpkg.com/@bsky.app/expo-translate-text/-/expo-translate-text-0.2.4.tgz#6e7f20f286111ee4d550c0c84f57393fc215a675" - integrity sha512-7mvFggNfkJEufI5A3WnjfjdN3H9P6Dpx7CpDkA9npWqA8Cb2icXq3k3nz3MaXGrVKTYiJnytAffYtos7mPoeOg== +"@bsky.app/expo-translate-text@^0.2.7": + version "0.2.7" + resolved "https://registry.yarnpkg.com/@bsky.app/expo-translate-text/-/expo-translate-text-0.2.7.tgz#e34811d0f0300f8808762e5676aa50790ca5d5e8" + integrity sha512-J9zctP9hLxX0eustTKk5CBnCkk6cEdlu1s7GzUnpT65qkCSNbYqbbUCpcU2Z2S2dN/1+w6L/iHb+vmCEbZMOaQ== "@bsky.app/react-native-mmkv@2.12.5": version "2.12.5"