Skip to content
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

handleInvalidTarget breaks the removeAttribute function #26206

Open
pvande opened this issue Mar 23, 2023 · 3 comments
Open

handleInvalidTarget breaks the removeAttribute function #26206

pvande opened this issue Mar 23, 2023 · 3 comments
Labels
E2E Issue related to end-to-end testing Triaged Issue has been routed to backlog. This is not a commitment to have it prioritized by the team. type: bug

Comments

@pvande
Copy link

pvande commented Mar 23, 2023

Current behavior

After an element has been passed to the handleInvalidTarget method, calling the removeAttribute function with any attribute except "target" will fail.

This is because the function has been overwritten with an implementation that's intended to special case "target", but which actually does nothing for non-"target" attributes.

Desired behavior

For non-"target" attributes, I would expect removeAttribute to continue to function as normal.

Test code to reproduce

I haven't properly determined under what conditions handleInvalidTarget is called. In my own test, I ran into this while my application was trying to control the disabled state of a link as I passed and failed various validation conditions.

Cypress Version

12.8.1

Node version

Standalone app (Mac)

Operating System

13.2

Debug Logs

No response

Other

No response

@AtofStryker
Copy link
Contributor

Hi @pvande. Thank you for opening your first issue in cypress! What you are describing sounds like it could be a problem. The intended behavior is for attributes that are "non-target" should just pass through as normal. Would you be able to help us reproduce this issue to see what is going on, perhaps with a reproduction repository?

@pvande
Copy link
Author

pvande commented Mar 24, 2023

Unfortunately my time for dealing with this issue is presently very short, so I'm not going to be able to build a reproduction case at this time. However, the function in question (lines 71–79 in the same file you linked to) is not long (three lines of code inside a conditional), and clearly does not implement the intended behavior (there is no code that runs if the "target" condition is not met).

I've hacked a workaround into my own test suite by deleteing the removeAttribute override before use, which works adequately.

@AtofStryker
Copy link
Contributor

oh I see what you are saying now. I linked to the wrong function 🤦🏻‍♂️ . The function in question is here. That seems like a bug to me and you're right, its a complete no-op without target. Going to route this over to the team.

@AtofStryker AtofStryker removed their assignment Mar 24, 2023
@nagash77 nagash77 added E2E Issue related to end-to-end testing Triaged Issue has been routed to backlog. This is not a commitment to have it prioritized by the team. and removed routed-to-e2e labels Apr 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E2E Issue related to end-to-end testing Triaged Issue has been routed to backlog. This is not a commitment to have it prioritized by the team. type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants