9
9
import java .util .List ;
10
10
11
11
import static com .epam .jdi .light .asserts .core .SoftAssert .jdiAssert ;
12
- import static com .jdiai .tools .StringUtils .format ;
13
12
14
13
public class PaginatorAssert extends UIAssert <PaginatorAssert , Paginator > {
15
14
@ JDIAction (value = "Assert that '{name}' has '{0}' label" , isAssert = true )
16
- public PaginatorAssert itemPerPageLabel (String label ) {
17
- jdiAssert (element ().itemPerPageLabel (), Matchers .is (label ));
15
+ public PaginatorAssert itemPerPageLabel (final String label ) {
16
+ jdiAssert (element ().itemPerPageLabel (), Matchers .equalTo (label ));
18
17
return this ;
19
18
}
20
19
21
20
@ JDIAction (value = "Assert that '{0}' option selected for '{name}'" , isAssert = true )
22
21
public PaginatorAssert itemsPerPageSelected (final int number ) {
23
- jdiAssert (element ().selected (), Matchers .is (number ));
22
+ jdiAssert (element ().selected (), Matchers .equalTo (number ));
24
23
return this ;
25
24
}
26
25
27
26
@ JDIAction (value = "Assert that '{0}' options for '{name}'" , isAssert = true )
28
27
public PaginatorAssert itemsPerPageList (final List <Integer > options ) {
29
- jdiAssert (element ().options (), Matchers .is (options ));
28
+ jdiAssert (element ().options (), Matchers .equalTo (options ));
30
29
return this ;
31
30
32
31
}
33
32
34
33
@ JDIAction (value = "Assert that range is '{0}' for '{name}'" , isAssert = true )
35
- public PaginatorAssert rangeLabel (String label ) {
36
- String expected = format (label );
37
- jdiAssert (element ().range (), Matchers .is (expected ));
34
+ public PaginatorAssert rangeLabel (final String label ) {
35
+ jdiAssert (element ().range (), Matchers .equalTo (label ));
38
36
return this ;
39
37
}
40
38
41
39
@ JDIAction (value = "Assert that '{name}' has '{0}' color theme" , isAssert = true )
42
- public PaginatorAssert color (AngularColors value ) {
43
- jdiAssert (element ().color (), Matchers .equalTo (value ));
40
+ public PaginatorAssert colorTheme (final AngularColors value ) {
41
+ final AngularColors color = AngularColors .fromName (element ().colorTheme ());
42
+ jdiAssert (color , Matchers .equalTo (value ));
43
+ return this ;
44
+ }
45
+
46
+ @ JDIAction (value = "Assert that '{name}' has '{0}' color theme" , isAssert = true )
47
+ public PaginatorAssert colorTheme (final String value ) {
48
+ jdiAssert (element ().colorTheme (), Matchers .equalToIgnoringCase (value ));
44
49
return this ;
45
50
}
46
51
47
52
@ JDIAction (value = "Assert that '{name}' has '{0}' color of the boarder" , isAssert = true )
48
- public PaginatorAssert colorOfBoarder ( AngularColors value ) {
49
- AngularColors actualColor = AngularColors .fromColor (element ().colorOfBoarder ());
53
+ public PaginatorAssert borderColor ( final AngularColors value ) {
54
+ AngularColors actualColor = AngularColors .fromColor (element ().boarderColor ());
50
55
jdiAssert (actualColor , Matchers .equalTo (value ));
51
56
return this ;
52
57
}
53
58
59
+ @ JDIAction (value = "Assert that '{name}' has '{0}' color of the boarder" , isAssert = true )
60
+ public PaginatorAssert borderColor (final String value ) {
61
+ jdiAssert (element ().boarderColor (), Matchers .equalTo (value ));
62
+ return this ;
63
+ }
64
+
54
65
@ JDIAction (value = "Assert that '{name}' has '{0}' color of the selected option" , isAssert = true )
55
- public PaginatorAssert colorOfSelectedOption ( AngularColors value ) {
56
- AngularColors actualColorInList = AngularColors .fromColor (element ().colorInList ());
66
+ public PaginatorAssert selectedOptionColor ( final AngularColors value ) {
67
+ AngularColors actualColorInList = AngularColors .fromColor (element ().selectedOptionColor ());
57
68
jdiAssert (actualColorInList , Matchers .equalTo (value ));
58
69
return this ;
59
70
}
60
71
72
+ @ JDIAction (value = "Assert that '{name}' has '{0}' color of the selected option" , isAssert = true )
73
+ public PaginatorAssert selectedOptionColor (final String value ) {
74
+ jdiAssert (element ().selectedOptionColor (), Matchers .equalTo (value ));
75
+ return this ;
76
+ }
77
+
61
78
@ JDIAction (value = "Assert that '{name} has firstPageLabel='{0}'" , isAssert = true )
62
- public PaginatorAssert firstPageLabel (String label ) {
63
- jdiAssert (element ().firstPageLabel (), Matchers .is (label ));
79
+ public PaginatorAssert firstPageLabel (final String label ) {
80
+ jdiAssert (element ().firstPageLabel (), Matchers .equalTo (label ));
64
81
return this ;
65
82
}
66
83
67
84
@ JDIAction (value = "Assert that '{name} has lastPageLabel='{0}'" , isAssert = true )
68
- public PaginatorAssert lastPageLabel (String label ) {
69
- jdiAssert (element ().lastPageLabel (), Matchers .is (label ));
85
+ public PaginatorAssert lastPageLabel (final String label ) {
86
+ jdiAssert (element ().lastPageLabel (), Matchers .equalTo (label ));
70
87
return this ;
71
88
}
72
89
73
90
@ JDIAction (value = "Assert that '{name}' has hidden page size" , isAssert = true )
74
- public PaginatorAssert hiddenPageSize (final boolean value ) {
75
- jdiAssert (element ().hidePageSize (), Matchers .is (value ),
91
+ public PaginatorAssert hiddenPageSize (boolean value ) {
92
+ jdiAssert (element ().isPageSizeHidden (), Matchers .is (value ),
76
93
value ? "page size should be hidden" : "page size should be visible" );
77
94
return this ;
78
95
}
79
96
80
97
@ JDIAction (value = "Assert that '{name}' has shown first and last page buttons" , isAssert = true )
81
- public PaginatorAssert showFirstLastButtons (boolean value ) {
82
- jdiAssert (element ().showFirstLastButtons (), Matchers .is (value ),
98
+ public PaginatorAssert firstLastButtonsShown (boolean value ) {
99
+ jdiAssert (element ().isFirstLastButtonsShown (), Matchers .is (value ),
83
100
value ? "first and last buttons should be shown" : "first and last buttons should be hidden"
84
101
);
85
102
return this ;
@@ -88,15 +105,57 @@ public PaginatorAssert showFirstLastButtons(boolean value) {
88
105
/**
89
106
* @param pageIndex starts from 0
90
107
*/
91
- @ JDIAction (value = "Assert that '{name}' has page index of {0}" , isAssert = true )
92
- public PaginatorAssert pageIndex (int pageIndex ) {
93
- jdiAssert (element ().pageIndex (), Matchers .is (pageIndex ));
108
+ @ JDIAction (value = "Assert that '{name}' has current page index of {0}" , isAssert = true )
109
+ public PaginatorAssert pageIndexCurrent (int pageIndex ) {
110
+ jdiAssert (element ().pageIndexCurrent (), Matchers .equalTo (pageIndex ));
94
111
return this ;
95
112
}
96
113
97
114
@ JDIAction (value = "Assert that '{name}' has page index of {0}" , isAssert = true )
98
- public PaginatorAssert length (int length ) {
99
- jdiAssert (element ().length (), Matchers .is (length ));
115
+ public PaginatorAssert totalNumberOfItems (int length ) {
116
+ jdiAssert (element ().totalNumberOfItems (), Matchers .equalTo (length ));
117
+ return this ;
118
+ }
119
+
120
+ @ JDIAction (value = "Assert that previous button enabled for '{name}'" , isAssert = true )
121
+ public PaginatorAssert previousEnabled () {
122
+ jdiAssert (element ().previousButton ().isEnabled () ? "enabled" : "disabled" , Matchers .equalTo ("enabled" ));
123
+ return this ;
124
+ }
125
+
126
+ @ JDIAction (value = "Assert that previous button disabled for '{name}'" , isAssert = true )
127
+ public PaginatorAssert previousDisabled () {
128
+ jdiAssert (element ().previousButton ().isEnabled () ? "enabled" : "disabled" , Matchers .equalTo ("disabled" ));
129
+ return this ;
130
+ }
131
+
132
+ @ JDIAction (value = "Assert that next button enabled for '{name}'" , isAssert = true )
133
+ public PaginatorAssert nextEnabled () {
134
+ jdiAssert (element ().nextButton ().isEnabled () ? "enabled" : "disabled" , Matchers .equalTo ("enabled" ));
135
+ return this ;
136
+ }
137
+
138
+ @ JDIAction (value = "Assert that next button disabled for '{name}'" , isAssert = true )
139
+ public PaginatorAssert nextDisabled () {
140
+ jdiAssert (element ().nextButton ().isEnabled () ? "enabled" : "disabled" , Matchers .equalTo ("disabled" ));
141
+ return this ;
142
+ }
143
+
144
+ @ JDIAction (value = "Assert that item per page selector is disabled for '{name}'" , isAssert = true )
145
+ public PaginatorAssert itemPerPageSelectorDisabled () {
146
+ jdiAssert (element ().itemPerPageSelector ().isDisabled () ? "disabled" : "enabled" , Matchers .equalTo ("disabled" ));
147
+ return this ;
148
+ }
149
+
150
+ @ JDIAction (value = "Assert that first page button displayed={0} for '{name}'" , isAssert = true )
151
+ public PaginatorAssert firstPageDisplayed (boolean value ) {
152
+ jdiAssert (element ().firstPageButton ().isDisplayed () ? "displayed" : "hidden" , Matchers .equalTo (value ? "displayed" : "hidden" ));
153
+ return this ;
154
+ }
155
+
156
+ @ JDIAction (value = "Assert that last page button displayed={0} for '{name}'" , isAssert = true )
157
+ public PaginatorAssert lastPageDisplayed (boolean value ) {
158
+ jdiAssert (element ().lastPageButton ().isDisplayed () ? "displayed" : "hidden" , Matchers .equalTo (value ? "displayed" : "hidden" ));
100
159
return this ;
101
160
}
102
161
}
0 commit comments