-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When there are two same elements Cypress is concatenating their values #28561
Comments
@ericrommel What is There are a lot of variables included with the wrapping of commands. Does the same issue occur with |
Note: Attached screenshot missed before. |
Hey @jennifer-shehane, have you had a chance to see my last message? Is this enough info? |
This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided. |
Current behavior
Hey Folks,
In my environment, developers are duplicating the elements based on the screen resolution. One group of elements will be visible when the other one is hidden and vice-versa. It's being done from the CSS side. The issue is that Cypress is finding the two elements from the DOM (e.g.: using the same data-cy id) and is concatenating their values. The test fails as I'm trying to check a value, let's say
0
but Cypress shows that the current value is0 0
.The code part into a
holding.component.html
file:The line that is doing the check in a
test.spec.ts
file:My
.shouldHaveText()
method, is like this:And this
.get()
method implemented is checking for visibility:This is why Cypress is finding two elements as you can see in the screenshot below:
But as I said, although there are two almost the same blocks, and inside them, the same elements, elements look okay. A very short version of this could be like this:
A block is set in Style like:
The other one is like:
Can someone advise why Cypess is acting like that?
Let me know if you have any other questions that can help to understand/fix this issue.
Thanks in advance...
Desired behavior
Even though there are two elements, they shouldn't be "concatenated".
Test code to reproduce
Added in description
Cypress Version
12.17.2
Node version
v16.19.0
Operating System
Win10 Enterprise (v10.0.19045 Build 19045)
Debug Logs
No response
Other
No response
The text was updated successfully, but these errors were encountered: