From 8f8bd1a1c6d23b8ac87f4b7385813c0614cfea1f Mon Sep 17 00:00:00 2001 From: Geofrey Flores <75278792+gflores-jahia@users.noreply.github.com> Date: Thu, 18 Jan 2024 10:12:53 -0500 Subject: [PATCH] BACKLOG-22218: Add more test scenarios (#12) --- tests/cypress/e2e/filtering.cy.ts | 56 ++++++++++++++++--- tests/cypress/fixtures/utils/configuration.ts | 21 ++++++- 2 files changed, 67 insertions(+), 10 deletions(-) diff --git a/tests/cypress/e2e/filtering.cy.ts b/tests/cypress/e2e/filtering.cy.ts index e285985..e69fd2d 100644 --- a/tests/cypress/e2e/filtering.cy.ts +++ b/tests/cypress/e2e/filtering.cy.ts @@ -1,5 +1,7 @@ import {addNode, createSite, deleteSite} from '@jahia/cypress'; import { + addConfig, + disableHtmlFiltering, enableHtmlFiltering, getContent, installConfig, @@ -11,6 +13,8 @@ describe('HTML rich text filtering', () => { const textName = 'myText'; const path = `/sites/${siteKey}/contents/${textName}`; + // TODO Need to clean up configuration manually (delete in file system) for local re-runs + before(() => { createSite(siteKey); addNode({ @@ -25,17 +29,18 @@ describe('HTML rich text filtering', () => { deleteSite(siteKey); }); - it('does not apply html filtering when disabled (default)', () => { - modifyContent(path, ''); + it('does not apply html filtering to tag when disabled (default)', () => { + modifyContent(path, ''); getContent(path).then(result => { expect(result.data.jcr.nodeByPath.property.value).to.contain('iframe'); + expect(result.data.jcr.nodeByPath.property.value).to.contain(''); getContent(path).then(result => { expect(result.data.jcr.nodeByPath.property.value).to.not.contain('iframe'); + expect(result.data.jcr.nodeByPath.property.value).to.not.contain('script'); + expect(result.data.jcr.nodeByPath.property.value).to.contain(' { + enableHtmlFiltering(siteKey); + modifyContent(path, ''); + getContent(path).then(result => { + expect(result.data.jcr.nodeByPath.property.value).to.contain('a'); }); }); it('applies default filtering to html element when enabled', () => { - modifyContent(path, ''); + modifyContent(path, '
This is a nestedtag
'); getContent(path).then(result => { - expect(result.data.jcr.nodeByPath.property.value).to.not.contain('iframe'); + expect(result.data.jcr.nodeByPath.property.value).to.not.contain('