How to add "id" attribute for testing purpose?
See original GitHub issueHello, I do not find a good way for adding unique “id” attribute for the toast
and toast body
. Currently, I work within className
but would be great to have optional parameter id
. Thanks
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (4 by maintainers)
Top Results From Across the Web
What is the data-testid attribute in testing? - Educative.io
data-testid is an attribute used to identify a DOM node for testing purposes. It should be used as a handler to the test...
Read more >HTML - The id attribute - W3Schools
The HTML id attribute is used to specify a unique id for an HTML element. You cannot have more than one element with...
Read more >Is it good practice to give html elements id attributes that are ...
CONS As the developer a am highly skeptical about adding id attributes that serve no functional purpose. I think it clutters the code....
Read more >HTML Id Attributes - GeeksforGeeks
The id attribute is a unique identifier that is used to specify the document. It is used by CSS and JavaScript to perform...
Read more >Data-* attributes. Hook your automated tests on proper selectors.
ID attribute. The purpose of ID is to have a unique reference that is not repeated on a page. So if you have...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The End to end test has implemented with Cypress?
Where I work, the shared function was implemented like this
Hi, thanks for your example @JulianoGTZ. We can improve it with
toastId
option like this :Create toast :
toast.success("hello" , {toastId: "my-toastId"});
Cypress command for check :
cy.checkToastMessage("my-toastId", "hello")