@@ -89,6 +89,55 @@ const testParams = {
89
89
}
90
90
}
91
91
} ,
92
+ json_support : {
93
+ facetIdx : 9 ,
94
+ totalNumOptions : 12 ,
95
+ numRows : 25 ,
96
+ tests : [
97
+ {
98
+ description : 'not-null' ,
99
+ option : 0 ,
100
+ filter : 'jsonb_colAll records with value' ,
101
+ numRows : 20 ,
102
+ } ,
103
+ {
104
+ description : 'null' ,
105
+ option : 1 ,
106
+ filter : 'jsonb_colNo value ' ,
107
+ numRows : 10 ,
108
+ } ,
109
+ {
110
+ description : 'json object' ,
111
+ option : 2 ,
112
+ filter : '"one"' ,
113
+ numRows : 5 ,
114
+ modal : {
115
+ numRows : 12 ,
116
+ checkedOption : 0
117
+ }
118
+ } ,
119
+ {
120
+ description : 'number' ,
121
+ option : 9 ,
122
+ filter : 'jsonb_col8' ,
123
+ numRows : 1 ,
124
+ modal : {
125
+ numRows : 12 ,
126
+ checkedOption : 7
127
+ }
128
+ } ,
129
+ {
130
+ description : 'string literal' ,
131
+ option : 10 ,
132
+ filter : 'jsonb_col"nine"' ,
133
+ numRows : 1 ,
134
+ modal : {
135
+ numRows : 12 ,
136
+ checkedOption : 8
137
+ }
138
+ }
139
+ ]
140
+ } ,
92
141
hide_row_count : {
93
142
hidden : {
94
143
facetIdx : 11 ,
@@ -481,6 +530,52 @@ test.describe('Other facet features', () => {
481
530
} ) ;
482
531
} ) ;
483
532
533
+ test . describe ( 'json/jsonb support' , ( ) => {
534
+ testParams . json_support . tests . forEach ( ( params ) => {
535
+ test ( `${ params . description } ` , async ( { page, baseURL } , testInfo ) => {
536
+ const facet = RecordsetLocators . getFacetById ( page , testParams . json_support . facetIdx ) ;
537
+ const numRowsWhenCleared = testParams . json_support . numRows ;
538
+
539
+ const checkPageStatusAfterSelection = async ( ) => {
540
+ await expect . soft ( RecordsetLocators . getRows ( page ) ) . toHaveCount ( params . numRows ) ;
541
+ await expect . soft ( RecordsetLocators . getCheckedFacetOptions ( facet ) ) . toHaveCount ( 1 ) ;
542
+ await expect . soft ( RecordsetLocators . getFacetFilters ( page ) . nth ( 0 ) ) . toContainText ( params . filter ) ;
543
+ }
544
+
545
+ await test . step ( 'should load recordset page, clear all filters, and open the json facet' , async ( ) => {
546
+ await page . goto ( generateChaiseURL ( APP_NAMES . RECORDSET , testParams . schema_name , testParams . table_name , testInfo , baseURL ) ) ;
547
+ await RecordsetLocators . waitForRecordsetPageReady ( page ) ;
548
+ await testClearAllFilters ( page , numRowsWhenCleared ) ;
549
+
550
+ // 4 open facets because 3 are already open on page load
551
+ await openFacet ( page , facet , testParams . json_support . facetIdx , testParams . json_support . totalNumOptions , 4 ) ;
552
+ } ) ;
553
+
554
+ await test . step ( 'choosing the option should work properly.' , async ( ) => {
555
+ await testSelectFacetOption ( page , facet , params . option , params . numRows , 1 ) ;
556
+ await checkPageStatusAfterSelection ( ) ;
557
+ } ) ;
558
+
559
+ await test . step ( 'refreshing the page should keep the selected filter.' , async ( ) => {
560
+ await page . reload ( ) ;
561
+ await RecordsetLocators . waitForRecordsetPageReady ( page ) ;
562
+ await checkPageStatusAfterSelection ( ) ;
563
+ } ) ;
564
+
565
+ if ( 'modal' in params ) {
566
+ await test . step ( 'the modal should show the selected option.' , async ( ) => {
567
+ const modal = ModalLocators . getRecordsetSearchPopup ( page ) ;
568
+ await testShowMoreClick ( facet , modal , params . modal ! . numRows , 1 ) ;
569
+ await expect . soft ( RecordsetLocators . getCheckboxInputs ( modal ) . nth ( params . modal ! . checkedOption ) ) . toBeChecked ( ) ;
570
+ await ModalLocators . getSubmitButton ( modal ) . click ( ) ;
571
+ await expect . soft ( modal ) . not . toBeVisible ( ) ;
572
+ await checkPageStatusAfterSelection ( ) ;
573
+ } ) ;
574
+ }
575
+ } ) ;
576
+ } ) ;
577
+ } ) ;
578
+
484
579
test ( 'regarding the logic to show only certain number of selected items' , async ( { page, baseURL } , testInfo ) => {
485
580
const params = testParams . hide_selected_items ;
486
581
const facet1 = RecordsetLocators . getFacetById ( page , params . firstFacet . index ) ;
0 commit comments