-
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
support partial matching text,html,value #3259
Conversation
Hmm, is this a bugfix? breaking change? feature? 🤔 Seems this could break some peoples expected implementation today. Does this also close this issue? #3887 |
packages/driver/test/cypress/integration/commands/assertions_spec.coffee
Outdated
Show resolved
Hide resolved
I have the issue tagged as 3.4.0 feature release. |
Given an element like this: <button type="button" class="⚛️ flex-grow-1 flex-lg-grow-0 btn btn-danger" id="CANCEL" data-survey-action="cancel" data-url="">
Cancel form
</button> I have to do something ugly like this:
or some convoluted way like this: cy.get('#CANCEL').then((exp) => {
const text = exp[0].textContent.trim();
expect(text).to.equal('Cancel form');
}); Would be great if there was an easy way to strip new lines and leading and trailing white spaces |
@reallyusefulengine This shouldn't be necessary in 3.4.0 of Cypress. What version are you using? |
@reallyusefulengine use |
Ok thanks @bkucera for the comment. The problem i have with To illustrate what I mean I created a custom function that basically does what I want: Cypress.Commands.add(
'hasText',
{
prevSubject: true,
},
function(subject, expectedText) {
const text = subject[0].textContent.trim();
expect(text).to.equal(expectedText);
}
); Not sure if doing that is good practice though |
@reallyusefulengine Custom commands are encouraged! It's the best way to get the right fit for your project and looks like a good solution. 👍 |
Commented out some WIP for the change in domain for payment. Added custom command for checking screen text inspired by cypress-io/cypress#3259 Updated README.md
am I the only who still sees this old issue reported here #1969 on cypress version 6.4.0 |
@minbarnett Please open a new issue with a reproducible example if you're seeing a bug in 6.4.0. |
fix #1969
adds the following partial matchers: