I am trying to write some assertions in Cypress e2e tests to check that meta tags are being rendered out with translated content.
However, this content comes from a CMS, and I don't want tests to break every time a content editor makes a change.
Therefore, I'd just like to come up with some generic regex that tests if a string "looks like" translated content, as opposed to some.untranslated.key
. Ideally I'd just like to check if there are at least two empty spaces in a string:
cy.document().get('head meta[name="description"]')
.should('have.attr', 'content')
.and('match', multiSpaceRegex)
I tried:
export const multiSpaceRegex = /[ ]{2,}/
However this didn't work. What exactly am I doing wrong?
Aucun commentaire:
Enregistrer un commentaire