Skip to content

Commit 51dc0ef

Browse files
committed
Add indexed documents test
1 parent 3a9ab5b commit 51dc0ef

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

cypress/e2e/features.cy.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,6 @@ describe('Meilisearch features', () => {
4343
)
4444
}
4545

46-
const clickAndCheckRowContent = ({ rowNb, contains }) => {
47-
clickCollection({ rowNb })
48-
checkCollectionContent({ rowNb, contains })
49-
}
50-
5146
beforeEach(() => {
5247
cy.session(
5348
USER_CREDENTIALS.email,
@@ -103,7 +98,7 @@ describe('Meilisearch features', () => {
10398
cy.contains('restaurant')
10499
})
105100

106-
it.only('can add collections to index', () => {
101+
it('can add collections to index', () => {
107102
visitPluginPage()
108103

109104
// Intercepts used to wait for the UI to refresh after toggles
@@ -136,4 +131,19 @@ describe('Meilisearch features', () => {
136131
.and('contain.text', 'Hooked')
137132
})
138133
})
134+
135+
it('displays the number of inxed documents for each collection', () => {
136+
visitPluginPage()
137+
138+
// 1 user in database -> 1 document in `user` index
139+
checkCollectionContent({ rowNb: 1, contains: ['1 / 1'] })
140+
// `about-us` is in the `content` index (2 documents)
141+
checkCollectionContent({ rowNb: 2, contains: ['2 / 2'] })
142+
// 2 categories in db -> 2 documents in `category` index
143+
checkCollectionContent({ rowNb: 3, contains: ['2 / 2'] })
144+
// `homepage` is in the `content` index (2 documents)
145+
checkCollectionContent({ rowNb: 4, contains: ['2 / 2'] })
146+
// 2 restaurants in db -> 2 documents in `restaurant` index
147+
checkCollectionContent({ rowNb: 5, contains: ['2 / 2'] })
148+
})
139149
})

playground/pre-seeded-database.db

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)