Skip to content

Commit c7df168

Browse files
committed
Add test for reindexing after removal
1 parent cf0660c commit c7df168

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

cypress/e2e/features.cy.js

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ describe('Meilisearch features', () => {
152152
})
153153

154154
describe.only('Content hooks', () => {
155-
it('indexes new content in the collections', () => {
155+
it('reindexes after adding content', () => {
156156
cy.visit(
157157
`${adminUrl}/content-manager/collection-types/api::restaurant.restaurant`,
158158
)
@@ -173,5 +173,36 @@ describe('Meilisearch features', () => {
173173
contains: [`${expectedNb} / ${expectedNb}`],
174174
})
175175
})
176+
177+
it('reindexes after removing content', () => {
178+
cy.visit(
179+
`${adminUrl}/content-manager/collection-types/api::restaurant.restaurant`,
180+
)
181+
182+
cy.get('main').contains('button', 'Search').click()
183+
cy.get('main').get('input[name="search"]').type('The slimy snail{enter}')
184+
cy.get('main').contains('tr', 'The slimy snail').should('be.visible')
185+
cy.get('main')
186+
.contains('tr', 'The slimy snail')
187+
.contains('button[type="button"]', 'Row actions')
188+
.click()
189+
cy.get('div[role="menu"]')
190+
.contains('div[role="menuitem"]', 'Delete')
191+
.click()
192+
cy.confirm()
193+
194+
cy.get('main').contains('button', 'Search').click()
195+
cy.get('main').get('input[name="search"]').type('The slimy snail{enter}')
196+
197+
cy.contains('No content found').should('be.visible')
198+
visitPluginPage()
199+
200+
cy.checkCollectionContent({
201+
rowNb: 5,
202+
contains: [
203+
`${FIXTURES.RESTAURANTS_COUNT} / ${FIXTURES.RESTAURANTS_COUNT}`,
204+
],
205+
})
206+
})
176207
})
177208
})

0 commit comments

Comments
 (0)