Skip to content

Instantly share code, notes, and snippets.

@prescottprue
Created November 24, 2018 23:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prescottprue/1f5e2d0cffcc15721d2b1a2d2c8feb56 to your computer and use it in GitHub Desktop.
Save prescottprue/1f5e2d0cffcc15721d2b1a2d2c8feb56 to your computer and use it in GitHub Desktop.
Super simple utility for creating selector string from a selector value for use in Cypress tests
/**
* Create a selector string from a selector value.
* @param {String} selectorValue - Value of the selector
* @example
* createSelector('some-btn')
* // => [data-test=some-btn]
*/
export function createSelector(selectorValue) {
return `[data-test=${selectorValue}]`
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment