Skip to content

Commit fdf95fc

Browse files
committed
fix: e2e tests
1 parent 3852a94 commit fdf95fc

File tree

2 files changed

+50
-31
lines changed

2 files changed

+50
-31
lines changed

e2e/kit/015-keyboard-extender.e2e.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,25 @@
1-
import { waitAndTap } from "./helpers";
1+
import { expectBitmapsToBeEqual } from "./asserts";
2+
import {
3+
scrollDownUntilElementIsVisible,
4+
waitAndTap,
5+
waitForElementById,
6+
waitForExpect,
7+
} from "./helpers";
28

39
describe("`KeyboardExtender` specification", () => {
410
it("should navigate to `Keyboard Extender` screen", async () => {
11+
await scrollDownUntilElementIsVisible(
12+
"main_scroll_view",
13+
"keyboard_extender",
14+
);
515
await waitAndTap("keyboard_extender");
16+
await waitForElementById("donation_amount");
17+
});
18+
19+
it("should have `KeyboardExtender` above the keyboard", async () => {
20+
await waitAndTap("donation_amount");
21+
await waitForExpect(async () => {
22+
await expectBitmapsToBeEqual("KeyboardExtenderIsAttached");
23+
});
624
});
725
});

example/src/screens/Examples/KeyboardExtender/index.tsx

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -49,37 +49,38 @@ export default function KeyboardExtendExample() {
4949
style={{ ...StyleSheet.absoluteFillObject, flex: 1, width: "100%" }}
5050
/>
5151
<TouchableWithoutFeedback onPress={() => Keyboard.dismiss()}>
52-
<SafeAreaView style={styles.container} edges={["top"]}>
53-
<TextInput
54-
placeholder="Donation amount"
55-
placeholderTextColor="#5c5c5c"
56-
keyboardType="numeric"
57-
style={styles.input}
58-
/>
52+
<SafeAreaView edges={["top"]} style={styles.container}>
53+
<TextInput
54+
keyboardType="numeric"
55+
placeholder="Donation amount"
56+
placeholderTextColor="#5c5c5c"
57+
style={styles.input}
58+
testID="donation_amount"
59+
/>
5960

60-
<KeyboardExtender enabled={showExtend}>
61-
<Reanimated.View style={[styles.keyboardExtend, animatedStyle]}>
62-
<TouchableOpacity onPress={() => Alert.alert("10$")}>
63-
<Text style={styles.priceText}>10$</Text>
64-
</TouchableOpacity>
65-
<TouchableOpacity onPress={() => Alert.alert("20$")}>
66-
<Text style={styles.priceText}>20$</Text>
67-
</TouchableOpacity>
68-
<TouchableOpacity onPress={() => Alert.alert("50$")}>
69-
<Text style={styles.priceText}>50$</Text>
70-
</TouchableOpacity>
71-
</Reanimated.View>
72-
</KeyboardExtender>
73-
<OverKeyboardView visible={isOKVMode}>
74-
<View style={{ flex: 1, justifyContent: "flex-end" }}>
75-
{/* TODO replace hardcoded value */}
76-
<TextInput
77-
placeholder="Search..."
78-
style={[styles.input, { marginBottom: height - 61.73 }]}
79-
/>
80-
</View>
81-
</OverKeyboardView>
82-
</SafeAreaView>
61+
<KeyboardExtender enabled={showExtend}>
62+
<Reanimated.View style={[styles.keyboardExtend, animatedStyle]}>
63+
<TouchableOpacity onPress={() => Alert.alert("10$")}>
64+
<Text style={styles.priceText}>10$</Text>
65+
</TouchableOpacity>
66+
<TouchableOpacity onPress={() => Alert.alert("20$")}>
67+
<Text style={styles.priceText}>20$</Text>
68+
</TouchableOpacity>
69+
<TouchableOpacity onPress={() => Alert.alert("50$")}>
70+
<Text style={styles.priceText}>50$</Text>
71+
</TouchableOpacity>
72+
</Reanimated.View>
73+
</KeyboardExtender>
74+
<OverKeyboardView visible={isOKVMode}>
75+
<View style={{ flex: 1, justifyContent: "flex-end" }}>
76+
{/* TODO replace hardcoded value */}
77+
<TextInput
78+
placeholder="Search..."
79+
style={[styles.input, { marginBottom: height - 61.73 }]}
80+
/>
81+
</View>
82+
</OverKeyboardView>
83+
</SafeAreaView>
8384
</TouchableWithoutFeedback>
8485
</>
8586
);

0 commit comments

Comments
 (0)