-
Notifications
You must be signed in to change notification settings - Fork 25
Add data-cy-* for items under /settings/appearance #111
base: master
Are you sure you want to change the base?
Conversation
I don't like the As an alternative because it doesn't work for the cases where the component has a different style for the inputs (since cypress can't click on 0-height elements?), I think selecting it through cypress with |
@@ -150,6 +150,7 @@ const LayoutsSection = () => { | |||
stickyLabels={StickyLabels} | |||
loading={loadingStickyLabels} | |||
onToggle={(value) => withLoadingStickyLabels(handleToggleStickyLabels(value))} | |||
cypressTag={{"data-cy-appearance":"sticky-labels"}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we always use data-cy
we can pass cypressTag="appearance:sticky-labels"
Idem, but we need to find a way to tag the component a prop is a solution, maybe the name is too much "cypress" 😁
It's better to use something not linked to the app itself/style etc. Having a data attribute is the best solution as we won't remove it by mistake because of what it means. We can't forget about it. using id/classNames will create an issue one day, it always. That's why people always try to scope classNames when using JS or CSS. |
Yeah, cypressTag is a bit weird. I'm open to suggestions for better name(s). |
For me the issue is Cypress. Why can it not press inputs with 0 height? The browser can, so it should be able too. |
Because, you want to interact with the same elements as the real user. |
The user is also interacting with the real input. Otherwise a change would never be triggered. In this case the label just defers the click to the input. So it does not matter if it happens on the input or on the label. |
Why do you not always use |
Closing. The focus has shifted to manual testing. |
Ok that's unfortunate. I feel like we were on the right track here. I will re-open this and take it over when I have more time. |
Summary
Some of the components don't have unique attributes. Without them, the e2e tests will end up with weird selectors and code that's hard to understand.
This will add data-cy-* attributes to the elements shown under
/settings/appearance
fyi: We already did this with login (#106).
The plan is to the the same with the rest of the app, one pr at a time.
Change log: