From 30dae943bcba6d37f630eee6ce268607767b58d2 Mon Sep 17 00:00:00 2001 From: Aleksandr_Vorobev Date: Fri, 21 Jun 2024 18:16:24 +0300 Subject: [PATCH] - refactoring: Snackbar element - Update test site: Snackbar element --- .../tests/elements/complex/SnackbarTests.java | 40 +++++++++---------- .../angular/elements/complex/Snackbar.java | 5 ++- 2 files changed, 22 insertions(+), 23 deletions(-) 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 5e1f83bbe9..b1da863f6a 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 @@ -6,12 +6,11 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; -import static com.epam.jdi.light.angular.elements.enums.Position.CENTER_BOTTOM; -import static com.epam.jdi.light.angular.elements.enums.Position.CENTER_TOP; -import static com.epam.jdi.light.angular.elements.enums.Position.LEFT_BOTTOM; -import static com.epam.jdi.light.angular.elements.enums.Position.LEFT_TOP; -import static com.epam.jdi.light.angular.elements.enums.Position.RIGHT_BOTTOM; -import static com.epam.jdi.light.angular.elements.enums.Position.RIGHT_TOP; +import static com.epam.jdi.light.angular.elements.enums.Position.BOTTOM; +import static com.epam.jdi.light.angular.elements.enums.Position.CENTER; +import static com.epam.jdi.light.angular.elements.enums.Position.LEFT; +import static com.epam.jdi.light.angular.elements.enums.Position.RIGHT; +import static com.epam.jdi.light.angular.elements.enums.Position.TOP; import static com.epam.jdi.light.elements.base.Conditions.hidden; import static com.epam.jdi.light.elements.base.Conditions.visible; import static com.jdiai.tools.Timer.waitCondition; @@ -93,30 +92,29 @@ public void snackbarDurationTest() { } @Test(dataProvider = "positionProvider") - public void snackbarPositionTest(String horizontal, String vertical, Position position) { + public void snackbarPositionTest(String horizontal,Position horizontalPosition, String vertical, Position verticalPosition) { horizontalPositionDropdown.select(horizontal); verticalPositionDropdown.select(vertical); showPositionSnackbarButton.click(); snackbar.has() .shown() - .and() - .has() - .position(position); + .and().has().position(verticalPosition) + .and().has().position(horizontalPosition); } @DataProvider(name = "positionProvider") public Object[][] providePositions() { return new Object[][]{ - {"Start", "Top", LEFT_TOP}, - {"Center", "Top", CENTER_TOP}, - {"End", "Top", RIGHT_TOP}, - {"Left", "Top", LEFT_TOP}, - {"Right", "Top", RIGHT_TOP}, - - {"Start", "Bottom", LEFT_BOTTOM}, - {"Center", "Bottom", CENTER_BOTTOM}, - {"End", "Bottom", RIGHT_BOTTOM}, - {"Left", "Bottom", LEFT_BOTTOM}, - {"Right", "Bottom", RIGHT_BOTTOM}}; + {"Start",LEFT, "Top", TOP}, + {"Center", CENTER, "Top", TOP}, + {"End", RIGHT, "Top", TOP}, + {"Left",LEFT, "Top", TOP}, + {"Right",RIGHT, "Top", TOP}, + + {"Start",LEFT, "Bottom", BOTTOM}, + {"Center", CENTER, "Bottom", BOTTOM}, + {"End", RIGHT,"Bottom", BOTTOM}, + {"Left",LEFT, "Bottom", BOTTOM}, + {"Right",RIGHT, "Bottom", BOTTOM}}; } } \ No newline at end of file diff --git a/jdi-light-angular/src/main/java/com/epam/jdi/light/angular/elements/complex/Snackbar.java b/jdi-light-angular/src/main/java/com/epam/jdi/light/angular/elements/complex/Snackbar.java index 261adbcb0a..3877cefb0d 100644 --- a/jdi-light-angular/src/main/java/com/epam/jdi/light/angular/elements/complex/Snackbar.java +++ b/jdi-light-angular/src/main/java/com/epam/jdi/light/angular/elements/complex/Snackbar.java @@ -1,6 +1,7 @@ package com.epam.jdi.light.angular.elements.complex; import com.epam.jdi.light.angular.asserts.SnackbarAssert; +import com.epam.jdi.light.angular.elements.common.Button; import com.epam.jdi.light.angular.elements.enums.Position; import com.epam.jdi.light.angular.elements.interfaces.HasPosition; import com.epam.jdi.light.common.JDIAction; @@ -17,8 +18,8 @@ public class Snackbar extends UIBaseElement implements HasPositi private static final String OVERLAY_LOCATOR = "//ancestor::div[@class='cdk-global-overlay-wrapper']"; @JDIAction("Get '{name}' action") - public UIElement action() { - return core().find(ACTION_LOCATOR); + public Button action() { + return new Button().setCore(Button.class, core().find(ACTION_LOCATOR)); } @JDIAction("Get '{name}' message")