@@ -318,7 +318,36 @@ module.exports = () => {
318318 await resetFilters ( page ) ;
319319
320320 await filterOnStatusHistory ( '.historyItems-filter input' , 'D-E' , [ 'KGIS12DS' ] ) ;
321- await resetFilters ( page ) ;
321+ await resetFilters ( page ) ;
322+ } ) ;
323+
324+ it ( 'should successfully filter environments by their current status' , async ( ) => {
325+ /**
326+ * Checks that all the rows of the given table have a valid current status
327+ *
328+ * @param {string[] } authorizedCurrentStatuses the list of valid current statuses
329+ * @return {void }
330+ */
331+ const checkTableCurrentStatuses = async ( authorizedCurrentStatuses ) => {
332+ const rows = await page . $$ ( 'tbody tr' ) ;
333+ for ( const row of rows ) {
334+ expect ( await row . evaluate ( ( rowItem ) => {
335+ const rowId = rowItem . id ;
336+ return document . querySelector ( `#${ rowId } -status-text` ) . innerText ;
337+ } ) ) . to . be . oneOf ( authorizedCurrentStatuses ) ;
338+ }
339+ } ;
340+
341+ const currentStatusSelectorPrefix = '.status-filter #checkboxes-checkbox-' ;
342+ const getCurrentStatusCheckboxSelector = ( statusName ) => `${ currentStatusSelectorPrefix } ${ statusName } ` ;
343+
344+ await page . $eval ( getCurrentStatusCheckboxSelector ( "RUNNING" ) , ( element ) => element . click ( ) ) ;
345+ await waitForTableLength ( page , 2 ) ;
346+ await checkTableCurrentStatuses ( [ "RUNNING" ] ) ;
347+
348+ await page . $eval ( getCurrentStatusCheckboxSelector ( "DEPLOYED" ) , ( element ) => element . click ( ) ) ;
349+ await waitForTableLength ( page , 3 ) ;
350+ await checkTableCurrentStatuses ( [ "RUNNING" , "DEPLOYED" ] ) ;
322351 } ) ;
323352
324353 it ( 'should successfully filter environments by their IDs' , async ( ) => {
0 commit comments