Skip to content

Commit

Permalink
4911-refactoringRadioButCommentFixed
Browse files Browse the repository at this point in the history
  • Loading branch information
MayaElf committed Oct 26, 2023
1 parent a25a035 commit 5721e73
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.github.epam.angular.tests.elements.complex;

import io.github.epam.TestsInit;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import static com.epam.jdi.light.angular.elements.enums.AngularColors.PRIMARY;
Expand All @@ -21,7 +21,7 @@ public class RadioButtonTests extends TestsInit {
private static final String accent = "accent";
private static final String warn = "warn";

@BeforeMethod
@BeforeClass
public void before() {
radioButtonPage.open();
waitCondition(() -> radioButtonPage.isOpened());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,50 +8,50 @@

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

public class RadioButtonsAssert extends UISelectAssert<RadioButtonsAssert, RadioGroup> {
public class RadioGroupAssert extends UISelectAssert<RadioGroupAssert, RadioGroup> {

@JDIAction("'{name}' is checked when '{0}' radio button value is provided")
public RadioButtonsAssert checked(String value) {
public RadioGroupAssert checked(String value) {
jdiAssert(element().isChecked(value), Matchers.is(true), "Radio button is not checked");
return this;
}

@JDIAction("'{name}' is not checked when '{0}' radio button value is provided")
public RadioButtonsAssert notChecked(String value) {
public RadioGroupAssert notChecked(String value) {
jdiAssert(element().isChecked(value), Matchers.is(false), "Radio button is checked");
return this;
}

@JDIAction("'{name}' label is in before position")
public RadioButtonsAssert isGroupBeforePosition() {
public RadioGroupAssert isGroupBeforePosition() {
jdiAssert(element().isGroupBeforePosition(), Matchers.is(true),
"Radio button group label is not in before position");
return this;
}

@JDIAction("'{name}' element label is in before position")
public RadioButtonsAssert isGroupElementBeforePosition(String value) {
public RadioGroupAssert isGroupElementBeforePosition(String value) {
jdiAssert(element().isGroupElementBeforePosition(value), Matchers.is(true),
"Radio button group element label is not in before position");
return this;
}

@JDIAction("'{name}' is disabled")
public RadioButtonsAssert isDisabled() {
public RadioGroupAssert isDisabled() {
jdiAssert(element().isDisabled(), Matchers.is(true),
"Radio button group is not disabled");
return this;
}

@JDIAction("'{name}' is disabled")
public RadioButtonsAssert isRequired() {
public RadioGroupAssert isRequired() {
jdiAssert(element().isRequired(), Matchers.is(true),
"Radio button group is not required");
return this;
}

@JDIAction("Assert that '{name}' color is '{0}'")
public RadioButtonsAssert color(AngularColors expectedColor, String value) {
public RadioGroupAssert color(AngularColors expectedColor, String value) {
jdiAssert(element().color(value).getColor(), Matchers.is(expectedColor.getColor()));
return this;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.epam.jdi.light.angular.elements.complex;

import com.epam.jdi.light.angular.asserts.RadioButtonsAssert;
import com.epam.jdi.light.angular.asserts.RadioGroupAssert;
import com.epam.jdi.light.angular.elements.enums.AngularColors;
import com.epam.jdi.light.asserts.generic.UISelectAssert;
import com.epam.jdi.light.common.JDIAction;
Expand All @@ -13,7 +13,7 @@
* To see an example of RadioButtons web element please visit https://material.angular.io/components/radio/overview.
*/

public class RadioGroup extends UIListBase<UISelectAssert<RadioButtonsAssert, RadioGroup>> {
public class RadioGroup extends UIListBase<UISelectAssert<RadioGroupAssert, RadioGroup>> {

@JDIAction("Click '{name}' button with tag value '{0}'")
public void click(String value) {
Expand All @@ -25,7 +25,8 @@ public boolean isChecked(String value) {
return getRadioButtonByTagValue(value).attr("class").contains("mat-mdc-radio-checked");
}

private UIElement getRadioButtonByTagValue(String value) {
@JDIAction("Get radio button by tag value {0}")
public UIElement getRadioButtonByTagValue(String value) {
UIElement element = null;
for (UIElement e : getRadioButtons()) {
if (e.find("input").attr("value").equalsIgnoreCase(value)) {
Expand All @@ -46,7 +47,7 @@ public AngularColors color(String value) {
return AngularColors.ACCENT;
}

@JDIAction("'{name}'label is in before position")
@JDIAction("'{name}' label is in before position")
public boolean isGroupBeforePosition() {
return core().attr("labelposition").equalsIgnoreCase("before");
}
Expand All @@ -56,19 +57,19 @@ public boolean isGroupElementBeforePosition(String value) {
return getRadioButtonByTagValue(value).attr("labelposition").equalsIgnoreCase("before");
}

@JDIAction("'{name}'is disabled")
@JDIAction("'{name}' is disabled")
public boolean isDisabled() {
return core().hasAttribute("disabled");
}

@JDIAction("'{name}'is required")
@JDIAction("'{name}' is required")
public boolean isRequired() {
return core().hasAttribute("required");
}

@Override
public RadioButtonsAssert is() {
return new RadioButtonsAssert().set(this);
public RadioGroupAssert is() {
return new RadioGroupAssert().set(this);
}

private WebList getRadioButtons() {
Expand Down

0 comments on commit 5721e73

Please sign in to comment.