local-search.test.ts 873 B

12345678910111213141516171819202122232425262728293031
  1. describe('local search', () => {
  2. beforeEach(async () => {
  3. await goto('/')
  4. })
  5. test('exclude content from search results', async () => {
  6. await page.locator('#local-search button').click()
  7. const input = await page.waitForSelector('input#localsearch-input')
  8. await input.type('local')
  9. await page.waitForSelector('ul#localsearch-list', { state: 'visible' })
  10. const searchResults = page.locator('#localsearch-list')
  11. expect(await searchResults.locator('li[role=option]').count()).toBe(1)
  12. expect(
  13. await searchResults.filter({ hasText: 'Local search included' }).count()
  14. ).toBe(1)
  15. expect(
  16. await searchResults.filter({ hasText: 'Local search excluded' }).count()
  17. ).toBe(0)
  18. expect(
  19. await searchResults
  20. .filter({ hasText: 'Local search frontmatter excluded' })
  21. .count()
  22. ).toBe(0)
  23. })
  24. })