Skip to content

Commit be1f413

Browse files
committed
refactor(demo): consolidate login modal into SingleInputModal
1 parent 499f55c commit be1f413

17 files changed

Lines changed: 68 additions & 120 deletions

.github/workflows/e2e.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,15 @@ jobs:
102102
-destination 'generic/platform=iOS' \
103103
-archivePath build/demo.xcarchive \
104104
-derivedDataPath build \
105+
-quiet \
106+
-hideShellScriptEnvironment \
105107
CODE_SIGN_STYLE=Manual \
106108
COMPILER_INDEX_STORE_ENABLE=NO
107109
xcodebuild -exportArchive \
108110
-archivePath build/demo.xcarchive \
109111
-exportOptionsPlist ExportOptions.plist \
110-
-exportPath build/ipa
112+
-exportPath build/ipa \
113+
-quiet
111114
112115
- name: Verify aps-environment in IPA
113116
working-directory: examples/demo/ios

examples/demo/src/components/ListWidgets.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,11 @@ interface SingleItemProps {
8181
export function SingleItem({ value, onDelete, sectionKey }: SingleItemProps) {
8282
return (
8383
<View style={styles.singleRow}>
84-
<Text style={styles.singleValue} numberOfLines={1}>
84+
<Text
85+
style={styles.singleValue}
86+
numberOfLines={1}
87+
testID={sectionKey ? `${sectionKey}_value_${value}` : undefined}
88+
>
8589
{value}
8690
</Text>
8791
{onDelete && (

examples/demo/src/components/modals/LoginModal.tsx

Lines changed: 0 additions & 93 deletions
This file was deleted.

examples/demo/src/components/modals/MultiSelectRemoveModal.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ export default function MultiSelectRemoveModal({
8989
style={AppDialogStyles.actionBtn}
9090
onPress={handleConfirm}
9191
disabled={selected.size === 0}
92+
testID="multiselect_confirm_button"
9293
>
9394
<Text
9495
style={[

examples/demo/src/components/modals/OutcomeModal.tsx

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,16 @@ export default function OutcomeModal({
6161
onClose();
6262
};
6363

64-
const RadioOption = ({ type, label }: { type: OutcomeType; label: string }) => (
65-
<TouchableOpacity style={styles.radioRow} onPress={() => setOutcomeType(type)}>
64+
const RadioOption = ({
65+
type,
66+
label,
67+
testID,
68+
}: {
69+
type: OutcomeType;
70+
label: string;
71+
testID: string;
72+
}) => (
73+
<TouchableOpacity style={styles.radioRow} onPress={() => setOutcomeType(type)} testID={testID}>
6674
<View style={styles.radioOuter}>
6775
{outcomeType === type && <View style={styles.radioInner} />}
6876
</View>
@@ -78,9 +86,13 @@ export default function OutcomeModal({
7886
>
7987
<View style={AppDialogStyles.container}>
8088
<Text style={AppDialogStyles.title}>Send Outcome</Text>
81-
<RadioOption type="normal" label="Normal Outcome" />
82-
<RadioOption type="unique" label="Unique Outcome" />
83-
<RadioOption type="withValue" label="Outcome with Value" />
89+
<RadioOption type="normal" label="Normal Outcome" testID="outcome_type_normal_radio" />
90+
<RadioOption type="unique" label="Unique Outcome" testID="outcome_type_unique_radio" />
91+
<RadioOption
92+
type="withValue"
93+
label="Outcome with Value"
94+
testID="outcome_type_value_radio"
95+
/>
8496
<TextInput
8597
style={[AppDialogStyles.input, styles.inputSpacing]}
8698
placeholder="Name"

examples/demo/src/components/modals/PairInputModal.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ interface Props {
2121
onClose: () => void;
2222
keyTestID?: string;
2323
valueTestID?: string;
24-
confirmTestID?: string;
2524
}
2625

2726
export default function PairInputModal({
@@ -33,7 +32,6 @@ export default function PairInputModal({
3332
onClose,
3433
keyTestID,
3534
valueTestID,
36-
confirmTestID,
3735
}: Props) {
3836
const [keyValue, setKeyValue] = useState('');
3937
const [val, setVal] = useState('');
@@ -93,7 +91,7 @@ export default function PairInputModal({
9391
style={AppDialogStyles.actionBtn}
9492
onPress={handleConfirm}
9593
disabled={!canSubmit}
96-
testID={confirmTestID}
94+
testID="singlepair_confirm_button"
9795
>
9896
<Text
9997
style={[

examples/demo/src/components/modals/SingleInputModal.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ interface Props {
1919
onConfirm: (value: string) => void;
2020
onClose: () => void;
2121
keyboardType?: 'default' | 'email-address' | 'phone-pad';
22+
confirmLabel?: string;
2223
testID?: string;
2324
}
2425

@@ -29,6 +30,7 @@ export default function SingleInputModal({
2930
onConfirm,
3031
onClose,
3132
keyboardType = 'default',
33+
confirmLabel = 'Add',
3234
testID,
3335
}: Props) {
3436
const [value, setValue] = useState('');
@@ -74,14 +76,15 @@ export default function SingleInputModal({
7476
style={AppDialogStyles.actionBtn}
7577
onPress={handleConfirm}
7678
disabled={!value.trim()}
79+
testID="singleinput_confirm_button"
7780
>
7881
<Text
7982
style={[
8083
AppDialogStyles.actionText,
8184
!value.trim() && AppDialogStyles.actionTextDisabled,
8285
]}
8386
>
84-
Add
87+
{confirmLabel}
8588
</Text>
8689
</TouchableOpacity>
8790
</View>

examples/demo/src/components/modals/TooltipModal.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ export default function TooltipModal({ visible, tooltip, onClose }: Props) {
3838
))}
3939
</ScrollView>
4040
<View style={AppDialogStyles.actions}>
41-
<TouchableOpacity style={AppDialogStyles.actionBtn} onPress={onClose}>
41+
<TouchableOpacity
42+
style={AppDialogStyles.actionBtn}
43+
onPress={onClose}
44+
testID="tooltip_ok_button"
45+
>
4246
<Text style={AppDialogStyles.actionText}>OK</Text>
4347
</TouchableOpacity>
4448
</View>

examples/demo/src/components/sections/AliasesSection.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ export default function AliasesSection({
6464
onClose={() => setAddVisible(false)}
6565
keyTestID="alias_label_input"
6666
valueTestID="alias_id_input"
67-
confirmTestID="alias_confirm_button"
6867
/>
6968
<MultiPairInputModal
7069
visible={addMultipleVisible}

examples/demo/src/components/sections/TrackEventSection.tsx renamed to examples/demo/src/components/sections/CustomEventsSection.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ interface Props {
1010
onInfoTap?: () => void;
1111
}
1212

13-
export default function TrackEventSection({ onTrackEvent, onInfoTap }: Props) {
13+
export default function CustomEventsSection({ onTrackEvent, onInfoTap }: Props) {
1414
const [modalVisible, setModalVisible] = useState(false);
1515

1616
return (

0 commit comments

Comments
 (0)