use static appview did for e2e
This commit is contained in:
+1
-16
@@ -3,22 +3,7 @@ appId: xyz.blueskyweb.app
|
|||||||
- launchApp:
|
- launchApp:
|
||||||
appId: "xyz.blueskyweb.app"
|
appId: "xyz.blueskyweb.app"
|
||||||
clearState: true
|
clearState: true
|
||||||
- extendedWaitUntil:
|
|
||||||
visible:
|
|
||||||
id: e2eProxyHeaderInput
|
|
||||||
timeout: 180000
|
|
||||||
- extendedWaitUntil:
|
- extendedWaitUntil:
|
||||||
visible: "Sign in"
|
visible: "Sign in"
|
||||||
timeout: 180000
|
timeout: 180000
|
||||||
- retry:
|
- waitForAnimationToEnd
|
||||||
maxRetries: 3
|
|
||||||
commands:
|
|
||||||
- tapOn:
|
|
||||||
id: e2eProxyHeaderInput
|
|
||||||
- eraseText
|
|
||||||
- inputText: ${output.result}
|
|
||||||
- pressKey: Enter
|
|
||||||
- extendedWaitUntil:
|
|
||||||
visible:
|
|
||||||
id: e2eSignInAlice
|
|
||||||
timeout: 10000
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef, typescript/no-unsafe-call, typescript/no-unsafe-member-access
|
||||||
var res = http.post('http://localhost:1986/' + SERVER_PATH, {
|
http.post('http://localhost:1986/' + SERVER_PATH, {
|
||||||
headers: {'Content-Type': 'text/plain'},
|
headers: {'Content-Type': 'text/plain'},
|
||||||
body: '',
|
body: '',
|
||||||
})
|
})
|
||||||
|
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
output.result = json(res.body).appviewDid
|
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
export const E2E_APPVIEW_DID = 'did:plc:bw7ad3erl7btq6qwf66yqiov'
|
||||||
@@ -5,6 +5,8 @@ import path from 'node:path'
|
|||||||
import {AtUri, BskyAgent} from '@atproto/api'
|
import {AtUri, BskyAgent} from '@atproto/api'
|
||||||
import {type TestBsky, TestNetwork} from '@atproto/dev-env'
|
import {type TestBsky, TestNetwork} from '@atproto/dev-env'
|
||||||
|
|
||||||
|
import {E2E_APPVIEW_DID} from './constants.ts'
|
||||||
|
|
||||||
export interface TestUser {
|
export interface TestUser {
|
||||||
email: string
|
email: string
|
||||||
did: string
|
did: string
|
||||||
@@ -83,6 +85,13 @@ export async function createServer(
|
|||||||
plc: {port: port2},
|
plc: {port: port2},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (testNet.bsky.serverDid !== E2E_APPVIEW_DID) {
|
||||||
|
await testNet.close()
|
||||||
|
throw new Error(
|
||||||
|
`E2E AppView DID changed from ${E2E_APPVIEW_DID} to ${testNet.bsky.serverDid}. Update E2E_APPVIEW_DID in dev-env/constants.ts.`,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
// DISABLED - looks like dev-env added this and now it conflicts
|
// DISABLED - looks like dev-env added this and now it conflicts
|
||||||
// add the test mod authority
|
// add the test mod authority
|
||||||
// const agent = new BskyAgent({service: pdsUrl})
|
// const agent = new BskyAgent({service: pdsUrl})
|
||||||
|
|||||||
@@ -234,7 +234,6 @@ export const PUBLIC_APPVIEW_DID = 'did:web:api.bsky.app'
|
|||||||
export const PUBLIC_STAGING_APPVIEW_DID = 'did:web:api.staging.bsky.dev'
|
export const PUBLIC_STAGING_APPVIEW_DID = 'did:web:api.staging.bsky.dev'
|
||||||
|
|
||||||
export const DEV_ENV_APPVIEW = `http://localhost:2584` // always the same
|
export const DEV_ENV_APPVIEW = `http://localhost:2584` // always the same
|
||||||
export const DEV_ENV_APPVIEW_DID = `did:plc:dw4kbjf5mn7nhenabiqpkyh3` // always the same
|
|
||||||
|
|
||||||
// temp hack for e2e - esb
|
// temp hack for e2e - esb
|
||||||
export const BLUESKY_PROXY_HEADER = {
|
export const BLUESKY_PROXY_HEADER = {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import {useState} from 'react'
|
import {LogBox, Pressable, View} from 'react-native'
|
||||||
import {LogBox, Pressable, TextInput, View} from 'react-native'
|
|
||||||
import {useQueryClient} from '@tanstack/react-query'
|
import {useQueryClient} from '@tanstack/react-query'
|
||||||
|
|
||||||
|
import {E2E_APPVIEW_DID} from '../../../../dev-env/constants'
|
||||||
import {BLUESKY_PROXY_HEADER} from '#/lib/constants'
|
import {BLUESKY_PROXY_HEADER} from '#/lib/constants'
|
||||||
import {useSessionApi} from '#/state/session'
|
import {useSessionApi} from '#/state/session'
|
||||||
import {useLoggedOutViewControls} from '#/state/shell/logged-out'
|
import {useLoggedOutViewControls} from '#/state/shell/logged-out'
|
||||||
@@ -18,24 +18,13 @@ LogBox.ignoreAllLogs()
|
|||||||
|
|
||||||
const BTN = {height: 1, width: 1, backgroundColor: 'red'}
|
const BTN = {height: 1, width: 1, backgroundColor: 'red'}
|
||||||
|
|
||||||
/*
|
BLUESKY_PROXY_HEADER.set(`${E2E_APPVIEW_DID}#bsky_appview`)
|
||||||
* This component is mounted inside <Fragment key={currentAccount?.did}> in
|
|
||||||
* App.tsx, so it fully remounts whenever the account changes (sign-in /
|
|
||||||
* sign-out). If the "proxy configured" flag lived only in React state it would
|
|
||||||
* reset to false on every remount, hiding the sign-in buttons. Keeping it at
|
|
||||||
* module level lets it survive remounts so the sign-in buttons stay visible
|
|
||||||
* across sign-out during multi-account flows. Module state still resets when
|
|
||||||
* the app relaunches with cleared state at the start of each flow, which is the
|
|
||||||
* desired gating behavior.
|
|
||||||
*/
|
|
||||||
let hasConfiguredProxy = false
|
|
||||||
|
|
||||||
export function TestCtrls() {
|
export function TestCtrls() {
|
||||||
const queryClient = useQueryClient()
|
const queryClient = useQueryClient()
|
||||||
const {logoutEveryAccount, login} = useSessionApi()
|
const {logoutEveryAccount, login} = useSessionApi()
|
||||||
const onboardingDispatch = useOnboardingDispatch()
|
const onboardingDispatch = useOnboardingDispatch()
|
||||||
const {setShowLoggedOut} = useLoggedOutViewControls()
|
const {setShowLoggedOut} = useLoggedOutViewControls()
|
||||||
const [isProxyConfigured, setIsProxyConfigured] = useState(hasConfiguredProxy)
|
|
||||||
const onPressSignInAlice = async () => {
|
const onPressSignInAlice = async () => {
|
||||||
console.info('[E2E] Signing in as Alice')
|
console.info('[E2E] Signing in as Alice')
|
||||||
await login(
|
await login(
|
||||||
@@ -60,47 +49,20 @@ export function TestCtrls() {
|
|||||||
)
|
)
|
||||||
setShowLoggedOut(false)
|
setShowLoggedOut(false)
|
||||||
}
|
}
|
||||||
const [proxyHeader, setProxyHeader] = useState('')
|
|
||||||
return (
|
return (
|
||||||
<View style={{position: 'absolute', top: 100, right: 0, zIndex: 100}}>
|
<View style={{position: 'absolute', top: 100, right: 0, zIndex: 100}}>
|
||||||
<TextInput
|
<Pressable
|
||||||
accessibilityLabel="Text input field"
|
testID="e2eSignInAlice"
|
||||||
accessibilityHint="Enter proxy header"
|
onPress={onPressSignInAlice}
|
||||||
testID="e2eProxyHeaderInput"
|
accessibilityRole="button"
|
||||||
onChangeText={val => setProxyHeader(val)}
|
style={BTN}
|
||||||
autoComplete="off"
|
/>
|
||||||
autoCorrect={false}
|
<Pressable
|
||||||
autoCapitalize="none"
|
testID="e2eSignInBob"
|
||||||
onSubmitEditing={() => {
|
onPress={onPressSignInBob}
|
||||||
const header = `${proxyHeader}#bsky_appview`
|
accessibilityRole="button"
|
||||||
/*
|
|
||||||
* The appview client reads `BLUESKY_PROXY_HEADER.get()` when the
|
|
||||||
* bundle builds it (see clients.ts), so setting the mutable constant
|
|
||||||
* retargets the proxy for the sign-ins below without reconfiguring
|
|
||||||
* anything: the gate above means no bundle exists yet.
|
|
||||||
*/
|
|
||||||
BLUESKY_PROXY_HEADER.set(header)
|
|
||||||
hasConfiguredProxy = true
|
|
||||||
setIsProxyConfigured(true)
|
|
||||||
}}
|
|
||||||
style={BTN}
|
style={BTN}
|
||||||
/>
|
/>
|
||||||
{isProxyConfigured && (
|
|
||||||
<>
|
|
||||||
<Pressable
|
|
||||||
testID="e2eSignInAlice"
|
|
||||||
onPress={onPressSignInAlice}
|
|
||||||
accessibilityRole="button"
|
|
||||||
style={BTN}
|
|
||||||
/>
|
|
||||||
<Pressable
|
|
||||||
testID="e2eSignInBob"
|
|
||||||
onPress={onPressSignInBob}
|
|
||||||
accessibilityRole="button"
|
|
||||||
style={BTN}
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
<Pressable
|
<Pressable
|
||||||
testID="e2eSignOut"
|
testID="e2eSignOut"
|
||||||
onPress={() => logoutEveryAccount('Settings')}
|
onPress={() => logoutEveryAccount('Settings')}
|
||||||
|
|||||||
Reference in New Issue
Block a user