File tree Expand file tree Collapse file tree 3 files changed +17
-14
lines changed
jdi-light-angular-tests/src/test/java/io/github/epam/angular/tests/elements/common
jdi-light-angular/src/main/java/com/epam/jdi/light/angular Expand file tree Collapse file tree 3 files changed +17
-14
lines changed Original file line number Diff line number Diff line change 1818
1919public class SlideToggleTests extends TestsInit {
2020
21+ private static final String SLIDE_ME = "Slide me!" ;
22+
2123 @ BeforeClass
2224 public void before () {
2325 slideTogglePage .open ();
@@ -66,8 +68,8 @@ public void resultToggleDisableTest() {
6668 public void labelButtonTogglePositionTest () {
6769 beforeLabelPositionRadioButton .click ();
6870 resultSlideToggle .has ().labelBeforePosition ();
69- resultSlideToggle .has ().correctLabelsSlideToggleText ( );
71+ resultSlideToggle .has ().labelsSlideToggleText ( SLIDE_ME );
7072 basicSlideToggle .has ().labelAfterPosition ();
71- basicSlideToggle .has ().correctLabelsSlideToggleText ( );
73+ basicSlideToggle .has ().labelsSlideToggleText ( SLIDE_ME );
7274 }
7375}
Original file line number Diff line number Diff line change @@ -26,21 +26,20 @@ public SlideToggleAssert enabled() {
2626 @ JDIAction ("'{name}' element label is in before position" )
2727 public SlideToggleAssert labelBeforePosition () {
2828 jdiAssert (element ().hasLabelBeforePosition (), Matchers .is (true ),
29- "Slide toggle label is not in before position" );
29+ "Slide toggle label is not in before position" );
3030 return this ;
3131 }
3232
3333 @ JDIAction ("'{name}' element label is in after position" )
3434 public SlideToggleAssert labelAfterPosition () {
3535 jdiAssert (element ().hasLabelBeforePosition (), Matchers .is (false ),
36- "Slide toggle label is not in after position" );
36+ "Slide toggle label is not in after position" );
3737 return this ;
3838 }
3939
40- @ JDIAction ("'{name}' element label has correct text" )
41- public SlideToggleAssert correctLabelsSlideToggleText () {
42- jdiAssert (element ().getLabelsSlideToggleText (), Matchers .is ("Slide me!" ),
43- "Slide toggle label has incorrect text" );
40+ @ JDIAction ("'{name}' has label with value '{0}'" )
41+ public SlideToggleAssert labelsSlideToggleText (String labelsText ) {
42+ jdiAssert (element ().label ().getValue (), Matchers .is (labelsText ));
4443 return this ;
4544 }
4645
Original file line number Diff line number Diff line change 33import com .epam .jdi .light .angular .asserts .SlideToggleAssert ;
44import com .epam .jdi .light .common .JDIAction ;
55import com .epam .jdi .light .elements .base .UIBaseElement ;
6+ import com .epam .jdi .light .elements .common .Label ;
67import com .epam .jdi .light .elements .common .UIElement ;
8+ import com .epam .jdi .light .elements .interfaces .base .HasLabel ;
79
810/**
911 * To see an example of SlideToggle web element please visit https://material.angular
1012 * .io/components/slide-toggle/overview.
1113 */
1214
13- public class SlideToggle extends UIBaseElement <SlideToggleAssert > {
15+ public class SlideToggle extends UIBaseElement <SlideToggleAssert > implements HasLabel {
1416
1517 private static final String FORM_FIELD_LOCATOR = ".mdc-form-field" ;
1618
@@ -31,16 +33,16 @@ public boolean isDisabled() {
3133 return e .hasAttribute ("disabled" );
3234 }
3335
36+ @ Override
37+ public Label label () {
38+ return new Label ().setCore (Label .class , core ().find ("//label" ));
39+ }
40+
3441 @ JDIAction ("Get if '{name}' element label is in before position" )
3542 public boolean hasLabelBeforePosition () {
3643 return core ().find (FORM_FIELD_LOCATOR ).hasClass ("mdc-form-field--align-end" );
3744 }
3845
39- @ JDIAction ("Get label's text of slide toggle" )
40- public String getLabelsSlideToggleText () {
41- return core ().find (FORM_FIELD_LOCATOR ).find ("//label" ).getText ();
42- }
43-
4446 public void check () {
4547 if (!isSelected ()) {
4648 core ().find (BUTTON_LOCATOR ).click ();
You can’t perform that action at this time.
0 commit comments