Skip to content

Commit

Permalink
rework Angular element: Button
Browse files Browse the repository at this point in the history
- add ButtonAssert for HasLink methods
  • Loading branch information
Aleksandr_Vorobev committed Mar 14, 2024
1 parent 07319c1 commit bc44814
Showing 1 changed file with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}

Expand All @@ -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;
}

Expand All @@ -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<String> condition) {
jdiAssert(element().ref(), condition);
return this;
}
}

0 comments on commit bc44814

Please sign in to comment.