open-presentation-modal.spec.ts 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. const getIframeBody = () => {
  2. return cy
  3. .getByTestid('page-presentation-modal')
  4. .its('0.contentDocument').should('exist')
  5. .its('body').should('not.be.undefined')
  6. .then(cy.wrap)
  7. };
  8. context('Open presentation modal', () => {
  9. const ssPrefix = 'access-to-presentation-modal-';
  10. let connectSid: string | undefined;
  11. before(() => {
  12. // login
  13. cy.fixture("user-admin.json").then(user => {
  14. cy.login(user.username, user.password);
  15. });
  16. cy.getCookie('connect.sid').then(cookie => {
  17. connectSid = cookie?.value;
  18. });
  19. });
  20. beforeEach(() => {
  21. if (connectSid != null) {
  22. cy.setCookie('connect.sid', connectSid);
  23. }
  24. });
  25. it('PresentationModal for "/" is shown successfully', () => {
  26. cy.visit('/');
  27. cy.get('#grw-subnav-container').within(() => {
  28. cy.getByTestid('open-page-item-control-btn').click({force: true})
  29. cy.getByTestid('open-presentation-modal-btn').click({force: true})
  30. });
  31. getIframeBody().find('slides').should('exist');
  32. cy.screenshot(`${ssPrefix}-opne-top`, { capture: 'viewport' });
  33. });
  34. it('PresentationModal for "/Sandbox/Bootstrap4" is shown successfully', () => {
  35. cy.visit('/Sandbox/Bootstrap4');
  36. cy.get('#grw-subnav-container').within(() => {
  37. cy.getByTestid('open-page-item-control-btn').click({force: true})
  38. cy.getByTestid('open-presentation-modal-btn').click({force: true})
  39. });
  40. getIframeBody().find('slides').should('exist');
  41. cy.screenshot(`${ssPrefix}-open-bootstrap4`, { capture: 'viewport' });
  42. });
  43. it('PresentationModal for /Sandbox/Bootstrap4#Cards" is shown successfully', () => {
  44. cy.visit('/Sandbox/Bootstrap4#Cards');
  45. cy.get('#grw-subnav-container').within(() => {
  46. cy.getByTestid('open-page-item-control-btn').click({force: true})
  47. cy.getByTestid('open-presentation-modal-btn').click({force: true})
  48. });
  49. getIframeBody().find('slides').should('exist');
  50. cy.screenshot(`${ssPrefix}-open-bootstrap4-with-ancker-link`, { capture: 'viewport' });
  51. });
  52. });