Skip to content

Commit

Permalink
Merge branch 'master' into angular_rework_development
Browse files Browse the repository at this point in the history
  • Loading branch information
pnatashap committed Dec 3, 2023
2 parents 56d22a0 + 54d97e1 commit 98b9822
Show file tree
Hide file tree
Showing 19 changed files with 91 additions and 90 deletions.
16 changes: 7 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 }}
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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<A, E extends HasImage> extends IBaseAssert<HasImage> {

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;
}

}
Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
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.
*
* @return image of the element as {@link Image}
*/
@JDIAction("Get '{name}' image")
default Image image() {
return new Image().setCore(Image.class, find("img"));
return new Image().setCore(Image.class, find(imageLocator()));
}

/**
* Checks that image or background image is displayed.
*
* @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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -16,7 +16,7 @@

public class AvatarTests extends TestsInit {

@BeforeMethod
@BeforeClass
public void beforeTest() {
avatarPage.open();
avatarPage.isOpened();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -13,7 +14,8 @@
/**
* Assertions for {@link Avatar}.
*/
public class AvatarAssert extends UIAssert<AvatarAssert, Avatar> implements ITextAssert<AvatarAssert> {
public class AvatarAssert extends UIAssert<AvatarAssert, Avatar> implements ITextAssert<AvatarAssert>,
HasImageAssert<AvatarAssert, Avatar> {

@Override
@JDIAction("Assert that '{name}' text {0}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<GridListTileAssert, GridListTile> {
public class GridListTileAssert extends UIAssert<GridListTileAssert, GridListTile> implements HasImageAssert<GridListTileAssert, GridListTile> {

public GridListTileAssert alternativeImageText(String alt) {
jdiAssert(element().image().alt(), Matchers.is(alt));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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')]";
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<GridListTileAssert> implements HasImage {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand All @@ -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)")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<ParallaxAssert, Parallax> {
public class ParallaxAssert extends UIAssert<ParallaxAssert, Parallax> implements HasImageAssert<ParallaxAssert, Parallax> {

@JDIAction("Assert that '{name}' container height is '{0} px'")
public ParallaxAssert height(int height) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand All @@ -20,10 +19,10 @@
public class Chip extends UIBaseElement<ChipAssert> 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() {
Expand All @@ -38,7 +37,7 @@ public boolean isEnabled() {

@JDIAction("Get '{name}' content")
public UIElement getContent() {
return find(CONTENT);
return find(CONTENT_LOCATOR);
}

@JDIAction("Get '{name}' text")
Expand All @@ -48,7 +47,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")
Expand All @@ -63,7 +62,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
Expand All @@ -72,10 +71,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")
Expand Down
Loading

0 comments on commit 98b9822

Please sign in to comment.