@@ -10,6 +10,9 @@ const USER_CREDENTIALS = {
1010}
1111
1212const FIXTURES = {
13+ USERS_COUNT : 1 ,
14+ CATEGORIES_COUNT : 2 ,
15+ CONTENT_COUNT : 2 ,
1316 RESTAURANTS_COUNT : 2 ,
1417}
1518
@@ -87,7 +90,7 @@ describe('Meilisearch features', () => {
8790 } )
8891 } )
8992
90- describe ( 'Collections panel' , ( ) => {
93+ describe . only ( 'Collections panel' , ( ) => {
9194 it ( 'displays all collections' , ( ) => {
9295 visitPluginPage ( )
9396
@@ -98,7 +101,7 @@ describe('Meilisearch features', () => {
98101 cy . contains ( 'restaurant' )
99102 } )
100103
101- it ( 'can add collections to index ' , ( ) => {
104+ it ( 'can enable collections indexing ' , ( ) => {
102105 visitPluginPage ( )
103106
104107 // Intercepts used to wait for the UI to refresh after toggles
@@ -138,20 +141,70 @@ describe('Meilisearch features', () => {
138141 it ( 'displays the number of inxed documents for each collection' , ( ) => {
139142 visitPluginPage ( )
140143
141- // 1 user in database -> 1 document in `user` index
142- checkCollectionContent ( { rowNb : 1 , contains : [ '1 / 1' ] } )
143- // `about-us` is in the `content` index (2 documents)
144- checkCollectionContent ( { rowNb : 2 , contains : [ '2 / 2' ] } )
145- // 2 categories in db -> 2 documents in `category` index
146- checkCollectionContent ( { rowNb : 3 , contains : [ '2 / 2' ] } )
147- // `homepage` is in the `content` index (2 documents)
148- checkCollectionContent ( { rowNb : 4 , contains : [ '2 / 2' ] } )
149- // 2 restaurants in db -> 2 documents in `restaurant` index
150- checkCollectionContent ( { rowNb : 5 , contains : [ '2 / 2' ] } )
144+ checkCollectionContent ( {
145+ rowNb : 1 ,
146+ contains : [ `${ FIXTURES . USERS_COUNT } / ${ FIXTURES . USERS_COUNT } ` ] ,
147+ } )
148+ checkCollectionContent ( {
149+ rowNb : 2 ,
150+ contains : [ `${ FIXTURES . CONTENT_COUNT } / ${ FIXTURES . CONTENT_COUNT } ` ] ,
151+ } )
152+ checkCollectionContent ( {
153+ rowNb : 3 ,
154+ contains : [
155+ `${ FIXTURES . CATEGORIES_COUNT } / ${ FIXTURES . CATEGORIES_COUNT } ` ,
156+ ] ,
157+ } )
158+ checkCollectionContent ( {
159+ rowNb : 4 ,
160+ contains : [ `${ FIXTURES . CONTENT_COUNT } / ${ FIXTURES . CONTENT_COUNT } ` ] ,
161+ } )
162+ checkCollectionContent ( {
163+ rowNb : 5 ,
164+ contains : [
165+ `${ FIXTURES . RESTAURANTS_COUNT } / ${ FIXTURES . RESTAURANTS_COUNT } ` ,
166+ ] ,
167+ } )
168+ } )
169+
170+ it ( 'can disable collection indexing' , ( ) => {
171+ visitPluginPage ( )
172+
173+ for ( let i = 1 ; i <= 5 ; i ++ ) {
174+ cy . clickAndCheckRowContent ( {
175+ rowNb : i ,
176+ contains : [ 'No' , 'Reload needed' ] ,
177+ } )
178+ }
179+
180+ cy . reloadServer ( )
181+
182+ visitPluginPage ( )
183+
184+ cy . checkCollectionContent ( {
185+ rowNb : 1 ,
186+ contains : [ `0 / ${ FIXTURES . USERS_COUNT } ` ] ,
187+ } )
188+ cy . checkCollectionContent ( {
189+ rowNb : 2 ,
190+ contains : [ `0 / ${ FIXTURES . CONTENT_COUNT } ` ] ,
191+ } )
192+ cy . checkCollectionContent ( {
193+ rowNb : 3 ,
194+ contains : [ `0 / ${ FIXTURES . CATEGORIES_COUNT } ` ] ,
195+ } )
196+ cy . checkCollectionContent ( {
197+ rowNb : 4 ,
198+ contains : [ `0 / ${ FIXTURES . CONTENT_COUNT } ` ] ,
199+ } )
200+ cy . checkCollectionContent ( {
201+ rowNb : 5 ,
202+ contains : [ `0 / ${ FIXTURES . RESTAURANTS_COUNT } ` ] ,
203+ } )
151204 } )
152205 } )
153206
154- describe . only ( 'Content hooks' , ( ) => {
207+ describe ( 'Content hooks' , ( ) => {
155208 it ( 'reindexes after adding content' , ( ) => {
156209 cy . visit (
157210 `${ adminUrl } /content-manager/collection-types/api::restaurant.restaurant` ,
@@ -204,20 +257,5 @@ describe('Meilisearch features', () => {
204257 ] ,
205258 } )
206259 } )
207-
208- it ( 'can disable collection indexing' , ( ) => {
209- visitPluginPage ( )
210-
211- cy . clickAndCheckRowContent ( {
212- rowNb : 1 ,
213- contains : [ 'No' , 'Reload needed' ] ,
214- } )
215-
216- cy . reloadServer ( )
217-
218- visitPluginPage ( )
219-
220- cy . checkCollectionContent ( { rowNb : 1 , contains : [ '0 / 1' ] } )
221- } )
222260 } )
223261} )
0 commit comments