From 64851fbaaa97a4df6a2ddbf56e0704cff733829b Mon Sep 17 00:00:00 2001 From: Kira Vlasova Date: Wed, 17 Apr 2024 16:52:26 +0200 Subject: [PATCH] 4908 fix comments --- .../elements/complex/FormFieldTests.java | 6 ----- .../elements/interfaces/IFormField.java | 27 +++++-------------- 2 files changed, 7 insertions(+), 26 deletions(-) diff --git a/jdi-light-angular-tests/src/test/java/io/github/epam/angular/tests/elements/complex/FormFieldTests.java b/jdi-light-angular-tests/src/test/java/io/github/epam/angular/tests/elements/complex/FormFieldTests.java index 52d7aa2ba3..1891cccf94 100644 --- a/jdi-light-angular-tests/src/test/java/io/github/epam/angular/tests/elements/complex/FormFieldTests.java +++ b/jdi-light-angular-tests/src/test/java/io/github/epam/angular/tests/elements/complex/FormFieldTests.java @@ -39,8 +39,6 @@ public void before() { @Test public void simpleFormFieldTest() { simpleFormFieldInput.show(); - simpleFormFieldTextarea.show(); - simpleFormFieldSelect.show(); simpleFormFieldInput.has().label("Input"); simpleFormFieldTextarea.has().label("Textarea"); simpleFormFieldSelect.has().label("Select"); @@ -64,8 +62,6 @@ public void simpleFormFieldTest() { @Test public void formFieldWithLabelTest() { formFieldWithLabelInputSimplePlaceholder.show(); - formFieldWithLabelInputSimplePlaceholderAndLabel.show(); - formFieldWithLabelSelect.show(); formFieldWithLabelInputSimplePlaceholder.has().placeholder("Simple placeholder"); formFieldWithLabelInputSimplePlaceholderAndLabel.has().placeholder("Simple placeholder"); formFieldWithLabelInputSimplePlaceholderAndLabel.has().label("Both a label and a placeholder"); @@ -135,7 +131,6 @@ public void formFieldsThemesTest() { @Test public void formFieldsRequiredTest() { formFieldWithLabelSelect.show(); - hideRequiredMarker.show(); formFieldWithLabelSelect.is().required(); hideRequiredMarker.click(); formFieldWithLabelSelect.is().notRequired(); @@ -144,7 +139,6 @@ public void formFieldsRequiredTest() { @Test public void formFieldsFloatLabelTest() { formFieldWithLabelSelect.show(); - alwaysFloatLabel.show(); alwaysFloatLabel.click(); formFieldWithLabelSelect.has().alwaysFloatLabel(); } diff --git a/jdi-light-angular/src/main/java/com/epam/jdi/light/angular/elements/interfaces/IFormField.java b/jdi-light-angular/src/main/java/com/epam/jdi/light/angular/elements/interfaces/IFormField.java index 8e174510c5..980f5abcc5 100644 --- a/jdi-light-angular/src/main/java/com/epam/jdi/light/angular/elements/interfaces/IFormField.java +++ b/jdi-light-angular/src/main/java/com/epam/jdi/light/angular/elements/interfaces/IFormField.java @@ -35,28 +35,15 @@ default String error() { return core().find(By.cssSelector("mat-error")).getText(); } - @JDIAction("Click icon in '{name}'") - default void clickIcon() { + @JDIAction("Get icon with '{name}'") + default UIElement icon() { WebElement element = core().find(By.xpath("//mat-icon/ancestor::button")); - UIElement actualElement = new UIElement(element); - actualElement.click(); - } - - @JDIAction("Get mat-icon text in '{name}'") - default String icon() { - WebElement element = core().find(By.cssSelector("mat-icon")); - UIElement actualElement = new UIElement(element); - return actualElement.getText(); - } - - @JDIAction("Get appearance attribute in '{name}'") - default String appearance() { - return core().attr("appearance"); + return new UIElement(element); } @JDIAction("Check if '{name}' is required") default boolean isRequired() { - return core().find(By.cssSelector("span")).attr("class").contains("mat-mdc-form-field-required-marker"); + return core().find(By.cssSelector("span.mat-mdc-form-field-required-marker")).isExist(); } @JDIAction("Check if '{name}' has always float label") @@ -65,13 +52,13 @@ default boolean hasAlwaysFloatLabel() { } @Override - @JDIAction("Check if '{name}' is disabled") - default boolean isDisabled() { + @JDIAction("Check if '{name}' is enabled") + default boolean isEnabled() { return core().attr("class").contains("mat-form-field-disabled"); } @JDIAction("Check if select field '{name}' has dynamic subscriptSizing") default boolean isDynamicSubscriptSizing() { - return !core().finds("//div[contains(@class,'mat-mdc-form-field-subscript-dynamic-size')]").getWebElements().isEmpty(); + return core().find("//div[contains(@class,'mat-mdc-form-field-subscript-dynamic-size')]").isExist(); } }