[Spike] Ensure feature and UI component specs use the same data-testid as E2E specs
This is issue is inspired by what happened in Analysis: QA error on Release environment (gitlab-com/gl-infra/delivery#21264 - closed) and the conclusions we came to while discussing the best way forward to prevent this from happening - see gitlab-org/gitlab!195754 (comment 2597559279)+ .
The big realization here is that we
'lack of early detection or rules forcing testid check'
We cannot use E2E specs as gate keeper for testid check. This is not what E2E specs are for. E2E specs should simply use these as ingredients they need to check for a given complete and meaningful user workflow.
We either move away from using data-testid as selector completely per UI testing best practice recommendation. Or we check for them early on in the test pyramid. But I suspect moving away from using data-testid probably requires a lot more redesigning effort for E2E test framework than updating existing feature and UI component specs to check for them, so I'm proposing this approach
And another perk of doing this is that we can eliminate a lot failures of this sort
Failure/Error: raise Capybara::ElementNotFound, "Unable to find #{query.applied_description}" if result.empty?
Capybara::ElementNotFound:
Unable to find css "[data-testid=\"access-token-name-field\"]"
in E2E test results because a testid is changed or missing because they would be detected at MR level by specs that aren't allowed to fail.