Interacting with a web user interface
Common web user interface interactions include selecting items from drop-down lists, clicking elements like buttons and icons, filling in and submitting forms, and validating that elements contain specific text or are visible to the visitor.
Filling in input boxes and clicking elements
A good practice is to add the data-testid attribute with a unique value to identify elements on a page that will participate in UI tests.
Good practice: There is some debate about whether to strip the
data-testidattributes out in production, often as an automated part of the build process. My recommendation is to keep them in production unless you have a concrete reason to remove them. If you remove attributes only in production, you’re no longer testing the exact thing you ship. Teams have hit CI failures because selectors exist indevbuilds but not inprodbuilds. They have negligible overhead since they’re tiny strings. They don’t affect...