@@ -27,6 +27,7 @@ const {
2727 goToPage,
2828 openFilteringPanel,
2929 fillInput,
30+ getPeriodInputsSelectors,
3031 expectAttributeValue,
3132 resetFilters,
3233} = require ( '../defaults.js' ) ;
@@ -87,7 +88,7 @@ module.exports = () => {
8788
8889 it ( 'Should have balloon on runs column' , async ( ) => {
8990 await checkColumnBalloon ( page , 1 , 2 ) ;
90- await checkColumnBalloon ( page , 1 , 5 ) ;
91+ await checkColumnBalloon ( page , 1 , 6 ) ;
9192 } ) ;
9293
9394 it ( 'Should have correct status color in the overview page' , async ( ) => {
@@ -135,11 +136,11 @@ module.exports = () => {
135136
136137 } ;
137138
138- await checkEnvironmentStatusColor ( 1 , 3 ) ;
139- await checkEnvironmentStatusColor ( 2 , 3 ) ;
140- await checkEnvironmentStatusColor ( 3 , 3 ) ;
141- await checkEnvironmentStatusColor ( 6 , 3 ) ;
142- await checkEnvironmentStatusColor ( 9 , 3 ) ;
139+ await checkEnvironmentStatusColor ( 1 , 4 ) ;
140+ await checkEnvironmentStatusColor ( 2 , 4 ) ;
141+ await checkEnvironmentStatusColor ( 3 , 4 ) ;
142+ await checkEnvironmentStatusColor ( 6 , 4 ) ;
143+ await checkEnvironmentStatusColor ( 9 , 4 ) ;
143144 } ) ;
144145
145146 it ( 'can set how many environments are available per page' , async ( ) => {
@@ -403,4 +404,53 @@ module.exports = () => {
403404 await filterOnID ( '.id-filter input' , 'j' , [ 'CmCvjNbg' , 'GIDO1jdkD' , '8E4aZTjY' , 'Dxi029djX' ] ) ;
404405 await resetFilters ( page ) ;
405406 } ) ;
407+
408+ it ( 'should successfully filter environments by their createdAt date' , async ( ) => {
409+ /**
410+ * This is the sequence to test filtering the environments based on their createdAt date
411+ *
412+ * @param {string } selector the filter input selector
413+ * @param {string } fromDate the from date string
414+ * @param {string } fromTime the from time string
415+ * @param {string } toDate the to date string
416+ * @param {string } toTime the to time string
417+ * @param {string[] } expectedIds the list of expected environment IDs after filtering
418+ * @return {void }
419+ */
420+ const filterOnCreatedAt = async ( selector , fromDate , fromTime , toDate , toTime , expectedIds ) => {
421+ await fillInput ( page , selector . fromTimeSelector , fromTime , [ 'change' ] ) ;
422+ await fillInput ( page , selector . toTimeSelector , toTime , [ 'change' ] ) ;
423+
424+ await fillInput ( page , selector . fromDateSelector , fromDate , [ 'change' ] ) ;
425+ await fillInput ( page , selector . toDateSelector , toDate , [ 'change' ] ) ;
426+
427+ await waitForTableLength ( page , expectedIds . length ) ;
428+ expect ( await page . $$eval ( 'tbody tr' , ( rows ) => rows . map ( ( row ) => row . id ) ) ) . to . eql ( expectedIds . map ( id => `row${ id } ` ) ) ;
429+ } ;
430+
431+ await openFilteringPanel ( page ) ;
432+
433+ const createdAtPopoverSelector = await getPopoverSelector ( await page . $ ( '.createdAt-filter .popover-trigger' ) ) ;
434+ const periodInputsSelectors = getPeriodInputsSelectors ( createdAtPopoverSelector ) ;
435+
436+ await filterOnCreatedAt (
437+ periodInputsSelectors ,
438+ '2019-05-08' ,
439+ '00:00' ,
440+ '2019-05-10' ,
441+ '00:00' ,
442+ [ 'eZF99lH6' ] ,
443+ ) ;
444+ await resetFilters ( page ) ;
445+
446+ await filterOnCreatedAt (
447+ periodInputsSelectors ,
448+ '2019-08-09' ,
449+ '00:00' ,
450+ '2019-08-09' ,
451+ '14:00' ,
452+ [ 'GIDO1jdkD' , '8E4aZTjY' , 'Dxi029djX' ] ,
453+ ) ;
454+ await resetFilters ( page ) ;
455+ } ) ;
406456} ;
0 commit comments