-
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
Allow to ignore special character sequences for cy.type #4287
Comments
@jennifer-shehane Yes, I can escape them. But as I said we type source code, it can be quite big. You need to go through it and find all lines with both Wouldn't it be much easier to simply say that there is no control sequences? |
We could probably add an option to type like, 'charSequences: false`. This will be pretty low priority for our team to work on though, since it is possible to achieve what is needed for this to work. We are always welcome to pull requests. Code for |
Sorry for my stupidity. While looking at tests I got how escaping really works. |
I don't know if it's possible to re-open this request? or if I should open a new issue? cy.get(el).type(myMessage.replace(/{/g, '{{}')).type('{enter}'); much nicer to have cy.get(el).type(myMessage, { commands: false }).type('{enter}'); I will admit it doesn't make the code anyshorter, but much easier to read the intent of the action. Reason this has become an issue is because we are dealing a lot with inputting mustache type strings into inputs and there is always someone who forgets this and spends a while trying to work it out. |
Another pretty reasonable argument for allowing an options argument to turn off special chars #4491 |
The code for this is done in cypress-io/cypress#4744, but has yet to be released. |
We need to rename this option to be |
@cypress-io/test-runner someone feel free to open a new PR fixing this. |
I suggest reverting this altogether, and you can simply have a function that escapes your string: const rawTypeString = (str) => str.replace(/{/g, '{{}')
cy.type(rawTypeString('{hello}')) As bonus, its even more readable, since I get told I'm passing a |
The whole point of this, is to remove the crappy str.replace. |
We decided to provide an option to The code for this is done in #4761, but this has yet to be released. We'll update this issue and reference the changelog when it's released. |
Released in |
Can you also add documentation? A search for "parseSpecialCharacterSequences cypress" in google only returns this page. |
Current behavior:
cy.type
considers everything in{}
as modifier sequence. In our app we have embedded code runner. For testing we put there code from fixtures withcy.type
. Andcy.type
throwsCypressError: Special character sequence: '{...}' is not recognized
when code includes some braced expression.Desired behavior:
Add option to
cy.type
to not treat{}
as modifier sequence.Versions
Cypress: 3.2.0
The text was updated successfully, but these errors were encountered: