Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests(mobile): add second safe #4974

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions apps/mobile/e2e/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# config.yaml
flows:
- happypath/*
63 changes: 63 additions & 0 deletions apps/mobile/e2e/happypath/add-second-safe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
appId: global.safe.mobileapp
---
- launchApp:
appId: 'global.safe.mobileapp'
clearState: true
clearKeychain: true
- runFlow:
when:
visible:
text: 'http.*'
commands:
- tapOn: 'http.*'
- runFlow:
when:
visible: 'Continue'
commands:
- tapOn: 'Continue'
- runFlow:
when:
visible: 'Reload'
commands:
- tapOn: 'Reload'
- tapOn:
id: 'e2eOnboardedAccount'
- tapOn:
id: 'opt-in-secondary-button'
- tapOn:
id: 'dropdown-label-view'
index: 0
- tapOn:
id: 'add-existing-account'
- tapOn:
id: 'enter-manually'
- assertVisible:
id: 'safe-input'
- tapOn:
id: 'safe-input'
- assertVisible: 'Continue'
- inputText: '0xF2CeA96575d6b10f51d9aF3b10e3e4E5738aa6bd'
- assertVisible: 'No Safe deployment found for this this address'
- 'eraseText'
- inputText: '0x1230B3D59858296A31053C1b8562ECF89A2f888B'
- assertVisible: 'Invalid address format'
- 'eraseText'
- inputText: 'sep:0x9BFCA75a05175503580D593F4330b5505c594596'
- assertVisible: 'Sepolia'
- assertVisible:
id: 'success-icon'
- tapOn:
id: 'continue-button'
- assertVisible: 'Import your signers to unlock account'
- assertVisible: " Before you import signers... Make sure to import signers from\
\ this list only. Others will not be imported."
- assertVisible:
id: 'signer-0x65F8236309e5A99Ff0d129d04E486EBCE20DC7B0'
- assertVisible:
id: 'signer-0x0D65139Da4B36a8A39BF1b63e950038D42231b2e'
- assertVisible:
id: 'signer-0x8aEf2f5c3F17261F6F1C4dA058D022BE92776af8'
- tapOn:
id: 'continue-button'
- assertVisible: '0x9BFC...4596'
- assertVisible: 'Sepolia'
Original file line number Diff line number Diff line change
@@ -1,29 +1,11 @@
appId: global.safe.mobileapp
---
- launchApp:
appId: 'global.safe.mobileapp'
clearState: true
clearKeychain: true
- runFlow:
when:
visible:
text: 'http.*'
commands:
- tapOn: 'http.*'
- runFlow:
when:
visible: 'Continue'
commands:
- tapOn: 'Continue'
- runFlow:
when:
visible: 'Reload'
commands:
- tapOn: 'Reload'
file: ../shared/clean-app-start.yml
- tapOn:
id: 'e2eOnboardedAccount'
- tapOn:
id: 'opt-in-secondary-button'
id: 'opt-in-secondary-button'
- assertVisible:
id: 'home-tab'
- tapOn:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,7 @@
appId: 'global.safe.mobileapp'
---
- launchApp:
appId: 'global.safe.mobileapp'
clearState: true
clearKeychain: true
- runFlow:
when:
visible:
text: 'http.*'
commands:
- tapOn: 'http.*'
- runFlow:
when:
visible: 'Continue'
commands:
- tapOn: 'Continue'
- runFlow:
when:
visible: 'Reload'
commands:
- tapOn: 'Reload'
- tapOn:
id: 'e2eTestOnboarding'
file: ../shared/clean-app-start.yml
- assertVisible:
id: 'carousel-item-0'
- swipe:
Expand Down
22 changes: 22 additions & 0 deletions apps/mobile/e2e/shared/clean-app-start.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
appId: 'global.safe.mobileapp'
---
- launchApp:
appId: 'global.safe.mobileapp'
clearState: true
clearKeychain: true
- runFlow:
when:
visible:
text: 'http.*'
commands:
- tapOn: 'http.*'
- runFlow:
when:
visible: 'Continue'
commands:
- tapOn: 'Continue'
- runFlow:
when:
visible: 'Reload'
commands:
- tapOn: 'Reload'
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export function SafeBottomSheet<T>({

return (
<BottomSheet
accessible={false}
enableOverDrag={false}
snapPoints={snapPoints}
enableDynamicSizing={true}
Expand All @@ -85,7 +86,10 @@ export function SafeBottomSheet<T>({
footerComponent={footerComponent}
>
{!isSortable && !!title && <TitleHeader />}
<BottomSheetView style={[styles.contentContainer, !isSortable ? { flex: 1, paddingHorizontal: 20 } : undefined]}>
<BottomSheetView
style={[styles.contentContainer, !isSortable ? { flex: 1, paddingHorizontal: 20 } : undefined]}
accessible={true}
>
{isSortable ? (
<DraggableFlatList<T>
data={items}
Expand Down
35 changes: 33 additions & 2 deletions apps/mobile/src/tests/e2e-maestro/components/TestCtrls.e2e.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import { setActiveSafe } from '@/src/store/activeSafeSlice'
import { useRouter } from 'expo-router'
import { SafeOverview } from '@safe-global/store/gateway/AUTO_GENERATED/safes'
import { SafeInfo } from '@/src/types/address'

import { updateSettings } from '@/src/store/settingsSlice'
import { updatePromptAttempts } from '@/src/store/notificationsSlice'
LogBox.ignoreAllLogs()

const mockedActiveAccount: SafeInfo = {
Expand All @@ -26,7 +27,23 @@ const mockedActiveSafeInfo: SafeOverview = {
queued: 1,
threshold: 1,
}

const mockedActiveAccount1: SafeInfo = {
address: '0x9BFCA75a05175503580D593F4330b5505c594596',
chainId: '11155111',
}
const mockedActiveSafeInfo1: SafeOverview = {
address: { value: '0x9BFCA75a05175503580D593F4330b5505c594596', name: null, logoUri: null },
awaitingConfirmation: null,
chainId: mockedActiveAccount1.chainId,
fiatTotal: '0',
owners: [
{ value: '0x65F8236309e5A99Ff0d129d04E486EBCE20DC7B0', name: null, logoUri: null },
{ value: '0x0D65139Da4B36a8A39BF1b63e950038D42231b2e', name: null, logoUri: null },
{ value: '0x8aEf2f5c3F17261F6F1C4dA058D022BE92776af8', name: null, logoUri: null },
],
queued: 1,
threshold: 1,
}
/**
* This utility component is only included in the test simulator
* build. It gives some quick triggers which help improve the pace
Expand All @@ -43,6 +60,14 @@ export function TestCtrls() {
dispatch(setActiveSafe(mockedActiveAccount))
router.replace('/(tabs)')
}
const onPressE2eHistory = async () => {
dispatch(updateSettings({ onboardingVersionSeen: 'v1' }))
dispatch(updatePromptAttempts(1))
dispatch(addSafe({ SafeInfo: mockedActiveSafeInfo1, chains: [mockedActiveSafeInfo1.chainId] }))
dispatch(setActiveSafe(mockedActiveAccount1))

router.replace('/(tabs)')
}
const onPressTestOnboarding = async () => {
router.replace('/onboarding')
}
Expand All @@ -55,6 +80,12 @@ export function TestCtrls() {
accessibilityRole="button"
style={BTN}
/>
<Pressable
testID="e2eHistory"
onPress={onPressE2eHistory}
accessibilityRole="button"
style={BTN}
/>
<Pressable testID="e2eTestOnboarding" onPress={onPressTestOnboarding} accessibilityRole="button" style={BTN} />
</View>
)
Expand Down