Skip to content

Commit 7c71b9f

Browse files
committed
refactoring ios
1 parent 6c9452d commit 7c71b9f

1 file changed

Lines changed: 30 additions & 35 deletions

File tree

src/test/java/eu/europa/eudi/pages/Wallet.java

Lines changed: 30 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,41 +1120,36 @@ public void scrollUntilmDLOnDocuments() throws InterruptedException {
11201120
String env = envDataConfig.getExecutionEnvironment();
11211121
if (env.equalsIgnoreCase("browserstack")) {
11221122
IOSDriver driver = (IOSDriver) test.mobileWebDriverFactory().getDriverIos();
1123-
// for (int i = 0; i < 22; i++) {
1124-
// try {
1125-
// WebElement mdlElement = driver.findElement(eu.europa.eudi.elements.ios.WalletElements.clickMdl);
1126-
// if (mdlElement.isDisplayed()) {
1127-
// break;
1128-
// }
1129-
// } catch (Exception e) {
1130-
// // element not visible yet, continue scrolling
1131-
// }
1132-
// // Get screen size
1133-
// Dimension size = driver.manage().window().getSize();
1134-
// int startX = size.width / 2;
1135-
// int startY = (int) (size.height * 0.6);
1136-
// int endY = (int) (size.height * 0.5);
1137-
// // --- START: REPLACEMENT FOR TouchAction ---
1138-
// PointerInput finger = new PointerInput(PointerInput.Kind.TOUCH, "finger");
1139-
// Sequence swipe = new Sequence(finger, 1);
1140-
//
1141-
// swipe.addAction(finger.createPointerMove(Duration.ofMillis(0), PointerInput.Origin.viewport(), startX, startY));
1142-
// swipe.addAction(finger.createPointerDown(PointerInput.MouseButton.LEFT.asArg()));
1143-
// swipe.addAction(new Pause(finger, Duration.ofMillis(500)));
1144-
// // This replaces your waitAction
1145-
// swipe.addAction(finger.createPointerMove(Duration.ofMillis(250), PointerInput.Origin.viewport(), startX, endY));
1146-
// swipe.addAction(finger.createPointerUp(PointerInput.MouseButton.LEFT.asArg()));
1147-
//
1148-
// driver.perform(Collections.singletonList(swipe));
1149-
// // --- END: REPLACEMENT FOR TouchAction ---// Optional: Add a short pause between swipes
1150-
// Thread.sleep(50);
1151-
// Scroll until visible
1152-
driver.executeScript("mobile: scroll", Map.of(
1153-
"predicateString", "label CONTAINS 'mDL'"
1154-
));
1155-
1156-
// Then click normally
1157-
driver.findElement(By.id("mDL (MSO Mdoc)")).click();
1123+
for (int i = 0; i < 22; i++) {
1124+
try {
1125+
WebElement mdlElement = driver.findElement(eu.europa.eudi.elements.ios.WalletElements.clickMdl);
1126+
if (mdlElement.isDisplayed()) {
1127+
break;
1128+
}
1129+
} catch (Exception e) {
1130+
// element not visible yet, continue scrolling
1131+
}
1132+
// Get screen size
1133+
Dimension size = driver.manage().window().getSize();
1134+
int startX = size.width / 2;
1135+
int startY = (int) (size.height * 0.6);
1136+
int endY = (int) (size.height * 0.5);
1137+
// --- START: REPLACEMENT FOR TouchAction ---
1138+
PointerInput finger = new PointerInput(PointerInput.Kind.TOUCH, "finger");
1139+
Sequence swipe = new Sequence(finger, 1);
1140+
1141+
swipe.addAction(finger.createPointerMove(Duration.ofMillis(0), PointerInput.Origin.viewport(), startX, startY));
1142+
swipe.addAction(finger.createPointerDown(PointerInput.MouseButton.LEFT.asArg()));
1143+
swipe.addAction(new Pause(finger, Duration.ofMillis(500)));
1144+
// This replaces your waitAction
1145+
swipe.addAction(finger.createPointerMove(Duration.ofMillis(250), PointerInput.Origin.viewport(), startX, endY));
1146+
swipe.addAction(finger.createPointerUp(PointerInput.MouseButton.LEFT.asArg()));
1147+
1148+
driver.perform(Collections.singletonList(swipe));
1149+
// --- END: REPLACEMENT FOR TouchAction ---// Optional: Add a short pause between swipes
1150+
Thread.sleep(50);
1151+
Scroll until visible
1152+
11581153

11591154
} else {
11601155
IOSDriver driver = (IOSDriver) test.mobileWebDriverFactory().getDriverIos();

0 commit comments

Comments
 (0)