Skip to content

Commit

Permalink
e2e: make selection test stable
Browse files Browse the repository at this point in the history
  • Loading branch information
kirillzyusko committed Jan 3, 2025
1 parent 5e6c79a commit d8d8f34
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
3 changes: 2 additions & 1 deletion e2e/kit/004-aware-scroll-view.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { expectBitmapsToBeEqual } from "./asserts";
import {
Env,
scrollUpUntilElementIsBarelyVisible,
selectText,
tap,
typeText,
waitAndReplace,
Expand Down Expand Up @@ -78,7 +79,7 @@ describe("AwareScrollView test cases", () => {
"aware_scroll_view_container",
"TextInput#4",
);
await element(by.id("TextInput#4")).multiTap(2);
await selectText("TextInput#4");
await waitForExpect(async () => {
await expectBitmapsToBeEqual(
"AwareScrollViewTextSelectionChanged",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 16 additions & 1 deletion e2e/kit/helpers/actions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,27 @@ export const scrollUpUntilElementIsBarelyVisible = async (
await element(by.id(elementId)).tap({ x: 0, y: 25 });
}
} catch (e) {
await element(by.id(scrollViewId)).scroll(35, "down", 0.01, 0.5);
await element(by.id(scrollViewId)).scroll(50, "down", 0.01, 0.5);
break;
}
}
};

export const selectText = async (id: string) => {
console.debug(
"---------------------------------\n",
"Select text with id:",
colors.magenta(id),
);

if (device.getPlatform() === "ios") {
// on Android multiTap sometimes may not work properly
await element(by.id(id)).multiTap(2);
} else {
await element(by.id(id)).longPress();
}
};

export const closeKeyboard = async (textInputId: string) => {
if (device.getPlatform() === "android") {
await device.pressBack();
Expand Down

0 comments on commit d8d8f34

Please sign in to comment.