Skip to content

Commit

Permalink
Merge pull request #5492 from jdi-testing/master
Browse files Browse the repository at this point in the history
sync with master
  • Loading branch information
pnatashap authored Apr 25, 2024
2 parents 8955cee + 01cb8c3 commit d87901b
Show file tree
Hide file tree
Showing 89 changed files with 662 additions and 691 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.github.epam.html.tests.elements.complex;

import io.github.epam.TestsInit;
import org.openqa.selenium.By;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

Expand Down Expand Up @@ -66,12 +65,4 @@ public void isValidationTest() {
public void assertValidationTest() {
odds.assertThat().values(contains("1", "3", "5", "7"));
}

// @todo #5048 Transform to test, now there is no validation
@Test(enabled = false)
public void problems() {
odds.list();
odds.core().finds(By.xpath("../")).get(1).getTagName();
odds.core().findElements(By.xpath("../"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
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.displaydata.Badge;
import com.epam.jdi.light.material.elements.inputs.ButtonGroup;
import com.epam.jdi.light.material.elements.inputs.Switch;
import com.epam.jdi.light.ui.html.elements.common.Button;

import java.util.List;

Expand All @@ -18,12 +18,8 @@ public class BadgePage extends WebPage {
@UI("#secondaryColorBadge")
public static Badge secondaryColorBadgeContainer;

// @todo #5297 Button should be used from ButtomGruop, not directly as single
@UI(".MuiButtonGroup-root button[aria-label='reduce']")
public static Button buttonReduce;

@UI(".MuiButtonGroup-root button[aria-label='increase']")
public static Button buttonIncrease;
@UI(".MuiButtonGroup-root")
public static ButtonGroup buttons;

@UI("//span[text()='Show Zero']/preceding-sibling::span[contains(@class,'MuiSwitch-root')]")
public static Switch switchShowZero;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@

public class ButtonGroupPage extends WebPage {

// @todo #5297 Check locators, the class is the same is for Button
@UI("div[aria-label = 'outlined primary button group'] .MuiButton-root")
@UI("div[aria-label = 'outlined primary button group'].MuiButtonGroup-root")
public static ButtonGroup basicButtonGroup;

@UI("div[aria-label = 'vertical contained primary button group'] .MuiButton-root")
@UI("div[aria-label = 'vertical contained primary button group'].MuiButtonGroup-root")
public static ButtonGroup verticalButtonGroup;

@UI("div[aria-label = 'split button'] .MuiButton-root")
@UI("div[aria-label = 'split button'].MuiButtonGroup-root")
public static ButtonGroup splitButtonGroup;

@UI("#split-button-menu")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,38 +9,38 @@

public class TextFieldPage extends WebPage {

// @todo #5297 Fix locators for more stable variant
@UI("//input[@id='standard-required']/../..")
@UI("//*[contains(@class, 'MuiTextField-root')][.//input[@id='standard-required']]")
public static TextField requiredTextField;

@UI("//input[@id='standard-disabled']/../..")
@UI("//*[contains(@class, 'MuiTextField-root')][.//input[@id='standard-disabled']]")
public static TextField disabledTextField;

@UI("//input[@id='standard-password-input']/../..")
@UI("//*[contains(@class, 'MuiTextField-root')][.//input[@id='standard-password-input']]")
public static TextField passwordTextField;

@UI("//input[@id='standard-read-only-input']/../..")
@UI("//*[contains(@class, 'MuiTextField-root')][.//input[@id='standard-read-only-input']]")
public static TextField readOnlyTextField;

@UI("//input[@id='standard-number']/../..")
@UI("//*[contains(@class, 'MuiTextField-root')][.//input[@id='standard-number']]")
public static TextField numberTextField;

@UI("//input[@id='standard-search']/../..")
@UI("//*[contains(@class, 'MuiTextField-root')][.//input[@id='standard-search']]")
public static TextField searchTextField;

@UI("//input[@id='standard-helperText']/../..")
@UI("//*[contains(@class, 'MuiTextField-root')][.//input[@id='standard-helperText']]")
public static TextField helperTextTextField;

@UI("//form[@id='formProps']/div[2]/div[contains(@class, 'MuiTextField-root')]")
@UI("//h2[text()='Validation']//following::div[1]/*[contains(@class, 'MuiTextField-root')]")
public static List<TextField> validationTextFields;

@UI("//form[@id='formProps']/div[3]/div[contains(@class, 'MuiTextField-root')]")
@UI("//h2[text()='Multiline']//following::div[1]/*[contains(@class, 'MuiTextField-root')]")
public static List<MultilineTextField> multilineTextFields;

@UI("//form[@id='formProps']/div[4]/div[contains(@class, 'MuiTextField-root')]")
@UI("//h2[text()='Select']//following::div[1]/*[contains(@class, 'MuiTextField-root')]")
public static List<SelectTextField> selectTextFields;

@UI("//form[@id='formProps']/div[5]/div[contains(@class, 'MuiFormControl-root')]")
// @todo #5343 Check that all fields are TextFields, only two of them has such class
@UI("//h2[text()='Input Adornments']//following::div[1]/*[contains(@class, 'MuiFormControl-root')]")
public static List<TextField> inputAdornmentsTextFields;

}
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package io.github.com.pages.navigation;

import com.epam.jdi.light.elements.complex.Menu;
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.navigation.Menu;
import com.epam.jdi.light.ui.html.elements.common.Text;

public class ContextMenuPage extends WebPage {

@UI("p.MuiTypography-root")
public static Text pageText;

// @todo #5297 Check the locator, looks like it points to item, not for Menu
@UI(".MuiMenuItem-root")
@UI(".MuiMenu-list")
public static Menu contextMenuList;
}
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
package io.github.com.pages.navigation;

import com.epam.jdi.light.elements.complex.WebList;
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.inputs.ButtonGroup;
import com.epam.jdi.light.material.elements.inputs.MUIButton;
import com.epam.jdi.light.material.elements.navigation.steppers.MUIStepper;
import com.epam.jdi.light.material.elements.navigation.steppers.MobileStepper;
import com.epam.jdi.light.ui.html.elements.common.Text;


public class StepperPage extends WebPage {

@UI("#simpleStepper")
public static MUIStepper simpleLinearStepper;

@UI("#simpleStepper < * button")
public static ButtonGroup simpleLinearButtons;
public static WebList simpleLinearButtons;

@UI("p.MuiTypography-root")
public static Text activeLinearStepText;

@UI("#nonLinearStepper")
public static MUIStepper nonlinearStepper;
@UI("#nonLinearStepper + div button")
public static ButtonGroup nonLinearButtons;
public static WebList nonLinearButtons;

@UI("#activeNonLinearStep")
public static Text activeNonLinearStepText;
Expand Down
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 @@ -7,8 +7,7 @@

public class BackToTopAppBarPage extends WebPage {

// @todo #5297 Check the locator, looks like it is not for AppBar (or use correct classname)
@UI(".MuiBox-root[1]")
@UI(".MuiAppBar-root")
public static AppBar backToTopAppBar;

@UI("div[role=presentation]")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package io.github.com.pages.surfaces;

import com.epam.jdi.light.elements.complex.Menu;
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.inputs.Switch;
import com.epam.jdi.light.material.elements.navigation.Menu;
import com.epam.jdi.light.material.elements.surfaces.AppBar;

public class SimpleAppBarPage extends WebPage {
Expand All @@ -17,7 +17,7 @@ public class SimpleAppBarPage extends WebPage {
@UI(".MuiAppBar-root[2]")
public static AppBar appBarWithMenu;

@UI(".MuiMenuItem-root")
@UI(".MuiMenu-list")
public static Menu appBarMenuItems;

@UI(".MuiAppBar-root[3]")
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
import static com.epam.jdi.light.material.elements.utils.enums.Position.TOP_RIGHT;
import static io.github.com.StaticSite.badgePage;
import static io.github.com.pages.displaydata.BadgePage.badgeDifferentPosition;
import static io.github.com.pages.displaydata.BadgePage.buttonIncrease;
import static io.github.com.pages.displaydata.BadgePage.buttonReduce;
import static io.github.com.pages.displaydata.BadgePage.buttons;
import static io.github.com.pages.displaydata.BadgePage.dotBadgeContainer;
import static io.github.com.pages.displaydata.BadgePage.secondaryColorBadgeContainer;
import static io.github.com.pages.displaydata.BadgePage.switchShowBadge;
Expand All @@ -31,7 +30,7 @@ public void variousBadgeTest() {
.and().has().text(Matchers.equalTo("1"))
.and().has().position(TOP_RIGHT.toString());

buttonReduce.click();
buttons.button("reduce").click();
secondaryColorBadgeContainer
.has().text(Matchers.equalTo("0"))
.and().is().notVisible();
Expand All @@ -46,7 +45,7 @@ public void variousBadgeTest() {
public void maxValueTest() {
for (int i = 1; i <= 10; i++) {
secondaryColorBadgeContainer.has().text(Matchers.equalTo(String.valueOf(i)));
buttonIncrease.click();
buttons.button("increase").click();
}
secondaryColorBadgeContainer.has().text(Matchers.equalTo("10+"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ public void before() {
dialogPage.isOpened();
}


@Test(dataProviderClass = DialogDataProvider.class, dataProvider = "simpleDialogDataProvider")
// @todo #5341 Closing dialog should not change anything on the page,
// only explicit click on buttons should be used
@Test(enabled = false, dataProviderClass = DialogDataProvider.class, dataProvider = "simpleDialogDataProvider")
public void simpleDialogTest(String titleText, int index, String text) {
simpleDialogButton.click();
simpleDialogButton.dialog().is().displayed();
simpleDialogButton.dialog().is().displayed().and().has().title();
simpleDialogButton.dialog().title().has().text(titleText);
simpleDialogButton.dialog().list().has().size(3);
simpleDialogButton.dialog().list().items().get(index).has().text(text);
Expand All @@ -53,7 +54,8 @@ public void alertDialogTest() {
alertDialogButton.actionText().has().text("Selected: ok");
}

@Test
// @todo #5341 Closing dialog should not change anything on the page, explicit click on buttons should be used
@Test(enabled = false)
public void formDialogsTest() {
final String email = "email@example.com";
formDialogButton.click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,8 @@ public void standardAmountAdornmentTextFieldTests() {
amountAdornmentTextField.has().text(randomString);
}

@Test
// @todo #5343 Check SelectTextField on Select functionality, default locators does not work
@Test(enabled = false)
public void selectTextFieldTest() {
SelectTextField selectTextField = selectTextFields.get(1);
selectTextField.show();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package io.github.epam.material.tests.navigation;

import com.epam.jdi.light.ui.html.elements.common.Button;
import io.github.epam.TestsInit;
import io.github.epam.test.data.MenuDataProvider;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import java.util.Arrays;
import java.util.List;

import static com.jdiai.tools.Timer.waitCondition;
import static io.github.com.StaticSite.contextMenuPage;
import static io.github.com.StaticSite.simpleMenuPage;
import static io.github.com.pages.navigation.ContextMenuPage.contextMenuList;
import static io.github.com.pages.navigation.ContextMenuPage.pageText;
import static io.github.com.pages.navigation.SimpleMenuPage.*;

public class ContextMenuTests extends TestsInit {

private static final List<String> CONTEXT_MENU_ITEMS = Arrays.asList("Copy", "Print", "Highlight", "Email");

@BeforeMethod
public void before() {
contextMenuPage.open();
contextMenuPage.isOpened();
}

@Test
public void contextMenuTest() {
pageText.is().displayed();

pageText.rightClick();
menu.is().displayed().and().has().itemsTexts(CONTEXT_MENU_ITEMS);
contextMenuList.select("Print");
waitCondition(() -> menu.isHidden());
menu.is().hidden();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,9 @@
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import java.util.Arrays;
import java.util.List;

import static com.jdiai.tools.Timer.waitCondition;
import static io.github.com.StaticSite.contextMenuPage;
import static io.github.com.StaticSite.simpleMenuPage;
import static io.github.com.pages.navigation.ContextMenuPage.contextMenuList;
import static io.github.com.pages.navigation.ContextMenuPage.pageText;
import static io.github.com.pages.navigation.SimpleMenuPage.iconMenuButton;
import static io.github.com.pages.navigation.SimpleMenuPage.menu;
import static io.github.com.pages.navigation.SimpleMenuPage.scrollMenuButton;
Expand All @@ -26,8 +21,6 @@

public class MenuTests extends TestsInit {

private static final List<String> CONTEXT_MENU_ITEMS = Arrays.asList("Copy", "Print", "Highlight", "Email");

@BeforeMethod
public void before() {
simpleMenuPage.open();
Expand Down Expand Up @@ -90,17 +83,4 @@ public void scrollMenuTest() {
menu.select(option);
selectedScrollMenuItem.has().text("Selected menu: " + option);
}

@Test
public void contextMenuTest() {
contextMenuPage.open();
contextMenuPage.isOpened();
pageText.is().displayed();

pageText.rightClick();
menu.is().displayed().and().has().itemsTexts(CONTEXT_MENU_ITEMS);
contextMenuList.select("Print");
waitCondition(() -> menu.isHidden());
menu.is().hidden();
}
}
Loading

0 comments on commit d87901b

Please sign in to comment.