title: Where exactly the data-cy or data-test-id attribute to the element to test can be added?
body: <p>I am a beginner for the Cypress automation testing. I have gone through the good practice document for Cypress E2E where it suggests to use <code>data-cy</code> or <code>data-test-id</code> for element selection. This might be a simple and dumb question but I am really curious to know the answer from you guys. I tried googling but no luck.</p>
  <p>Where exactly the <code>data-cy</code> or <code>data-test-id</code> attribute to the element to test can be added?</p>
  <p>a. Do I have to checkout the code from the developers team, then add the attribute in there?
  b. Can I use the <code>invoke</code> command in cypress (just like we can add/remove attr using invoke in jquery)?
  c. Any other method?</p>
  <p>If the option a. is your answer, then
  what are the steps you follow?
  Does the app code and testing code need to be in one project?
  What hierarchy of element selection you follow?</p>
  <p>(More info: I have frontend in Typescript and React, backend in sql, test project in cypress)</p>