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 8e2ead76b2..d742fe8631 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,20 +54,14 @@ public void checkSnackbarWithNoActionTest() { @Test public void checkSnackbarDurationTest() { - final int DURATION = 5; // Duration in seconds + final int DURATION = 5; - // Set the duration for the snackbar visibility - snackBarPage.durationInput.setValue(String.valueOf(DURATION)); + JAction action = () -> { + snackBarPage.customSnackbar.base().timer().wait(() -> snackBarPage.customSnackbar.isDisplayed()); + snackBarPage.customSnackbar.base().timer().wait(() -> snackBarPage.customSnackbar.isHidden()); + }; - // Open the custom snackbar + snackBarPage.durationInput.setValue(String.valueOf(DURATION)); 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 91b3603f15..c31a28a764 100644 --- a/jdi-light-angular-tests/src/test/resources/common.properties +++ b/jdi-light-angular-tests/src/test/resources/common.properties @@ -1 +1 @@ -arguments=--headed +arguments=--headless