@@ -13,13 +13,22 @@ const removeTutorial = () => {
1313 cy . get ( '.videosContent' ) . siblings ( '.openBtn' ) . click ( )
1414}
1515
16- const clickAndCheckRowContent = ( rowNumber , contains ) => {
17- const row = `.collections tbody tr:nth-child(${ rowNumber } )`
16+ const clickCollection = ( { rowNb } ) => {
17+ const row = `.collections tbody tr:nth-child(${ rowNb } )`
1818 cy . get ( `${ row } input[type="checkbox"]` ) . click ( )
1919 removeNotifications ( )
20+ }
21+
22+ const checkCollectionContent = ( { rowNb, contains } ) => {
23+ const row = `.collections tbody tr:nth-child(${ rowNb } )`
2024 contains . map ( content => cy . get ( `${ row } ` ) . contains ( content ) )
2125}
2226
27+ const clickAndCheckRowContent = ( { rowNb, contains } ) => {
28+ clickCollection ( { rowNb } )
29+ checkCollectionContent ( { rowNb, contains } )
30+ }
31+
2332const removeNotifications = ( ) => {
2433 cy . wait ( 1000 )
2534 cy . get ( '.notification-enter-done > div > div > div:last-child' ) . click ( {
@@ -80,32 +89,59 @@ describe('Strapi Login flow', () => {
8089 } )
8190
8291 it ( 'Add Collections to MeiliSearch' , ( ) => {
83- clickAndCheckRowContent ( 1 , [ 'Indexed In MeiliSearch' , 'Reload needed' ] )
84- clickAndCheckRowContent ( 2 , [ 'Indexed In MeiliSearch' , 'Reload needed' ] )
85- clickAndCheckRowContent ( 3 , [ 'Indexed In MeiliSearch' , 'Reload needed' ] )
92+ clickAndCheckRowContent ( {
93+ rowNb : 1 ,
94+ contains : [ 'Indexed In MeiliSearch' , 'Reload needed' ]
95+ } )
96+ clickAndCheckRowContent ( {
97+ rowNb : 2 ,
98+ contains : [ 'Indexed In MeiliSearch' , 'Reload needed' ]
99+ } )
100+ clickAndCheckRowContent ( {
101+ rowNb : 3 ,
102+ contains : [ 'Indexed In MeiliSearch' , 'Reload needed' ]
103+ } )
86104 } )
87105
88106 it ( 'Reload Server' , ( ) => {
89107 const row = '.reload_button'
90108 cy . get ( `${ row } ` ) . click ( )
91- if ( env === 'watch' ) {
92- cy . wait ( 4000 )
93- cy . visit ( adminUrl , { timeout : 4000 } )
94- cy . url ( ) . should ( 'match' , / l o g i n / )
95- cy . get ( 'form' , { timeout : 10000 } ) . should ( 'be.visible' )
96- cy . get ( 'input[name="email"]' ) . type ( email ) . should ( 'have.value' , email )
97- cy . get ( 'input[name="password"]' ) . type ( password ) . should ( 'have.value' , password )
98- cy . get ( 'button[type="submit"]' ) . click ( )
99- cy . contains ( 'MeiliSearch' , { timeout : 10000 } ) . click ( )
100- cy . url ( ) . should ( 'include' , '/plugins/meilisearch' )
109+ cy . wait ( 4000 )
110+ if ( env === 'develop' || env === 'watch' ) {
111+ removeTutorial ( )
112+ }
113+ } )
114+
115+ it ( 'Check for successfull hooks in develop mode' , ( ) => {
116+ if ( env === 'develop' || env === 'watch' ) {
117+ checkCollectionContent ( { rowNb : 1 , contains : [ 'Indexed In MeiliSearch' , 'Active' ] } )
118+ checkCollectionContent ( { rowNb : 2 , contains : [ 'Indexed In MeiliSearch' , 'Active' ] } )
119+ checkCollectionContent ( { rowNb : 3 , contains : [ 'Indexed In MeiliSearch' , 'Active' ] } )
120+ } else {
121+ checkCollectionContent ( { rowNb : 1 , contains : [ 'Indexed In MeiliSearch' , 'Reload needed' ] } )
122+ checkCollectionContent ( { rowNb : 2 , contains : [ 'Indexed In MeiliSearch' , 'Reload needed' ] } )
123+ checkCollectionContent ( { rowNb : 3 , contains : [ 'Indexed In MeiliSearch' , 'Reload needed' ] } )
101124 }
102- removeTutorial ( )
103125 } )
104126
105127 it ( 'Remove Collections from MeiliSearch' , ( ) => {
106- clickAndCheckRowContent ( 1 , [ 'Not in MeiliSearch' ] )
107- clickAndCheckRowContent ( 2 , [ 'Not in MeiliSearch' ] )
108- clickAndCheckRowContent ( 3 , [ 'Not in MeiliSearch' ] )
128+ clickAndCheckRowContent ( {
129+ rowNb : 1 ,
130+ contains : [ 'Not in MeiliSearch' ]
131+ } )
132+ clickAndCheckRowContent ( {
133+ rowNb : 2 ,
134+ contains : [ 'Not in MeiliSearch' ]
135+ } )
136+ clickAndCheckRowContent ( {
137+ rowNb : 3 ,
138+ contains : [ 'Not in MeiliSearch' ]
139+ } )
140+ if ( env === 'develop' || env === 'watch' ) {
141+ checkCollectionContent ( { rowNb : 1 , contains : [ 'Not in MeiliSearch' , 'Reload needed' ] } )
142+ checkCollectionContent ( { rowNb : 2 , contains : [ 'Not in MeiliSearch' , 'Reload needed' ] } )
143+ checkCollectionContent ( { rowNb : 3 , contains : [ 'Not in MeiliSearch' , 'Reload needed' ] } )
144+ }
109145 } )
110146
111147 it ( 'Change Host to wrong host' , ( ) => {
0 commit comments