Skip to content

Commit

Permalink
Merge pull request #5512 from jdi-testing/5428
Browse files Browse the repository at this point in the history
#5428 add HasSize interface
  • Loading branch information
pnatashap authored Apr 29, 2024
2 parents 14ed0fe + de7dfac commit 71406a2
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@
import com.epam.jdi.light.asserts.generic.ColorAssert;
import com.epam.jdi.light.vuetify.interfaces.asserts.MeasurementAssert;
import com.epam.jdi.light.vuetify.interfaces.asserts.OutlinedAssert;
import com.epam.jdi.light.vuetify.interfaces.asserts.SizeAssert;
import com.epam.jdi.light.vuetify.interfaces.asserts.ThemeAssert;
import org.hamcrest.Matcher;
import org.hamcrest.Matchers;

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

public class ChipAssert extends UIAssert<ChipAssert, Chip> implements ColorAssert<ChipAssert, Chip>,
OutlinedAssert<ChipAssert, Chip>, ThemeAssert<ChipAssert, Chip>, MeasurementAssert<ChipAssert, Chip>,
OutlinedAssert<ChipAssert, Chip>, ThemeAssert<ChipAssert, Chip>,
MeasurementAssert<ChipAssert, Chip>,
SizeAssert<ChipAssert, Chip>,
ITextAssert<ChipAssert> {
@Override
@JDIAction(value = "Assert that '{name}' has text '{0}'", isAssert = true)
Expand Down Expand Up @@ -91,36 +94,6 @@ public ChipAssert image() {
return this;
}

@JDIAction(value = "Assert that '{name}' size is x-small", isAssert = true)
public ChipAssert xSmallSize() {
jdiAssert(element().hasXSmallSize(), Matchers.is(true), "Chip's size is not x-small");
return this;
}

@JDIAction(value = "Assert that '{name}' size is small", isAssert = true)
public ChipAssert smallSize() {
jdiAssert(element().hasSmallSize(), Matchers.is(true), "Chip's size is not small");
return this;
}

@JDIAction(value = "Assert that '{name}' size is default", isAssert = true)
public ChipAssert defaultSize() {
jdiAssert(element().hasDefaultSize(), Matchers.is(true), "Chip's size is not default");
return this;
}

@JDIAction(value = "Assert that '{name}' size is large", isAssert = true)
public ChipAssert largeSize() {
jdiAssert(element().hasLargeSize(), Matchers.is(true), "Chip's size is not large");
return this;
}

@JDIAction(value = "Assert that '{name}' size is x-large", isAssert = true)
public ChipAssert xLargeSize() {
jdiAssert(element().hasXLargeSize(), Matchers.is(true), "Chip's size is not x-large");
return this;
}

@JDIAction(value = "Assert that '{name}' is removable", isAssert = true)
public ChipAssert removable() {
jdiAssert(element().isRemovable(), Matchers.is(true), "Chip is not removable");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,15 @@
import com.epam.jdi.light.common.JDIAction;
import com.epam.jdi.light.vuetify.elements.common.VuetifyButton;
import com.epam.jdi.light.asserts.generic.ColorAssert;
import com.epam.jdi.light.vuetify.interfaces.asserts.ElevationAssert;
import com.epam.jdi.light.vuetify.interfaces.asserts.MeasurementAssert;
import com.epam.jdi.light.vuetify.interfaces.asserts.OutlinedAssert;
import com.epam.jdi.light.vuetify.interfaces.asserts.RoundedAssert;
import com.epam.jdi.light.vuetify.interfaces.asserts.ThemeAssert;
import com.epam.jdi.light.vuetify.interfaces.asserts.*;

import org.hamcrest.Matchers;


public class VuetifyButtonAssert extends TextAssert implements ThemeAssert<VuetifyButtonAssert, VuetifyButton>,
ColorAssert<VuetifyButtonAssert, VuetifyButton>, OutlinedAssert<VuetifyButtonAssert, VuetifyButton>,
ElevationAssert<VuetifyButtonAssert, VuetifyButton>, MeasurementAssert<VuetifyButtonAssert, VuetifyButton>,
RoundedAssert<VuetifyButtonAssert, VuetifyButton> {
RoundedAssert<VuetifyButtonAssert, VuetifyButton>, SizeAssert<VuetifyButtonAssert, VuetifyButton> {

@Override
public VuetifyButton element() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,14 @@
import com.epam.jdi.light.elements.interfaces.base.HasClick;
import com.epam.jdi.light.vuetify.asserts.ChipAssert;
import com.epam.jdi.light.elements.interfaces.base.HasColor;
import com.epam.jdi.light.vuetify.interfaces.HasIcon;
import com.epam.jdi.light.vuetify.interfaces.HasImage;
import com.epam.jdi.light.vuetify.interfaces.HasMeasurement;
import com.epam.jdi.light.vuetify.interfaces.HasTheme;
import com.epam.jdi.light.vuetify.interfaces.IsOutlined;
import com.epam.jdi.light.vuetify.interfaces.*;

/**
* To see an example of Chip web element please visit https://v2.vuetifyjs.com/en/components/chips/
*/

public class Chip extends UIBaseElement<ChipAssert> implements HasClick, HasColor, HasIcon, HasImage,
HasTheme, IsOutlined, HasMeasurement {
HasTheme, IsOutlined, HasMeasurement, HasSize {

private static final String CONTENT_LOCATOR = ".v-chip__content";
private static final String CLOSE_BUTTON_LOCATOR = "button.v-chip__close";
Expand Down Expand Up @@ -76,7 +72,6 @@ public Image image() {
return new Image().setCore(Image.class, core().find(IMAGE_LOCATOR));
}

// @todo #5309 Ass interface for sizes (all small, x-small, default, large, x-large)
@JDIAction("Get if '{name}' hss x-small size")
public boolean hasXSmallSize() {
return core().hasClass("v-size--x-small");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,7 @@
import com.epam.jdi.light.ui.html.elements.common.Button;
import com.epam.jdi.light.vuetify.asserts.VuetifyButtonAssert;
import com.epam.jdi.light.elements.interfaces.base.HasColor;
import com.epam.jdi.light.vuetify.interfaces.HasElevation;
import com.epam.jdi.light.vuetify.interfaces.HasIcon;
import com.epam.jdi.light.vuetify.interfaces.HasMeasurement;
import com.epam.jdi.light.vuetify.interfaces.HasRounded;
import com.epam.jdi.light.vuetify.interfaces.HasTheme;
import com.epam.jdi.light.vuetify.interfaces.IsOutlined;
import com.epam.jdi.light.vuetify.interfaces.*;

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

Expand All @@ -22,7 +17,7 @@
*/

public class VuetifyButton extends Button implements HasClick, HasIcon,
HasColor, HasTheme, HasElevation, IsOutlined,
HasColor, HasTheme, HasElevation, IsOutlined, HasSize,
HasMeasurement, HasRounded {

@UI(".v-btn__loader")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.epam.jdi.light.vuetify.interfaces;

import com.epam.jdi.light.common.JDIAction;
import com.epam.jdi.light.elements.interfaces.base.ICoreElement;

public interface HasSize extends ICoreElement {

@JDIAction("Get if '{name}' hss x-small size")
default boolean xSmallSize() {
return core().hasClass("v-size--x-small");
}

@JDIAction("Get if '{name}' has small size")
default boolean smallSize() {
return core().hasClass("v-size--small");
}

@JDIAction("Get if '{name}' has default size")
default boolean defaultSize() {
return core().hasClass("v-size--default");
}

@JDIAction("Get if '{name}' has large size")
default boolean largeSize() {
return core().hasClass("v-size--large");
}

@JDIAction("Get if '{name}' has x-large size")
default boolean xLargeSize() {
return core().hasClass("v-size--x-large");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.epam.jdi.light.vuetify.interfaces.asserts;

import com.epam.jdi.light.asserts.generic.IBaseAssert;
import com.epam.jdi.light.common.JDIAction;
import com.epam.jdi.light.vuetify.interfaces.HasSize;
import org.hamcrest.Matchers;

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

public interface SizeAssert<A, E extends HasSize> extends IBaseAssert<E> {

@JDIAction(value = "Assert that '{name}' size is x-small", isAssert = true)
default A xSmallSize() {
jdiAssert(element().xSmallSize(), Matchers.is(true), "Chip's size is not x-small");
return (A) this;
}

@JDIAction(value = "Assert that '{name}' size is small", isAssert = true)
default A smallSize() {
jdiAssert(element().smallSize(), Matchers.is(true), "Chip's size is not small");
return (A) this;
}

@JDIAction(value = "Assert that '{name}' size is default", isAssert = true)
default A defaultSize() {
jdiAssert(element().defaultSize(), Matchers.is(true), "Chip's size is not default");
return (A) this;
}

@JDIAction(value = "Assert that '{name}' size is large", isAssert = true)
default A largeSize() {
jdiAssert(element().largeSize(), Matchers.is(true), "Chip's size is not large");
return (A) this;
}

@JDIAction(value = "Assert that '{name}' size is x-large", isAssert = true)
default A xLargeSize() {
jdiAssert(element().xLargeSize(), Matchers.is(true), "Chip's size is not x-large");
return (A) this;
}
}

0 comments on commit 71406a2

Please sign in to comment.