Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#5431 add assertions for Dialog #5469

Merged
merged 1 commit into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public void before() {
@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 Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
import com.epam.jdi.light.asserts.generic.UIAssert;
import com.epam.jdi.light.common.JDIAction;
import com.epam.jdi.light.material.elements.feedback.Dialog;
import org.hamcrest.Matcher;
import org.hamcrest.Matchers;

import static com.epam.jdi.light.asserts.core.SoftAssert.jdiAssert;

/**
* Assertions for {@link Dialog}
*/
// @todo #5341 Assertions to add: have title, have content, have actions
public class DialogAssert extends UIAssert<DialogAssert, Dialog> {

/**
Expand Down Expand Up @@ -58,4 +58,29 @@ public DialogAssert displayed() {
jdiAssert(element().isDisplayed(), Matchers.is(true), "Dialog is not displayed");
return this;
}

public DialogAssert title() {
jdiAssert(element().title().isExist(), Matchers.is(true), "Dialog title is not exist");
return this;
}

public DialogAssert title(Matcher<String> matcher) {
jdiAssert(element().title().text(), matcher);
return this;
}

public DialogAssert content() {
jdiAssert(element().content().isExist(), Matchers.is(true), "Dialog content is not exist");
return this;
}

public DialogAssert actions() {
jdiAssert(element().actionButtons().isExist(), Matchers.is(true), "Dialog actions is not exist");
return this;
}

public DialogAssert noActions() {
jdiAssert(element().actionButtons().isExist(), Matchers.is(false), "Dialog actions is exist");
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
/**
* Assertions for {@link ButtonGroup}.
*/
// #todo 5431 add assertion for button text is exist
public class ButtonGroupAssert extends UISelectAssert<ButtonGroupAssert, ButtonGroup> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,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.material.asserts.feedback.DialogAssert;
import com.epam.jdi.light.material.elements.displaydata.list.SimpleList;
import com.epam.jdi.light.material.elements.inputs.ButtonGroup;
Expand Down Expand Up @@ -42,11 +43,15 @@ public Text title() {
*
* @return list with items within dialog as {@link SimpleList}
*/
// @todo #5431 looks like list is not a required part of Dialog, should be removed
@JDIAction("Get '{name}' list items")
public SimpleList list() {
return new SimpleList().setCore(SimpleList.class, core().find(".MuiList-root"));
}

public UIElement content() {
return core().find(".MuiDialogContent-root");
}
/**
* Gets the text content of this dialog.
*
Expand All @@ -73,6 +78,7 @@ public ButtonGroup actionButtons() {
*
* @return radioButtons of this dialog as {@link RadioButtons}
*/
// @todo #5431 radiobuttons is not a part of standard dialog, should be removed
@JDIAction("Get '{name}' radio buttons")
public RadioButtons radioButtons() {
return new RadioButtons().setCore(RadioButtons.class, core().find(".MuiRadio-root"));
Expand Down