Skip to content

Commit 2daa5c2

Browse files
committed
Fix end to end tests
1 parent e7b7ca8 commit 2daa5c2

File tree

3 files changed

+19
-14
lines changed

3 files changed

+19
-14
lines changed

cypress/integration/search-ui.spec.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,27 @@ describe(`${playground} playground test`, () => {
3838

3939
it('Sort by recommendationCound ascending', () => {
4040
const select = `.ais-SortBy-select`
41-
cy.get(select).select('steam-video-games:recommendationCount:asc')
41+
cy.get(select).select('games:recommendationCount:asc')
4242
cy.wait(1000)
4343
cy.get(HIT_ITEM_CLASS).eq(0).contains('Deathmatch Classic')
4444
})
4545

4646
it('Sort by default relevancy', () => {
4747
const select = `.ais-SortBy-select`
48-
cy.get(select).select('steam-video-games')
48+
cy.get(select).select('games')
4949
cy.wait(1000)
5050
cy.get(HIT_ITEM_CLASS).eq(0).contains('Counter-Strike')
5151
})
5252

53-
it('click on facets', () => {
54-
const checkbox = `.ais-RefinementList-list .ais-RefinementList-checkbox`
55-
cy.get(checkbox).eq(1).click()
53+
it('click on facets ensure disjunctive facet search', () => {
54+
const facet = `.ais-RefinementList-list`
55+
const checkbox = `.ais-RefinementList-checkbox`
56+
const facetCount = '.ais-RefinementList-count'
57+
cy.get(facet).eq(0).get(checkbox).eq(1).click() // genres > action
58+
cy.get(facet).eq(0).get(facetCount).eq(0).contains('5') // genres > action count
59+
60+
cy.get(facet).eq(1).find(facetCount).eq(0).contains('4') // players > multiplayer
5661
cy.wait(1000)
57-
cy.get(HIT_ITEM_CLASS).eq(1).contains('Team Fortress Classic')
58-
cy.get(HIT_ITEM_CLASS).eq(1).contains('4.99 $')
5962
})
6063

6164
it('Search', () => {
@@ -78,6 +81,6 @@ describe(`${playground} playground test`, () => {
7881

7982
it('Paginate Search', () => {
8083
cy.get('.ais-InfiniteHits-loadMore').click()
81-
cy.get(HIT_ITEM_CLASS).should('have.length', 11)
84+
cy.get(HIT_ITEM_CLASS).should('have.length', 12)
8285
})
8386
})

tests/env/react/setup.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ const games = require('../../assets/games.json')
1818
filterableAttributes: ['genres', 'color', 'platforms'],
1919
})
2020
await gamesIndex.updateSettings({
21-
filterableAttributes: ['genres', 'color', 'platforms'],
21+
filterableAttributes: ['genres', 'color', 'platforms', 'misc', 'players'],
22+
searchableAttributes: ['name', 'description'],
23+
sortableAttributes: ['recommendationCount'],
2224
})
2325

2426
const moviesRes = await moviesIndex.addDocuments(movies)

tests/env/react/src/components/SingleIndex.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,20 @@ const SingleIndex = () => (
3131
This is not the official Steam dataset but only for demo purpose. Enjoy
3232
searching with Meilisearch!
3333
</p>
34-
<InstantSearch indexName="steam-video-games" searchClient={searchClient}>
34+
<InstantSearch indexName="games" searchClient={searchClient}>
3535
<Stats />
3636
<div className="left-panel">
3737
<ClearRefinements />
3838
<SortBy
39-
defaultRefinement="steam-video-games"
39+
defaultRefinement="games"
4040
items={[
41-
{ value: 'steam-video-games', label: 'Relevant' },
41+
{ value: 'games', label: 'Relevant' },
4242
{
43-
value: 'steam-video-games:recommendationCount:desc',
43+
value: 'games:recommendationCount:desc',
4444
label: 'Most Recommended',
4545
},
4646
{
47-
value: 'steam-video-games:recommendationCount:asc',
47+
value: 'games:recommendationCount:asc',
4848
label: 'Least Recommended',
4949
},
5050
]}

0 commit comments

Comments
 (0)