Skip to content

Commit

Permalink
fix(queries): escape string in "When I find element by test ID"
Browse files Browse the repository at this point in the history
  • Loading branch information
remarkablemark committed Oct 6, 2023
1 parent 948a43f commit e5edd72
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/queries/testid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

0 comments on commit e5edd72

Please sign in to comment.