-
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.
4988-refactoringSelectDeleteDuplicates
- Loading branch information
Showing
6 changed files
with
388 additions
and
455 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
128 changes: 0 additions & 128 deletions
128
...ight-angular/src/main/java/com/epam/jdi/light/angular/asserts/MaterialSelectorAssert.java
This file was deleted.
Oops, something went wrong.
123 changes: 121 additions & 2 deletions
123
jdi-light-angular/src/main/java/com/epam/jdi/light/angular/asserts/SelectAssert.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,9 +1,128 @@ | ||
package com.epam.jdi.light.angular.asserts; | ||
|
||
import com.epam.jdi.light.angular.elements.complex.Select; | ||
import com.epam.jdi.light.angular.elements.complex.MaterialSelector; | ||
import com.epam.jdi.light.asserts.generic.UIAssert; | ||
import com.epam.jdi.light.common.JDIAction; | ||
import org.hamcrest.Matcher; | ||
import org.hamcrest.Matchers; | ||
|
||
public class SelectAssert extends UIAssert<SelectAssert, Select> { | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import static com.epam.jdi.light.asserts.core.SoftAssert.jdiAssert; | ||
import static com.jdiai.tools.EnumUtils.getEnumValue; | ||
import static com.jdiai.tools.LinqUtils.toStringArray; | ||
import static org.hamcrest.Matchers.hasItem; | ||
import static org.hamcrest.Matchers.hasItems; | ||
|
||
public class SelectAssert extends UIAssert<SelectAssert, MaterialSelector> { | ||
@JDIAction("Assert that '{name}' expanded") | ||
public SelectAssert expanded() { | ||
jdiAssert(element().isExpanded(), Matchers.is(true)); | ||
return this; | ||
} | ||
|
||
@JDIAction("Assert that '{name}' collapsed") | ||
public SelectAssert collapsed() { | ||
jdiAssert(element().isCollapsed(), Matchers.is(true)); | ||
return this; | ||
} | ||
|
||
@JDIAction("Assert that '{0}' option selected for '{name}'") | ||
public SelectAssert selected(final Matcher<String> condition) { | ||
jdiAssert(element().selected(), condition); | ||
return this; | ||
} | ||
|
||
@JDIAction("Assert that '{0}' option selected for '{name}'") | ||
public SelectAssert selected(final String option) { | ||
return selected(Matchers.is(option)); | ||
} | ||
|
||
public <T extends Enum<?>> SelectAssert selected(final T option) { | ||
return selected(getEnumValue(option)); | ||
} | ||
|
||
public <T extends Enum<?>> SelectAssert value(final T option) { | ||
jdiAssert(element().values(), hasItem(getEnumValue(option))); | ||
return this; | ||
} | ||
|
||
@JDIAction("Assert that '{name}' value '{0}'") | ||
public SelectAssert value(final Matcher<String> condition) { | ||
return values(hasItem(condition)); | ||
} | ||
|
||
@JDIAction("Assert that '{name}' has value '{0}'") | ||
public SelectAssert value(final String value) { | ||
return values(hasItem(value)); | ||
} | ||
|
||
@JDIAction("Assert that '{name}' values '{0}'") | ||
public SelectAssert values(final Matcher<? super List<String>> condition) { | ||
jdiAssert(element().values(), condition); | ||
return this; | ||
} | ||
|
||
public SelectAssert values(final String... values) { | ||
return values(hasItems(values)); | ||
} | ||
|
||
public SelectAssert values(final List<String> values) { | ||
return values(toStringArray(values)); | ||
} | ||
|
||
@JDIAction("Assert that '{name}' has groups '{0}'") | ||
public SelectAssert groups(final Matcher<? super List<String>> condition) { | ||
jdiAssert(element().groups(), condition); | ||
return this; | ||
} | ||
|
||
public SelectAssert groups(final List<String> groups) { | ||
return groups(toStringArray(groups)); | ||
} | ||
|
||
public SelectAssert groups(final String... values) { | ||
return groups(hasItems(values)); | ||
} | ||
|
||
@JDIAction("Assert that '{name}' has groups and options '{0}'") | ||
public SelectAssert groupsAndOptions(final Map<String, List<String>> expectedGroupsAndOptions) { | ||
jdiAssert(element().groupsAndOptions(), Matchers.is(expectedGroupsAndOptions)); | ||
return this; | ||
} | ||
|
||
@JDIAction("Assert that '{name}' has enabled values '{0}'") | ||
public SelectAssert listEnabled(final Matcher<? super List<String>> condition) { | ||
jdiAssert(element().listEnabled(), condition); | ||
return this; | ||
} | ||
|
||
public SelectAssert listEnabled(final List<String> listEnabled) { | ||
return listEnabled(toStringArray(listEnabled)); | ||
} | ||
|
||
public SelectAssert listEnabled(final String... values) { | ||
return listEnabled(hasItems(values)); | ||
} | ||
|
||
@JDIAction("Assert that '{name}' has disabled values '{0}'") | ||
public SelectAssert listDisabled(final Matcher<? super List<String>> condition) { | ||
jdiAssert(element().listDisabled(), condition); | ||
return this; | ||
} | ||
|
||
public SelectAssert listDisabled(final List<String> listDisabled) { | ||
return listDisabled(toStringArray(listDisabled)); | ||
} | ||
|
||
public SelectAssert listDisabled(final String... values) { | ||
return listDisabled(hasItems(values)); | ||
} | ||
|
||
@JDIAction("Assert that rgba({0}, {1}, {2}, {3}) is the specified color") | ||
public SelectAssert color(final int red, final int green, final int blue, final double a) { | ||
jdiAssert(element().color(red, green, blue, a), Matchers.is(true)); | ||
return this; | ||
} | ||
} |
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
Oops, something went wrong.