search.spec.ts 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. context('Access to search result page', () => {
  2. const ssPrefix = 'access-to-result-page-directly-';
  3. beforeEach(() => {
  4. // login
  5. cy.fixture("user-admin.json").then(user => {
  6. cy.login(user.username, user.password);
  7. });
  8. // collapse sidebar
  9. cy.collapseSidebar(true);
  10. });
  11. it('/_search with "q" param is successfully loaded', () => {
  12. cy.visit('/_search', { qs: { q: 'labels alerts cards blocks' } });
  13. cy.getByTestid('search-result-list').should('be.visible');
  14. cy.getByTestid('search-result-content').should('be.visible');
  15. cy.screenshot(`${ssPrefix}-with-q`);
  16. });
  17. it('checkboxes behaviors', () => {
  18. cy.visit('/_search', { qs: { q: 'labels alerts cards blocks' } });
  19. cy.getByTestid('search-result-base').should('be.visible');
  20. cy.getByTestid('search-result-list').should('be.visible');
  21. cy.getByTestid('cb-select').first().click({force: true});
  22. cy.screenshot(`${ssPrefix}-the-first-checkbox-on`);
  23. cy.getByTestid('cb-select').first().click({force: true});
  24. cy.screenshot(`${ssPrefix}-the-first-checkbox-off`);
  25. // click select all checkbox
  26. cy.getByTestid('cb-select-all').click({force: true});
  27. cy.screenshot(`${ssPrefix}-the-select-all-checkbox-1`);
  28. cy.getByTestid('cb-select').first().click({force: true});
  29. cy.screenshot(`${ssPrefix}-the-select-all-checkbox-2`);
  30. cy.getByTestid('cb-select').first().click({force: true});
  31. cy.screenshot(`${ssPrefix}-the-select-all-checkbox-3`);
  32. cy.getByTestid('cb-select-all').click({force: true});
  33. cy.screenshot(`${ssPrefix}-the-select-all-checkbox-4`);
  34. });
  35. });
  36. context('Access to legacy private pages', () => {
  37. const ssPrefix = 'access-to-legacy-private-pages-directly-';
  38. beforeEach(() => {
  39. // login
  40. cy.fixture("user-admin.json").then(user => {
  41. cy.login(user.username, user.password);
  42. });
  43. // collapse sidebar
  44. cy.collapseSidebar(true);
  45. });
  46. it('/_private-legacy-pages is successfully loaded', () => {
  47. cy.visit('/_private-legacy-pages');
  48. cy.getByTestid('search-result-base').should('be.visible');
  49. cy.screenshot(`${ssPrefix}-shown`);
  50. });
  51. });