-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement meilisearch search, import translations (#378)
* feat: implement meilisearch search, import translations
- Loading branch information
Showing
59 changed files
with
1,447 additions
and
461 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,73 @@ | ||
import { HOME_ROUTE } from '../../../src/config/routes'; | ||
import { MAX_RESULTS_TO_SHOW } from '../../../src/config/constants'; | ||
import { ALL_COLLECTIONS_ROUTE, HOME_ROUTE } from '../../../src/config/routes'; | ||
import { | ||
HOME_SEARCH_BUTTON_ID, | ||
ALL_COLLECTIONS_GRID_ID, | ||
HOME_SEARCH_ID, | ||
SEARCH_RESULTS_LIST_ID, | ||
SEARCH_RESULTS_SHOW_MORE_BUTTON, | ||
} from '../../../src/config/selectors'; | ||
import { buildPublicAndPrivateEnvironments } from '../../fixtures/environment'; | ||
import { PUBLISHED_ITEMS } from '../../fixtures/items'; | ||
|
||
const search = (text: string) => { | ||
cy.get(`#${HOME_SEARCH_ID}`).type(text); | ||
cy.get(`#${HOME_SEARCH_BUTTON_ID}`).click(); | ||
}; | ||
|
||
// the text doesn't affect the result: results are set in setUpApi | ||
const keywords = 'keywords'; | ||
const searchResultItems = PUBLISHED_ITEMS.slice(2); | ||
|
||
// todo: enable back when search is implemented | ||
describe.skip('Search', () => { | ||
describe('Search', () => { | ||
buildPublicAndPrivateEnvironments().forEach((environment) => { | ||
describe(`Fetch results for ${environment.currentMember?.name}`, () => { | ||
it('title and description', () => { | ||
cy.setUpApi({ ...environment, searchResultItems }); | ||
it(`Show more than ${MAX_RESULTS_TO_SHOW} results at home`, () => { | ||
cy.setUpApi(environment); | ||
cy.visit(HOME_ROUTE); | ||
|
||
search(keywords); | ||
// this is a frontend search currently | ||
cy.get(`#${HOME_SEARCH_ID}`).type(keywords); | ||
|
||
// verify result items are displayed | ||
// cy.wait('@search').then(({ request: { url } }) => { | ||
// expect(url).to.contain(keywords); | ||
// cy.get(`#${SEARCH_RESULTS_GRID_ID}`) | ||
// .children() | ||
// .should('have.length', searchResultItems.length); | ||
// }); | ||
// only part of the results are displayed | ||
// eslint-disable-next-line no-restricted-syntax | ||
for (const item of PUBLISHED_ITEMS.slice( | ||
0, | ||
-(PUBLISHED_ITEMS.length - MAX_RESULTS_TO_SHOW), | ||
)) { | ||
cy.get(`#${SEARCH_RESULTS_LIST_ID}`).contains(item.name); | ||
} | ||
|
||
cy.get(`#${SEARCH_RESULTS_SHOW_MORE_BUTTON}`) | ||
.should('be.visible') | ||
.click(); | ||
|
||
cy.get(`#${ALL_COLLECTIONS_GRID_ID}`).should('be.visible'); | ||
|
||
cy.get(`#${HOME_SEARCH_ID}`).should('have.value', keywords); | ||
}); | ||
|
||
it(`Search with correct parameters in all collections`, () => { | ||
cy.setUpApi(environment); | ||
cy.visit(ALL_COLLECTIONS_ROUTE); | ||
|
||
// verify all items are displayed | ||
// eslint-disable-next-line no-restricted-syntax | ||
for (const item of PUBLISHED_ITEMS) { | ||
cy.get(`#${ALL_COLLECTIONS_GRID_ID}`).contains(item.name); | ||
} | ||
|
||
cy.get(`#${HOME_SEARCH_ID}`).type(keywords); | ||
|
||
cy.wait(['@search', '@search']).then( | ||
([ | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
_first, | ||
{ | ||
request: { body }, | ||
}, | ||
]) => { | ||
expect(body.queries[0].q).to.eq(keywords); | ||
}, | ||
); | ||
|
||
// todo: toggle categories | ||
}); | ||
|
||
// todo: load more | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,19 @@ | ||
import { MY_LIST_ROUTE } from '../../../src/config/routes'; | ||
import { | ||
MY_PUBLISHED_COLLECTIONS_ID, | ||
buildMyListNavigationTabId, | ||
} from '../../../src/config/selectors'; | ||
import { | ||
PUBLISHED_ITEMS, | ||
getNumberOfOwnPublishedItems, | ||
} from '../../fixtures/items'; | ||
import { CURRENT_USER } from '../../fixtures/members'; | ||
// todo: enable back when we have a proper page | ||
// describe('My Published Items', () => { | ||
// describe('Current user', () => { | ||
// // check if title and headings are displayed correctly | ||
// it('display published items', () => { | ||
// cy.setUpApi({ currentMember: CURRENT_USER, items: PUBLISHED_ITEMS }); | ||
// cy.visit(MY_LIST_ROUTE); | ||
|
||
describe('My Published Items', () => { | ||
describe('Current user', () => { | ||
// check if title and headings are displayed correctly | ||
it('display published items', () => { | ||
cy.setUpApi({ currentMember: CURRENT_USER, items: PUBLISHED_ITEMS }); | ||
cy.visit(MY_LIST_ROUTE); | ||
// // click my publishment tab | ||
// cy.get( | ||
// `#${buildMyListNavigationTabId(MY_LIST_TAB_NAMES.MY_PUBLISHMENTS)}`, | ||
// ).click(); | ||
|
||
// click my publishment tab | ||
cy.get(`#${buildMyListNavigationTabId('myPublishments')}`).click(); | ||
|
||
cy.get(`#${MY_PUBLISHED_COLLECTIONS_ID}`) | ||
.children() | ||
.should('have.length', getNumberOfOwnPublishedItems(CURRENT_USER.id)); | ||
}); | ||
}); | ||
}); | ||
// cy.get(`#${MY_PUBLISHED_COLLECTIONS_ID}`) | ||
// .children() | ||
// .should('have.length', getNumberOfOwnPublishedItems(CURRENT_USER.id)); | ||
// }); | ||
// }); | ||
// }); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.