Remove Default data-testid Support from CustomersDot E2E Framework
Problem
The CustomersDot E2E test framework currently defaults to using data-testid
for element declarations in pages if no selector is specified.
For example:
button :foo
Implies that the locator being used to define this is data-testid: 'foo'
While
button :foo, id: 'foo'
Implies that id
is being used instead
However, there are a few problems with this:
- When there is no selector defined, it isn't immediately clear what selector is being used without digging through framework code, especially for engineers who are not familiar with E2E tests.
- For selectors originating from GitLab pages, once we migrate away from Chemlab in the GitLab project, we will need to use the element naming convention for
data-testid
s there (ex:foo
will now need to becomefoo-button
). This will lead us to need to explicitly definedata-testid
s anyway, ex:button :foo, data_testid: 'foo-button'
. At that point, we will have a mix of elements with explicitly defineddata-testid
s (originating from GitLab), and ones without (originating from CustomersDot).
Proposal
Remove default support for data-testid
from the CustomersDot framework and explicitly define data-testid
in all element definitions where needed for clarity and consistency, ex:
button :foo, data_testid: 'foo'
Once complete, update corresponding Danger rule to reflect these changes
Edited by Valerie Burton