-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
4903: tests refactoring BADGE. fix 4
- Loading branch information
1 parent
01e3ac0
commit 7ca902f
Showing
7 changed files
with
149 additions
and
189 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 25 additions & 18 deletions
43
jdi-light-angular/src/main/java/com/epam/jdi/light/angular/asserts/BadgeAssert.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,79 @@ | ||
package com.epam.jdi.light.angular.asserts; | ||
|
||
import com.epam.jdi.light.angular.elements.common.Badge; | ||
import com.epam.jdi.light.angular.elements.enums.BadgePosition; | ||
import com.epam.jdi.light.angular.elements.enums.BadgeSize; | ||
import com.epam.jdi.light.asserts.generic.UIAssert; | ||
import com.epam.jdi.light.common.JDIAction; | ||
import org.hamcrest.Matchers; | ||
|
||
import static com.epam.jdi.light.asserts.core.SoftAssert.jdiAssert; | ||
import static java.lang.String.format; | ||
|
||
public class BadgeAssert extends UIAssert<BadgeAssert, Badge> { | ||
|
||
@JDIAction("Assert that '{name}' has '{0}' color") | ||
public BadgeAssert color(String value) { | ||
jdiAssert(element().color(value), Matchers.is(true)); | ||
String actualColor = element().color(); | ||
jdiAssert(actualColor, Matchers.equalTo(value), format("%s is not equal to %s", actualColor, value)); | ||
return this; | ||
} | ||
|
||
@JDIAction("Assert that '{name}' has '{0}' size") | ||
public BadgeAssert size(String value) { | ||
jdiAssert(element().size(value), Matchers.is(true)); | ||
public BadgeAssert size(BadgeSize size) { | ||
final BadgeSize actualBadgeSize = element().size(); | ||
jdiAssert(actualBadgeSize, Matchers.is(size), format("%s is not equal to %s", actualBadgeSize, size)); | ||
return this; | ||
|
||
} | ||
|
||
@JDIAction("Assert that '{name}' has '{0}' position (vertical)") | ||
public BadgeAssert positionVertical(String value) { | ||
jdiAssert(element().positionVertical(value), Matchers.is(true)); | ||
public BadgeAssert positionVertical(BadgePosition value) { | ||
final BadgePosition actualPosition = element().positionVertical(); | ||
jdiAssert(actualPosition, Matchers.is(value), format("%s is not equal to %s", actualPosition, value)); | ||
return this; | ||
|
||
} | ||
|
||
@JDIAction("Assert that '{name}' has '{0}' position (horizontal)") | ||
public BadgeAssert positionHorizontal(String value) { | ||
jdiAssert(element().positionHorizontal(value), Matchers.is(true)); | ||
public BadgeAssert positionHorizontal(BadgePosition value) { | ||
final BadgePosition actualPosition = element().positionHorizontal(); | ||
jdiAssert(actualPosition, Matchers.is(value), format("%s is not equal to %s", actualPosition, value)); | ||
return this; | ||
|
||
} | ||
|
||
@JDIAction("Assert that '{name}' is overlap: {0}") | ||
public BadgeAssert overlap(boolean value) { | ||
jdiAssert(element().overlap(), Matchers.is(value)); | ||
jdiAssert(element().isOverlap(), Matchers.is(value), value ? "should be overlap" : "should NOT be overlap"); | ||
return this; | ||
} | ||
|
||
@Override | ||
@JDIAction("Assert that '{name}' is displayed") | ||
public BadgeAssert displayed() { | ||
jdiAssert(element().hidden(), Matchers.is(false)); | ||
jdiAssert(element().isDisplayed(), Matchers.is(true), "should be displayed"); | ||
return super.displayed(); | ||
} | ||
|
||
@Override | ||
@JDIAction("Assert that '{name}' is hidden") | ||
public BadgeAssert hidden() { | ||
jdiAssert(element().hidden(), Matchers.is(true)); | ||
return this; | ||
} | ||
|
||
@Override | ||
@JDIAction("Assert that '{name}' is enabled") | ||
public BadgeAssert enabled() { | ||
jdiAssert(element().disabled(), Matchers.is(false)); | ||
jdiAssert(element().isEnabled(), Matchers.is(true), "should be enabled"); | ||
return super.enabled(); | ||
} | ||
|
||
@Override | ||
@JDIAction("Assert that '{name}' is disabled") | ||
public BadgeAssert disabled() { | ||
jdiAssert(element().disabled(), Matchers.is(true)); | ||
jdiAssert(element().isDisabled(), Matchers.is(true), "should be disabled"); | ||
return this; | ||
} | ||
|
||
@JDIAction("Assert that '{name}' has text {0}") | ||
public BadgeAssert text(String value) { | ||
final String actualText = element().getText(); | ||
jdiAssert(actualText, Matchers.is(value), format("%s is not equal to %s", actualText, value)); | ||
return this; | ||
} | ||
} |
Oops, something went wrong.