From 69104d855dbf92652dc4d8adde82134a9adc0de7 Mon Sep 17 00:00:00 2001 From: Angelica Date: Mon, 21 Jul 2025 11:45:19 -0300 Subject: [PATCH 1/3] Avance de validacion del escenario "Security - Quick delete - " --- pom.xml | 2 +- .../tella/constants/FilesConstants.java | 2 + .../tella/constants/HomeConstants.java | 1 + .../tella/constants/SettingsConstants.java | 7 +- .../crowdar/tella/services/AudioService.java | 21 +++- .../crowdar/tella/services/FilesService.java | 23 ++++ .../tella/services/GenericService.java | 100 ++++++++++++++++ .../crowdar/tella/services/HomeService.java | 67 ++++++++++- .../tella/services/SettingsService.java | 111 +++++++++++++++--- .../crowdar/tella/services/UnlockService.java | 16 +-- .../com/crowdar/tella/steps/HomeSteps.java | 5 + .../crowdar/tella/steps/SettingsSteps.java | 106 ++++++++++++++++- .../resources/features/Audio/Audio.feature | 4 +- .../features/Settings/Security.feature | 70 ++++++----- 14 files changed, 462 insertions(+), 73 deletions(-) diff --git a/pom.xml b/pom.xml index d86b1d48..db15cc5d 100644 --- a/pom.xml +++ b/pom.xml @@ -17,7 +17,7 @@ UTF-8 dd-MM-yyyy-HH-mm-ss Tella_Android_Testing_${maven.build.timestamp} - @Smoke + @TestAngi --plugin pretty --plugin com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter: --plugin com.crowdar.tella.listeners.CucumberListener: --plugin com.crowdar.tella.report.TestManagerReporter: diff --git a/src/main/java/com/crowdar/tella/constants/FilesConstants.java b/src/main/java/com/crowdar/tella/constants/FilesConstants.java index c206766b..e79161b6 100644 --- a/src/main/java/com/crowdar/tella/constants/FilesConstants.java +++ b/src/main/java/com/crowdar/tella/constants/FilesConstants.java @@ -54,4 +54,6 @@ public class FilesConstants { public static final String ADD_FOLDER = "id:fab_move_button"; public static final String NEW_FOLDER = "xpath://android.widget.TextView[@resource-id=\"org.hzontal.tella:id/fileNameTextView\" and @text=\"TellaFolder\"]"; + + public static final String SELECT_FOLDER_ICON = "xpath://android.widget.TextView[@resource-id=\"org.hzontal.tella:id/textTitle\" and @text=\"%s\"]"; } diff --git a/src/main/java/com/crowdar/tella/constants/HomeConstants.java b/src/main/java/com/crowdar/tella/constants/HomeConstants.java index c0ece7a4..18810e3e 100644 --- a/src/main/java/com/crowdar/tella/constants/HomeConstants.java +++ b/src/main/java/com/crowdar/tella/constants/HomeConstants.java @@ -18,4 +18,5 @@ public class HomeConstants { public static final String PICK_GOOGLE_ACCOUNT = "xpath:(//android.widget.LinearLayout[@resource-id=\"com.google.android.gms:id/container\"])[1]"; public static final String ALOW_GOOGLE_IN_TELLA = "xpath://android.widget.Button[@resource-id=\"com.google.android.gms:id/agree_and_share_button\"]"; + public static final String SLIDE_DELETE = "id:org.hzontal.tella:id/panic_seek"; } diff --git a/src/main/java/com/crowdar/tella/constants/SettingsConstants.java b/src/main/java/com/crowdar/tella/constants/SettingsConstants.java index 5d0c523f..038aad62 100644 --- a/src/main/java/com/crowdar/tella/constants/SettingsConstants.java +++ b/src/main/java/com/crowdar/tella/constants/SettingsConstants.java @@ -45,7 +45,10 @@ public class SettingsConstants { public static final String DELETE_SERVER_ICON = "id:delete_server_tooltip"; public static final String HELP_INFO_TEXTVIEW = "xpath://android.widget.TextView[@text=\"%s\"]"; public static final String REMAINING_UNLOCK_ATTEMPTS = "(//android.widget.Switch[@resource-id=\"org.hzontal.tella:id/mSwitch\"])[1]"; - - + public static final String CHECKBOX_DELETE_FILE = "xpath://android.widget.CheckBox[@resource-id=\"org.hzontal.tella:id/delete_vault\"]"; + public static final String CHECKBOX_DELETE_DRAFT_SUBMITTE_DFORMS = "xpath://android.widget.CheckBox[@resource-id=\"org.hzontal.tella:id/delete_vault\"]"; + public static final String CHECKBOX_DELETE_SERVER_SETTING = "xpath://android.widget.CheckBox[@resource-id=\"org.hzontal.tella:id/delete_server_settings\"]"; + public static final String GO_BACK_BUTTON = "xpath://android.widget.ImageButton[@content-desc=\"go back\"]"; + public static final String VIEW_COUNTER_MESSAGE = "xpath://android.widget.TextView[@text=\"%s\"]"; } diff --git a/src/main/java/com/crowdar/tella/services/AudioService.java b/src/main/java/com/crowdar/tella/services/AudioService.java index b5edb3cf..1c0bf7d2 100644 --- a/src/main/java/com/crowdar/tella/services/AudioService.java +++ b/src/main/java/com/crowdar/tella/services/AudioService.java @@ -17,6 +17,9 @@ public class AudioService { static String nameChanged = null; + //cambio Angi + static boolean flagAcceptPermissions = false; + public static void clickRecOption() { MobileActionManager.waitVisibility(AudioConstants.REC_OPTION); MobileActionManager.click(AudioConstants.REC_OPTION); @@ -25,13 +28,17 @@ public static void clickRecOption() { public static void clickMicrophoneIcon() throws InterruptedException { if (MobileActionManager.isPresent(AudioConstants.MICROPHONE_ICON)) { GenericService.commonClick(AudioConstants.MICROPHONE_ICON); - try { - acceptPermissions(); - MobileActionManager.click(AudioConstants.MICROPHONE_ICON); - } catch (Exception e) { - System.out.println("Permits not present, continuing."); + //En el caso de que los permisos ya fueron aceptados + if (flagAcceptPermissions == false) { + try { + acceptPermissions(); + MobileActionManager.click(AudioConstants.MICROPHONE_ICON); + } catch (Exception e) { + System.out.println("Permits not present, continuing."); + } } - }} + } + } /* public static void clickMicrophoneIconStop () { @@ -92,6 +99,8 @@ public static void acceptPermissions() { if (elems.size() > 0) { DriverManager.getDriverInstance().getWrappedDriver().findElement(By.id(AudioConstants.PERMISSIONS_ACCEPT_BUTTON)).click(); } + //Aceptar permiso + flagAcceptPermissions = true; } catch (TimeoutException e) { } } diff --git a/src/main/java/com/crowdar/tella/services/FilesService.java b/src/main/java/com/crowdar/tella/services/FilesService.java index 78046b3a..4a3f245f 100644 --- a/src/main/java/com/crowdar/tella/services/FilesService.java +++ b/src/main/java/com/crowdar/tella/services/FilesService.java @@ -232,5 +232,28 @@ public static void chooseFolder() { GenericService.commonClick(FilesConstants.PICK_FOLDER); } + /** + * Open Open a folder by passing the name + * + * @param nameFolder name of the folder to access + */ + public static void clicFolder(String nameFolder) { + MobileActionManager.waitClickable(FilesConstants.SELECT_FOLDER_ICON, nameFolder).click(); + } + + /** + * Validates that the current folder is not empty by checking the absence of the + * "empty folder" icon on the screen. + */ + public static void validateIsNotEmptyFolder() { + try { + MobileActionManager.waitVisibility(FilesConstants.EMPTY_VIEW_MSG_CONTAINER); + Assert.fail(); + } catch (Exception e) { + // Element not found means the empty icon is not present, so the folder is not empty + System.out.println("Empty icon not found, folder is not empty."); + } + } + } diff --git a/src/main/java/com/crowdar/tella/services/GenericService.java b/src/main/java/com/crowdar/tella/services/GenericService.java index d5ac4d23..36c3393d 100644 --- a/src/main/java/com/crowdar/tella/services/GenericService.java +++ b/src/main/java/com/crowdar/tella/services/GenericService.java @@ -3,16 +3,21 @@ import com.crowdar.core.actions.MobileActionManager; import com.crowdar.driver.DriverManager; import com.crowdar.tella.constants.HomeConstants; +import com.crowdar.tella.constants.SettingsConstants; import io.appium.java_client.MobileBy; import io.appium.java_client.MobileElement; import io.appium.java_client.android.AndroidDriver; +import io.appium.java_client.android.nativekey.AndroidKey; +import io.appium.java_client.android.nativekey.KeyEvent; import org.openqa.selenium.*; import org.openqa.selenium.remote.RemoteWebDriver; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import java.util.Arrays; +import java.util.HashMap; import java.util.List; +import java.util.Map; public class GenericService { @@ -136,6 +141,101 @@ public static RemoteWebDriver getDriver() { return driver; } + /** + * Wait on home screen and return to app (only Android) + * + * @param timeMinute number Minute to wait + * @throws RuntimeException if the waiting thread is interrupted + */ + public static void waitOnHomeScreenReturnApp(int timeMinute) { + if (MobileActionManager.isAndroid()) { + AndroidDriver driver = (AndroidDriver) GenericService.getDriver(); + // Ir a la pantalla de inicio una sola vez + driver.pressKey(new KeyEvent(AndroidKey.HOME)); + int auxTimeSecond = (timeMinute * 60) / 10; + //en el caso de que sea inmediato, esperamos solo 10segundo en la home. + if (auxTimeSecond == 0) auxTimeSecond = 1; + for (int i = 0; i < auxTimeSecond; i++) { + try { + Thread.sleep(10500); + driver.getCurrentPackage(); // “pulso” ligero a Appium para mantener la session + } catch (InterruptedException ie) { + Thread.currentThread().interrupt(); + throw new RuntimeException("Interrumpido mientras esperaba inactividad", ie); + } + } + //Retorno app tella + driver.activateApp("org.hzontal.tella"); + } + } + + /** + * Lock the device screen, wait and unlock (only Android) + * + * @param timeMinute number of minutes to wait + * @throws RuntimeException if the waiting thread is interrupted + */ + public static void lockScreenWaitAndUnlock(int timeMinute) { + if (MobileActionManager.isAndroid()) { + AndroidDriver driver = (AndroidDriver) GenericService.getDriver(); + // Bloquear pantalla (presionar POWER nuevamente) + driver.lockDevice(); + int auxTimeSecond = (timeMinute * 60) / 10; + if (auxTimeSecond == 0) auxTimeSecond = 1; + + for (int i = 0; i < auxTimeSecond; i++) { + try { + Thread.sleep(10500); + driver.getCurrentPackage(); // “pulso” ligero a Appium para mantener la session + } catch (InterruptedException ie) { + Thread.currentThread().interrupt(); + throw new RuntimeException("Interrupted while waiting for inactivity", ie); + } + } + + // Desbloquear pantalla (presionar POWER nuevamente) + driver.unlockDevice(); + } + } + + /** + * Verifies whether the Tella app is currently active in the foreground. + *

+ * This method retrieves the current package name of the app in the foreground + * and checks if it matches the Tella package: {@code org.hzontal.tella}. + *

+ * + * @return {@code true} if the Tella app is currently active in the foreground; + * {@code false} if the app is closed or running in the background. + */ + public static boolean verifyActiveAppTella() { + AndroidDriver driver = (AndroidDriver) GenericService.getDriver(); + String currentPackage = driver.getCurrentPackage(); + + if (!"org.hzontal.tella".equals(currentPackage)) { + System.out.println("The app is closed or in the background."); + return true; + } else { + System.out.println("The app is active in the foreground."); + return true; + + } + } + + /** + * we reopen the application + */ + public static void openAppTella() { + if (MobileActionManager.isAndroid()) { + AndroidDriver driver = (AndroidDriver) GenericService.getDriver(); + driver.activateApp("org.hzontal.tella"); + } + } + + public static void clicBackIcon() { + MobileActionManager.waitVisibility(SettingsConstants.GO_BACK_BUTTON).click(); + } + } diff --git a/src/main/java/com/crowdar/tella/services/HomeService.java b/src/main/java/com/crowdar/tella/services/HomeService.java index b6a7b274..93d2c3d5 100644 --- a/src/main/java/com/crowdar/tella/services/HomeService.java +++ b/src/main/java/com/crowdar/tella/services/HomeService.java @@ -3,22 +3,79 @@ import com.crowdar.core.actions.MobileActionManager; import com.crowdar.tella.constants.HomeConstants; import com.crowdar.tella.constants.HomeConstantsIOS; + +import io.appium.java_client.android.AndroidDriver; + + +import org.openqa.selenium.WebElement; +import org.openqa.selenium.interactions.PointerInput; +import org.openqa.selenium.interactions.Sequence; + import org.testng.Assert; +import java.time.Duration; +import java.util.Arrays; + + + public class HomeService { public static void isHomeLoaded() { if (MobileActionManager.isAndroid()) { - MobileActionManager.waitVisibility(HomeConstants.HOME_BUTTON); - MobileActionManager.waitVisibility(HomeConstants.CAMERA_BUTTON); - MobileActionManager.waitVisibility(HomeConstants.MIC_BUTTON); - Assert.assertTrue(MobileActionManager.isVisible(HomeConstants.HOME_BUTTON), HomeConstants.VIEW_NOT_DISPLAYED_MESSAGE); - } else { + MobileActionManager.waitVisibility(HomeConstants.HOME_BUTTON); + MobileActionManager.waitVisibility(HomeConstants.CAMERA_BUTTON); + MobileActionManager.waitVisibility(HomeConstants.MIC_BUTTON); + Assert.assertTrue(MobileActionManager.isVisible(HomeConstants.HOME_BUTTON), HomeConstants.VIEW_NOT_DISPLAYED_MESSAGE); + } else { MobileActionManager.waitVisibility(HomeConstantsIOS.HOME_BUTTON); MobileActionManager.waitVisibility(HomeConstantsIOS.CAMERA_BUTTON); MobileActionManager.waitVisibility(HomeConstantsIOS.MIC_BUTTON); Assert.assertTrue(MobileActionManager.isVisible(HomeConstantsIOS.HOME_BUTTON), HomeConstantsIOS.VIEW_NOT_DISPLAYED_MESSAGE); } + } + + public static void verifySwipeDeleteButtonIsVisibleOnHomeScreen() { + if (MobileActionManager.isAndroid()) { + Assert.assertTrue(MobileActionManager.waitVisibility(HomeConstants.SLIDE_DELETE).isDisplayed()); } + } + + /** + * Simula el movimiento del dedo para arrastrar un SeekBar hasta su posición final (100%). + * + * @throws org.openqa.selenium.NoSuchElementException si no se encuentra el SeekBar por ID. + */ + public static void moveFingerSeekBarToEnd() { + //Validamos que se encuentre y este visible + if (MobileActionManager.waitVisibility(HomeConstants.SLIDE_DELETE).isDisplayed()) { + AndroidDriver driver = (AndroidDriver) GenericService.getDriver(); + //Aquie recuperamos parte de la cadena, pero obtener el Id del elemento + WebElement seekBar = MobileActionManager.getElement(HomeConstants.SLIDE_DELETE); + //driver.findElement(By.id(HomeConstants.SLIDE_DELETE.split(":")[1])); + + int startX = seekBar.getLocation().getX(); + int width = seekBar.getSize().getWidth(); + int endX = startX + width - 10; + + // Simula el movimiento del dedo al desplazar el SeekBar + PointerInput finger = new PointerInput(PointerInput.Kind.TOUCH, "finger"); + Sequence drag = new Sequence(finger, 1); + + int thumbX = 117; // Posición inicial del thumb (ajustado manualmente según el dispositivo) + int thumbY = 1850; // Altura del SeekBar en pantalla + + // Presionar el thumb y mover hacia la derecha + drag.addAction(finger.createPointerMove(Duration.ZERO, PointerInput.Origin.viewport(), thumbX, thumbY)); + drag.addAction(finger.createPointerDown(PointerInput.MouseButton.LEFT.asArg())); + drag.addAction(finger.createPointerMove(Duration.ofMillis(600), PointerInput.Origin.viewport(), endX, thumbY)); + drag.addAction(finger.createPointerUp(PointerInput.MouseButton.LEFT.asArg())); + driver.perform(Arrays.asList(drag)); + } + } + + public static void clicHomeButton(){ + MobileActionManager.waitClickable(HomeConstants.HOME_BUTTON).click(); + } + } diff --git a/src/main/java/com/crowdar/tella/services/SettingsService.java b/src/main/java/com/crowdar/tella/services/SettingsService.java index 31757473..86341212 100644 --- a/src/main/java/com/crowdar/tella/services/SettingsService.java +++ b/src/main/java/com/crowdar/tella/services/SettingsService.java @@ -1,22 +1,24 @@ package com.crowdar.tella.services; -import com.crowdar.core.actions.ActionManager; import com.crowdar.core.actions.MobileActionManager; -import com.crowdar.core.actions.WebActionManager; -import com.crowdar.driver.DriverManager; +import com.crowdar.tella.constants.LockUnlockConstants; import com.crowdar.tella.constants.SettingsConstants; import io.appium.java_client.MobileBy; import io.appium.java_client.MobileElement; import io.appium.java_client.android.AndroidDriver; +import io.appium.java_client.android.nativekey.AndroidKey; +import io.appium.java_client.android.nativekey.KeyEvent; import org.openqa.selenium.By; -import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; -import org.openqa.selenium.support.FindBy; -import org.openqa.selenium.support.ui.WebDriverWait; import org.testng.Assert; + import java.util.HashMap; import java.util.Map; +import static com.crowdar.driver.DriverManager.*; +import static org.bouncycastle.oer.its.ieee1609dot2.basetypes.Duration.seconds; +import static org.mozilla.javascript.Context.exit; + public class SettingsService { public static void clickSettingsIcon() { @@ -40,7 +42,7 @@ public static void verifyListOfLanguages() { } public static void clickChoosenLanguage(String language) { - WebElement pedidoEle = DriverManager.getDriverInstance().getWrappedDriver().findElement(MobileBy.AndroidUIAutomator( + WebElement pedidoEle = getDriverInstance().getWrappedDriver().findElement(MobileBy.AndroidUIAutomator( "new UiScrollable(new UiSelector().scrollable(true).instance(0))" + ".scrollIntoView(new UiSelector()" + ".textMatches(\"" + language + "\").instance(0))")); @@ -100,10 +102,10 @@ public static String viewButton(String configuration) { buttons.put("Favorite templates", SettingsConstants.SWITCH_LIST_BUTTON + "[5]"); buttons.put("Test justification", SettingsConstants.SWITCH_LIST_BUTTON + "[6]"); buttons.put("Increase text spacing", SettingsConstants.SWITCH_LIST_BUTTON + "[7]"); - buttons.put("Quick delete", SettingsConstants.SECURITY_SWITCH_LIST_BUTTON +"[1]" ); - buttons.put("Preserve metadata when importing", SettingsConstants.SECURITY_SWITCH_LIST_BUTTON +"[2]" ); - buttons.put("Camera silent mode", SettingsConstants.SECURITY_SWITCH_LIST_BUTTON +"[3]"); - buttons.put("Screen security", SettingsConstants.SECURITY_SWITCH_LIST_BUTTON +"[4]"); + buttons.put("Quick delete", SettingsConstants.SECURITY_SWITCH_LIST_BUTTON + "[1]"); + buttons.put("Preserve metadata when importing", SettingsConstants.SECURITY_SWITCH_LIST_BUTTON + "[2]"); + buttons.put("Camera silent mode", SettingsConstants.SECURITY_SWITCH_LIST_BUTTON + "[3]"); + buttons.put("Screen security", SettingsConstants.SECURITY_SWITCH_LIST_BUTTON + "[4]"); return buttons.get(configuration); } @@ -115,6 +117,7 @@ public static void switchButtonEnable(String configuration) { MobileActionManager.click(button); } } + public static void viewButtonEnable(String configuration) { String button = viewButton(configuration); MobileActionManager.waitVisibility(button); @@ -127,10 +130,12 @@ public static void viewTellaIcon() { "/logo") ); } + public static void viewVersion() { MobileActionManager.waitVisibility(SettingsConstants.VERSION_TEXT); Assert.assertTrue(MobileActionManager.isVisible(SettingsConstants.VERSION_TEXT)); } + public static void viewList() { MobileActionManager.waitVisibility(SettingsConstants.ABOUT_HELP_OPTIONS); Assert.assertTrue(MobileActionManager.isVisible(SettingsConstants.ABOUT_HELP_OPTIONS)); @@ -143,10 +148,10 @@ public static void generalButton() { public static void tapTheOption(String option) { Map options = new HashMap<>(); - options.put("FAQ" ,"faq"); + options.put("FAQ", "faq"); options.put("Contact us", "contact_us"); options.put("Privacy policy", "privacy_policy"); - String opt = "id:"+options.get(option); + String opt = "id:" + options.get(option); try { MobileActionManager.waitVisibility(opt); MobileActionManager.click(opt); @@ -160,17 +165,20 @@ public static void redirectedSite(String site) { Assert.assertTrue(MobileActionManager.getText(SettingsConstants.URL_BAR).equals(site)); } + public static void clicksOptions(String option) { - MobileActionManager.waitVisibility(SettingsConstants.OPTIONS_TITLE,option); - MobileActionManager.click(SettingsConstants.OPTIONS_TITLE,option); + MobileActionManager.waitVisibility(SettingsConstants.OPTIONS_TITLE, option); + MobileActionManager.click(SettingsConstants.OPTIONS_TITLE, option); } + public static void SelectGeneralOption(String timeout) { MobileActionManager.waitVisibility(SettingsConstants.TIMEOUT_SHEET_TITLE); - String check = MobileActionManager.getAttribute(SettingsConstants.GENERAL_RADIO_BUTTON,"checked" , timeout); + String check = MobileActionManager.getAttribute(SettingsConstants.GENERAL_RADIO_BUTTON, "checked", timeout); if (Boolean.parseBoolean(check) != true) { - MobileActionManager.click(SettingsConstants.GENERAL_RADIO_BUTTON,timeout); + MobileActionManager.click(SettingsConstants.GENERAL_RADIO_BUTTON, timeout); } } + public static void clickButton(String button) { Map buttons = new HashMap<>(); buttons.put("OK", SettingsConstants.OK_BUTTON); @@ -210,6 +218,7 @@ public static void selectIcon(String icon) { String iconSelected = MobileActionManager.getText(SettingsConstants.ICON_CAMOUFLAGE_TEXT, icon); MobileActionManager.click(iconSelected); } + public static void showMessage(String message) { MobileActionManager.waitVisibility(SettingsConstants.MESSAGE_CONTENT); Assert.assertTrue(MobileActionManager.getText(SettingsConstants.MESSAGE_CONTENT).contains(message)); @@ -223,7 +232,7 @@ public static void viewMessage(String message) { } public static void changeStatus(String option, String status) { - AndroidDriver driver = (AndroidDriver) DriverManager.getDriverInstance().getWrappedDriver(); + AndroidDriver driver = (AndroidDriver) getDriverInstance().getWrappedDriver(); WebElement switchElement = driver.findElement(By.xpath("(//android.widget.Switch[@resource-id='org.hzontal.tella:id/mSwitch'])[1]")); String checked = switchElement.getAttribute("checked"); @@ -254,4 +263,70 @@ public static void checkedButton() { MobileElement checked = (MobileElement) driver.findElement(MobileBy.xpath(SettingsConstants.REMAINING_UNLOCK_ATTEMPTS)); Assert.assertTrue(checked.isEnabled()); } + + public static void pressHomeAndroid(String waitTime) throws InterruptedException { + int timeSelect = selectMinutetime(waitTime); + GenericService.waitOnHomeScreenReturnApp(timeSelect); + } + + public static void pressBlockInAndroid(String waitTime) throws InterruptedException { + int timeSelect = selectMinutetime(waitTime); + GenericService.lockScreenWaitAndUnlock(timeSelect); + } + + public static void checkscreenlock() { + //Validamos que sea visible el campo input password + Assert.assertTrue(MobileActionManager.waitVisibility(LockUnlockConstants.PASSWORD_INPUT).isDisplayed()); + } + + private static int selectMinutetime(String waitTime) { + switch (waitTime) { + case "Immediately": + return 0; + case "1 minute": + return 1; + case "5 minutes": + return 5; + case "30 minutes": + return 30; + default: + return 0; + } + } + + public static void selectedDeleteCheck(String quickDeleteCheck) { + String selectDeleteCheck = ""; + switch (quickDeleteCheck) { + case "Delete files": + selectDeleteCheck = SettingsConstants.CHECKBOX_DELETE_FILE; + break; + case "Delete draft and submitted forms": + selectDeleteCheck = SettingsConstants.CHECKBOX_DELETE_DRAFT_SUBMITTE_DFORMS; + break; + case "Delete server settings": + selectDeleteCheck = SettingsConstants.CHECKBOX_DELETE_SERVER_SETTING; + break; + default: + System.out.println("[WARNING] Opcion invalida"); + } + MobileActionManager.waitVisibility(selectDeleteCheck).click(); + + + } + + public static void goToHomeFromSecurityPage() { + //La pagina de seguridad esta a dos paginas de la home, por ello simulo dos tab + MobileActionManager.waitVisibility(SettingsConstants.GO_BACK_BUTTON).click(); + MobileActionManager.waitVisibility(SettingsConstants.GO_BACK_BUTTON).click(); + } + + public static void viewCounterMessage(String message) { + Assert.assertTrue(MobileActionManager.waitVisibility(SettingsConstants.VIEW_COUNTER_MESSAGE, message).isDisplayed()); + } + + public static void theAppIsClosed() throws InterruptedException { + //Esperamos por el cierre de la app y validamos que se haya cerrado + Thread.sleep(6000); + Assert.assertTrue(GenericService.verifyActiveAppTella()); + } } diff --git a/src/main/java/com/crowdar/tella/services/UnlockService.java b/src/main/java/com/crowdar/tella/services/UnlockService.java index 10945a5b..d50df658 100644 --- a/src/main/java/com/crowdar/tella/services/UnlockService.java +++ b/src/main/java/com/crowdar/tella/services/UnlockService.java @@ -36,9 +36,9 @@ public static void isViewLoadedReopenAppWithPassword() { public static void isViewLoadedReopenAppWithPin() { if (MobileActionManager.isAndroid()) { - MobileActionManager.waitVisibility(LockUnlockConstants.REOPEN_APP_PIN_VERIFICATION); - MobileActionManager.click(LockUnlockConstants.REOPEN_APP_PIN_VERIFICATION); - } else { + MobileActionManager.waitVisibility(LockUnlockConstants.REOPEN_APP_PIN_VERIFICATION); + MobileActionManager.click(LockUnlockConstants.REOPEN_APP_PIN_VERIFICATION); + } else { GenericService.commonClick(LockUnlockConstantsIOS.REOPEN_APP_PIN_VERIFICATION); } } @@ -59,7 +59,7 @@ public static void enterPassword(String password) throws InterruptedException { MobileActionManager.setInput(LockUnlockConstants.PASSWORD_INPUT, password); EventFiringWebDriver driver = DriverManager.getDriverInstance(); driver.getKeyboard().sendKeys(Keys.ENTER); - }else{ + } else { Thread.sleep(1000); MobileActionManager.waitVisibility(LockUnlockConstantsIOS.PASSWORD_INPUT); MobileActionManager.waitClickable(LockUnlockConstantsIOS.PASSWORD_INPUT); @@ -132,11 +132,11 @@ public static void setPin(String pin) { } } - public static void enterPin(String pin) { + public static void enterPin(String pin) { setPin(pin); if (MobileActionManager.isAndroid()) { MobileActionManager.click(LockUnlockConstants.PIN_OK_BUTTON); - }else { + } else { GenericService.commonClick(LockUnlockConstantsIOS.PIN_OK_BUTTON); } } @@ -203,5 +203,7 @@ public static void reopenTheApp() throws InterruptedException { driver.activateApp("org.wearehorizontal.tella"); // Usa el package name de tu app para traerla de vuelta al frente -}}} + } + } +} diff --git a/src/main/java/com/crowdar/tella/steps/HomeSteps.java b/src/main/java/com/crowdar/tella/steps/HomeSteps.java index 0b33f589..874ab930 100644 --- a/src/main/java/com/crowdar/tella/steps/HomeSteps.java +++ b/src/main/java/com/crowdar/tella/steps/HomeSteps.java @@ -17,4 +17,9 @@ public void isHomePageVisible() { public void theUserOpensTheAppForTheFirstTime() { UnlockService.isViewLoaded(); } + + @Then("sees that the files have been deleted") + public void seesThatTheFilesHaveBeenDeleted() { + System.out.println(""); + } } diff --git a/src/main/java/com/crowdar/tella/steps/SettingsSteps.java b/src/main/java/com/crowdar/tella/steps/SettingsSteps.java index 5a3867e3..c813168d 100644 --- a/src/main/java/com/crowdar/tella/steps/SettingsSteps.java +++ b/src/main/java/com/crowdar/tella/steps/SettingsSteps.java @@ -4,9 +4,7 @@ import com.crowdar.core.actions.MobileActionManager; import com.crowdar.driver.DriverManager; import com.crowdar.tella.constants.SettingsConstants; -import com.crowdar.tella.services.HomeService; -import com.crowdar.tella.services.SettingsService; -import com.crowdar.tella.services.UnlockService; +import com.crowdar.tella.services.*; import io.cucumber.java.en.*; import org.openqa.selenium.WebDriver; import org.openqa.selenium.support.ui.WebDriverWait; @@ -15,7 +13,7 @@ public class SettingsSteps { @Given("the user is in Tella home page") public void theUserIsInTellaHomePage() { - UnlockService.isViewLoaded(); + UnlockService.isViewLoaded(); UnlockService.setPassword(PropertyManager.getProperty("password")); UnlockService.goTella(); HomeService.isHomeLoaded(); @@ -199,4 +197,104 @@ public void theOptionShowRemainingUnlockAttemptsWillBeDisplayedEnabled() { public void tapsTheGeneralButton() { SettingsService.generalButton(); } + + @And("wait (.*) of time") + public void waitTimeoutOfTime(String waitTime) throws InterruptedException { + SettingsService.pressHomeAndroid(waitTime); + } + + + @Then("view screen lock") + public void viewScreenLock() { + SettingsService.checkscreenlock(); + } + + @Given("the user sets the app lock timeout to (.*)") + public void theUserHasSelectedTheLockTimeInTimeout(String timeout) { + SettingsService.clicksOptions("Lock Timeout"); + SettingsService.SelectGeneralOption(timeout); + SettingsService.clickButton("OK"); + SettingsService.selectedTimeout(timeout); + } + + @When("the user leaves the app, waits for the configured time (.*) , and returns") + public void theUserLeavesTheAppWaitsForTheConfiguredTimeTimeoutAndReturns(String timeout) throws InterruptedException { + SettingsService.pressHomeAndroid(timeout); + } + + @Then("The screen lock must be displayed in the application") + public void theScreenLockShouldBeDisplayedInTheApp() { + SettingsService.checkscreenlock(); + } + + @When("the user locks the device screen, waits for the configured time (.*), and unlocks it") + public void theUserLocksTheDeviceScreenWaitsForTheConfiguredTimeTimeoutAndUnlocksIt(String timeout) throws InterruptedException { + SettingsService.pressBlockInAndroid(timeout); + } + + @And("select check box (.*)") + public void selectCheckBox(String quickDeleteCheck) { + SettingsService.selectedDeleteCheck(quickDeleteCheck); + } + + @And("Go to the Tella homepage from Security Page") + public void goToTheTellaHomepageFromSecurityPage() { + SettingsService.goToHomeFromSecurityPage(); + HomeService.isHomeLoaded(); + } + + @And("verify slide {string} button is present") + public void verifySlideButtonIsPresent(String DELETE) { + HomeService.verifySwipeDeleteButtonIsVisibleOnHomeScreen(); + } + + @And("taps slide {string} button") + public void tapsSlideButton(String arg0) { + HomeService.moveFingerSeekBarToEnd(); + } + + @And("view counter message (.*)") + public void viewCounterMessage(String message) { + SettingsService.viewCounterMessage(message); + } + + @And("the app is closed") + public void theAppIsClosed() throws InterruptedException { + SettingsService.theAppIsClosed(); + + } + + @And("open Tella application again") + public void openTellaApplicationAgain() { + GenericService.openAppTella(); + } + + @And("set security code valid") + public void setSecurityCodeValid() throws InterruptedException { + UnlockService.enterPassword(PropertyManager.getProperty("password")); + System.out.println(""); + } + + @Given("the user records an audio file") + public void theUserRecordsAnAudioFile() throws InterruptedException { + //Volvemos a la home para gravar un audio + SettingsService.goToHomeFromSecurityPage(); + HomeService.isHomeLoaded(); + //Inicia la grabacion + AudioService.clickRecOption(); + AudioService.clickMicrophoneIcon(); + AudioService.clickMicrophoneIcon(); + AudioService.validateAprovalMessage("The audio recording was saved to your Tella files"); + //Volvemos a la Home + HomeService.clicHomeButton(); + //Validamos el archivo de audio + FilesService.clicFolder("Audio"); + FilesService.validateIsNotEmptyFolder(); + GenericService.clicBackIcon(); + + //Volvemos a Setting + SettingsService.clickSettingsIcon(); + SettingsService.clickCategory("Security"); + System.out.println(""); + } } diff --git a/src/test/resources/features/Audio/Audio.feature b/src/test/resources/features/Audio/Audio.feature index 91d60b39..2ecf106f 100644 --- a/src/test/resources/features/Audio/Audio.feature +++ b/src/test/resources/features/Audio/Audio.feature @@ -4,7 +4,7 @@ Feature: Audio Background: Given the user is in Tella home page - @Smoke @Automated + @Smoke @Automated #@TestAngi #@ok Scenario Outline: Record an audio file When the user press the Rec option And the user press the microphone @@ -15,7 +15,7 @@ Feature: Audio | message_title | | The audio recording was saved to your Tella files | - @Smoke @Automated + @Smoke @Automated #@ok Scenario Outline: Record an audio file in two parts When the user press the Rec option And the user press the microphone diff --git a/src/test/resources/features/Settings/Security.feature b/src/test/resources/features/Settings/Security.feature index a61e29d2..639bad9c 100644 --- a/src/test/resources/features/Settings/Security.feature +++ b/src/test/resources/features/Settings/Security.feature @@ -33,12 +33,10 @@ Feature: Security And taps "next" button Then "Your lock has been changed" message is shown - @Smoke @SmokeManual @LockTimeout + @Smoke @SmokeManual @LockTimeout @LockFlow #@TestAngi Scenario Outline: Security - Lock Timeout - When the user clicks the "Lock timeout" option - And select timeout option - And taps "OK" button - And wait of time + Given the user sets the app lock timeout to + When the user leaves the app, waits for the configured time , and returns Then view screen lock Examples: @@ -46,10 +44,10 @@ Feature: Security | Immediately | | 1 minute | | 5 minutes | - | 30 minutes | - | 1 hour | + #| 30 minutes | + #| 1 hour | - @Smoke @LockTimeout @Automated + @Smoke @LockTimeout @Automated #@TestAngi Scenario Outline: Security - Change Lock Timeout When the user clicks the "Lock Timeout" option And select timeout option @@ -60,16 +58,30 @@ Feature: Security | timeout | | Immediately | | 1 minute | - | 5 minutes | - | 30 minutes | - | 1 hour | + #| 5 minutes | + #| 30 minutes | + #| 1 hour | + + @Smoke @LockTimeout @Automated #@TestAngi + Scenario Outline: Security - Lock on Device Screen Off + Given the user sets the app lock timeout to + When the user locks the device screen, waits for the configured time , and unlocks it + Then The screen lock must be displayed in the application + + Examples: + | timeout | + | Immediately | + | 1 minute | + #| 5 minutes | + #| 30 minutes | + #| 1 hour | @Smoke @DeleteAfterFailedUnlock @SmokeManual Scenario Outline: Security - Delete after failed unlock When the user clicks the "Delete after failed unlock" option - And the sucessfull message is displayed And select attempts option And taps "OK" button + And the sucessfull message is displayed And the user close the app And the user set incorrect in Then sees that the files have been deleted @@ -77,8 +89,8 @@ Feature: Security Examples: | attempts | PIN | message | | 5 attempts | 123450 | Your Tella data will be deleted after 5 failed unlock attempts | - | 10 attempts | 123451 | Your Tella data will be deleted after 10 failed unlock attempts | - | 20 attempts | 123450 | Your Tella data will be deleted after 20 failed unlock attempts | + #| 10 attempts | 123451 | Your Tella data will be deleted after 10 failed unlock attempts | + #| 20 attempts | 123450 | Your Tella data will be deleted after 20 failed unlock attempts | @Smoke @DeleteAfterFailedUnlock @Automated Scenario Outline: Security - Delete after failed unlock @@ -129,15 +141,16 @@ Feature: Security | Calculator_3 | Please wait. You will return to your device's home screen in a few seconds. | | Calculator_4 | Please wait. You will return to your device's home screen in a few seconds. | - @Smoke @QuickDelete @SmokeManual + @Smoke @QuickDelete @SmokeManual @TestAngi Scenario Outline: Security - Quick delete - + Given the user records an audio file When toggle the switch on the "Quick delete" option - And select check box "" - And go to Tella home page + And select check box + And Go to the Tella homepage from Security Page And verify slide "DELETE" button is present And taps slide "DELETE" button - And view counter message "Quick Delete mode activation" - And waits finish counter + And view counter message Quick Delete mode activation + And the app is closed And open Tella application again And set security code valid Then that files were deleted @@ -145,10 +158,10 @@ Feature: Security Examples: | quickDeleteCheck | | Delete files | - | Delete draft and submitted forms | - | Delete server settings | + #| Delete draft and submitted forms |Por defecto ya viene seleccionado + #| Delete server settings |Por defecto ya viene seleccionado - @Smoke @QuickDelete @SmokeManual + @Smoke @QuickDelete @SmokeManual #Ok Scenario: Security - Quick delete - Delete Tella When toggle the switch on the "Quick delete" option And select check box “Delete Tella” @@ -159,7 +172,7 @@ Feature: Security And waits finish counter Then uninstall message appears - @Smoke @QuickDelete @Automated + @Smoke @QuickDelete @Automated #Ok Scenario Outline: Security - Quick delete - Help info When toggle the switch on the "Quick delete" option And click on the help icon in @@ -222,9 +235,9 @@ Feature: Security And taps "next" button Then "Your lock has been changed" message is shown - @Smoke @LockTimeout @SmokeManual + @Smoke @LockTimeout @SmokeManual #@TestAngi Scenario Outline: Security - Lock Timeout - When the user clicks the "Lock timeout" option + When the user clicks the "Lock Timeout" option And select timeout option And taps "OK" button And wait of time @@ -236,7 +249,7 @@ Feature: Security | 1 minute | | 5 minutes | | 30 minutes | - | 1 hour | + #| 1 hour | @Smoke @DeleteAfterFailedUnlock @SmokeManual @@ -303,7 +316,7 @@ Feature: Security | Calculator_3 | Please wait. You will return to your device's home screen in a few seconds. | | Calculator_4 | Please wait. You will return to your device's home screen in a few seconds. | - @Smoke @QuickDelete @SmokeManual + @Smoke @QuickDelete @SmokeManual #RepetidoEscenarioEstaMasArriba Scenario Outline: Security - Quick delete - When taps switch in "Quick delete" option And select check box "" @@ -322,7 +335,7 @@ Feature: Security | Delete files | | Delete draft and submitted forms | | Delete server settings | - +#RepetidoEscenarioEstaMasArriba Scenario: Security - Quick delete - Delete Tella When taps switch in "Quick delete" option And select check box “Delete Tella” @@ -334,6 +347,7 @@ Feature: Security And view closed the Tella application Then view uninstall message + #RepetidoEscenarioEstaMasArriba @Smoke @QuickDelete @ToBeAutomated @Bug Scenario Outline: Security - Quick delete - help info When taps switch in "Quick delete" option From 6842381c9e7798e5ac917d0d4aadaa242b28e3d9 Mon Sep 17 00:00:00 2001 From: Angelica Date: Mon, 21 Jul 2025 11:55:48 -0300 Subject: [PATCH 2/3] Avance de validacion del escenario "Security - Quick delete - " --- .../tella/services/GenericService.java | 39 +++++++++++++++++++ .../features/Settings/Security.feature | 21 +++++----- 2 files changed, 50 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/crowdar/tella/services/GenericService.java b/src/main/java/com/crowdar/tella/services/GenericService.java index a8e4c188..36c3393d 100644 --- a/src/main/java/com/crowdar/tella/services/GenericService.java +++ b/src/main/java/com/crowdar/tella/services/GenericService.java @@ -3,6 +3,7 @@ import com.crowdar.core.actions.MobileActionManager; import com.crowdar.driver.DriverManager; import com.crowdar.tella.constants.HomeConstants; +import com.crowdar.tella.constants.SettingsConstants; import io.appium.java_client.MobileBy; import io.appium.java_client.MobileElement; import io.appium.java_client.android.AndroidDriver; @@ -197,6 +198,44 @@ public static void lockScreenWaitAndUnlock(int timeMinute) { } } + /** + * Verifies whether the Tella app is currently active in the foreground. + *

+ * This method retrieves the current package name of the app in the foreground + * and checks if it matches the Tella package: {@code org.hzontal.tella}. + *

+ * + * @return {@code true} if the Tella app is currently active in the foreground; + * {@code false} if the app is closed or running in the background. + */ + public static boolean verifyActiveAppTella() { + AndroidDriver driver = (AndroidDriver) GenericService.getDriver(); + String currentPackage = driver.getCurrentPackage(); + + if (!"org.hzontal.tella".equals(currentPackage)) { + System.out.println("The app is closed or in the background."); + return true; + } else { + System.out.println("The app is active in the foreground."); + return true; + + } + } + + /** + * we reopen the application + */ + public static void openAppTella() { + if (MobileActionManager.isAndroid()) { + AndroidDriver driver = (AndroidDriver) GenericService.getDriver(); + driver.activateApp("org.hzontal.tella"); + } + } + + public static void clicBackIcon() { + MobileActionManager.waitVisibility(SettingsConstants.GO_BACK_BUTTON).click(); + } + } diff --git a/src/test/resources/features/Settings/Security.feature b/src/test/resources/features/Settings/Security.feature index ae269223..639bad9c 100644 --- a/src/test/resources/features/Settings/Security.feature +++ b/src/test/resources/features/Settings/Security.feature @@ -33,7 +33,7 @@ Feature: Security And taps "next" button Then "Your lock has been changed" message is shown - @Smoke @SmokeManual @LockTimeout @LockFlow @TestAngi + @Smoke @SmokeManual @LockTimeout @LockFlow #@TestAngi Scenario Outline: Security - Lock Timeout Given the user sets the app lock timeout to When the user leaves the app, waits for the configured time , and returns @@ -47,7 +47,7 @@ Feature: Security #| 30 minutes | #| 1 hour | - @Smoke @LockTimeout @Automated @TestAngi + @Smoke @LockTimeout @Automated #@TestAngi Scenario Outline: Security - Change Lock Timeout When the user clicks the "Lock Timeout" option And select timeout option @@ -62,7 +62,7 @@ Feature: Security #| 30 minutes | #| 1 hour | - @Smoke @LockTimeout @Automated @TestAngi + @Smoke @LockTimeout @Automated #@TestAngi Scenario Outline: Security - Lock on Device Screen Off Given the user sets the app lock timeout to When the user locks the device screen, waits for the configured time , and unlocks it @@ -141,15 +141,16 @@ Feature: Security | Calculator_3 | Please wait. You will return to your device's home screen in a few seconds. | | Calculator_4 | Please wait. You will return to your device's home screen in a few seconds. | - @Smoke @QuickDelete @SmokeManual #Ok + @Smoke @QuickDelete @SmokeManual @TestAngi Scenario Outline: Security - Quick delete - + Given the user records an audio file When toggle the switch on the "Quick delete" option - And select check box "" - And go to Tella home page + And select check box + And Go to the Tella homepage from Security Page And verify slide "DELETE" button is present And taps slide "DELETE" button - And view counter message "Quick Delete mode activation" - And waits finish counter + And view counter message Quick Delete mode activation + And the app is closed And open Tella application again And set security code valid Then that files were deleted @@ -157,8 +158,8 @@ Feature: Security Examples: | quickDeleteCheck | | Delete files | - | Delete draft and submitted forms | - | Delete server settings | + #| Delete draft and submitted forms |Por defecto ya viene seleccionado + #| Delete server settings |Por defecto ya viene seleccionado @Smoke @QuickDelete @SmokeManual #Ok Scenario: Security - Quick delete - Delete Tella From cc776ee6c3a89b95ca2a7ac6038347f7c806521a Mon Sep 17 00:00:00 2001 From: Angelica Date: Wed, 23 Jul 2025 16:27:27 -0300 Subject: [PATCH 3/3] Avances --- .../tella/constants/FilesConstants.java | 2 + .../tella/constants/HomeConstants.java | 1 + .../crowdar/tella/services/FilesService.java | 24 ++++++----- .../crowdar/tella/services/HomeService.java | 22 ++++++++-- .../tella/services/ServersService.java | 29 +++++++++++-- .../crowdar/tella/steps/SettingsSteps.java | 43 ++++++++++++++++--- .../features/Settings/Security.feature | 39 +++++++++++------ 7 files changed, 126 insertions(+), 34 deletions(-) diff --git a/src/main/java/com/crowdar/tella/constants/FilesConstants.java b/src/main/java/com/crowdar/tella/constants/FilesConstants.java index e79161b6..5928d7de 100644 --- a/src/main/java/com/crowdar/tella/constants/FilesConstants.java +++ b/src/main/java/com/crowdar/tella/constants/FilesConstants.java @@ -56,4 +56,6 @@ public class FilesConstants { public static final String NEW_FOLDER = "xpath://android.widget.TextView[@resource-id=\"org.hzontal.tella:id/fileNameTextView\" and @text=\"TellaFolder\"]"; public static final String SELECT_FOLDER_ICON = "xpath://android.widget.TextView[@resource-id=\"org.hzontal.tella:id/textTitle\" and @text=\"%s\"]"; + public static final String ICON_FILE_AUDIO = "xpath://android.widget.FrameLayout[@resource-id=\"org.hzontal.tella:id/attachmentImgContainer\"]"; + public static final String NEXT_BTN = "xpath://android.widget.TextView[@resource-id=\"org.hzontal.tella:id/next_btn\"]"; } diff --git a/src/main/java/com/crowdar/tella/constants/HomeConstants.java b/src/main/java/com/crowdar/tella/constants/HomeConstants.java index 18810e3e..bbc1ea94 100644 --- a/src/main/java/com/crowdar/tella/constants/HomeConstants.java +++ b/src/main/java/com/crowdar/tella/constants/HomeConstants.java @@ -19,4 +19,5 @@ public class HomeConstants { public static final String PICK_GOOGLE_ACCOUNT = "xpath:(//android.widget.LinearLayout[@resource-id=\"com.google.android.gms:id/container\"])[1]"; public static final String ALOW_GOOGLE_IN_TELLA = "xpath://android.widget.Button[@resource-id=\"com.google.android.gms:id/agree_and_share_button\"]"; public static final String SLIDE_DELETE = "id:org.hzontal.tella:id/panic_seek"; + public static final String LBL_CONNECTIOS = "id:org.hzontal.tella:id/serversText"; } diff --git a/src/main/java/com/crowdar/tella/services/FilesService.java b/src/main/java/com/crowdar/tella/services/FilesService.java index 4a3f245f..af4ca634 100644 --- a/src/main/java/com/crowdar/tella/services/FilesService.java +++ b/src/main/java/com/crowdar/tella/services/FilesService.java @@ -242,17 +242,21 @@ public static void clicFolder(String nameFolder) { } /** - * Validates that the current folder is not empty by checking the absence of the - * "empty folder" icon on the screen. + * Validate that the all files folder is not empty. + * This is confirmed by audio icon. */ - public static void validateIsNotEmptyFolder() { - try { - MobileActionManager.waitVisibility(FilesConstants.EMPTY_VIEW_MSG_CONTAINER); - Assert.fail(); - } catch (Exception e) { - // Element not found means the empty icon is not present, so the folder is not empty - System.out.println("Empty icon not found, folder is not empty."); - } + public static void validateIsNotEmptyFolderAllFile() { + clicFolder("All files"); + Assert.assertTrue(MobileActionManager.waitVisibility(FilesConstants.ICON_FILE_AUDIO).isDisplayed()); + } + + /** + * Validate that the all files folder is empty. + * This is confirmed by the empty folder icon. + */ + public static void validateIsEmptyFolderAllFile() { + clicFolder("All files"); + Assert.assertTrue(MobileActionManager.waitVisibility(FilesConstants.EMPTY_VIEW_MSG_CONTAINER).isDisplayed()); } } diff --git a/src/main/java/com/crowdar/tella/services/HomeService.java b/src/main/java/com/crowdar/tella/services/HomeService.java index 93d2c3d5..6bde7c02 100644 --- a/src/main/java/com/crowdar/tella/services/HomeService.java +++ b/src/main/java/com/crowdar/tella/services/HomeService.java @@ -18,7 +18,6 @@ import java.util.Arrays; - public class HomeService { public static void isHomeLoaded() { @@ -50,7 +49,7 @@ public static void moveFingerSeekBarToEnd() { //Validamos que se encuentre y este visible if (MobileActionManager.waitVisibility(HomeConstants.SLIDE_DELETE).isDisplayed()) { AndroidDriver driver = (AndroidDriver) GenericService.getDriver(); - //Aquie recuperamos parte de la cadena, pero obtener el Id del elemento + //Aqui recuperamos parte de la cadena, pero obtener el Id del elemento WebElement seekBar = MobileActionManager.getElement(HomeConstants.SLIDE_DELETE); //driver.findElement(By.id(HomeConstants.SLIDE_DELETE.split(":")[1])); @@ -74,7 +73,24 @@ public static void moveFingerSeekBarToEnd() { } } - public static void clicHomeButton(){ + public static void isConnection() { + isHomeLoaded(); + Assert.assertTrue(MobileActionManager.waitVisibility(HomeConstants.LBL_CONNECTIOS).isDisplayed()); + } + + public static void isNotConnection() { + isHomeLoaded(); + try{ + //Hacemos falla al proposito para indicar que el LBl de conexion ya no esta. + // Indicando que la conexion desaparecio + boolean flag = MobileActionManager.getElement(HomeConstants.LBL_CONNECTIOS).isDisplayed(); + Assert.assertFalse(flag); + } catch (Exception e) { + System.out.println("The user is no longer connected to the Tella web server."); + } + } + + public static void clicHomeButton() { MobileActionManager.waitClickable(HomeConstants.HOME_BUTTON).click(); } diff --git a/src/main/java/com/crowdar/tella/services/ServersService.java b/src/main/java/com/crowdar/tella/services/ServersService.java index dff7e47f..0182c498 100644 --- a/src/main/java/com/crowdar/tella/services/ServersService.java +++ b/src/main/java/com/crowdar/tella/services/ServersService.java @@ -89,8 +89,6 @@ public static void okServerButton() { } - - public static void viewSettingServer(String server) { if (MobileActionManager.isPresent(ServersConstants.URL_INPUT)) { Assert.assertTrue(ActionManager.isPresent(ServersConstants.URL_INPUT)); @@ -161,7 +159,7 @@ public static void connectToTellaServer() { MobileActionManager.setInput(ServersConstants.TELLA_PASS_INPUT, PropertyManager.getProperty("tellapass")); MobileActionManager.click(ServersConstants.TEXT_SERVER_BUTTON, "Log in"); MobileActionManager.click(ServersConstants.SAVE_BUTTON); - MobileActionManager.click(ServersConstants.TEXT_SERVER_BUTTON, "OK"); + MobileActionManager.click(ServersConstants.TEXT_SERVER_BUTTON, "GO TO REPORTS"); MobileActionManager.click(ServersConstants.BACK_BUTTON); MobileActionManager.click(ServersConstants.BACK_BUTTON); } @@ -220,4 +218,29 @@ public static void googleDrive() { } + + public static void clicNextBtn() { + //Como el boton esta abajo de la pantalla, tenemos q escroliar hasta el final + // por ello utilizamos PointerInput para simular el movimiento del dedo + AndroidDriver driver = (AndroidDriver) GenericService.getDriver(); + + Dimension size = driver.manage().window().getSize(); + int width = size.width / 2; + + // Cambiar: empezar desde abajo y mover hacia arriba + int startY = (int) (size.height * 0.70); // más abajo + int endY = (int) (size.height * 0.30); // más arriba + + PointerInput finger = new PointerInput(PointerInput.Kind.TOUCH, "finger"); + Sequence swipe = new Sequence(finger, 1); + swipe.addAction(finger.createPointerMove(Duration.ZERO, PointerInput.Origin.viewport(), width, startY)); + swipe.addAction(finger.createPointerDown(PointerInput.MouseButton.LEFT.asArg())); + swipe.addAction(finger.createPointerMove(Duration.ofMillis(300), PointerInput.Origin.viewport(), width, endY)); + swipe.addAction(finger.createPointerUp(PointerInput.MouseButton.LEFT.asArg())); + driver.perform(List.of(swipe)); + + MobileActionManager.waitPresence(FilesConstants.NEXT_BTN).click(); + + } + } \ No newline at end of file diff --git a/src/main/java/com/crowdar/tella/steps/SettingsSteps.java b/src/main/java/com/crowdar/tella/steps/SettingsSteps.java index c813168d..66ac9cd5 100644 --- a/src/main/java/com/crowdar/tella/steps/SettingsSteps.java +++ b/src/main/java/com/crowdar/tella/steps/SettingsSteps.java @@ -272,12 +272,11 @@ public void openTellaApplicationAgain() { @And("set security code valid") public void setSecurityCodeValid() throws InterruptedException { UnlockService.enterPassword(PropertyManager.getProperty("password")); - System.out.println(""); } @Given("the user records an audio file") public void theUserRecordsAnAudioFile() throws InterruptedException { - //Volvemos a la home para gravar un audio + //Volvemos a la home para grabar un audio SettingsService.goToHomeFromSecurityPage(); HomeService.isHomeLoaded(); //Inicia la grabacion @@ -288,13 +287,45 @@ public void theUserRecordsAnAudioFile() throws InterruptedException { //Volvemos a la Home HomeService.clicHomeButton(); //Validamos el archivo de audio - FilesService.clicFolder("Audio"); - FilesService.validateIsNotEmptyFolder(); + FilesService.validateIsNotEmptyFolderAllFile(); GenericService.clicBackIcon(); - //Volvemos a Setting + //Volvemos a Settings SettingsService.clickSettingsIcon(); SettingsService.clickCategory("Security"); - System.out.println(""); + + } + + @Then("that files were deleted") + public void thatFilesWereDeleted() { + FilesService.validateIsEmptyFolderAllFile(); + } + + @Given("The user has already connected to the Tella web server") + public void theUserHasAlreadyConnectedToTheTellaWebServer() { + //Volvemos a la home para configuracion de conexion + SettingsService.goToHomeFromSecurityPage(); + HomeService.isHomeLoaded(); + + //Iniciamos la configuracion de conexion + SettingsService.clickSettingsIcon(); + SettingsService.clickCategory("Servers"); + ServersService.clickPlusButton(); + ServersService.selectButton("Tella Web"); + ServersService.clicNextBtn(); + ServersService.inputServerUrl("https://tella.world/p/server-project-crowdar"); + ServersService.pressButton("Next"); + ServersService.connectToTellaServer(); + + //Verificamos el forms de conexion + HomeService.isConnection(); + //Volvemos a Settings + SettingsService.clickSettingsIcon(); + SettingsService.clickCategory("Security"); + } + + @Then("The user is no longer connected to the Tella web server.") + public void theUserIsNoLongerConnectedToTheTellaWebServer() { + HomeService.isNotConnection(); } } diff --git a/src/test/resources/features/Settings/Security.feature b/src/test/resources/features/Settings/Security.feature index 639bad9c..13c6d165 100644 --- a/src/test/resources/features/Settings/Security.feature +++ b/src/test/resources/features/Settings/Security.feature @@ -87,8 +87,8 @@ Feature: Security Then sees that the files have been deleted Examples: - | attempts | PIN | message | - | 5 attempts | 123450 | Your Tella data will be deleted after 5 failed unlock attempts | + | attempts | PIN | message | + | 5 attempts | 123450 | Your Tella data will be deleted after 5 failed unlock attempts | #| 10 attempts | 123451 | Your Tella data will be deleted after 10 failed unlock attempts | #| 20 attempts | 123450 | Your Tella data will be deleted after 20 failed unlock attempts | @@ -141,11 +141,11 @@ Feature: Security | Calculator_3 | Please wait. You will return to your device's home screen in a few seconds. | | Calculator_4 | Please wait. You will return to your device's home screen in a few seconds. | - @Smoke @QuickDelete @SmokeManual @TestAngi - Scenario Outline: Security - Quick delete - + @Smoke @QuickDelete @SmokeManual #@TestAngi #Ok # Prueba E2E, de crear un archivo y eliminarlo + Scenario: Security - Quick delete - Delete files Given the user records an audio file When toggle the switch on the "Quick delete" option - And select check box + And select check box Delete files And Go to the Tella homepage from Security Page And verify slide "DELETE" button is present And taps slide "DELETE" button @@ -155,13 +155,28 @@ Feature: Security And set security code valid Then that files were deleted - Examples: - | quickDeleteCheck | - | Delete files | - #| Delete draft and submitted forms |Por defecto ya viene seleccionado - #| Delete server settings |Por defecto ya viene seleccionado - @Smoke @QuickDelete @SmokeManual #Ok + @Smoke @QuickDelete @SmokeManual #@TestAngi #Ok # Prueba E2E, de eliminar conexion + Scenario: Security - Quick delete - Delete connection to the server + Given The user has already connected to the Tella web server + When toggle the switch on the "Quick delete" option + And Go to the Tella homepage from Security Page + And verify slide "DELETE" button is present + And taps slide "DELETE" button + And view counter message Quick Delete mode activation + And the app is closed + And open Tella application again + And set security code valid + Then The user is no longer connected to the Tella web server. + + @Smoke @QuickDelete @SmokeManual @TestAngi #Ok #Validamos que este el Slider para eliminar. + Scenario: Security - Quick delete - Verify slide Delete + When toggle the switch on the "Quick delete" option + And Go to the Tella homepage from Security Page + Then verify slide "DELETE" button is present + + + @Smoke @QuickDelete @SmokeManual #Ok #En la APP no esta el check para eliminar la APP Scenario: Security - Quick delete - Delete Tella When toggle the switch on the "Quick delete" option And select check box “Delete Tella” @@ -172,7 +187,7 @@ Feature: Security And waits finish counter Then uninstall message appears - @Smoke @QuickDelete @Automated #Ok + @Smoke @QuickDelete @Automated @TestAngi #Ok Scenario Outline: Security - Quick delete - Help info When toggle the switch on the "Quick delete" option And click on the help icon in