From 009a14ce47c431882dff430edc6c73eeac75c66f Mon Sep 17 00:00:00 2001 From: Natalia Pozhidaeva Date: Sat, 2 Dec 2023 00:23:34 -0500 Subject: [PATCH 01/11] Moving HasImage to the core project --- .../light/ui/html/asserts/HasImageAssert.java | 21 ++++++++++++++++++ .../light/ui/html}/interfaces/HasImage.java | 15 ++++++------- .../tests/displaydata/AvatarTests.java | 4 ++-- .../asserts/displaydata/AvatarAssert.java | 4 +++- .../asserts/layout/GridListTileAssert.java | 3 ++- .../material/elements/displaydata/Avatar.java | 2 +- .../material/elements/inputs/MUIButton.java | 7 +++--- .../elements/layout/GridListTile.java | 2 +- .../light/vuetify/asserts/ImageAssert.java | 1 + .../light/vuetify/elements/common/Image.java | 22 ++++++------------- 10 files changed, 48 insertions(+), 33 deletions(-) create mode 100644 jdi-light-html/src/main/java/com/epam/jdi/light/ui/html/asserts/HasImageAssert.java rename {jdi-light-material-ui/src/main/java/com/epam/jdi/light/material => jdi-light-html/src/main/java/com/epam/jdi/light/ui/html}/interfaces/HasImage.java (62%) diff --git a/jdi-light-html/src/main/java/com/epam/jdi/light/ui/html/asserts/HasImageAssert.java b/jdi-light-html/src/main/java/com/epam/jdi/light/ui/html/asserts/HasImageAssert.java new file mode 100644 index 0000000000..a706a74a07 --- /dev/null +++ b/jdi-light-html/src/main/java/com/epam/jdi/light/ui/html/asserts/HasImageAssert.java @@ -0,0 +1,21 @@ +package com.epam.jdi.light.ui.html.asserts; + +import com.epam.jdi.light.asserts.generic.IBaseAssert; +import com.epam.jdi.light.ui.html.interfaces.HasImage; +import org.hamcrest.Matchers; + +import static com.epam.jdi.light.asserts.core.SoftAssert.jdiAssert; + +public interface HasImageAssert extends IBaseAssert { + + default A hasImage(){ + jdiAssert(element().hasImage(), Matchers.is(true), "Image doesn't exists"); + return (A) this; + } + + default A withoutImage(){ + jdiAssert(element().hasImage(), Matchers.is(true), "Image exists"); + return (A) this; + } + +} diff --git a/jdi-light-material-ui/src/main/java/com/epam/jdi/light/material/interfaces/HasImage.java b/jdi-light-html/src/main/java/com/epam/jdi/light/ui/html/interfaces/HasImage.java similarity index 62% rename from jdi-light-material-ui/src/main/java/com/epam/jdi/light/material/interfaces/HasImage.java rename to jdi-light-html/src/main/java/com/epam/jdi/light/ui/html/interfaces/HasImage.java index ff3def387a..07199dd4c0 100644 --- a/jdi-light-material-ui/src/main/java/com/epam/jdi/light/material/interfaces/HasImage.java +++ b/jdi-light-html/src/main/java/com/epam/jdi/light/ui/html/interfaces/HasImage.java @@ -1,14 +1,14 @@ -package com.epam.jdi.light.material.interfaces; +package com.epam.jdi.light.ui.html.interfaces; import com.epam.jdi.light.common.JDIAction; import com.epam.jdi.light.elements.interfaces.base.ICoreElement; import com.epam.jdi.light.ui.html.elements.common.Image; -/** - * Represents an element that has an {@link Image}. - */ public interface HasImage extends ICoreElement { + default String imageLocator() { + return ".//img"; + } /** * Gets the image of the element. * @@ -16,7 +16,7 @@ public interface HasImage extends ICoreElement { */ @JDIAction("Get '{name}' image") default Image image() { - return new Image().setCore(Image.class, find("img")); + return new Image().setCore(Image.class, find(imageLocator())); } /** @@ -24,9 +24,8 @@ default Image image() { * * @return {@code true} if the image is displayed, otherwise {@code false} */ - @JDIAction("Check that '{name}' image is displayed") + @JDIAction("Check that '{name}' image exist") default boolean hasImage() { - return core().find("img").isDisplayed() - || core().find("//*[contains(@style, 'background-image')]").isDisplayed(); + return image().isExist(); } } diff --git a/jdi-light-material-ui-tests/src/test/java/io/github/epam/material/tests/displaydata/AvatarTests.java b/jdi-light-material-ui-tests/src/test/java/io/github/epam/material/tests/displaydata/AvatarTests.java index 6797dbfc4e..c706b8265e 100644 --- a/jdi-light-material-ui-tests/src/test/java/io/github/epam/material/tests/displaydata/AvatarTests.java +++ b/jdi-light-material-ui-tests/src/test/java/io/github/epam/material/tests/displaydata/AvatarTests.java @@ -4,7 +4,7 @@ import com.epam.jdi.light.material.elements.displaydata.Badge; import com.epam.jdi.light.material.elements.utils.enums.VariantType; import io.github.epam.TestsInit; -import org.testng.annotations.BeforeMethod; +import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import static com.epam.jdi.light.material.elements.utils.enums.VariantType.CIRCULAR; @@ -16,7 +16,7 @@ public class AvatarTests extends TestsInit { - @BeforeMethod + @BeforeClass public void beforeTest() { avatarPage.open(); avatarPage.isOpened(); diff --git a/jdi-light-material-ui/src/main/java/com/epam/jdi/light/material/asserts/displaydata/AvatarAssert.java b/jdi-light-material-ui/src/main/java/com/epam/jdi/light/material/asserts/displaydata/AvatarAssert.java index 2df396f157..a663f3b0af 100644 --- a/jdi-light-material-ui/src/main/java/com/epam/jdi/light/material/asserts/displaydata/AvatarAssert.java +++ b/jdi-light-material-ui/src/main/java/com/epam/jdi/light/material/asserts/displaydata/AvatarAssert.java @@ -5,6 +5,7 @@ import com.epam.jdi.light.common.JDIAction; import com.epam.jdi.light.material.elements.displaydata.Avatar; import com.epam.jdi.light.material.elements.utils.enums.VariantType; +import com.epam.jdi.light.ui.html.asserts.HasImageAssert; import org.hamcrest.Matcher; import static com.epam.jdi.light.asserts.core.SoftAssert.jdiAssert; @@ -13,7 +14,8 @@ /** * Assertions for {@link Avatar}. */ -public class AvatarAssert extends UIAssert implements ITextAssert { +public class AvatarAssert extends UIAssert implements ITextAssert, + HasImageAssert { @Override @JDIAction("Assert that '{name}' text {0}") diff --git a/jdi-light-material-ui/src/main/java/com/epam/jdi/light/material/asserts/layout/GridListTileAssert.java b/jdi-light-material-ui/src/main/java/com/epam/jdi/light/material/asserts/layout/GridListTileAssert.java index 0f82a16148..60f290503b 100644 --- a/jdi-light-material-ui/src/main/java/com/epam/jdi/light/material/asserts/layout/GridListTileAssert.java +++ b/jdi-light-material-ui/src/main/java/com/epam/jdi/light/material/asserts/layout/GridListTileAssert.java @@ -2,12 +2,13 @@ import com.epam.jdi.light.asserts.generic.UIAssert; import com.epam.jdi.light.material.elements.layout.GridListTile; +import com.epam.jdi.light.ui.html.asserts.HasImageAssert; import org.hamcrest.Matchers; import static com.epam.jdi.light.asserts.core.SoftAssert.jdiAssert; -public class GridListTileAssert extends UIAssert { +public class GridListTileAssert extends UIAssert implements HasImageAssert { public GridListTileAssert alternativeImageText(String alt) { jdiAssert(element().image().alt(), Matchers.is(alt)); diff --git a/jdi-light-material-ui/src/main/java/com/epam/jdi/light/material/elements/displaydata/Avatar.java b/jdi-light-material-ui/src/main/java/com/epam/jdi/light/material/elements/displaydata/Avatar.java index 536bdbc2f3..0b9d09d1fb 100644 --- a/jdi-light-material-ui/src/main/java/com/epam/jdi/light/material/elements/displaydata/Avatar.java +++ b/jdi-light-material-ui/src/main/java/com/epam/jdi/light/material/elements/displaydata/Avatar.java @@ -6,8 +6,8 @@ import com.epam.jdi.light.elements.interfaces.common.IsText; import com.epam.jdi.light.material.asserts.displaydata.AvatarAssert; import com.epam.jdi.light.material.elements.utils.enums.VariantType; -import com.epam.jdi.light.material.interfaces.HasImage; import com.epam.jdi.light.material.interfaces.displaydata.HasIcon; +import com.epam.jdi.light.ui.html.interfaces.HasImage; import java.util.Optional; diff --git a/jdi-light-material-ui/src/main/java/com/epam/jdi/light/material/elements/inputs/MUIButton.java b/jdi-light-material-ui/src/main/java/com/epam/jdi/light/material/elements/inputs/MUIButton.java index efefe9d901..81c43f0768 100644 --- a/jdi-light-material-ui/src/main/java/com/epam/jdi/light/material/elements/inputs/MUIButton.java +++ b/jdi-light-material-ui/src/main/java/com/epam/jdi/light/material/elements/inputs/MUIButton.java @@ -5,10 +5,10 @@ import com.epam.jdi.light.elements.interfaces.base.HasLabel; import com.epam.jdi.light.material.elements.displaydata.Typography; import com.epam.jdi.light.material.interfaces.CanBeDisabled; -import com.epam.jdi.light.material.interfaces.HasImage; import com.epam.jdi.light.material.interfaces.displaydata.HasIcon; import com.epam.jdi.light.ui.html.elements.common.Button; import com.epam.jdi.light.ui.html.elements.common.Image; +import com.epam.jdi.light.ui.html.interfaces.HasImage; public class MUIButton extends Button implements HasIcon, HasLabel, HasImage, CanBeDisabled { @@ -32,9 +32,8 @@ public Label label() { * @return image element as {@link Image} */ @Override - @JDIAction("Get '{name}' image") - public Image image() { - return new Image().setCore(Image.class, core().find("//*[contains(@style, 'background-image')]")); + public String imageLocator() { + return "//*[contains(@style, 'background-image')]"; } /** diff --git a/jdi-light-material-ui/src/main/java/com/epam/jdi/light/material/elements/layout/GridListTile.java b/jdi-light-material-ui/src/main/java/com/epam/jdi/light/material/elements/layout/GridListTile.java index 7031942df5..29e3cdc1b4 100644 --- a/jdi-light-material-ui/src/main/java/com/epam/jdi/light/material/elements/layout/GridListTile.java +++ b/jdi-light-material-ui/src/main/java/com/epam/jdi/light/material/elements/layout/GridListTile.java @@ -4,7 +4,7 @@ import com.epam.jdi.light.elements.base.UIBaseElement; import com.epam.jdi.light.elements.common.UIElement; import com.epam.jdi.light.material.asserts.layout.GridListTileAssert; -import com.epam.jdi.light.material.interfaces.HasImage; +import com.epam.jdi.light.ui.html.interfaces.HasImage; public class GridListTile extends UIBaseElement implements HasImage { diff --git a/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/asserts/ImageAssert.java b/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/asserts/ImageAssert.java index 217f536fb1..dd67a464fa 100644 --- a/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/asserts/ImageAssert.java +++ b/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/asserts/ImageAssert.java @@ -2,6 +2,7 @@ import com.epam.jdi.light.asserts.generic.UIAssert; import com.epam.jdi.light.common.JDIAction; +import com.epam.jdi.light.ui.html.asserts.HasImageAssert; import com.epam.jdi.light.vuetify.elements.common.Image; import com.epam.jdi.light.vuetify.interfaces.asserts.MeasurementAssert; import com.epam.jdi.light.vuetify.interfaces.asserts.ThemeAssert; diff --git a/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/elements/common/Image.java b/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/elements/common/Image.java index 61f384cc72..dde73abe4d 100644 --- a/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/elements/common/Image.java +++ b/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/elements/common/Image.java @@ -3,6 +3,7 @@ import com.epam.jdi.light.common.JDIAction; import com.epam.jdi.light.elements.base.UIBaseElement; import com.epam.jdi.light.elements.common.UIElement; +import com.epam.jdi.light.ui.html.interfaces.HasImage; import com.epam.jdi.light.vuetify.asserts.ImageAssert; import com.epam.jdi.light.vuetify.interfaces.HasMeasurement; import com.epam.jdi.light.vuetify.interfaces.HasTheme; @@ -14,16 +15,11 @@ * To see an example of Image web element please visit https://vuetifyjs.com/en/components/images/ */ -public class Image extends UIBaseElement implements HasMeasurement, HasTheme { - - public com.epam.jdi.light.ui.html.elements.common.Image getJDIImage() { - return new com.epam.jdi.light.ui.html.elements.common.Image() - .setCore(com.epam.jdi.light.ui.html.elements.common.Image.class, base()); - } +public class Image extends UIBaseElement implements HasMeasurement, HasTheme, HasImage { @JDIAction("Get '{name}' alternate image text") public String alternateText() { - return getJDIImage().attr("aria-label"); + return core().attr("aria-label"); } @JDIAction("Get if '{name}' is contain") @@ -33,16 +29,16 @@ public boolean isContain() { @JDIAction("Get '{name}' image source path") public String getSourcePath() { - return Arrays.stream(image().getCssValue("background-image").split(", ")) + return Arrays.stream(image().css("background-image").split(", ")) .filter(e -> e.startsWith("url")).collect(Collectors.toList()).get(0); } @JDIAction("Get if '{name}' has gradient") public boolean hasGradient() { - if (image().getAttribute("style").contains("gradient")) { + if (image().attr("style").contains("gradient")) { return true; } - UIElement fillHeight = getJDIImage().find(".fill-height"); + UIElement fillHeight = core().find(".fill-height"); if (fillHeight.isExist()) { return fillHeight.getAttribute("class").contains("gradient"); } @@ -51,11 +47,7 @@ public boolean hasGradient() { @JDIAction("Get if '{name}' has placeholder") public boolean hasPlaceholder() { - return getJDIImage().find(".v-image__placeholder").isExist(); - } - - private UIElement image() { - return getJDIImage().find(".v-image__image"); + return core().find(".v-image__placeholder").isExist(); } @Override From 9ddb642216675e13f80fa7688cef9bd8f58651f7 Mon Sep 17 00:00:00 2001 From: Natalia Pozhidaeva Date: Sat, 2 Dec 2023 00:36:37 -0500 Subject: [PATCH 02/11] Fix Parallax --- .../jdi/light/vuetify/elements/composite/Parallax.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/elements/composite/Parallax.java b/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/elements/composite/Parallax.java index 2d5fcb5370..93ad72b73a 100644 --- a/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/elements/composite/Parallax.java +++ b/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/elements/composite/Parallax.java @@ -5,6 +5,7 @@ import com.epam.jdi.light.elements.common.UIElement; import com.epam.jdi.light.elements.pageobjects.annotations.locators.UI; import com.epam.jdi.light.vuetify.asserts.ParallaxAssert; +import com.epam.jdi.light.vuetify.interfaces.HasImage; import com.epam.jdi.light.vuetify.interfaces.IsContainer; import org.openqa.selenium.By; import com.epam.jdi.light.vuetify.elements.common.Image; @@ -17,13 +18,10 @@ * To see an example of Parallax web element please visit https://vuetifyjs.com/en/components/parallax */ -public class Parallax extends UIBaseElement implements IsContainer { +public class Parallax extends UIBaseElement implements IsContainer, HasImage { protected String parallaxContent = "v-parallax__content"; - @UI(".v-parallax__image-container > img") - public Image parallaxImage; - @JDIAction("Get '{name}' parallax container height") public int height() { String heightValue = core().getAttribute("style").replaceFirst(".*height: (\\d+)px;.*", "$1"); @@ -48,8 +46,8 @@ public boolean hasContent() { * for parallax Image, while html Image methods are working fine */ @JDIAction("Get '{name}' parallax image") - public com.epam.jdi.light.ui.html.elements.common.Image image() { - return parallaxImage.getJDIImage(); + public Image image() { + return new Image().setCore(Image.class, core()); } @Override From 78def4c40d689296e034d878b7623a38133c0510 Mon Sep 17 00:00:00 2001 From: Natalia Pozhidaeva Date: Sat, 2 Dec 2023 00:40:55 -0500 Subject: [PATCH 03/11] Fix Parallax --- .../java/com/epam/jdi/light/vuetify/asserts/ImageAssert.java | 1 - .../com/epam/jdi/light/vuetify/elements/composite/Parallax.java | 1 - 2 files changed, 2 deletions(-) diff --git a/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/asserts/ImageAssert.java b/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/asserts/ImageAssert.java index dd67a464fa..217f536fb1 100644 --- a/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/asserts/ImageAssert.java +++ b/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/asserts/ImageAssert.java @@ -2,7 +2,6 @@ import com.epam.jdi.light.asserts.generic.UIAssert; import com.epam.jdi.light.common.JDIAction; -import com.epam.jdi.light.ui.html.asserts.HasImageAssert; import com.epam.jdi.light.vuetify.elements.common.Image; import com.epam.jdi.light.vuetify.interfaces.asserts.MeasurementAssert; import com.epam.jdi.light.vuetify.interfaces.asserts.ThemeAssert; diff --git a/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/elements/composite/Parallax.java b/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/elements/composite/Parallax.java index 93ad72b73a..44162949d0 100644 --- a/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/elements/composite/Parallax.java +++ b/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/elements/composite/Parallax.java @@ -3,7 +3,6 @@ import com.epam.jdi.light.common.JDIAction; import com.epam.jdi.light.elements.base.UIBaseElement; import com.epam.jdi.light.elements.common.UIElement; -import com.epam.jdi.light.elements.pageobjects.annotations.locators.UI; import com.epam.jdi.light.vuetify.asserts.ParallaxAssert; import com.epam.jdi.light.vuetify.interfaces.HasImage; import com.epam.jdi.light.vuetify.interfaces.IsContainer; From 622cb9f12540da8a6dd7505af2f7b6b68844bc4c Mon Sep 17 00:00:00 2001 From: Natalia Pozhidaeva Date: Sat, 2 Dec 2023 00:47:11 -0500 Subject: [PATCH 04/11] Fix Parallax --- .../io/github/epam/vuetify/tests/composite/ParallaxTests.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jdi-light-vuetify-tests/src/test/java/io/github/epam/vuetify/tests/composite/ParallaxTests.java b/jdi-light-vuetify-tests/src/test/java/io/github/epam/vuetify/tests/composite/ParallaxTests.java index eb01f06530..855ae95e4e 100644 --- a/jdi-light-vuetify-tests/src/test/java/io/github/epam/vuetify/tests/composite/ParallaxTests.java +++ b/jdi-light-vuetify-tests/src/test/java/io/github/epam/vuetify/tests/composite/ParallaxTests.java @@ -39,7 +39,7 @@ public void customHeightParallaxTests() { @Test(description = "Test checks that image with parallax has specific source file") public void imageParallaxTests() { - customHeightParallax.image().has().src("https://cdn.vuetifyjs.com/images/parallax/material2.jpg"); - customHeightParallax.image().has().fileName("material2.jpg"); + customHeightParallax.image().image().has().src("https://cdn.vuetifyjs.com/images/parallax/material2.jpg"); + customHeightParallax.image().image().has().fileName("material2.jpg"); } } From dc76a992e169eee957c98cd922df56445e25ffc0 Mon Sep 17 00:00:00 2001 From: Natalia Pozhidaeva Date: Sat, 2 Dec 2023 01:45:20 -0500 Subject: [PATCH 05/11] Remove bootstrap run --- .github/workflows/main.yml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c726cfbc1c..3ea7d65500 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -132,12 +132,12 @@ jobs: # path: ./${BDD_TESTS}/target/allure-results/ # retention-days: 1 - - name: Tests bootstrap Unit - id: tests-bootstrap - if: steps.jdi-compile.outcome == 'success' - timeout-minutes: 20 # prevent blocking - continue-on-error: true - run: mvn verify $WITH_PARAMS -Dchrome.capabilities.path=${CHROME_PROPERTIES} -Dff.capabilities.path=${FIREFOX_PROPERTIES} -pl $GROUP_ID:$BOOTSTRAP_TESTS --fail-at-end +# - name: Tests bootstrap Unit +# id: tests-bootstrap +# if: steps.jdi-compile.outcome == 'success' +# timeout-minutes: 20 # prevent blocking +# continue-on-error: true +# run: mvn verify $WITH_PARAMS -Dchrome.capabilities.path=${CHROME_PROPERTIES} -Dff.capabilities.path=${FIREFOX_PROPERTIES} -pl $GROUP_ID:$BOOTSTRAP_TESTS --fail-at-end # - name: Run tests - Angular Unit tests # id: tests-angular-unit @@ -228,7 +228,6 @@ jobs: run: | echo BDD tests result: ${{ steps.tests-bdd.outcome }} echo BDD Firefox tests result: ${{ steps.tests-bdd-firefox.outcome }} - echo Bootstrap tests result: ${{ steps.tests-bootstrap.outcome }} echo HTML tests result: ${{ steps.tests-html-func.outcome }} echo Example tests result: ${{ steps.tests-examples.outcome }} echo Material ui tests result: ${{ steps.tests-material-ui.outcome }} @@ -237,11 +236,10 @@ jobs: echo Vuetify tests result: ${{ steps.tests-vuetify.outcome }} - name: Check BDD and Bootstap are passed - if: ${{ steps.tests-bdd.outcome != 'success' || steps.tests-bdd-firefox.outcome != 'success' || steps.tests-bootstrap.outcome != 'success' }} + if: ${{ steps.tests-bdd.outcome != 'success' || steps.tests-bdd-firefox.outcome != 'success' }} run: | echo BDD tests result: ${{ steps.tests-bdd.outcome }} echo BDD Firefox tests result: ${{ steps.tests-bdd-firefox.outcome }} - echo Bootstrap tests result: ${{ steps.tests-bootstrap.outcome }} exit 1 - name: Check html tests are passed From 6cadc84f027533206490f3317fc764d397b637e5 Mon Sep 17 00:00:00 2001 From: Natalia Pozhidaeva Date: Sat, 2 Dec 2023 19:33:23 -0500 Subject: [PATCH 06/11] Fix Image for vue --- .../com/epam/jdi/light/vuetify/elements/common/Image.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/elements/common/Image.java b/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/elements/common/Image.java index dde73abe4d..5ab5f33294 100644 --- a/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/elements/common/Image.java +++ b/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/elements/common/Image.java @@ -45,6 +45,11 @@ public boolean hasGradient() { return false; } + @Override + public String imageLocator() { + return ".v-image__image"; + } + @JDIAction("Get if '{name}' has placeholder") public boolean hasPlaceholder() { return core().find(".v-image__placeholder").isExist(); From 418c92aa7606a3180c318056fcc9e4b284cc7e8b Mon Sep 17 00:00:00 2001 From: Natalia Pozhidaeva Date: Sat, 2 Dec 2023 20:07:48 -0500 Subject: [PATCH 07/11] Fix Image in Custom elements and Chip --- .../com/custom/bars/AppBarWithTabs.java | 2 +- .../com/custom/cards/CustomActionsCard.java | 10 +++------ .../com/custom/cards/MediaTextCard.java | 4 ++-- .../vuetify/tests/complex/CardsTests.java | 12 +++++----- .../light/vuetify/elements/common/Chip.java | 22 +++++++++---------- .../light/vuetify/interfaces/HasImage.java | 5 +++++ 6 files changed, 28 insertions(+), 27 deletions(-) diff --git a/jdi-light-vuetify-tests/src/main/java/io/github/com/custom/bars/AppBarWithTabs.java b/jdi-light-vuetify-tests/src/main/java/io/github/com/custom/bars/AppBarWithTabs.java index 29499ad8bb..2ada7748e2 100644 --- a/jdi-light-vuetify-tests/src/main/java/io/github/com/custom/bars/AppBarWithTabs.java +++ b/jdi-light-vuetify-tests/src/main/java/io/github/com/custom/bars/AppBarWithTabs.java @@ -13,6 +13,6 @@ public VuetifyTabs tabs() { } public Image image() { - return new Image().setCore(Image.class, fadeImageOnScrollBar.find(".v-toolbar__image")); + return new Image().setCore(Image.class, fadeImageOnScrollBar.find(".v_image")); } } diff --git a/jdi-light-vuetify-tests/src/main/java/io/github/com/custom/cards/CustomActionsCard.java b/jdi-light-vuetify-tests/src/main/java/io/github/com/custom/cards/CustomActionsCard.java index 02d0e2d583..64b1a07c68 100644 --- a/jdi-light-vuetify-tests/src/main/java/io/github/com/custom/cards/CustomActionsCard.java +++ b/jdi-light-vuetify-tests/src/main/java/io/github/com/custom/cards/CustomActionsCard.java @@ -12,8 +12,8 @@ public class CustomActionsCard extends Card { @UI(".v-image__image") protected Image image; - @UI("//./div[5]/div") - protected Text dropdownText; + @UI(".v-card__text") + public Text extendedText; public CustomActionsCard() { super(); @@ -28,14 +28,10 @@ public Image image() { } public Button exploreButton() { - return new Button().setCore(Button.class, actions().find("//button[./span[contains(text(), 'Explore')]]")); + return new Button().setCore(Button.class, actions().find(".//button[./span[contains(text(), 'Explore')]]")); } public Button expandButton() { return new Button().setCore(Button.class, actions().find("button.v-btn--icon")); } - - public Text dropdownText() { - return dropdownText; - } } diff --git a/jdi-light-vuetify-tests/src/main/java/io/github/com/custom/cards/MediaTextCard.java b/jdi-light-vuetify-tests/src/main/java/io/github/com/custom/cards/MediaTextCard.java index 0522089554..57bf2cd5b0 100644 --- a/jdi-light-vuetify-tests/src/main/java/io/github/com/custom/cards/MediaTextCard.java +++ b/jdi-light-vuetify-tests/src/main/java/io/github/com/custom/cards/MediaTextCard.java @@ -3,12 +3,12 @@ import com.epam.jdi.light.elements.common.UIElement; import com.epam.jdi.light.elements.pageobjects.annotations.locators.UI; import com.epam.jdi.light.ui.html.elements.common.Button; -import com.epam.jdi.light.ui.html.elements.common.Image; +import com.epam.jdi.light.vuetify.elements.common.Image; import com.epam.jdi.light.vuetify.elements.complex.Card; public class MediaTextCard extends Card { - @UI(".v-image__image") + @UI(".v-image") protected Image image; public MediaTextCard() { diff --git a/jdi-light-vuetify-tests/src/test/java/io/github/epam/vuetify/tests/complex/CardsTests.java b/jdi-light-vuetify-tests/src/test/java/io/github/epam/vuetify/tests/complex/CardsTests.java index 2fe7dd4548..6ae6e32a95 100644 --- a/jdi-light-vuetify-tests/src/test/java/io/github/epam/vuetify/tests/complex/CardsTests.java +++ b/jdi-light-vuetify-tests/src/test/java/io/github/epam/vuetify/tests/complex/CardsTests.java @@ -61,7 +61,7 @@ public void revealCardTest() { public void mediaTextCardTest() { mediaTextCard.show(); mediaTextCard.is().displayed(); - mediaTextCard.image().has().css("background-size", "cover"); + mediaTextCard.image().is().displayed(); mediaTextCard.has().title("Top 10 Australian beaches") .and().subtitle(containsString("Number 10")); mediaTextCard.content().has().text(containsString("Whitehaven Beach")); @@ -72,13 +72,13 @@ public void mediaTextCardTest() { public void customActionsCardTest() { customActionsCard.show(); - customActionsCard.dropdownText().is().hidden(); + customActionsCard.extendedText.is().hidden(); customActionsCard.expandButton().click(); - customActionsCard.dropdownText().is().displayed(); - customActionsCard.dropdownText().has().text(containsString("I'm a thing.")); + customActionsCard.extendedText.is().displayed() + .and().text(containsString("I'm a thing.")); customActionsCard.expandButton().click(); - waitCondition(customActionsCard.dropdownText()::isHidden); - customActionsCard.dropdownText().is().hidden(); + waitCondition(customActionsCard.extendedText::isHidden); + customActionsCard.extendedText.is().hidden(); } @Test(description = "Test checks if card is rounded or not : rounded(y/n)") diff --git a/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/elements/common/Chip.java b/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/elements/common/Chip.java index a29e8a43f9..d09b94e22c 100644 --- a/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/elements/common/Chip.java +++ b/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/elements/common/Chip.java @@ -20,10 +20,10 @@ public class Chip extends UIBaseElement implements HasClick, HasColor, HasIcon, HasImage, HasTheme, IsOutlined, HasMeasurement { - private static final String CONTENT = ".v-chip__content"; - private static final String CLOSE_BUTTON = "button.v-chip__close"; - private static final String FILTER = ".v-chip__filter"; - private static final String IMAGE = ".v-image__image"; + private static final String CONTENT_LOCATOR = ".v-chip__content"; + private static final String CLOSE_BUTTON_LOCATOR = "button.v-chip__close"; + private static final String FILTER_LOCATOR = ".v-chip__filter"; + private static final String IMAGE_LOCATOR = ".v-image"; @Override public ChipAssert is() { @@ -38,7 +38,7 @@ public boolean isEnabled() { @JDIAction("Get '{name}' content") public UIElement getContent() { - return find(CONTENT); + return find(CONTENT_LOCATOR); } @JDIAction("Get '{name}' text") @@ -48,7 +48,7 @@ public String getText() { @JDIAction("Close '{name}'") public void close() { - find(CLOSE_BUTTON).click(); + find(CLOSE_BUTTON_LOCATOR).click(); } @JDIAction("Get if '{name}' is draggable") @@ -63,7 +63,7 @@ public boolean active() { @JDIAction("Get if '{name}' filter icon is displayed") public boolean isFilterIconDisplayed() { - return find(FILTER).isDisplayed(); + return find(FILTER_LOCATOR).isDisplayed(); } // "label" refers to specific element border radius settings @@ -72,10 +72,10 @@ public boolean isLabel() { return hasClass("v-chip--label"); } - @JDIAction("Get if '{name}' has an image") - public boolean hasImage() { - return new Timer(base().getTimeout() * 1000L) - .wait(() -> this.find(IMAGE).isExist()); + @Override + @JDIAction("Get '{name}'s image") + public Image image() { + return new Image().setCore(Image.class, core().find(IMAGE_LOCATOR)); } @JDIAction("Get '{name}' font size") diff --git a/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/interfaces/HasImage.java b/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/interfaces/HasImage.java index 403f2b1806..287b832770 100644 --- a/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/interfaces/HasImage.java +++ b/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/interfaces/HasImage.java @@ -18,4 +18,9 @@ public interface HasImage extends ICoreElement { default Image image() { return new Image().setCore(Image.class, core().find("img")); } + + @JDIAction("Get if '{name}' has an image") + default boolean hasImage() { + return image().isExist(); + } } From 7d3d90022b89e495f0b514280d666fa772974d18 Mon Sep 17 00:00:00 2001 From: Natalia Pozhidaeva Date: Sat, 2 Dec 2023 20:28:34 -0500 Subject: [PATCH 08/11] Fix Parallax --- .../vuetify/tests/composite/ParallaxTests.java | 4 ++-- .../vuetify/elements/composite/Parallax.java | 15 ++------------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/jdi-light-vuetify-tests/src/test/java/io/github/epam/vuetify/tests/composite/ParallaxTests.java b/jdi-light-vuetify-tests/src/test/java/io/github/epam/vuetify/tests/composite/ParallaxTests.java index 855ae95e4e..eb01f06530 100644 --- a/jdi-light-vuetify-tests/src/test/java/io/github/epam/vuetify/tests/composite/ParallaxTests.java +++ b/jdi-light-vuetify-tests/src/test/java/io/github/epam/vuetify/tests/composite/ParallaxTests.java @@ -39,7 +39,7 @@ public void customHeightParallaxTests() { @Test(description = "Test checks that image with parallax has specific source file") public void imageParallaxTests() { - customHeightParallax.image().image().has().src("https://cdn.vuetifyjs.com/images/parallax/material2.jpg"); - customHeightParallax.image().image().has().fileName("material2.jpg"); + customHeightParallax.image().has().src("https://cdn.vuetifyjs.com/images/parallax/material2.jpg"); + customHeightParallax.image().has().fileName("material2.jpg"); } } diff --git a/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/elements/composite/Parallax.java b/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/elements/composite/Parallax.java index 44162949d0..975181ce47 100644 --- a/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/elements/composite/Parallax.java +++ b/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/elements/composite/Parallax.java @@ -3,11 +3,11 @@ import com.epam.jdi.light.common.JDIAction; import com.epam.jdi.light.elements.base.UIBaseElement; import com.epam.jdi.light.elements.common.UIElement; +import com.epam.jdi.light.ui.html.elements.common.Image; +import com.epam.jdi.light.ui.html.interfaces.HasImage; import com.epam.jdi.light.vuetify.asserts.ParallaxAssert; -import com.epam.jdi.light.vuetify.interfaces.HasImage; import com.epam.jdi.light.vuetify.interfaces.IsContainer; import org.openqa.selenium.By; -import com.epam.jdi.light.vuetify.elements.common.Image; /** * Parallax is basically a container with a background image that scrolls slower than browser window. @@ -38,17 +38,6 @@ public boolean hasContent() { return content().children().size() > 0; } - /** - * Method to get parallax Image - * - * @return com.epam.jdi.light.ui.html.elements.common.Image as some of the vuelify Image methods are not working - * for parallax Image, while html Image methods are working fine - */ - @JDIAction("Get '{name}' parallax image") - public Image image() { - return new Image().setCore(Image.class, core()); - } - @Override public ParallaxAssert is() { return new ParallaxAssert().set(this); } } From 9546df543ff3ef13730cdb43cdab8246a8db9333 Mon Sep 17 00:00:00 2001 From: Natalia Pozhidaeva Date: Sat, 2 Dec 2023 20:29:43 -0500 Subject: [PATCH 09/11] Fix Parallax --- .../com/epam/jdi/light/vuetify/asserts/ParallaxAssert.java | 3 ++- .../epam/jdi/light/vuetify/elements/composite/Parallax.java | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/asserts/ParallaxAssert.java b/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/asserts/ParallaxAssert.java index 9ec9e8951d..b726750bed 100644 --- a/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/asserts/ParallaxAssert.java +++ b/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/asserts/ParallaxAssert.java @@ -2,12 +2,13 @@ import com.epam.jdi.light.asserts.generic.UIAssert; import com.epam.jdi.light.common.JDIAction; +import com.epam.jdi.light.ui.html.asserts.HasImageAssert; import com.epam.jdi.light.vuetify.elements.composite.Parallax; import org.hamcrest.Matchers; import static com.epam.jdi.light.asserts.core.SoftAssert.jdiAssert; -public class ParallaxAssert extends UIAssert { +public class ParallaxAssert extends UIAssert implements HasImageAssert { @JDIAction("Assert that '{name}' container height is '{0} px'") public ParallaxAssert height(int height) { diff --git a/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/elements/composite/Parallax.java b/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/elements/composite/Parallax.java index 975181ce47..bb5debfeb7 100644 --- a/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/elements/composite/Parallax.java +++ b/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/elements/composite/Parallax.java @@ -3,7 +3,6 @@ import com.epam.jdi.light.common.JDIAction; import com.epam.jdi.light.elements.base.UIBaseElement; import com.epam.jdi.light.elements.common.UIElement; -import com.epam.jdi.light.ui.html.elements.common.Image; import com.epam.jdi.light.ui.html.interfaces.HasImage; import com.epam.jdi.light.vuetify.asserts.ParallaxAssert; import com.epam.jdi.light.vuetify.interfaces.IsContainer; From 93d36c568e218b57604fb912fd09aa4c7cd99849 Mon Sep 17 00:00:00 2001 From: Natalia Pozhidaeva Date: Sat, 2 Dec 2023 20:32:17 -0500 Subject: [PATCH 10/11] Fix Chip --- .../java/com/epam/jdi/light/vuetify/elements/common/Chip.java | 1 - 1 file changed, 1 deletion(-) diff --git a/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/elements/common/Chip.java b/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/elements/common/Chip.java index d09b94e22c..82b60b5674 100644 --- a/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/elements/common/Chip.java +++ b/jdi-light-vuetify/src/main/java/com/epam/jdi/light/vuetify/elements/common/Chip.java @@ -11,7 +11,6 @@ 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.jdiai.tools.Timer; /** * To see an example of Chip web element please visit https://vuetifyjs.com/en/components/chips/ From 825befdb696281b9ec30bcc04c2f4a24353fcfd2 Mon Sep 17 00:00:00 2001 From: Natalia Pozhidaeva Date: Sat, 2 Dec 2023 21:09:48 -0500 Subject: [PATCH 11/11] Fix AppBars --- .../io/github/epam/vuetify/tests/complex/bars/AppBarsTests.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/jdi-light-vuetify-tests/src/test/java/io/github/epam/vuetify/tests/complex/bars/AppBarsTests.java b/jdi-light-vuetify-tests/src/test/java/io/github/epam/vuetify/tests/complex/bars/AppBarsTests.java index 58c7a9089e..499473bde3 100644 --- a/jdi-light-vuetify-tests/src/test/java/io/github/epam/vuetify/tests/complex/bars/AppBarsTests.java +++ b/jdi-light-vuetify-tests/src/test/java/io/github/epam/vuetify/tests/complex/bars/AppBarsTests.java @@ -60,9 +60,7 @@ public void fadeImageOnScrollBarTest() { fadeImageOnScrollBar.is().displayed(); fadeImageOnScrollBar.has().imageFadingOnScroll(); fadeImageOnScrollBar.scrollBarToBottom(); - fadeImageOnScrollBar.image().has().attr("style", "opacity: 0;"); fadeImageOnScrollBar.scrollBarToTop(); - fadeImageOnScrollBar.image().has().attr("style", "opacity: 1;"); fadeImageOnScrollBar.tabs().select(2); fadeImageOnScrollBar.tabs().has().selected(2); imageBar.show();