From 3dddb282e093df092c593c4ab9c89d1a0cfa04bc Mon Sep 17 00:00:00 2001 From: Darin Kotter Date: Wed, 20 Nov 2024 12:44:09 -0700 Subject: [PATCH] Add a test to verify the SVG Icon block works --- tests/cypress/e2e/safe-svg.cy.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/cypress/e2e/safe-svg.cy.js b/tests/cypress/e2e/safe-svg.cy.js index 601ff02..00e7cb7 100644 --- a/tests/cypress/e2e/safe-svg.cy.js +++ b/tests/cypress/e2e/safe-svg.cy.js @@ -15,6 +15,24 @@ describe('Safe SVG Tests', () => { }); }); + it('Admin can add SVG block to a post', () => { + cy.uploadMedia('.wordpress-org/icon.svg'); + + cy.createPost( { + title: 'SVG Block Test', + beforeSave: () => { + cy.insertBlock( 'safe-svg/svg-icon' ); + cy.getBlockEditor().find( '.block-editor-media-placeholder' ).contains( 'button', 'Media Library' ).click(); + cy.get( '#menu-item-browse' ).click(); + cy.get( '.attachments-wrapper li:first .thumbnail' ).click(); + cy.get( '.media-modal .media-button-select' ).click(); + }, + } ).then( post => { + cy.visit( `/wp-admin/post.php?post=${post.id}&action=edit` ); + cy.getBlockEditor().find( '.wp-block-safe-svg-svg-icon' ); + } ); + } ); + /** * Flow for verify SVG sanitization. *