11package io .github .epam .angular .tests .elements .complex ;
22
3- import com .epam .jdi .light .angular .elements .composite .MaterialSelectorContainer ;
43import com .epam .jdi .light .elements .common .UIElement ;
54import io .github .epam .TestsInit ;
6- import org .testng .annotations .BeforeMethod ;
5+ import org .testng .annotations .BeforeClass ;
76import org .testng .annotations .Test ;
87
98import static com .epam .jdi .light .elements .composite .WebPage .refresh ;
1918import static io .github .com .pages .SideNavPage .contentRadioGroup ;
2019import static io .github .com .pages .SideNavPage .contentToggle ;
2120import static io .github .com .pages .SideNavPage .customEscapeBackdrop ;
22- import static io .github .com .pages .SideNavPage .firstElement ;
2321import static io .github .com .pages .SideNavPage .firstElementFocused ;
2422import static io .github .com .pages .SideNavPage .fixSideNav ;
2523import static io .github .com .pages .SideNavPage .fixedPosition ;
@@ -55,7 +53,7 @@ public class SideNavTests extends TestsInit {
5553 public static final String MODE = "mode" ;
5654 public static final String SIDE = "side" ;
5755
58- @ BeforeMethod (alwaysRun = true )
56+ @ BeforeClass (alwaysRun = true )
5957 public void before () {
6058 sideNavPage .open ();
6159 waitCondition (() -> sideNavPage .isOpened ());
@@ -87,11 +85,11 @@ public void verifyPositionSelectionDrawerWithExplicitBackdropSettingSideNavTest(
8785 sidenavBackdropContainer .is ().enabled ();
8886
8987 sideNavPosition .click ();
90- ( new MaterialSelectorContainer ()) .select ("End" );
88+ sideNavPosition .select ("End" );
9189
9290 backDropToggle .click ();
9391 sidenavBackdropDrawer .is ().displayed ();
94- sidenavBackdropDrawer .has ().cssClass ( "mat-drawer-end" );
92+ sidenavBackdropContainer .has ().sideNavSectionOnTheRight ( sidenavBackdropDrawer . getLocation () );
9593 }
9694
9795 @ Test (description = "Test verifies first menu item focus when 'true' is selected" )
@@ -101,13 +99,13 @@ public void verifyFocusSelectionDrawerWithExplicitBackdropSettingSideNavTest() {
10199 sidenavBackdropContainer .is ().enabled ();
102100
103101 sideNavFocusSelection .click ();
104- ( new MaterialSelectorContainer ()) .select ("True" );
102+ sideNavFocusSelection .select ("True" );
105103
106104 backDropToggle .click ();
107105
108106 firstElementFocused .base ().timer ().wait (() -> firstElementFocused .has ().cssClass ("cdk-program-focused" ));
109- firstElementFocused .has ().cssClass ("cdk-focused" );
110107 firstElementFocused .is ().displayed ();
108+ firstElementFocused .is ().focused ();
111109 }
112110
113111 @ Test (description = "Verify main content is properly displayed alongside two side navigation panels" )
@@ -131,6 +129,7 @@ public void verifyImplicitMainContentWithTwoSideNavTest() {
131129
132130 @ Test (description = "Tests the opening and closing functionality of the component" )
133131 public void verifyOpenCloseBehaviorTest () {
132+ refresh ();
134133 openCloseBehavior .show ();
135134 openCloseBehavior .getContent ().is ().displayed ();
136135 openCloseBehavior .getContent ().is ().enabled ();
@@ -140,8 +139,6 @@ public void verifyOpenCloseBehaviorTest() {
140139
141140 sideNavOpened .click ();
142141 openCloseBehavior .base ().timer ().wait (() -> openCloseBehavior .isEnabled ());
143- openCloseBehavior .base ().timer ().wait (() -> openCloseBehavior .getEvents ().has ().text ("open!" ));
144- sideNavOpened .click ();
145142 openCloseBehavior .base ().timer ().wait (() -> openCloseBehavior .getEvents ().has ().text ("open!\n close!" ));
146143 }
147144
@@ -206,19 +203,17 @@ public void verifyAutoSizeSideNav() {
206203 toggleAutoNav .click ();
207204 toggleExtraText .click ();
208205 autoSizeSideNav .getMatDrawer ().has ().text (containsString ("Toggle extra text" ));
209- autoSizeSideNav .getMatDrawerContent ().has ().attr (STYLE , "margin-left: 305px ;" );
206+ autoSizeSideNav .getMatDrawerContent ().has ().attr (STYLE , "margin-left: 303px ;" );
210207 }
211208
212209 @ Test (description = "Verify fixed sideNav" )
213210 public void fixedSideNavTest () {
214211 String testValue = "100" ;
215212 fixedPosition .show ();
216- topGap .click ();
217213 topGap .clear ();
218- topGap .sendKeys (testValue );
219- bottomGap .click ();
214+ topGap .setValue (testValue );
220215 bottomGap .clear ();
221- bottomGap .sendKeys (testValue );
216+ bottomGap .setValue (testValue );
222217 fixSideNav .click ();
223218 fixedPosition .getSideNav ().has ().attr (STYLE , "transform: none; visibility: visible; top: 100px; bottom: " +
224219 "100px;" );
0 commit comments