Skip to content

Commit

Permalink
#5463 fixing messages
Browse files Browse the repository at this point in the history
  • Loading branch information
pnatashap committed May 1, 2024
1 parent 07450ee commit b093619
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import io.github.com.custom.AdvancedCombobox;

public class ComboboxPage extends VuetifyPage {
// @todo #5463 Check if JDICombobox annotation, now the root value is not correct
@JDICombobox(
root = "#AutofocusCombobox div[role ='combobox']",
listItems = "//ancestor::div[@id = 'app']//div[contains(@class, 'v-autocomplete__content')]//div[@class='v-list-item__title']")
Expand Down Expand Up @@ -99,7 +100,7 @@ public class ComboboxPage extends VuetifyPage {
"//div[@class='v-list-item__title']")
public static Combobox hideDetailsCombobox1;
@JDICombobox(
root = "#HideDetailsCombobox .col-6:nth-child(6) [role='combobox']",
root = "#HideDetailsCombobox .col-6:nth-child(6) .v-select",
listItems = "//ancestor::div[@id = 'app']//div[contains(@class, 'v-autocomplete__content')]" +
"//div[@class='v-list-item__title']")
public static Combobox errorMessageCombobox;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@
/**
* To see example of Combobox web element please visit https://v2.vuetifyjs.com/en/components/combobox/
*/

// @todo #5463 Refactor element, root element is element with class v-autocomplete
// According to the docs The v-combobox component is a v-autocomplete that
// allows the user to enter values that do not exist within the provided items.
// May be it should inherit from autocomplete
public class Combobox extends UIBaseElement<ComboboxAssert> implements ISetup, IsClearable, IsMultiple,
IsReverse, IsSingleLine, IsFilled, IsLoading, IsReadOnly, HasMessages, IsDense, IsOutlined, IsSolo,
IsFullWidth, HasColor, HasTheme, IsFlat, HasMeasurement, HasRounded, IsShaped, HasDetailsHidden, IsVuetifyInput {
Expand All @@ -56,7 +59,6 @@ public class Combobox extends UIBaseElement<ComboboxAssert> implements ISetup, I
protected String inputLocator = "div input[type='text']";
protected String expandLocator = "div .v-input__append-inner";
protected String labelLocator = ".v-label";
protected String messageLocator = "//following::div[@class = 'v-messages__message']";
protected String counterLocator = "//following::div[contains(@class, 'v-counter')]";
protected String errorMessageLocator = "//following::div[contains(@class, 'error--text')]"
+ "//div[@class = 'v-messages__message']";
Expand Down Expand Up @@ -130,17 +132,6 @@ public Label label() {
return new Label().setCore(Label.class, core().find(labelLocator));
}

@Override
public List<UIElement> messages() {
return messages(messageLocator);
}

@Override
@JDIAction("Get '{name}' messages text")
public List<String> messagesText() {
return messagesText(messageLocator);
}

@Override
@JDIAction("Get '{name}' error messages")
public List<String> errorMessagesText() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public class TextField extends UIBaseElement<TextFieldAssert>
implements HasLabel, HasPlaceholder, IsInput, HasClick, HasColor, HasIcon, HasMeasurement, HasMessages,
HasRounded, HasTheme, IsClearable, IsDense, IsFilled, IsFlat, IsLoading, IsOutlined, IsReadOnly, IsReverse,
IsShaped, IsSingleLine, IsSolo, IsFullWidth, HasDetailsHidden {

private static final String DISABLED_CLASS = "v-input--is-disabled";
private static final String FOCUSED_CLASS = "v-input--is-focused";

Expand All @@ -59,7 +60,6 @@ public class TextField extends UIBaseElement<TextFieldAssert>
private String prefixLocator = ".v-text-field__prefix";
private String suffixLocator = ".v-text-field__suffix";
private String detailsLocator = ".v-text-field__details";
private String messageLocator = ".v-messages__message";
private String loaderLocator = "div [role='progressbar']";

public TextField() {
Expand Down Expand Up @@ -100,17 +100,6 @@ public UIElement slot() {
return core().find(slotLocator);
}

/** Get the message element of the TextField.
*
* @return message as {@link UIElement}
*/
@Override
@JDIAction("Get '{name}' message")
public List<UIElement> messages() {
return details().finds(messageLocator);
}

// @todo #5320 Check this method, not clear why should we have external locator
@Override
@JDIAction("Get '{name}' messages text by locator '{0}'")
public List<String> messagesText(String locator) {
Expand Down Expand Up @@ -313,6 +302,11 @@ public ProgressLinear loader() {
return new ProgressLinear().setCore(ProgressLinear.class, core().find(loaderLocator));
}

@Override
public void click() {
core().find(inputLocator).click();
}

@Override
public TextFieldAssert is() {
return new TextFieldAssert().set(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ default int messagesCount() {
*/
@JDIAction("Check that '{name}' has error messages")
default boolean hasErrorMessages() {
return errorMessagesCount() > 0;
return !errorMessagesText().isEmpty();
}

/**
Expand Down Expand Up @@ -96,7 +96,7 @@ default int errorMessagesCount() {
*/
@JDIAction("Check that '{name}' has success messages")
default boolean hasSuccessMessages() {
return successMessagesCount() > 0;
return !successMessagesText().isEmpty();
}

/**
Expand Down

0 comments on commit b093619

Please sign in to comment.