Skip to content

Commit 58114bb

Browse files
committed
Add indexing test for single content types
1 parent a0f31b2 commit 58114bb

File tree

1 file changed

+28
-8
lines changed

1 file changed

+28
-8
lines changed

cypress/e2e/features.cy.js

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ describe('Meilisearch features', () => {
137137
})
138138
})
139139

140-
// This test assumes that the collections are indexed (in previous test)
140+
// This test assumes that the collections are indexed by previous tests
141141
it('displays the number of inxed documents for each collection', () => {
142142
visitPluginPage()
143143

@@ -167,6 +167,7 @@ describe('Meilisearch features', () => {
167167
})
168168
})
169169

170+
// This test assumes that indexing is enabled by previous tests
170171
it('can disable collection indexing', () => {
171172
visitPluginPage()
172173

@@ -181,27 +182,46 @@ describe('Meilisearch features', () => {
181182

182183
visitPluginPage()
183184

184-
cy.checkCollectionContent({
185+
checkCollectionContent({
185186
rowNb: 1,
186187
contains: [`0 / ${FIXTURES.USERS_COUNT}`],
187188
})
188-
cy.checkCollectionContent({
189+
checkCollectionContent({
189190
rowNb: 2,
190191
contains: [`0 / ${FIXTURES.CONTENT_COUNT}`],
191192
})
192-
cy.checkCollectionContent({
193+
checkCollectionContent({
193194
rowNb: 3,
194195
contains: [`0 / ${FIXTURES.CATEGORIES_COUNT}`],
195196
})
196-
cy.checkCollectionContent({
197+
checkCollectionContent({
197198
rowNb: 4,
198199
contains: [`0 / ${FIXTURES.CONTENT_COUNT}`],
199200
})
200-
cy.checkCollectionContent({
201+
checkCollectionContent({
201202
rowNb: 5,
202203
contains: [`0 / ${FIXTURES.RESTAURANTS_COUNT}`],
203204
})
204205
})
206+
207+
it('enabling indexing for single-type content only indexes 1 document', () => {
208+
visitPluginPage()
209+
210+
cy.clickAndCheckRowContent({
211+
rowNb: 2,
212+
contains: ['about-us', 'Yes', 'Hooked'],
213+
})
214+
215+
checkCollectionContent({
216+
rowNb: 2,
217+
contains: [`1 / ${FIXTURES.CONTENT_COUNT}`],
218+
})
219+
220+
cy.clickAndCheckRowContent({
221+
rowNb: 2,
222+
contains: ['No', 'Reload needed'],
223+
})
224+
})
205225
})
206226

207227
describe('Content hooks', () => {
@@ -221,7 +241,7 @@ describe('Meilisearch features', () => {
221241
visitPluginPage()
222242

223243
const expectedNb = FIXTURES.RESTAURANTS_COUNT + 1
224-
cy.checkCollectionContent({
244+
checkCollectionContent({
225245
rowNb: 5,
226246
contains: [`${expectedNb} / ${expectedNb}`],
227247
})
@@ -250,7 +270,7 @@ describe('Meilisearch features', () => {
250270
cy.contains('No content found').should('be.visible')
251271
visitPluginPage()
252272

253-
cy.checkCollectionContent({
273+
checkCollectionContent({
254274
rowNb: 5,
255275
contains: [
256276
`${FIXTURES.RESTAURANTS_COUNT} / ${FIXTURES.RESTAURANTS_COUNT}`,

0 commit comments

Comments
 (0)