HelloWorld.ts 645 B

12345678910111213141516171819202122232425262728293031
  1. import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor'
  2. When(
  3. 'I click on the {string} button {int} times',
  4. (attr: string, times: number) => {
  5. const el = cy.dataCy(attr)
  6. for (let i = 0; i < times; i++) {
  7. el.click()
  8. }
  9. }
  10. )
  11. Then(
  12. 'The {string} button should say {string} and be disabled',
  13. (attr: string, message: string) => {
  14. const el = cy.dataCy(attr)
  15. el.should('have.text', message)
  16. el.should('be.disabled')
  17. }
  18. )
  19. Then(
  20. 'The {string} switch should say {string}',
  21. (attr: string, message: string) => {
  22. const el = cy.dataCy(attr)
  23. el.should('include.text', message)
  24. }
  25. )