diff --git a/jdi-light-angular-tests/src/test/java/io/github/epam/angular/tests/elements/complex/SnackbarTests.java b/jdi-light-angular-tests/src/test/java/io/github/epam/angular/tests/elements/complex/SnackbarTests.java index d742fe8631..8e2ead76b2 100644 --- a/jdi-light-angular-tests/src/test/java/io/github/epam/angular/tests/elements/complex/SnackbarTests.java +++ b/jdi-light-angular-tests/src/test/java/io/github/epam/angular/tests/elements/complex/SnackbarTests.java @@ -54,14 +54,20 @@ public void checkSnackbarWithNoActionTest() { @Test public void checkSnackbarDurationTest() { - final int DURATION = 5; - - JAction action = () -> { - snackBarPage.customSnackbar.base().timer().wait(() -> snackBarPage.customSnackbar.isDisplayed()); - snackBarPage.customSnackbar.base().timer().wait(() -> snackBarPage.customSnackbar.isHidden()); - }; + final int DURATION = 5; // Duration in seconds + // Set the duration for the snackbar visibility snackBarPage.durationInput.setValue(String.valueOf(DURATION)); + + // Open the custom snackbar snackBarPage.customSnackbarOpenButton.click(); + + // Wait for the snackbar to be displayed + snackBarPage.customSnackbar.base().timer().waitFor(() -> snackBarPage.customSnackbar.isDisplayed(), DURATION, "Snackbar did not appear in expected time"); + + // Then, wait for the snackbar to disappear. + // Assuming snackbar visibility duration is DURATION, add a buffer to wait for disappearance. + int waitTimeForDisappearance = DURATION + 2; // Adding a buffer time for it to disappear + snackBarPage.customSnackbar.base().timer().waitFor(() -> snackBarPage.customSnackbar.isHidden(), waitTimeForDisappearance, "Snackbar did not disappear in expected time"); } } diff --git a/jdi-light-angular-tests/src/test/resources/common.properties b/jdi-light-angular-tests/src/test/resources/common.properties index c31a28a764..91b3603f15 100644 --- a/jdi-light-angular-tests/src/test/resources/common.properties +++ b/jdi-light-angular-tests/src/test/resources/common.properties @@ -1 +1 @@ -arguments=--headless +arguments=--headed