Effective DOM selector patterns. Interact like a user | Carter Capocaccia

Sdílet
Vložit
  • čas přidán 22. 08. 2024
  • When writing tests that interact with your UI, you will likely utilize DOM nodes to isolate elements of your application and perform actions or assertions upon those elements or contents thereof.
    In this talk, Carter ranks DOM node selectors styles into three "tiers" and discusses why he favors some over others and how Cypress enables us to act like a user more than ever before. Using poor selectors is akin to building your house upon sand. You can build a mansion of a test suite using poor selectors, but the test suite will crumble violently and require constant maintenance.

Komentáře • 4

  • @kegharp84
    @kegharp84 Před 9 měsíci +1

    Really useful best practise tips for someone like me who is also starting their baby steps with js/automation and cypress :)

  • @ronnygey9012
    @ronnygey9012 Před 2 dny

    writing test in this visual style.. looking for a "visible" button with a text.. has some new own "problems".. in my world.. i have to deal with 13 languages ... can you describe how to deal with that circumstances?

  • @pR13S7
    @pR13S7 Před 8 měsíci +2

    cy.get('button').contains('Buy') - it's kinda anti-pattern. if you want select button with text just use it like - cy.contains('button', 'Buy') with one comand without unnecessary chaining

  • @MultiMangoPie
    @MultiMangoPie Před 9 měsíci

    11:07 rankings of ways to grab elements