Skip to content

Commit

Permalink
Merge pull request #5453 from jdi-testing/5318
Browse files Browse the repository at this point in the history
#5318 refactor SlideGroup
  • Loading branch information
pnatashap authored Apr 12, 2024
2 parents 4f96915 + 9ad153e commit 82a1d4f
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 51 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package io.github.epam.vuetify.tests.complex;

import io.github.epam.TestsInit;
import io.github.epam.vuetify.tests.data.SlideGroupTestsData;
import java.util.List;
import org.hamcrest.Matchers;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

Expand All @@ -18,10 +17,6 @@

public class SlideGroupsTests extends TestsInit {

private final String minusIcon = ".v-icon.mdi-minus";

private final String plusIcon = ".v-icon.mdi-plus";

@BeforeClass
public void before() {
slideGroupsPage.open();
Expand All @@ -43,7 +38,6 @@ public void activeClassSlideGroupTests() {

@Test(enabled = false, description="Test checks slide group feature 'center-active'")
public void centerActiveSlideGroupTests() {
List<Integer> slidesPositions = new SlideGroupTestsData().centerActiveSlideGroupTestData();
centerActiveSlideGroup.show();
centerActiveSlideGroup.hasAttribute("style");
centerActiveSlideGroup.is().displayed();
Expand All @@ -62,13 +56,12 @@ public void centerActiveSlideGroupTests() {
}
}

@Test(description="Test checks slide group feature: 'icon' and theme = 'light'")
public void customIconsSlideGroupTests() {
@Test(description="Test checks slide group feature: theme = 'light'")
public void themeSlideGroupTests() {
customIconsSlideGroup.show();
customIconsSlideGroup.is().displayed();
customIconsSlideGroup.has().iconSlidesVisible(minusIcon);
customIconsSlideGroup.has().iconSlidesVisible(plusIcon);

// @todo #5318 content can have links, so wee need additional method to select
customIconsSlideGroup.slideByIndex(1).click();
customIconsSlideGroup.has().slideSelected(1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ public static void centerActiveTabsTest() {
@Test(description = "Test checks tabs custom icons")
public static void customIconsTabsTest() {
customIconsTabs.show();
clickWhileClickable(customIconsTabs.navigation().getNextButton());
clickWhileClickable(customIconsTabs.navigation().getPreviousButton());
clickWhileClickable(customIconsTabs.navigation().nextButton());
clickWhileClickable(customIconsTabs.navigation().previousButton());
customIconsTabs.icons().get(0).is().visible();
customIconsTabs.icons().get(0).has().type(ARROW_LEFT_BOLD_BOX_OUTLINE.mdi());
customIconsTabs.icons().get(1).is().visible();
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,6 @@ public SlideGroupAssert slideNotSelected(int index) {
return this;
}

// @todo #5048 Check method functionality, there is no specific for any icon functionality
@JDIAction(value = "Assert that '{name}' icon is visible", isAssert = true)
public SlideGroupAssert iconSlidesVisible(String by) {
jdiAssert(element().find(by).isDisplayed(), Matchers.is(true), "SlideGroup icons are not displayed");
return this;
}

@JDIAction(value = "Assert that '{name}' icon is visible", isAssert = true)
public SlideGroupAssert previousButtonActive() {
jdiAssert(element().isPreviousButtonDisabled(), Matchers.is(false), "Previous Button is disabled");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,26 @@
import com.epam.jdi.light.vuetify.elements.common.VuetifyButton;
import com.epam.jdi.light.vuetify.interfaces.HasIcon;
import com.epam.jdi.light.vuetify.interfaces.HasTheme;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;

import java.util.List;

/**
* To see an example of SlideGroup web element please visit https://v2.vuetifyjs.com/en/components/slide-groups/
*/

public class SlideGroup extends UIBaseElement<SlideGroupAssert> implements HasIcon, HasTheme {

@JDIAction("Get '{name}'s 'next slides' button")
public VuetifyButton getNextButton() {
public VuetifyButton nextButton() {
return new VuetifyButton(core().find(".v-slide-group__next"));
}

@JDIAction("Get '{name}'s 'previous slides' button")
public VuetifyButton getPreviousButton() {
public VuetifyButton previousButton() {
return new VuetifyButton(core().find(".v-slide-group__prev"));
}

@JDIAction("Get '{name}' slide by index")
public Card slideByIndex(int index) {
return this.finds(".v-card").get(index).with(Card.class);
return this.slides().get(index).with(Card.class);
}

@JDIAction("Get if slide is selected in {name}")
Expand All @@ -39,14 +35,9 @@ public boolean slideIsSelected(int index) {
return cardClass.contains("success") || cardClass.contains("active");
}

@JDIAction("Click on 'next slides' button")
public void clickOnNextButton() {
getNextButton().click();
}

@JDIAction("Click on 'next slides' button")
public boolean isNextButtonDisabled() {
return getNextButton().hasClass("v-slide-group__next--disabled");
return nextButton().hasClass("v-slide-group__next--disabled");
}

@JDIAction("Click on 'next slides' button")
Expand All @@ -56,17 +47,21 @@ public boolean isNextButtonActive() {

@JDIAction("Click on 'previous slides' button")
public boolean isPreviousButtonDisabled() {
return getPreviousButton().hasClass("v-slide-group__prev--disabled");
return previousButton().hasClass("v-slide-group__prev--disabled");
}

public WebList getSlides() {
// @todo #5318 Slides can be not only v-cards, but any element,
// we should receive childs for .v-slide-group__content
// Check the page from the header, there is an example with buttons
@JDIAction("Get {name}'s slides")
public WebList slides() {
return this.finds(".v-card");
}

@JDIAction("Get position of the '{name}'")
public int position() {
int index = 0;
for (WebElement slideCard : getSlides()) {
for (WebElement slideCard : slides()) {
index++;
if (slideCard.getAttribute("class").contains("active")) {
return index;
Expand All @@ -75,10 +70,6 @@ public int position() {
return -1;
}

public List<WebElement> getAllSlides(By by) {
return core().findElements(by);
}

public SlideGroupAssert is() {
return new SlideGroupAssert().set(this);
}
Expand Down

0 comments on commit 82a1d4f

Please sign in to comment.