Skip to content

Commit 5e6ad22

Browse files
committed
e2e: make selection test stable
1 parent ed9e7ef commit 5e6ad22

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed

e2e/kit/004-aware-scroll-view.e2e.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { expectBitmapsToBeEqual } from "./asserts";
22
import {
33
Env,
44
scrollUpUntilElementIsBarelyVisible,
5+
selectText,
56
tap,
67
typeText,
78
waitAndReplace,
@@ -78,7 +79,7 @@ describe("AwareScrollView test cases", () => {
7879
"aware_scroll_view_container",
7980
"TextInput#4",
8081
);
81-
await element(by.id("TextInput#4")).multiTap(2);
82+
await selectText("TextInput#4");
8283
await waitForExpect(async () => {
8384
await expectBitmapsToBeEqual(
8485
"AwareScrollViewTextSelectionChanged",
Loading
Loading

e2e/kit/helpers/actions/index.ts

+16-1
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,27 @@ export const scrollUpUntilElementIsBarelyVisible = async (
145145
await element(by.id(elementId)).tap({ x: 0, y: 25 });
146146
}
147147
} catch (e) {
148-
await element(by.id(scrollViewId)).scroll(35, "down", 0.01, 0.5);
148+
await element(by.id(scrollViewId)).scroll(50, "down", 0.01, 0.5);
149149
break;
150150
}
151151
}
152152
};
153153

154+
export const selectText = async (id: string) => {
155+
console.debug(
156+
"---------------------------------\n",
157+
"Select text with id:",
158+
colors.magenta(id),
159+
);
160+
161+
if (device.getPlatform() === "ios") {
162+
// on Android multiTap sometimes may not work properly
163+
await element(by.id(id)).multiTap(2);
164+
} else {
165+
await element(by.id(id)).longPress();
166+
}
167+
};
168+
154169
export const closeKeyboard = async (textInputId: string) => {
155170
if (device.getPlatform() === "android") {
156171
await device.pressBack();

0 commit comments

Comments
 (0)