-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
fix: The content of <script>
and <style>
inside <body>
should be ignored with cy.contains
.
#17477
Conversation
Thanks for taking the time to open a PR!
|
cy.contains('some-script-content').should('not.match', 'script') | ||
cy.contains('some-script-content').should('not.exist') |
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.
This code was added at #5079. It had to be written in this way because cy.contains()
returns <body>
tag at that time.
It is changed, because it simply fails.
Updated base branch to 9.0-release branch |
Thanks @sainthkh, we're prioritizing reviewing other work for now for the immediate release but do plan to review this when we can. |
- moves removing style and script elements into own function, since it's not related to normalizing whitespace - adds nested style and script elements to html fixture. this fails the test with the previous implementation, which only removed non-nested ones - uses jquery for removing elements, which will remove nested style and script elements as well as non-nested ones
Thanks everyone for making this change, it is very much appreciated! |
User facing changelog
cy.contains()
no longer yields the<body>
element when it matches the content of<script>
or<style>
tags.Additional details
<script>
or<style>
tag inside the<body>
body
tag,<script>
and<style>
tags inside it will be removedHow has the user experience changed?
N/A
Notes
includeScriptContent
,includeStyleContent
, do we?PR Tasks