From 3e25598d62792d1bac7e21b9829dbc1a7ae43d37 Mon Sep 17 00:00:00 2001 From: Mark Date: Thu, 5 Oct 2023 20:19:23 -0400 Subject: [PATCH] fix(queries): escape string in "When I find headings by text" --- src/queries/heading.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/queries/heading.ts b/src/queries/heading.ts index 5376b11db..b2d90f0cd 100644 --- a/src/queries/heading.ts +++ b/src/queries/heading.ts @@ -31,7 +31,7 @@ import { getCypressElement, setCypressElement } from '../utils'; */ export function When_I_find_headings_by_text(text: string) { const selector = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'] - .map((tag) => `${tag}:contains('${text}'):visible`) + .map((tag) => `${tag}:contains(${JSON.stringify(text)}):visible`) .join(','); setCypressElement(cy.get(selector)); }