@@ -90,67 +90,29 @@ private void doInit()
9090 @ Test
9191 public final void testSteps ()
9292 {
93- boolean pass = true ;
94-
95- try
96- {
97- log ("Validate the pipeline job has completed." );
98- waitForElementToDisappear (Locator .css ("div.x4-grid-empty" ), 5000 );
99- }
100- catch (org .openqa .selenium .TimeoutException te )
101- {
102- assertTrue ("Grid was never populated, check for pipeline error." , false );
103- }
104-
105- log ("Validate number of text icons is correct." );
106- pass = validateCount ("span.fa-file-text-o" , 8 ) & pass ;
107-
108- log ("Validate number of code icons is correct." );
109- pass = validateCount ("span.fa-file-code-o" , 4 ) & pass ;
110-
111- log ("Validate number of rtf\\ word icons is correct." );
112- pass = validateCount ("span.fa-file-word-o" , 5 ) & pass ;
113-
114- log ("Validate number of image icons is correct." );
115- pass = validateCount ("span.fa-file-image-o" , 6 ) & pass ;
116-
117- log ("Validate number of archive icons is correct." );
118- pass = validateCount ("span.fa-file-archive-o" , 4 ) & pass ;
119-
120- log ("Validate number of video icons is correct." );
121- pass = validateCount ("span.fa-file-video-o" , 1 ) & pass ;
122-
123- log ("Validate number of pdf icons is correct." );
124- pass = validateCount ("span.fa-file-pdf-o" , 2 ) & pass ;
125-
126- log ("Validate number of excel icons is correct." );
127- pass = validateCount ("span.fa-file-excel-o" , 4 ) & pass ;
128-
129- log ("Validate number of list icons is correct." );
130- pass = validateCount ("span.fa-list-alt" , 2 ) & pass ;
131-
132- log ("Validate number of powerpoint icons is correct." );
133- pass = validateCount ("span.fa-file-powerpoint-o" , 2 ) & pass ;
134-
135- log ("Validate number of file icons is correct." );
136- pass = validateCount ("span.fa-file-o" , 1 ) & pass ;
137-
138- assertTrue ("Count(s) for icons were not as expected. Review log to find the counts that were wrong." , pass );
93+ _fileBrowserHelper .waitForFileGridReady ();
94+
95+ validateCount ("text" , "span.fa-file-text-o" , 8 );
96+ validateCount ("code" , "span.fa-file-code-o" , 4 );
97+ validateCount ("rtf/word" , "span.fa-file-word-o" , 5 );
98+ validateCount ("image" , "span.fa-file-image-o" , 6 );
99+ validateCount ("archive" , "span.fa-file-archive-o" , 5 );
100+ validateCount ("video" , "span.fa-file-video-o" , 1 );
101+ validateCount ("pdf" , "span.fa-file-pdf-o" , 2 );
102+ validateCount ("excel" , "span.fa-file-excel-o" , 4 );
103+ validateCount ("list" , "span.fa-list-alt" , 2 );
104+ validateCount ("powerpoint" , "span.fa-file-powerpoint-o" , 2 );
105+ validateCount ("file" , "span.fa-file-o" , 1 );
106+
107+ checker ().screenShotIfNewError ("icon_counts" );
139108 }
140109
141- private boolean validateCount (String cssIcon , int expCount )
110+ private void validateCount (String description , String cssIcon , int expCount )
142111 {
143- int count = getElementCount (Locator .css (cssIcon ));
144-
145- if (getElementCount (Locator .css (cssIcon )) != expCount )
146- {
147- log ("!!!!!Number of " + cssIcon + " is not as expected. Expected: " + expCount + " Actual: " + count );
148- return false ;
149- }
150- else
151- {
152- return true ;
153- }
112+ log ("Validate number of %s icons is correct." .formatted (description ));
113+ int count = Locator .css (cssIcon ).findElements (getDriver ()).size ();
114+
115+ checker ().verifyEquals (description + " icons" , expCount , count );
154116 }
155117
156118}
0 commit comments