Skip to content

Commit 4c987de

Browse files
authored
fix: e2e tests (on iOS 16) (#943)
## 📜 Description Fixed interactive keyboard test flakiness. ## 💡 Motivation and Context For some reasons `scrollToEnd` is not getting called on iOS 16 now. So I added additional swipe down to be sure, that initial screen layout looks identical to local tests. Not a perfect solution, but I don't know why `scrollToEnd` is not getting called and it's so difficult to debug it on CI, so let's have this fix. ## 📢 Changelog <!-- High level overview of important changes --> <!-- For example: fixed status bar manipulation; added new types declarations; --> <!-- If your changes don't affect one of platform/language below - then remove this platform/language --> ### E2E - added `safeSwipe` function; - added swipe down when screen got shown initially. ## 🤔 How Has This Been Tested? Tested on CI. ## 📸 Screenshots (if appropriate): <img width="855" alt="image" src="https://github.com/user-attachments/assets/faeb96b6-4c6d-4bbc-9055-ec688b2ec925" /> ## 📝 Checklist - [x] CI successfully passed - [x] I added new mocks and corresponding unit-tests if library API was changed
1 parent 661b39e commit 4c987de

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

e2e/kit/006-interactive-keyboard.e2e.ts

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ import {
88
const scrollable =
99
device.getPlatform() === "android" ? "chat.gesture" : "chat.scroll";
1010

11+
const safeSwipe = async (callback: () => Promise<void>) => {
12+
try {
13+
await callback();
14+
} catch {
15+
// ignore exception, will be thrown on Android 9
16+
}
17+
};
18+
1119
describe("Interactive keyboard interactions", () => {
1220
it("should navigate to `Interactive keyboard` screen", async () => {
1321
const item = `interactive_keyboard_${device.getPlatform()}`;
@@ -17,6 +25,11 @@ describe("Interactive keyboard interactions", () => {
1725
`interactive_keyboard_${device.getPlatform()}`,
1826
);
1927
await waitAndTap(item);
28+
29+
// scroll to the end of ScrollView to be sure UI is always identical
30+
await safeSwipe(() =>
31+
element(by.id(scrollable)).swipe("up", "fast", 1, 0.5, 0.4),
32+
);
2033
});
2134

2235
it("should have expected state when keyboard is opened", async () => {
@@ -27,25 +40,21 @@ describe("Interactive keyboard interactions", () => {
2740
});
2841

2942
it("should have expected state after the gesture", async () => {
30-
try {
31-
await element(by.id(scrollable)).swipe("down", "fast", 1);
32-
} catch (e) {
33-
// ignore exception, will be thrown on Android 9
34-
}
43+
await safeSwipe(() => element(by.id(scrollable)).swipe("down", "fast", 1));
3544
await waitForExpect(async () => {
3645
await expectBitmapsToBeEqual("InteractiveKeyboardAfterGestureDown");
3746
});
3847
});
3948

4049
it("should react on the gesture up when keyboard closed", async () => {
41-
try {
42-
// show the keyboard on Android 12+
43-
await element(by.id(scrollable)).swipe("up", "fast", 1, 0.5, 0.5);
44-
// scroll to the end of ScrollView to be sure UI is always identical
45-
await element(by.id(scrollable)).swipe("up", "fast", 1, 0.5, 0.4);
46-
} catch (e) {
47-
// ignore exception, will be thrown on Android 9
48-
}
50+
// show the keyboard on Android 12+
51+
await safeSwipe(() =>
52+
element(by.id(scrollable)).swipe("up", "fast", 1, 0.5, 0.5),
53+
);
54+
// scroll to the end of ScrollView to be sure UI is always identical
55+
await safeSwipe(() =>
56+
element(by.id(scrollable)).swipe("up", "fast", 1, 0.5, 0.4),
57+
);
4958
await waitForExpect(async () => {
5059
await expectBitmapsToBeEqual("InteractiveKeyboardAfterGestureUp");
5160
});

0 commit comments

Comments
 (0)