@@ -294,6 +294,35 @@ module.exports = () => {
294294 await page . waitForSelector ( filterPanelSelector , { visible : true } ) ;
295295 } ) ;
296296
297+ it ( 'should successfully filter environments by their current status' , async ( ) => {
298+ /**
299+ * Checks that all the rows of the given table have a valid current status
300+ *
301+ * @param {string[] } authorizedCurrentStatuses the list of valid current statuses
302+ * @return {void }
303+ */
304+ const checkTableCurrentStatuses = async ( authorizedCurrentStatuses ) => {
305+ const rows = await page . $$ ( 'tbody tr' ) ;
306+ for ( const row of rows ) {
307+ expect ( await row . evaluate ( ( rowItem ) => {
308+ const rowId = rowItem . id ;
309+ return document . querySelector ( `#${ rowId } -status-text` ) . innerText ;
310+ } ) ) . to . be . oneOf ( authorizedCurrentStatuses ) ;
311+ }
312+ } ;
313+
314+ const currentStatusSelectorPrefix = '.status-filter #checkboxes-checkbox-' ;
315+ const getCurrentStatusCheckboxSelector = ( statusName ) => `${ currentStatusSelectorPrefix } ${ statusName } ` ;
316+
317+ await page . $eval ( getCurrentStatusCheckboxSelector ( "RUNNING" ) , ( element ) => element . click ( ) ) ;
318+ await waitForTableLength ( page , 2 ) ;
319+ await checkTableCurrentStatuses ( [ "RUNNING" ] ) ;
320+
321+ await page . $eval ( getCurrentStatusCheckboxSelector ( "DEPLOYED" ) , ( element ) => element . click ( ) ) ;
322+ await waitForTableLength ( page , 3 ) ;
323+ await checkTableCurrentStatuses ( [ "RUNNING" , "DEPLOYED" ] ) ;
324+ } ) ;
325+
297326 it ( 'should successfully filter environments by their IDs' , async ( ) => {
298327 /**
299328 * This is the sequence to test filtering the environments on IDs.
0 commit comments