From dc052a4432ebeab176c442ad1109a525ee4fc619 Mon Sep 17 00:00:00 2001 From: David LJ Date: Fri, 22 Nov 2024 13:15:00 +0100 Subject: [PATCH] build: ensure all scripts are removed when testing SSR (#1051) --- .../ngx-meta/e2e/cypress/support/commands.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/projects/ngx-meta/e2e/cypress/support/commands.ts b/projects/ngx-meta/e2e/cypress/support/commands.ts index 95a7dd73..587abad0 100644 --- a/projects/ngx-meta/e2e/cypress/support/commands.ts +++ b/projects/ngx-meta/e2e/cypress/support/commands.ts @@ -1,6 +1,7 @@ /// import { ROUTES } from '../fixtures/routes' import { JSON_LD_MIME } from './json-ld' +import { CyHttpMessages } from 'cypress/types/net-stubbing' Cypress.Commands.add('getMeta', (name) => { cy.get(`meta[name="${name}"]`) @@ -28,10 +29,12 @@ Cypress.Commands.add('goToRootPage', () => { cy.location('pathname').should('eq', ROUTES.root.path) }) -const HTML_SCRIPTS_BUT_JSON_LD = new RegExp( - ``, +const HTML_SCRIPTS_REGEXP = /]*>([\s\S]*?)<\/script>/gi +const JSON_LD_SCRIPT_REGEXP = new RegExp( + `(.*?)`, 'gi', ) + /** * Intercepts URL(s) and modifies the response to remove `