Skip to content

Commit

Permalink
- refactoring: Snackbar element
Browse files Browse the repository at this point in the history
- Update test site: Snackbar element
  • Loading branch information
Aleksandr_Vorobev committed Jun 21, 2024
1 parent 81d4a9d commit 30dae94
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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}};
}
}
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -17,8 +18,8 @@ public class Snackbar extends UIBaseElement<SnackbarAssert> 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")
Expand Down

0 comments on commit 30dae94

Please sign in to comment.