Shun Miyazawa 4 лет назад
Родитель
Сommit
7bc8312654

+ 1 - 1
packages/app/src/components/PagePresentationModal.jsx

@@ -12,7 +12,7 @@ const PagePresentationModal = () => {
   return (
     <Modal isOpen={presentationData.isOpened} toggle={closePresentationModal} className="grw-presentation-modal" unmountOnClose={false}>
       <ModalBody className="modal-body">
-        <iframe src={presentationData.href} />
+        <iframe src={presentationData.href} data-testid="page-presentation-modal" />
       </ModalBody>
     </Modal>
   );

+ 10 - 3
packages/app/test/cypress/integration/2-basic-features/open-presentation-modal.spec.ts

@@ -1,3 +1,10 @@
+const getIframeBody = () => {
+  return cy
+    .getByTestid('page-presentation-modal')
+    .its('0.contentDocument').should('exist')
+    .its('body').should('not.be.undefined')
+    .then(cy.wrap)
+};
 
 context('Open presentation modal', () => {
   const ssPrefix = 'access-to-presentation-modal-';
@@ -28,7 +35,7 @@ context('Open presentation modal', () => {
       cy.getByTestid('open-presentation-modal-btn').click({force: true})
     });
 
-    cy.get('.grw-presentation-modal').should('be.visible')
+    getIframeBody().find('slides').should('exist');
     cy.screenshot(`${ssPrefix}-opne-top`, { capture: 'viewport' });
   });
 
@@ -40,7 +47,7 @@ context('Open presentation modal', () => {
       cy.getByTestid('open-presentation-modal-btn').click({force: true})
     });
 
-    cy.get('.grw-presentation-modal').should('be.visible')
+    getIframeBody().find('slides').should('exist');
     cy.screenshot(`${ssPrefix}-open-bootstrap4`, { capture: 'viewport' });
   });
 
@@ -52,7 +59,7 @@ context('Open presentation modal', () => {
       cy.getByTestid('open-presentation-modal-btn').click({force: true})
     });
 
-    cy.get('.grw-presentation-modal').should('be.visible')
+    getIframeBody().find('slides').should('exist');
     cy.screenshot(`${ssPrefix}-open-bootstrap4-with-ancker-link`, { capture: 'viewport' });
   });
 });