Skip to content

Commit

Permalink
Merge pull request #5486 from jdi-testing/5347
Browse files Browse the repository at this point in the history
#5347 change locators
  • Loading branch information
pnatashap authored Apr 24, 2024
2 parents 64c778f + bb9782f commit 3150f5b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
package io.github.com.pages.navigation;

import com.epam.jdi.light.elements.common.UIElement;
import com.epam.jdi.light.elements.composite.WebPage;
import com.epam.jdi.light.elements.pageobjects.annotations.locators.UI;
import com.epam.jdi.light.material.elements.layout.Container;
import com.epam.jdi.light.material.elements.navigation.Tabs;

public class TabPage extends WebPage {

@UI("h2+div[1] .MuiTabs-root")
@UI("//h2[text()='Simple tabs']/following::div//div[@class='MuiTabs-root']")
public static Tabs simpleTabs;

// @todo #5297 Fix locator to be more stable for layout
@UI("//div[./h2[text()='Simple tabs']]/div[1]/div[@role='tabpanel' and not(@hidden)]")
public static Container simplePanels;
// @todo #5347 Box control should be added as a Container https://v4.mui.com/api/container/
// test page also exists https://jdi-testing.github.io/jdi-light/material/box_layout
@UI("//h2[text()='Simple tabs']/following::div/div[@role='tabpanel' and not(@hidden)]")
public static UIElement simplePanels;

@UI("h2+div[2] .MuiTabs-root")
@UI("//h2[text()='Scrollable tabs']/following::div//div[@class='MuiTabs-root']")
public static Tabs scrollableTabs;

@UI("h2+div[3] .MuiTabs-root")
@UI("//h2[text()='Prevent scroll buttons']/following::div//div[@class='MuiTabs-root']")
public static Tabs preventScrollTabs;

@UI("h2+div[4] .MuiTabs-root")
@UI("//h2[text()='Vertical tab']/following::div//div[contains(@class,'MuiTabs-root')]")
public static Tabs verticalTabs;
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public void before() {

@Test
public void simpleTabTest() {
simpleTabs.show();
simpleTabs.has().values(equalTo(asList("ITEM ONE", "ITEM TWO", "ITEM THREE", "ITEM FOUR", "ITEM FIVE")));
simpleTabs.has().selected(1).and().value("ITEM ONE");
simpleTabs.select(2);
Expand All @@ -31,6 +32,7 @@ public void simpleTabTest() {

@Test
public void scrollableTabTest() {
scrollableTabs.show();
scrollableTabs.has().values(equalTo(asList("ITEM ONE", "ITEM TWO", "ITEM THREE", "ITEM FOUR", "ITEM FIVE",
"ITEM SIX", "ITEM SEVEN", "ITEM EIGHT", "ITEM NINE", "ITEM TEN", "ITEM ELEVEN")));
scrollableTabs.select(1);
Expand All @@ -45,6 +47,7 @@ public void scrollableTabTest() {

@Test
public void preventScrollTest() {
preventScrollTabs.show();
preventScrollTabs.select(1);
preventScrollTabs.has().selected(1);
preventScrollTabs.select(7);
Expand All @@ -54,8 +57,7 @@ public void preventScrollTest() {

@Test
public void verticalTabTest() {
scrollableTabs.has().values(equalTo(asList("ITEM ONE", "ITEM TWO", "ITEM THREE", "ITEM FOUR", "ITEM FIVE",
"ITEM SIX", "ITEM SEVEN", "ITEM EIGHT", "ITEM NINE", "ITEM TEN", "ITEM ELEVEN")));
verticalTabs.show();
verticalTabs.select(1);
verticalTabs.has().selected(1).and().value("ITEM ONE");
verticalTabs.select(7);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,14 @@ public String imageLocator() {
public Typography typography() {
return new Typography().setCore(Typography.class, core().find(".MuiTypography-root"));
}

@Override
public boolean isDisabled() {
return core().hasClass("Mui-disabled");
}

@Override
public boolean isEnabled() {
return !this.isDisabled();
}
}

0 comments on commit 3150f5b

Please sign in to comment.