swift-lamp-72788
01/20/2022, 9:02 AM<sasearchinput texts="{\r\ntest1: \"aaa\",\r\ntest2: \"bbb\"\r\n}"></sasearchinput>
instead of
<sasearchinput texts="[objject Object]"></sasearchinput>
I am open to new ideas, like registering sasearchinput in order to render real content of it, but then I think I wouldn't be able to test props, only option would be to check innerTexts etc.wonderful-match-15836
01/20/2022, 11:57 AMtoString()
. To be more clear what I think is going on: it's not a Cypress issue, it's your JS framework doing its best to convert an attribute value to a string to put it on a HTML element. Without the component registered in the context of mounting the component, the framework doesn't know that this attribute is a prop or that the element name refers to a component, it just thinks you are doing a plain HTML element with a funny name, and putting regular attributes on it.wonderful-match-15836
01/20/2022, 12:17 PMJSON.stringify()
to render the props object, so it converts to something you can grab from the DOM.
Overall though, I don't generally want to get in the weeds like this with the connections between components in my tests. I think it's more robust to test the props through their impact on the UI - does SASearchInput have the expected appearance & content from a user perspective when used in CustomComponent? I think that's a good way to know if SASearchInput is being used properly without asserting the specific prop names and values.
Ideally you could completely refactor the API for SASearchInput and the higher level component tests wouldn't need to be updated at all. If the user-facing functionality in the browser is the same.
But if you really want to, you have options.swift-lamp-72788
01/20/2022, 11:38 PM