Escape Regular Expression Text When Using cy.contains Command

Publicado em: 25 Julho 2023
no canal de: gleb bahmutov
605
28

This video shows how to escape special characters like "$", "[]", and "^" when creating regular expressions to use with cy.contains command. You can escape the characters yourself or use the Lodash method Cypress._.escapeRegExp bundled with Cypress to do it for you
const suffix = '$/day'
const regex = new RegExp(Cypress._.escapeRegExp(suffix))
cy.contains(regex).should('have.id', 'rate')
Find the full recipe at https://glebbahmutov.com/cypress-exam...


Nesta página do site você pode assistir ao vídeo on-line Escape Regular Expression Text When Using cy.contains Command duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário gleb bahmutov 25 Julho 2023, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 605 vezes e gostou 28 espectadores. Boa visualização!