Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5421 #5505

Merged
merged 3 commits into from
Apr 28, 2024
Merged

5421 #5505

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void before() {
public void styleAutocompleteTest() {
List<String> list = Arrays.asList("foo", "bar", "fizz", "buzz");
lightDenseShapedOutlinedAutocomplete.is()
.light()
.lightTheme()
.dense()
.shaped()
.outlined();
Expand All @@ -56,13 +56,13 @@ public void styleAutocompleteTest() {
lightDenseFilledRoundedAutocomplete.close();

darkSoloAutocomplete.is()
.dark()
.darkTheme()
.solo();
darkSoloAutocomplete.expand();
darkSoloAutocomplete.has().options(list);
darkSoloAutocomplete.close();

darkSoloInvertedAutocomplete.is().dark();
darkSoloInvertedAutocomplete.is().darkTheme();
darkSoloInvertedAutocomplete.expand();
darkSoloInvertedAutocomplete.has().options(list);
darkSoloInvertedAutocomplete.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ public void iconListItemGroup() {
@Test(description = "Test checks list item group's theme : Theme (dark/light)")
public void themeListItemGroup() {
activeClassListItemGroup.show();
activeClassListItemGroup.has().theme("theme--dark");
activeClassListItemGroup.has().darkTheme();
flatListItemGroup.show();
flatListItemGroup.has().theme("theme--light");
flatListItemGroup.has().lightTheme();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ public class AutocompleteAssert extends UIAssert<AutocompleteAssert, Autocomplet
OutlinedAssert<AutocompleteAssert, Autocomplete>,
DenseAssert<AutocompleteAssert, Autocomplete>,
RoundedAssert<AutocompleteAssert, Autocomplete>,
ShapedAssert<AutocompleteAssert, Autocomplete> {
ShapedAssert<AutocompleteAssert, Autocomplete>,
ThemeAssert<AutocompleteAssert, Autocomplete> {

@JDIAction(value = "Assert that '{name}' is expanded", isAssert = true)
public AutocompleteAssert expanded() {
Expand Down Expand Up @@ -86,23 +87,4 @@ public AutocompleteAssert solo() {
);
return this;
}

// @todo #5308 create interface for Themes
@JDIAction(value = "Assert that 'name' has dark style", isAssert = true)
public AutocompleteAssert dark() {
jdiAssert(
element().root().attr("class"),
Matchers.containsString("theme--dark")
);
return this;
}

@JDIAction(value = "Assert that 'name' has dark style", isAssert = true)
public AutocompleteAssert light() {
jdiAssert(
element().root().attr("class"),
Matchers.containsString("theme--light")
);
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.epam.jdi.light.asserts.generic.UIAssert;
import com.epam.jdi.light.common.JDIAction;
import com.epam.jdi.light.vuetify.elements.common.ListItem;
import com.epam.jdi.light.vuetify.interfaces.asserts.ThemeAssert;
import org.hamcrest.Matcher;
import org.hamcrest.Matchers;

Expand All @@ -13,7 +14,8 @@
* Assertions for {@link ListItem}
*/
public class ListItemAssert extends UIAssert<ListItemAssert, ListItem>
implements ITextAssert<ListItemAssert> {
implements ITextAssert<ListItemAssert>,
ThemeAssert<ListItemAssert, ListItem> {

@Override
@JDIAction(value = "Assert that '{name}' is displayed", isAssert = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
import com.epam.jdi.light.common.JDIAction;
import com.epam.jdi.light.vuetify.elements.complex.timelines.TimeLine;
import com.epam.jdi.light.vuetify.interfaces.asserts.DenseAssert;
import com.epam.jdi.light.vuetify.interfaces.asserts.ThemeAssert;
import org.hamcrest.Matchers;

import static com.epam.jdi.light.asserts.core.SoftAssert.jdiAssert;

public class TimeLineAssert extends UISelectAssert<TimeLineAssert, TimeLine>
implements DenseAssert<TimeLineAssert, TimeLine> {
implements DenseAssert<TimeLineAssert, TimeLine>,
ThemeAssert<TimeLineAssert, TimeLine> {

@JDIAction(value = "Assert that '{name}' is align to top", isAssert = true)
public TimeLineAssert alignTop() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*/

public class Autocomplete extends UIBaseElement<AutocompleteAssert>
implements ISetup, IsFilled, IsOutlined, IsDense, IsShaped, HasRounded {
implements ISetup, IsFilled, IsOutlined, IsDense, IsShaped, HasRounded, HasTheme {
private static final String VALUE_LOCATOR = "div input[type='hidden']";
private static final String INPUT_LOCATOR = "div input[type='text']";
private static final String EXPAND_LOCATOR = "div .v-input__append-inner";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.epam.jdi.light.vuetify.asserts.PaginationPageAssert;
import com.epam.jdi.light.elements.interfaces.base.HasColor;

// @todo #5421 PaginationPage is not a part of Vue, should be removed
/**
* Class describes the Page displayed in Pagination element
* https://v2.vuetifyjs.com/en/components/paginations/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*/

public class AppBar extends BasicBar<AppBar, AppBarAssert> {

private static final String IMAGE_LOCATOR = ".v-toolbar__image .v-image";
private static final String OVERFLOW_WINDOW_LOCATOR = "//ancestor::div[contains(@class, 'v-card')]//div[contains" +
"(@class, 'overflow-y-auto')]";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.epam.jdi.light.vuetify.asserts.bars.SystemBarAssert;
import com.epam.jdi.light.vuetify.elements.common.Icon;
import com.epam.jdi.light.vuetify.interfaces.HasMeasurement;
import com.epam.jdi.light.vuetify.interfaces.HasTheme;

import java.util.List;
import java.util.stream.Collectors;
Expand All @@ -13,7 +12,7 @@
* To see examples of System Bar web elements please visit https://v2.vuetifyjs.com/en/components/system-bars
*/

public class SystemBar extends BasicBar<SystemBar, SystemBarAssert> implements HasTheme, HasMeasurement {
public class SystemBar extends BasicBar<SystemBar, SystemBarAssert> implements HasMeasurement {

@JDIAction("Get '{name}' icons")
public List<Icon> icons() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/

public class ToolBar extends BasicBar<ToolBar, ToolBarAssert> {

public ToolBarAssert is() {
return new ToolBarAssert().set(this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.epam.jdi.light.common.JDIAction;
import com.epam.jdi.light.vuetify.elements.common.VueCheckbox;

// @todo #5421 Check if this checkbox is a part of vue
public class TableCheckbox extends VueCheckbox {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.epam.jdi.light.elements.interfaces.base.ICoreElement;
import com.epam.jdi.light.vuetify.annotations.JDITimeLine;
import com.epam.jdi.light.vuetify.asserts.timelines.TimeLineAssert;
import com.epam.jdi.light.vuetify.interfaces.HasTheme;
import com.epam.jdi.light.vuetify.interfaces.IsDense;

import java.lang.reflect.Field;
Expand All @@ -22,7 +23,8 @@
* To see an example of Timeline web element please visit
* https://v2.vuetifyjs.com/en/components/timelines/
*/
public class TimeLine<T extends ICoreElement, U extends ICoreElement> extends UIListBase<TimeLineAssert> implements ISetup, IsDense {
public class TimeLine<T extends ICoreElement, U extends ICoreElement> extends UIListBase<TimeLineAssert>
implements ISetup, IsDense, HasTheme {

private static final String ALIGN_TOP_CLASS = "v-timeline--align-top";
private static final String REVERSE_CLASS = "v-timeline--reverse";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,14 @@ public interface HasTheme extends ICoreElement {
default String theme() {
return core().classLike("theme--");
}

@JDIAction("Get if '{name}' has dark theme")
default boolean isDarkTheme() {
return core().hasClass("theme--dark");
}

@JDIAction("Get if '{name}' has light theme")
default boolean isLightTheme() {
return core().hasClass("theme--light");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.epam.jdi.light.common.JDIAction;
import com.epam.jdi.light.vuetify.interfaces.HasTheme;
import com.epam.jdi.light.asserts.generic.IBaseAssert;
import org.hamcrest.Matcher;
import org.hamcrest.Matchers;

import static com.epam.jdi.light.asserts.core.SoftAssert.jdiAssert;
Expand All @@ -22,4 +23,9 @@ default A darkTheme() {
jdiAssert(element().theme(), Matchers.is(THEME_DARK.getValue()), "Element has light theme");
return (A) this;
}

default A theme(Matcher<String> matcher) {
jdiAssert(element().theme(), matcher);
return (A) this;
}
}