From bc448140eed8ed10670b037236123c260fe18284 Mon Sep 17 00:00:00 2001 From: Aleksandr_Vorobev Date: Thu, 14 Mar 2024 17:09:13 +0300 Subject: [PATCH] rework Angular element: Button - add ButtonAssert for HasLink methods --- .../light/angular/asserts/ButtonAssert.java | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/jdi-light-angular/src/main/java/com/epam/jdi/light/angular/asserts/ButtonAssert.java b/jdi-light-angular/src/main/java/com/epam/jdi/light/angular/asserts/ButtonAssert.java index 3c546d6511..f5e5542177 100644 --- a/jdi-light-angular/src/main/java/com/epam/jdi/light/angular/asserts/ButtonAssert.java +++ b/jdi-light-angular/src/main/java/com/epam/jdi/light/angular/asserts/ButtonAssert.java @@ -6,6 +6,7 @@ import com.epam.jdi.light.angular.elements.interfaces.asserts.HasBadgeAssert; import com.epam.jdi.light.asserts.generic.UIAssert; import com.epam.jdi.light.common.JDIAction; +import org.hamcrest.Matcher; import org.hamcrest.Matchers; import static com.epam.jdi.light.asserts.core.SoftAssert.jdiAssert; @@ -21,8 +22,7 @@ public ButtonAssert text(String expectedText) { @JDIAction(value = "Assert that '{name}' is focused", isAssert = true) public ButtonAssert focused() { boolean actualFocused = element().focused(); - jdiAssert(actualFocused, Matchers.is(true), - "Element is not focused"); + jdiAssert(actualFocused, Matchers.is(true), "Element is not focused"); return this; } @@ -40,8 +40,7 @@ public ButtonAssert color(AngularColors expectedColor) { @JDIAction(value = "Assert that '{name}' has default color", isAssert = true) public ButtonAssert defaultColor() { - jdiAssert(element().defaultColor(), Matchers.is(true), - "Element doesn't have default color."); + jdiAssert(element().defaultColor(), Matchers.is(true), "Element doesn't have default color."); return this; } @@ -54,8 +53,19 @@ public ButtonAssert visualType(ButtonsTypes expectedType) { @JDIAction(value = "Assert that '{name}' has icon", isAssert = true) public ButtonAssert hasIcon() { - jdiAssert(element().hasIcon(), Matchers.is(true), - "Element doesn't have icon inside"); + jdiAssert(element().hasIcon(), Matchers.is(true), "Element doesn't have icon inside"); + return this; + } + + @JDIAction(value = "Assert that '{name}' has link", isAssert = true) + public ButtonAssert hasLink() { + jdiAssert(element().hasLink(), Matchers.is(true), "Element doesn't have link inside"); + return this; + } + + @JDIAction("Assert that '{name}' ref {0}") + public ButtonAssert ref(Matcher condition) { + jdiAssert(element().ref(), condition); return this; } }