From e5edd7236bc0088a5572b6e5f041e26c8279a5a4 Mon Sep 17 00:00:00 2001 From: Mark <mark@remarkablemark.org> Date: Thu, 5 Oct 2023 20:21:01 -0400 Subject: [PATCH] fix(queries): escape string in "When I find element by test ID" --- src/queries/testid.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/queries/testid.ts b/src/queries/testid.ts index a593664a9..eed05de5d 100644 --- a/src/queries/testid.ts +++ b/src/queries/testid.ts @@ -37,7 +37,9 @@ import { setCypressElement } from '../utils'; */ /* eslint-enable tsdoc/syntax */ export function When_I_find_element_by_testid(testId: string) { - setCypressElement(cy.get(`[data-testid='${testId}']:visible`).first()); + setCypressElement( + cy.get(`[data-testid=${JSON.stringify(testId)}]:visible`).first(), + ); } When('I find element by test ID {string}', When_I_find_element_by_testid);